Commit d2a0d75b by simonabottani

Refactor ML

parent 3bf1bdcf
Pipeline #1074 passed with stages
in 1 minute 49 seconds
......@@ -427,6 +427,7 @@ class LearningCurveRepeatedHoldOut(base.MLValidation):
return self._classifier, self._best_params, self._split_results
def save_results(self, output_dir):
from clinica.utils.stream import cprint
if self._split_results is None:
raise Exception("No results to save. Method validate() must be run before save_results().")
......@@ -470,7 +471,7 @@ class LearningCurveRepeatedHoldOut(base.MLValidation):
mean_results_df = pd.DataFrame(iteration_results_df.apply(np.nanmean).to_dict(),
columns=iteration_results_df.columns, index=[0, ])
print mean_results_df
cprint (mean_results_df)
mean_results_df.to_csv(path.join(iteration_dir, 'mean_results.tsv'),
index=False, sep='\t', encoding='utf-8')
all_results_list.append(mean_results_df)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment