skorch: a PyTorch module behind the scikit-learn parameter syntax
A scikit-learn compatible neural network library that wraps PyTorch
At a glance
- What is it?
- skorch turns a PyTorch nn.Module into a scikit-learn estimator so it can sit in a Pipeline and a GridSearchCV. It does not include PyTorch, and its Python version floor disagrees with its own packaging metadata.
- Who is it for?
- skorch is the right pick when your pipeline already runs through scikit-learn and you want grid search, early stopping or checkpointing without hand-writing a training loop. It is the wrong pick when you want a managed torch version or an accelerated path outside the extended extras.
- Can I use it commercially?
- Yes. BSD-3-Clause is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 6 days ago.
- What is it written in?
- Mainly Jupyter Notebook, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.
Star history
- skorch-dev/skorch6,189 ★ · +10
| Repository | 2026-09-11 | 2026-11-15 |
|---|---|---|
| skorch-dev/skorch | 6.2k | 6.2k |
10 Stars in the last 65 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
Two underscores route a parameter into the module
The whole trick is that a PyTorch module becomes a scikit-learn estimator, and the routing between the two worlds happens in parameter names. A double underscore means something: iterator_train__shuffle=True sends shuffle to the training iterator, and module__num_units sends num_units into the module constructor. Anything unprefixed stays on the net itself, which is why lr and max_epochs are plain while the module's own arguments are not.
That convention is what makes searching over architecture possible. The example grid reaches inside the module without a nested structure:
params = {
'lr': [0.01, 0.02],
'max_epochs': [10, 20],
'module__num_units': [10, 20],
}
gs = GridSearchCV(net, params, refit=False, cv=3, scoring='accuracy', verbose=2)GridSearchCV sees one estimator with named parameters, exactly as it would with a random forest. There is no custom search loop.
One setting from the same mechanism meets you immediately. skorch takes an internal train and valid split out of the data you pass to fit, and the grid search example switches it off with net.set_params(train_split=False, verbose=0). Leave it on and part of your training data quietly stops being training data.
skorch needs torch but does not depend on it
pyproject.toml lists five runtime dependencies: numpy>=1.13.3, scikit-learn>=0.22.0, scipy>=1.1.0, tabulate>=0.7.7 and tqdm>=4.14.0. PyTorch is not among them, which is why every from-source recipe installs torch on the line before skorch itself.
The reason is legible in that list. A torch pin is tied to a CUDA build, and leaving the choice open is the only way the instructions can say to install the PyTorch version for your system and move on. The cost lands on the reader: nothing in the metadata checks that the torch you have is one skorch can drive, so a mismatch surfaces as an import or device error rather than a resolver error.
Everything else is optional and grouped into extras. dev pulls pylint, flake8 and future>=0.17.1. test pulls pytest>=3.4, pytest-cov and flaky. docs pulls sphinx, sphinx_rtd_theme and numpydoc. extended pulls accelerate>=0.22.0, tensorboard>=1.14.0, wandb>=0.12.17, neptune, sacred, jupyter, matplotlib>=2.0.2, pandas, openpyxl, transformers and more. The plain pip install stays small because none of those are required to fit a net.
The README says Python 3.9 while pyproject requires 3.10
The installation section opens by saying skorch requires Python 3.9 or higher. The packaging metadata says requires-python = ">=3.10", and the classifiers run from 3.10 to 3.13 with no 3.9 entry at all. One of the two is stale, and the file pip reads is the second one, so a 3.9 environment cannot install the current release.
The same split shows up in the from-source recipes, which create the environment with conda create -n skorch-env python=3.12, and in the sentence that follows them telling you to adjust the Python version to any of the supported Python versions. Supported is carrying weight in that sentence, because the supported set is the classifier list, which starts at 3.10.
Check the metadata rather than the prose when you pin an interpreter. If you need 3.9, the fix is not a patch to skorch but an older release, and the project does not say which release dropped 3.9.
The Dockerfile targets CUDA 9.0 and a requirements.txt that is absent
There is a Dockerfile at the repository root and it has not kept pace. It starts FROM nvidia/cuda:9.0-cudnn7-runtime, installs python3.5-dev alongside vim, git, g++, sudo and zip, upgrades pip with easy_install3, then copies in requirements.txt and installs the project editable. The build asks for Python 3.5 while the project requires 3.10 or higher, and the requirements.txt it adds is not among the files in the tree, so the build stops at that ADD line before reaching the install.
It also has no CMD and no ENTRYPOINT, so the image finishes installing and exits. And it predates the pyproject build: it calls pip3 install -e . rather than using the setuptools backend declared in pyproject.toml.
The container route is therefore not one of the documented installs, and no supported image is named anywhere. Read the Dockerfile as a historical artefact rather than a deployment path.
conda-forge owns the skorch channel, not the maintainers
Three documented routes, and the channel matters on the first one:
conda install -c conda-forge skorchThe installation section flags that this channel is not managed by the skorch maintainers and points at the conda-forge feedstock instead. The conda build of skorch therefore runs on somebody else's release cadence, and that is the line to pin if you pin anything.
pip is the second route and the one most environments will use:
python -m pip install -U skorchThe third is source, and it is the only route that gives you the most recent additions or lets you contribute. The conda flavour builds a Python 3.12 environment and installs torch first:
git clone https://github.com/skorch-dev/skorch.git
cd skorch
conda create -n skorch-env python=3.12
conda activate skorch-env
python -m pip install torch
python -m pip install .The pip flavour follows the same clone-and-install sequence inside a virtual environment, installing the PyTorch version for your system first. For development the install line becomes python -m pip install '.[test,docs,dev,extended]', after which the documented checks are py.test for unit tests and pylint skorch for static code checks. A conda virtual environment is recommended for the conda route and a plain virtual environment for the pip route.
The first fit is four arguments away from a raw nn.Module
Write the module as you would in plain PyTorch, with forward accepting X and `**kwargs`, then hand the class to NeuralNetClassifier with max_epochs, lr and one iterator setting:
net = NeuralNetClassifier(
MyModule,
max_epochs=10,
lr=0.1,
# Shuffle training data on each epoch
iterator_train__shuffle=True,
)
net.fit(X, y)
y_proba = net.predict_proba(X)From there it composes with the rest of scikit-learn. StandardScaler and the net form an ordinary Pipeline, which is what keeps preprocessing inside the cross-validation folds instead of before them. Paired with GridSearchCV, the same net takes a parameter grid and a scorer, and that is where most skorch code ends up.
The example data is make_classification(1000, 20, n_informative=10, random_state=0) with X cast to np.float32 and y to np.int64. The example sets the dtypes explicitly.
The integrations live in examples/, not in the feature list
What skorch adds around your module is mostly callbacks: learning rate schedulers including warm restarts and cyclic schedules, epoch scoring with sklearn and custom scoring functions, early stopping, checkpointing, parameter freezing and unfreezing, a progress bar that works for the CLI as well as in jupyter, automatic inference of CLI parameters, GPyTorch integration for Gaussian processes, and Hugging Face integration.
The examples directory shows those working. It holds accelerate-multigpu, benchmarks, cli, image-classifier-finetuning, nuclei_image_segmentation, optuna, rnn_classifer, translation and word_language_model, covering multi-GPU training, hyperparameter search, fine-tuning an existing image model and training both a word level language model and a translator. One directory name is misspelled, rnn_classifer, which is a useful reminder that these are working projects rather than a curated gallery.
That directory also explains why the repository's dominant language reads as Jupyter Notebook: notebooks/ is a first-class citizen, with notebooks/README.md collecting the elaborate examples and docs/ holding the readthedocs build. Version and readme are dynamic in pyproject.toml, with the number taken from the VERSION file at the root, so the metadata is generated from the tree.
On cadence, the repository is not archived and the last push was on 2026-10-26, with v1.4.0 released on 2026-05-14 after v1.3.1 and v1.3.0 in late 2025. The licence is BSD-3-Clause, declared in the metadata with the LICENSE file at the root named in license-files.
Editorial conclusion
skorch is the right pick when your pipeline already runs through scikit-learn and you want grid search, early stopping or checkpointing without hand-writing a training loop. It is the wrong pick when you want a managed torch version or an accelerated path outside the extended extras. Before installing, read requires-python in pyproject.toml rather than the Python line in the README, and confirm torch is already in your environment, because nothing in the metadata pulls it in for you.
Frequently asked questions
Is skorch better than using PyTorch directly?
skorch is a wrapper, not a replacement. You still write the nn.Module and its forward yourself; skorch supplies the scikit-learn estimator interface, the callback set, the double underscore parameter routing and the training loop around it.
How do I install skorch?
Three routes are documented: conda install -c conda-forge skorch, python -m pip install -U skorch, or a git clone followed by an install from the checkout. PyTorch is not a declared dependency, so the from-source recipes install torch separately before skorch.
Which Python versions does skorch support?
The README says 3.9 or higher, but pyproject.toml sets requires-python to >=3.10 and the classifiers list 3.10 through 3.13. pip resolves against the metadata, so a 3.9 environment cannot install the current release.
Does skorch have early stopping built in?
Yes. Early stopping is one of the callbacks, alongside learning rate schedulers, epoch scoring with sklearn or custom functions, checkpointing, parameter freezing and unfreezing, and a progress bar that also works for the CLI.
What licence is skorch released under?
BSD-3-Clause. The metadata declares it in the project table and names the LICENSE file at the repository root in license-files.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/skorch-dev-skorch)Star history chart for your README
[](https://hysenlabs.com/projects/skorch-dev-skorch)Was this useful?