scikit-learn
Data & MLscikit-learn: machine learning in Python
Release History
1.8.02 featuresscikit-learn 1.8.0 adds support for Python 3.11‑3.14 and free‑threaded CPython, with standard pip and conda upgrade paths.
1.7.21 fixscikit-learn 1.7.2 introduces bug fixes and adds support for Python 3.14.
1.7.11 fixscikit-learn 1.7.1 releases bug fixes for regressions introduced in 1.7.
1.7.01 featurescikit-learn 1.7.0 adds experimental free-threaded CPython support and updates the supported Python range to 3.10–3.13.
Common Errors
InvalidParameterError3 reportsInvalidParameterError in scikit-learn usually arises from passing incorrect or unsupported parameter values to a function or class constructor. To fix it, carefully review the documentation of the function/class, ensuring all parameter names are spelled correctly and the provided values match the expected data type and allowed range/options; double-check for deprecated or renamed parameters.
NotImplementedError2 reportsThe `NotImplementedError` in scikit-learn arises when a method or functionality is declared (e.g., in an abstract base class or for a specific configuration) but lacks a concrete implementation for a specific use case. To fix this, implement the missing functionality by providing the necessary code within the relevant class method, ensuring it handles the specific input and produces the expected output according to the method's defined purpose. If the functionality truly cannot be implemented, consider raising `NotImplementedError` only when the specific problematic conditions are met, and clearly document why it's not supported and suggest alternative approaches or inputs.
ValueError2 reportsValueError in scikit-learn usually arises from providing incorrect data types to a model, like strings when expecting numerical values, or incompatible shapes/structures. Address this by ensuring your input data conforms to the expected data type and shape specified in the documentation, often by converting strings to numbers using LabelEncoder or OneHotEncoder or reshaping arrays. Check the specific model's input requirements and modify your data accordingly to resolve data type and shape mismatches.
LinAlgError1 reportLinAlgError in scikit-learn often arises from singular matrices during calculations like matrix inversion, often within algorithms involving covariance matrices. Resolve this by adding regularization (e.g., `reg_param` in `QuadraticDiscriminantAnalysis` or a small value to the diagonal in covariance calculations) to improve matrix conditioning and ensure invertibility. Alternatively, check for and remove highly correlated features in your data which can also cause singularity.
AttributeError1 reportThis "AttributeError" in scikit-learn often arises when a method like 'predict_proba' is called on an estimator that doesn't implement it or when using MultiOutputClassifier/Regressor with base estimators lacking the requested method. Ensure the base estimator supports the called method (e.g., use a classifier with `predict_proba` if needed) or avoid calling methods not available in the base estimator for multi-output scenarios, potentially requiring custom prediction logic. For cross_val_predict specifically, if your estimator doesn't have the requested method (e.g. predict_proba), change the method to "predict" instead.
NotFittedError1 reportThe "NotFittedError" in scikit-learn usually arises when you try to use a transformer or estimator (like a pipeline, scaler, or model) before calling its `fit` method to train it on data. To fix this, ensure you call the `fit` method on your transformer/estimator object, passing it the appropriate training data (X, and optionally y for supervised models) before using it for transformation or prediction. For pipelines, fitting the pipeline fits all its constituent steps.
Related Data & ML Packages
An Open Source Machine Learning Framework for Everyone
🤗 Transformers: the model-definition framework for state-of-the-art machine learning models in text, vision, audio, and multimodal models, for both inference and training.
Tensors and Dynamic neural networks in Python with strong GPU acceleration
Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more
Streamlit — A faster way to build and share data apps.
Build and share delightful machine learning apps, all in Python. 🌟 Star to support our work!
Subscribe to Updates
Get notified when new versions are released