Accenture / Accenture/AmpliGraph

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

Open
#265 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.2k
Forks
257
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the generate_candidates() entry point and run the reproduction with the stated AmpliGraph, NumPy, and NetworkX versions. Compare the graph_degree output with the expected three distinct candidate triplets; done means the function no longer returns the same triplet for every candidate.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.