Skip to content

Training a curation model with metrics from older version fail #4742

Description

@hlayardhorsfall

I am trying to train a model for curation with an analyser computed with version 0.103.0, using spike interface version 0.104.8 fails with error

KeyError                                  Traceback (most recent call last)
Cell In[22], line 3
      1 folder = "/Users/layardh/The Francis Crick Dropbox/Hugo LayardHorsfall/1 SUNAN/OSSS_unitrefine/UnitRefine/human_np"
      2 
----> 3 trainer = sc.train_model(
      4     mode="analyzers",                           # Use SortingAnalyzer objects as input
      5     labels=[labels],                            # List of label arrays (one per analyzer)
      6     analyzers=[analyzer],                       # List of SortingAnalyzer objects

File ~/The Francis Crick Dropbox/Hugo LayardHorsfall/1 SUNAN/OSSS_unitrefine/UnitRefine/.venv/lib/python3.13/site-packages/spikeinterface/curation/train_manual_curation.py:762, in train_model(mode, labels, analyzers, metrics_paths, folder, metric_names, imputation_strategies, scaling_techniques, classifiers, test_size, overwrite, seed, search_kwargs, verbose, enforce_metric_params, **job_kwargs)
    760 if mode == "analyzers":
    761     assert analyzers is not None, "Analyzers must be provided as a list for mode 'analyzers'"
--> 762     trainer.load_and_preprocess_analyzers(analyzers, enforce_metric_params)
    764 elif mode == "csv":
    765     for metrics_path in metrics_paths:

File ~/The Francis Crick Dropbox/Hugo LayardHorsfall/1 SUNAN/OSSS_unitrefine/UnitRefine/.venv/lib/python3.13/site-packages/spikeinterface/curation/train_manual_curation.py:276, in CurationTrainer.load_and_preprocess_analyzers(self, analyzers, enforce_metric_params)
    273         metric_names = metric_extension.params["metric_names"]
    274         consistent_metrics = list(set(metric_names).difference(set(conflicting_metrics)))
    275         consistent_metric_params = {
--> 276             metric: metric_extension.params["metric_params"][metric] for metric in consistent_metrics
    277         }
    278         self.metrics_params[extension_name + "_params"]["metric_params"] = consistent_metric_params
    280 self.process_test_data_for_classification()

KeyError: 'mahalanobis'```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions