Skip to content

generate_candidates() doesn't work as expected - generates same triplet  #265

@smejkka3

Description

@smejkka3

Description

The function generate_candidates(X, strategy='graph_degree', target_rel='y', max_candidates=3) generates different output then shown in the example in the file, which is not correct as it is generating 3x the same array

Actual Behavior

import numpy as np
import networkx as nx
        
X = np.array([['a', 'y', 'b'],
            ['b', 'y', 'a'],
            ['a', 'y', 'c'],
            ['c', 'y', 'a'],
            ['a', 'y', 'd'],
            ['c', 'y', 'd'],
            ['b', 'y', 'c'],
            ['f', 'y', 'e']])
X_candidates = generate_candidates(X, strategy='graph_degree', target_rel='y', max_candidates=3)
array([['b', 'y', 'c'],
       ['b', 'y', 'c'],
       ['b', 'y', 'c']], dtype=object)

Expected Behavior

import numpy as np
import networkx as nx
        
X = np.array([['a', 'y', 'b'],
            ['b', 'y', 'a'],
            ['a', 'y', 'c'],
            ['c', 'y', 'a'],
            ['a', 'y', 'd'],
            ['c', 'y', 'd'],
            ['b', 'y', 'c'],
            ['f', 'y', 'e']])
X_candidates = generate_candidates(X, strategy='graph_degree', target_rel='y', max_candidates=3)
# ([['a', 'y', 'e'],
# ['f', 'y', 'a'],
# ['c', 'y', 'e']])

Steps to Reproduce

Run above mentioned code, ampligraph version = 1.4.0, numpy version = 1.19.5, networkx version=2.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions