Simplified tensor building

Registered by Ken Arnold

Make it simpler to create sparse labeled tensors. Two approaches are currently in use: nested lists in the tests, and explicit item assignment in AnalogySpace and other code like that.

I'm thinking about making tensor builder classes that make a tensor and updates it with a passed sequence, which will probably be a generator. Then `queryset_to_tensor` would look something like:

    def queryset_items(queryset):
        return (((concept1, relation, concept2), get_value(score, freq))
                for (relation, concept1, concept2, score, freq) in queryset.values_list(
                'relation__name', 'concept1__text', 'concept2__text', 'score', 'frequency__value').iterator())

And you'd call it like:

    Mirrored3DTensorBuilder.from_seq(
        queryset_items(conceptnet_queryset(cutoff)),
        identity_weight)

Blueprint information

Status:
Not started
Approver:
None
Priority:
Undefined
Drafter:
None
Direction:
Needs approval
Assignee:
None
Definition:
New
Series goal:
None
Implementation:
Unknown
Milestone target:
None

Related branches

Sprints

Whiteboard

This doesn't address the nested dict issue for the tests, though it could be adapted to.

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.