@@ -24,8 +24,8 @@ workflow EVALUATION_WF {
2424
2525 ch_versions = Channel . empty()
2626
27- //
28- // Evaluation mode 1: Predict the data using the best model
27+ //
28+ // Evaluation mode 1: Predict the data using the best model
2929 // and then compare the predictions of 2 different models
3030 //
3131
@@ -36,44 +36,49 @@ workflow EVALUATION_WF {
3636 ch_versions = ch_versions. mix(STIMULUS_PREDICT . out. versions)
3737 predictions = STIMULUS_PREDICT . out. predictions
3838
39- // Now we can estimate the noise across replicates
39+ // Now we can estimate the noise across replicates
4040 // This means: given a fixed initial model, initial data, and initial weights
4141 // and the same number of trials, we can estimate the noise across replicates
4242 // This is done by comparing the predictions of the alternative models between each other
4343 // and then calculatin a summary metric over them (e.g. mean, median, std, etc.)
4444
4545 replicate_predictions = predictions. map{
46- meta, prediction ->
46+ meta, prediction ->
4747 [[" id" : meta. id,
4848 " split_id" : meta. split_id,
4949 " transform_id" : meta. transform_id,
5050 " n_trials" : meta. n_trials ], meta, prediction]
5151 }. groupTuple(by :0 )
5252 .map{
53- merging_meta, metas, predictions ->
53+ merging_meta, metas, predictions ->
5454 [merging_meta, predictions]
5555 }
5656
57- // STIMULUS_COMPARE_TENSORS_COSINE(
58- // replicate_predictions
59- // )
60-
61- // cosine_scores = STIMULUS_COMPARE_TENSORS_COSINE.out.scores
62-
63- // cosine_scores
64- // .map {
65- // meta, csv -> csv
66- // }
67- // .collect()
68- // .map {
69- // csv ->
70- // [ [ id:"summary_cosine" ], csv ]
71- // }
72- // .set { ch_cosine_summary }
73- // CONCAT_COSINE (ch_cosine_summary, "csv", "csv")
57+ // check if the predictions are at least 2, meta,predictions
58+ replicate_predictions. filter{
59+ it[1 ]. size() > 1
60+ }. set{ replicate_predictions }
7461
62+ STIMULUS_COMPARE_TENSORS_COSINE (
63+ replicate_predictions
64+ )
7565
76- emit :
66+ cosine_scores = STIMULUS_COMPARE_TENSORS_COSINE . out. csv
67+
68+ cosine_scores
69+ .map {
70+ meta, csv -> csv
71+ }
72+ .collect()
73+ .map {
74+ csv ->
75+ [ [ id :" summary_cosine" ], csv ]
76+ }
77+ .set { ch_cosine_summary }
78+ CONCAT_COSINE (ch_cosine_summary, " csv" , " csv" )
79+
80+
81+ emit :
7782 versions = ch_versions // channel: [ versions.yml ]
7883
79- }
84+ }
0 commit comments