skorch-dev/skorch
A scikit-learn compatible neural network library that wraps PyTorch
What it solves
It bridges the gap between PyTorch and scikit-learn, allowing users to treat PyTorch neural networks as if they were scikit-learn estimators. This eliminates the need to write repetitive boilerplate code for training loops and allows PyTorch models to be used directly within scikit-learn's ecosystem of tools for preprocessing, pipeline construction, and hyperparameter tuning.
How it works
Skorch wraps PyTorch modules into a scikit-learn compatible interface. By providing classes like NeuralNetClassifier, it enables the use of standard scikit-learn methods such as .fit() and .predict(). This wrapper allows PyTorch models to integrate seamlessly into sklearn.pipeline.Pipeline and sklearn.model_selection.GridSearchCV for automated model selection and optimization.
Who it’s for
Machine learning engineers and data scientists who use PyTorch for building neural networks but prefer the scikit-learn API for model management, evaluation, and pipeline orchestration.
Highlights
- Scikit-learn Compatibility: Full integration with scikit-learn pipelines and grid search for hyperparameter optimization.
- Training Utilities: Built-in support for early stopping, checkpointing, and learning rate schedulers (including cyclic LR and warm restarts).
- Model Management: Features for parameter freezing/unfreezing and progress bars for both CLI and Jupyter notebooks.
- Broad Integration: Compatible with Hugging Face and GPyTorch for Gaussian Processes.
Related
- Project
- Project
- Project
- Project
- Project