Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic curation with metrics #2918

Merged
merged 209 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from 198 commits
Commits
Show all changes
209 commits
Select commit Hold shift + click to select a range
8666a53
empty update
anoushkajain May 29, 2024
555e9b0
test commit to metrics branch
robyngreene May 29, 2024
06c1e6d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 29, 2024
d252f3d
test
jakeswann1 May 29, 2024
be656d8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 29, 2024
955aec8
anoushka model function prototype
jakeswann1 May 29, 2024
fee55eb
Merge branch 'curation_metrics' of https://github.com/anoushkajain/sp…
jakeswann1 May 29, 2024
c8eeb1f
ModelBasedClassification class prototype
jakeswann1 May 30, 2024
41a3358
Small changes
jakeswann1 May 30, 2024
f232864
Cleaned notebook
jakeswann1 May 30, 2024
4c5d335
Class and function for model based classification
jakeswann1 May 30, 2024
f3dabd3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 30, 2024
88bb8b4
Removed notebook
jakeswann1 May 30, 2024
66f9098
Parameter checking for classification
jakeswann1 May 30, 2024
c411d7c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 30, 2024
c143e30
Cleaned
jakeswann1 May 31, 2024
c4fb884
Draft tests
jakeswann1 May 31, 2024
564e5ac
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 31, 2024
5c3e588
Tests with pretrained toy pipeline
jakeswann1 May 31, 2024
c408ff8
Merge branch 'curation_metrics' of https://github.com/anoushkajain/sp…
jakeswann1 May 31, 2024
3a61bba
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 31, 2024
f5b6998
pathing
jakeswann1 May 31, 2024
daec0c7
Bug fixes & tests improvement
jakeswann1 May 31, 2024
75b11ce
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 31, 2024
dd846cf
Tests passing. Code to create test pipeline commented
jakeswann1 May 31, 2024
57d5e32
small fix
jakeswann1 May 31, 2024
d164684
Rename files
jakeswann1 Jun 2, 2024
60485d3
Removed joblib dependency
jakeswann1 Jun 4, 2024
3d6b4ac
small fix
jakeswann1 Jun 4, 2024
111c33c
Moved sklearn to local import
jakeswann1 Jun 5, 2024
061c9f4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 5, 2024
8aa63e0
Fixed typing
jakeswann1 Jun 5, 2024
b798048
Merge branch 'curation_metrics' of https://github.com/anoushkajain/sp…
jakeswann1 Jun 5, 2024
f7fef17
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 5, 2024
4cf0859
Pathing fix
jakeswann1 Jun 5, 2024
fb2e3c8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 5, 2024
4ca6ce7
Pandas local import
jakeswann1 Jun 5, 2024
6645b67
Merge branch 'curation_metrics' of https://github.com/anoushkajain/sp…
jakeswann1 Jun 5, 2024
0b0456e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 29, 2024
8d281be
ModelBasedClassification class prototype
jakeswann1 May 30, 2024
5ee79ab
Small changes
jakeswann1 May 30, 2024
459edf0
Cleaned notebook
jakeswann1 May 30, 2024
15bbb1a
Class and function for model based classification
jakeswann1 May 30, 2024
9b884e9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 30, 2024
5002655
Removed notebook
jakeswann1 May 30, 2024
6081265
Parameter checking for classification
jakeswann1 May 30, 2024
546033a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 30, 2024
932cf2b
Cleaned
jakeswann1 May 31, 2024
e0a2520
added a script to train decoder on new data
anoushkajain Jun 18, 2024
9df4b07
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 18, 2024
4816710
Merge branch 'curation_metrics' of https://github.com/anoushkajain/sp…
jakeswann1 Jun 19, 2024
9e2e9ce
Refactored imports to match dependencies
jakeswann1 Jun 19, 2024
044983d
Refactored training code to allow general label sets
jakeswann1 Jun 21, 2024
b763922
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 21, 2024
108f09a
Removed required_metrics arg from prediction class & func
jakeswann1 Jun 21, 2024
1fa0ee2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 21, 2024
0a4dd94
Improved metrics handling
jakeswann1 Jun 24, 2024
b730ace
Merge branch 'curation_metrics' of https://github.com/anoushkajain/sp…
jakeswann1 Jun 24, 2024
e9706c8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 24, 2024
5efe492
Suppress annoying LGBM warnings
jakeswann1 Jun 24, 2024
fcf7f3f
Merge branch 'curation_metrics' of https://github.com/anoushkajain/sp…
jakeswann1 Jun 24, 2024
9654b45
Added optional metrics list param for training
jakeswann1 Jun 24, 2024
100b6f7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 24, 2024
c502fc2
Input data processing
jakeswann1 Jun 24, 2024
2497fbc
small fix
jakeswann1 Jun 24, 2024
a9fc6b3
small fix
jakeswann1 Jun 24, 2024
3e10175
Small fixes, removed metrics params check for now
jakeswann1 Jun 25, 2024
869a177
Pandas 2.2.1+ compatibility
jakeswann1 Jun 25, 2024
0de50a7
Metrics list parsing correction
jakeswann1 Jun 27, 2024
7a32238
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 27, 2024
a99a747
Merge branch 'SpikeInterface:main' into curation_metrics
jakeswann1 Jul 8, 2024
c0d1fe7
Added training tests & refactoring
jakeswann1 Jul 9, 2024
12d20d1
Refactor
jakeswann1 Jul 9, 2024
84026d4
dependency fix
jakeswann1 Jul 9, 2024
c0cc5fb
import extra packages only if installed & requested
jakeswann1 Jul 9, 2024
fdf7399
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 9, 2024
f29be37
seeeeeeeeeeeds
jakeswann1 Jul 9, 2024
e10d25e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 9, 2024
99cc2d6
Removed hard dependency on skopt
jakeswann1 Jul 9, 2024
96ecd3f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 9, 2024
e13fb36
fix
jakeswann1 Jul 9, 2024
1a493b9
Replaced with basic hyperparam search
jakeswann1 Jul 9, 2024
02ee1cb
docstrings
jakeswann1 Jul 9, 2024
18c0f2e
Fixed classifier parsing bug
jakeswann1 Jul 10, 2024
d2d1386
Merge branch 'main' of https://github.com/SpikeInterface/spikeinterfa…
jakeswann1 Jul 10, 2024
983cc3a
Added export to phy function for predicted labels
jakeswann1 Jul 11, 2024
c3a66a0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 11, 2024
d0c8b12
Set labels & confidence as properties. Allow metrics input
jakeswann1 Jul 11, 2024
210e5ce
Added dict attribute and SMOTE for class imbalance
jakeswann1 Jul 12, 2024
e2ac418
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 12, 2024
8db4bbf
Smote default to false
jakeswann1 Jul 12, 2024
9dd7dd7
fix
jakeswann1 Jul 12, 2024
1780bb5
fix
jakeswann1 Jul 15, 2024
a84bf53
Merge branch 'main' of https://github.com/SpikeInterface/spikeinterfa…
jakeswann1 Jul 15, 2024
3e433fa
Merge branch 'main' into curation_metrics
jakeswann1 Jul 17, 2024
d89ee8d
training output_folder optional, best_pileline attr, tidying
jakeswann1 Aug 7, 2024
99f9d55
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 7, 2024
0012048
Added option to provide a list of SortingAnalyzers for model training
jakeswann1 Aug 7, 2024
b55c533
Improved error handling for missing metrics
jakeswann1 Aug 8, 2024
62f6657
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 8, 2024
b2eb645
Merge branch 'main' into curation_metrics
chrishalcrow Aug 26, 2024
1176e65
Added quality metric parameters provenance json file and checks
chrishalcrow Aug 26, 2024
4a4d15d
custom classifier params & labels, change to skops, n_jobs updated
jakeswann1 Aug 27, 2024
50e4520
Import skops moved to function
jakeswann1 Aug 27, 2024
19fe160
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 27, 2024
9e970b1
add pipeline_info_path, change to metric_names and improve missing me…
chrishalcrow Aug 28, 2024
b9a6c3a
move back pandas and export auto_label_units and train_model
chrishalcrow Aug 28, 2024
75e45c4
remove set_global_jobs_kwargs from tests
chrishalcrow Aug 28, 2024
fd07f68
Fix tests (that I broke) and move metric_names check to _get_metrics_…
chrishalcrow Aug 28, 2024
e4726fd
Add skops to full and test deps
chrishalcrow Aug 28, 2024
f2a230f
Change target to labels or target_label and allow for passing of list…
chrishalcrow Aug 29, 2024
272f9b7
Make default classifier just RandomForest
chrishalcrow Aug 29, 2024
d960a03
Get rid of some prints
chrishalcrow Aug 29, 2024
f994f26
Default metrics now those computed in analyzer. Added compute all met…
jakeswann1 Aug 29, 2024
7a742a4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 29, 2024
2996c03
Added label conversion to .json file
jakeswann1 Aug 29, 2024
85310d4
must pass seperate list of labels
chrishalcrow Aug 29, 2024
8aa705a
delete compute_all_metrics
chrishalcrow Aug 29, 2024
4e5ab7b
Use label dict from pipeline_info and update docstrings
chrishalcrow Sep 2, 2024
6fb3bc9
Add check for list of lists in labels input
jakeswann1 Sep 2, 2024
b087989
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 2, 2024
7852bc6
Tutorial & how to docs v1
jakeswann1 Sep 2, 2024
2d5cedb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 2, 2024
69a5e8c
add requirements to pipeline_info
chrishalcrow Sep 6, 2024
7009a7f
Remove `get_default_metrics_list`
chrishalcrow Sep 6, 2024
f18d565
Add load from folder
chrishalcrow Sep 9, 2024
2cd50c6
fix skops import
chrishalcrow Sep 9, 2024
9961b49
Add huggingface_hub load
chrishalcrow Sep 9, 2024
28918a5
Pipeline to model, and add more requirements metadata
chrishalcrow Sep 9, 2024
45fa7bc
change model_folder_path to model_folder
chrishalcrow Sep 9, 2024
7198d2e
Pass trusted to skops.load
chrishalcrow Sep 9, 2024
e10fe69
propogate trusted
chrishalcrow Sep 10, 2024
4104d21
small fix, changed map() to applymap() to apply to dataframes
anoushkajain Sep 17, 2024
acb47c8
Update doc tutorials
chrishalcrow Sep 19, 2024
3a0ffc9
Add curation readme
chrishalcrow Sep 19, 2024
11f3821
Update conf.py for docs
chrishalcrow Sep 19, 2024
062038c
Update for auto doc build
chrishalcrow Sep 19, 2024
2304b80
Change sklearn install name in pyproject.toml
chrishalcrow Sep 19, 2024
fe76d80
Update how-tos and change property name
chrishalcrow Sep 19, 2024
86dd96a
Make metric_names lists
chrishalcrow Sep 19, 2024
5a6a92e
Add upload to HFH tutorial
chrishalcrow Sep 19, 2024
2d68bba
Docs round of editing and add to API
chrishalcrow Sep 20, 2024
a4f3795
Add autosave of training_data and labels, and add overwrite
chrishalcrow Sep 20, 2024
9638cf9
Add Neuropixels to subtitle
chrishalcrow Sep 20, 2024
8791c69
Add useful info when error raised
chrishalcrow Sep 25, 2024
ea5863c
Merge branch 'main' into curation_metrics
alejoe91 Oct 3, 2024
7065726
Add trusted_model argument to load and raise if multiple models avail…
alejoe91 Oct 3, 2024
9287ac1
output_folder -> folder and use pathlib
alejoe91 Oct 3, 2024
2c2b812
fix tests
alejoe91 Oct 3, 2024
d7aa4d6
Update module imports and half-fix tutorials
chrishalcrow Oct 4, 2024
e7904e1
Merge branch 'main' into curation_metrics
chrishalcrow Oct 11, 2024
2c9a39b
Change metric_path to metric_pathS
chrishalcrow Oct 11, 2024
051f073
Add verbose and search_kwargs. Add trust_model to docs.
chrishalcrow Oct 14, 2024
670eeb7
Fix search_kwargs tests
chrishalcrow Oct 14, 2024
41cadac
Add test_size
chrishalcrow Oct 15, 2024
5889c0a
Merge branch 'main' into curation_metrics
alejoe91 Oct 31, 2024
78589cd
Respond to review
chrishalcrow Nov 4, 2024
0dbfaf9
Rejig checks on parameters used to compute metrics. And add `enforce_…
chrishalcrow Nov 6, 2024
3ddfa57
Update automated curation tutorial
chrishalcrow Nov 6, 2024
ed02545
Merge branch 'main' into curation_metrics
chrishalcrow Nov 7, 2024
9488416
Update saving of metric params
chrishalcrow Nov 7, 2024
dbbb1b8
Keep inconsistent params by metric info, and warn/error based on this
chrishalcrow Nov 7, 2024
e99c3b9
Add train using sorting_analyzer tests
chrishalcrow Nov 8, 2024
5ba50b5
oups
chrishalcrow Nov 8, 2024
64e1636
Replace pipeline.skops with model folder
chrishalcrow Nov 8, 2024
dab85bf
Update tests, and code to pass the tests, for model based curation
chrishalcrow Nov 8, 2024
7ea3212
Update use models how_to and tutorial
chrishalcrow Nov 20, 2024
41955d7
Give isolation_distance, l_ratio, d_prime empty default params
chrishalcrow Nov 22, 2024
b2a3dba
Train a model doc review response
chrishalcrow Nov 22, 2024
6efd7b1
respond to upload_a_model review
chrishalcrow Nov 22, 2024
26ae2b5
Merge branch 'main' into curation_metrics
chrishalcrow Nov 22, 2024
65847c1
Respond to `model_based_curation` review
chrishalcrow Nov 28, 2024
4d0e259
respond to train_manual_curation review
chrishalcrow Nov 28, 2024
a939d81
Refactor to use `_get_computed_metrics` for both CurationModelTrainer…
chrishalcrow Nov 28, 2024
748c21d
Add tutorials to tutorials_custom_index
chrishalcrow Nov 28, 2024
793a530
update train a model docs for new not-nan imputation
chrishalcrow Nov 28, 2024
19c0990
oups
chrishalcrow Nov 28, 2024
f69d2f0
Little bits
chrishalcrow Nov 28, 2024
8dacf2a
add hfh logo
chrishalcrow Nov 29, 2024
830a977
start responding to test comments
chrishalcrow Nov 29, 2024
0eb8751
add test documentation
chrishalcrow Nov 29, 2024
37746e0
Merge branch 'main' into curation_metrics
chrishalcrow Dec 4, 2024
c14b5d7
Change `qm_params` to `metric_params`
chrishalcrow Dec 4, 2024
7585cdd
Change `metrics_kwargs` to `metric_params` and add backwards compat f…
chrishalcrow Dec 4, 2024
955ca72
lil bugs for backwards compat
chrishalcrow Dec 4, 2024
233d598
Refactor to take advantage of unified quality and template metrics
chrishalcrow Dec 4, 2024
7b7323e
Add links at start and end of `train_a_model` and `upload_a_model` docs
chrishalcrow Dec 4, 2024
46681f8
Make generalised `_format_metric_dataframe` function
chrishalcrow Dec 11, 2024
52ac6a0
Update docs
chrishalcrow Dec 11, 2024
fee5f5b
Write metric names for csv mode, and don't check params if not in mod…
chrishalcrow Dec 11, 2024
be79a83
Update csv model_info to match analyzer model_info file
chrishalcrow Dec 11, 2024
77b8c81
Merge branch 'main' into curation_metrics
chrishalcrow Dec 12, 2024
c6739df
add docstring and delete a test
chrishalcrow Dec 12, 2024
6aaf01f
Update so csv can use subset of metrics
chrishalcrow Dec 16, 2024
59fad3f
Change lists to distributions in `default_classifier_search_spaces`
chrishalcrow Dec 17, 2024
493ba4e
Add scoring_method for sorting best models
chrishalcrow Dec 17, 2024
832b4cd
Fix tests
chrishalcrow Dec 17, 2024
3babf42
Merge branch 'main' into curation_metrics
alejoe91 Jan 8, 2025
9c6e078
Allow for parameter check even when there are no parameters
chrishalcrow Jan 8, 2025
e67dd83
Respond to Alessio docs comments
chrishalcrow Jan 8, 2025
0c9a554
move scipy import
chrishalcrow Jan 8, 2025
dc72f8e
Merge branch 'main' into curation_metrics
alejoe91 Jan 8, 2025
97e50f9
Merge branch 'main' into curation_metrics
alejoe91 Jan 8, 2025
45e3e6a
remove double parallelisation
chrishalcrow Jan 8, 2025
45d8f17
Merge branch 'main' into curation_metrics
alejoe91 Jan 10, 2025
33798ee
Fix tutorial
alejoe91 Jan 10, 2025
41f620e
Include cv=3 in tutorial
chrishalcrow Jan 10, 2025
a609417
Adjust subplots for feature importance plot in tutorial
alejoe91 Jan 10, 2025
6e3714c
Fix quality metrics tutorial name in tutorials_custom_index
alejoe91 Jan 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,9 @@ spikeinterface.curation
.. autofunction:: remove_redundant_units
.. autofunction:: remove_duplicated_spikes
.. autofunction:: remove_excess_spikes
.. autofunction:: load_model
.. autofunction:: auto_label_units
.. autofunction:: train_model

Deprecated
~~~~~~~~~~
Expand Down
1 change: 1 addition & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
'subsection_order': ExplicitOrder([
'../examples/tutorials/core',
'../examples/tutorials/extractors',
'../examples/tutorials/curation',
'../examples/tutorials/qualitymetrics',
'../examples/tutorials/comparison',
'../examples/tutorials/widgets',
Expand Down
43 changes: 43 additions & 0 deletions doc/how_to/auto_curation_prediction.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
How to use a trained model to predict the curation labels
chrishalcrow marked this conversation as resolved.
Show resolved Hide resolved
=========================================================

For a more detailed guide to using trained models, `read our tutorial here
<https://spikeinterface.readthedocs.io/en/latest/tutorials/curation/plot_1_automated_curation.html>`_).

