Hello there,
I can't seem to solve this problem of mine.
I have a class algorithm that has the relationship overperforms
conneting to other algorithm classes, and a result that should rank these algorithms based on their number of overperforms
compared to the total algorithm number. Additionally, a group of algorithms can be compared in different experiments.
The problem however is, that these overperform
contain a metric (e.g., F-Score), and my result should only count the overperform
relations with the same metric in the same experiment for each algorithm.
Heres what I tried:
MATCH (b:RESULT)<-[y:HAS_RESULT]-(a:EXPERIMENT)<-[z:EVALUATED_IN]-(m:ALGORITHM)-[x:OVERPERFORMS]->(n:ALGORITHM)
WHERE a.ID = x.Experiment AND m.ID <> n.ID
WITH m as pipe, z.Metric as metr, a.ID as exp, count(x) as cc, x.Metric as xm, b
CALL apoc.create.relationship(b, "RANKS",
apoc.map.fromValues([
"Number_of_Pipelines", cc,
"Experiment", exp,
"Metric", metr])
, pipe)
YIELD rel
RETURN pipe.ID , rel
;
But when I do this, I get multiple relations with the wrong count.
Heres a example of what I get for one algorithm:
[:RANKS {Metric: "Precision",Experiment: "ID152",Number_of_Pipelines: 4}]
[:RANKS {Metric: "Precision",Experiment: "ID152",Number_of_Pipelines: 4}]
[:RANKS {Metric: "Precision",Experiment: "ID152",Number_of_Pipelines: 3}]
[:RANKS {Metric: "F1Score",Experiment: "ID152",Number_of_Pipelines: 4}]
[:RANKS {Metric: "F1Score",Experiment: "ID152",Number_of_Pipelines: 4}]
[:RANKS {Metric: "F1Score",Experiment: "ID152",Number_of_Pipelines: 3}]
[:RANKS {Metric: "Recall",Experiment: "ID152",Number_of_Pipelines: 4}]
[:RANKS {Metric: "Recall",Experiment: "ID152",Number_of_Pipelines: 4}]
[:RANKS {Metric: "Recall",Experiment: "ID152",Number_of_Pipelines: 3}]
Heres what it should look like:
[:RANKS {Metric: "Precision",Experiment: "ID152",Number_of_Pipelines: 4}]
[:RANKS {Metric: "F1Score",Experiment: "ID152",Number_of_Pipelines: 4}]
[:RANKS {Metric: "Recall",Experiment: "ID152",Number_of_Pipelines: 3}]
Now if I delete the x.Metric as xm
from my WITH count adds all ranks regardless of the metric
[:RANKS {Metric: "Precision",Experiment: "ID152",Number_of_Pipelines: 11}]
[:RANKS {Metric: "F1Score",Experiment: "ID152",Number_of_Pipelines: 11}]
[:RANKS {Metric: "Recall",Experiment: "ID152",Number_of_Pipelines: 11}]
I appreciate any help or ideas. Maybe is there a way to specifiy which of the double rels should be deleted (2,3 for the first; 1,3 for the second; 1, 2 for the third)
Best regards