BorgwardtLab / proteinshake

Protein structure datasets for machine learning.
https://proteinshake.ai
BSD 3-Clause "New" or "Revised" License
101 stars 9 forks source link

GO evaluate divide by zero #191

Closed cgoliver closed 1 year ago

cgoliver commented 1 year ago
from proteinshake.tasks import GeneOntologyTask
task = GeneOntologyTask()
task.evaluate(np.random.rand(len(task.test_index), len(task.token_map.keys())))

Gives this error:


 File "/Users/cgonzalez/Projects/proteinshake/proteinshake/tasks/gene_ontology.py", line 94, in evaluate
    'Fmax': self.fmax(y_pred),
  File "/Users/cgonzalez/Projects/proteinshake/proteinshake/tasks/gene_ontology.py", line 72, in fmax
    return max([
  File "/Users/cgonzalez/Projects/proteinshake/proteinshake/tasks/gene_ontology.py", line 73, in <listcomp>
    2 * self.precision(y_pred, t) * self.recall(y_pred, t)
  File "/Users/cgonzalez/Projects/proteinshake/proteinshake/tasks/gene_ontology.py", line 61, in recall
    np.logical_and(y_true, y_pred).sum(axis=1)
ZeroDivisionError: division by zero