There is a Collection of models for automated curation available on the
`SpikeInterface HuggingFace page <https://huggingface.co/SpikeInterface>`_.

We'll apply the model ``toy_tetrode_model`` from ``SpikeInterface`` on a SortingAnalyzer
called ``sorting_analyzer``. We assume that the quality and template metrics have
already been computed.

We need to pass the ``sorting_analyzer``, the ``repo_id`` (which is just the part of the
repo's URL after huggingface.co/) and that we trust the model.

.. code::

from spikeinterface.curation import auto_label_units

labels_and_probabilities = auto_label_units(
sorting_analyzer = sorting_analyzer,
repo_id = "SpikeInterface/toy_tetrode_model",
trust_model = True
)

If you have a local directory containing the model in a ``skops`` file you can use this to
create the labels:

.. code::

labels_and_probabilities = si.auto_label_units(
sorting_analyzer = sorting_analyzer,
model_folder = "my_folder_with_a_model_in_it",
)

The returned labels are a dictionary of model's predictions and it's confidence. These
are also saved as a property of your ``sorting_analyzer`` and can be accessed like so:

.. code::

labels = sorting_analyzer.sorting.get_property("classifier_label")
probabilities = sorting_analyzer.sorting.get_property("classifier_probability")
58 changes: 58 additions & 0 deletions doc/how_to/auto_curation_training.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
How to train a model to predict curation labels
alejoe91 marked this conversation as resolved.
Show resolved Hide resolved
===============================================

A full tutorial for model-based curation can be found `here <https://spikeinterface.readthedocs.io/en/latest/tutorials/curation/plot_2_train_a_model.html>`_.

Here, we assume that you have:

* Two SortingAnalyzers called ``analyzer_1`` and
``analyzer_2``, and have calculated some template and quality metrics for both
* Manually curated labels for the units in each analyzer, in lists called
``analyzer_1_labels`` and ``analyzer_2_labels``. If you have used phy, the lists can
be accessed using ``curated_labels = analyzer.sorting.get_property("quality")``.

With these objects calculated, you can train a model as follows

.. code::

from spikeinterface.curation import train_model

analyzer_list = [analyzer_1, analyzer_2]
labels_list = [analyzer_1_labels, analyzer_2_labels]
output_folder = "/path/to/output_folder"

trainer = train_model(
mode="analyzers",
labels=labels_list,
analyzers=analyzer_list,
output_folder=output_folder,
metric_names=None, # Set if you want to use a subset of metrics, defaults to all calculated quality and template metrics
imputation_strategies=None, # Default is all available imputation strategies
scaling_techniques=None, # Default is all available scaling techniques
classifiers=None, # Defaults to Random Forest classifier only - we usually find this gives the best results, but a range of classifiers is available
seed=None, # Set a seed for reproducibility
)


The trainer tries several models and chooses the most accurate one. This model and
some metadata are stored in the ``output_folder``, which can later be loaded using the
``load_model`` function (`more details <https://spikeinterface.readthedocs.io/en/latest/tutorials/curation/plot_1_automated_curation.html#download-a-pretrained-model>`_).
We can also access the model, which is an sklearn ``Pipeline``, from the trainer object

.. code::

best_model = trainer.best_pipeline


The training function can also be run in “csv” mode, if you prefer to
store metrics in as .csv files. If the target labels are stored as a column in
the file, you can point to these with the ``target_label`` parameter

.. code::

trainer = train_model(
mode="csv",
metrics_paths = ["/path/to/csv_file_1", "/path/to/csv_file_2"],
target_label = "my_label",
output_folder=output_folder,
)
2 changes: 2 additions & 0 deletions doc/how_to/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ Guides on how to solve specific, short problems in SpikeInterface. Learn how to.
load_your_data_into_sorting
benchmark_with_hybrid_recordings
drift_with_lfp
auto_curation_training
auto_curation_prediction
Binary file added doc/images/files_screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions doc/images/hf-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/initial_model_screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions doc/tutorials_custom_index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,39 @@ The :code:`spikeinterface.qualitymetrics` module allows users to compute various
:class-card: gallery-card
:text-align: center

Automated curation tutorials
----------------------------

Learn how to curate your units using a trained machine learning model. Or how to create
and share your own model.

.. grid:: 1 2 2 3
:gutter: 2

.. grid-item-card:: Model-based curation
:link-type: ref
:link: sphx_glr_tutorials_curation_plot_1_automated_curation.py
:img-top: /tutorials/curation/images/sphx_glr_plot_1_automated_curation_002.png
:img-alt: Model-based curation
:class-card: gallery-card
:text-align: center

.. grid-item-card:: Train your own model
:link-type: ref
:link: sphx_glr_tutorials_curation_plot_2_train_a_model.py
:img-top: /tutorials/curation/images/thumb/sphx_glr_plot_2_train_a_model_thumb.png
:img-alt: Train your own model
:class-card: gallery-card
:text-align: center

.. grid-item-card:: Upload your model to HuggingFaceHub
:link-type: ref
:link: sphx_glr_tutorials_curation_plot_3_upload_a_model.py
:img-top: /images/hf-logo.svg
:img-alt: Upload your model
:class-card: gallery-card
:text-align: center

Comparison tutorial
-------------------

Expand Down
5 changes: 5 additions & 0 deletions examples/tutorials/curation/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Curation tutorials
------------------

Learn how to use models to automatically curated your sorted data, or generate models
based on your own curation.
Loading