Skip to main content

Python 3.11+ compatible version of auto-sklearn

Project description

Auto-Sklearn2

A Python 3.11+ compatible version of auto-sklearn for automated machine learning.

Overview

Auto-Sklearn2 is a lightweight, Python 3.11+ compatible alternative to the popular auto-sklearn package. It provides automated machine learning capabilities without the dependency on ConfigSpace, which currently has compatibility issues with newer Python versions and NumPy 2.0.

Features

  • Python 3.11+ Compatible: Works with Python 3.11, 3.12, and 3.13
  • Automated Machine Learning: Automatically selects the best model and preprocessing pipeline
  • Classification and Regression: Supports both classification and regression tasks
  • Time-Limited Optimization: Set a time budget for model selection
  • Multiple Models: Includes RandomForest, GradientBoosting, LogisticRegression, SVC, KNN, MLP, and more
  • Multiple Preprocessors: Includes StandardScaler, MinMaxScaler, and RobustScaler
  • Cross-Validation: Uses cross-validation for model evaluation

Installation

pip install auto-sklearn2

Quick Start for Classification

from auto_sklearn2 import AutoSklearnClassifier
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split

# Load data
X, y = load_breast_cancer(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

# Create and fit the auto-sklearn classifier
auto_sklearn = AutoSklearnClassifier(time_limit=120, random_state=42)
auto_sklearn.fit(X_train, y_train)

# Make predictions
y_pred = auto_sklearn.predict(X_test)

# Get the best model details
print(f"Best model: {auto_sklearn.best_params}")
print(f"Accuracy: {auto_sklearn.score(X_test, y_test):.4f}")

# Show all models performance
for model_name, score in auto_sklearn.get_models_performance().items():
    print(f"{model_name}: {score:.4f}")

Quick Start for Regression

from auto_sklearn2 import AutoSklearnRegressor
from sklearn.datasets import load_diabetes
from sklearn.model_selection import train_test_split
from sklearn.metrics import r2_score, mean_squared_error
import numpy as np

# Load data
X, y = load_diabetes(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

# Create and fit the auto-sklearn regressor
auto_sklearn = AutoSklearnRegressor(time_limit=120, random_state=42)
auto_sklearn.fit(X_train, y_train)

# Make predictions
y_pred = auto_sklearn.predict(X_test)

# Calculate metrics
r2 = r2_score(y_test, y_pred)
rmse = np.sqrt(mean_squared_error(y_test, y_pred))

print(f"Best model: {auto_sklearn.best_params}")
print(f"R² Score: {r2:.4f}")
print(f"Root Mean Squared Error: {rmse:.4f}")

# Show all models performance
for model_name, score in auto_sklearn.get_models_performance().items():
    print(f"{model_name}: {score:.4f}")

Differences from auto-sklearn

Auto-Sklearn2 is a simplified version of auto-sklearn with the following differences:

  1. No ConfigSpace Dependency: Uses scikit-learn's built-in models and preprocessing methods
  2. Fewer Models and Preprocessors: Includes only the most common models and preprocessors
  3. No Meta-Learning: Does not use meta-learning to warm-start the optimization
  4. No Ensemble Building: Does not build ensembles of models
  5. Simpler Hyperparameter Optimization: Uses cross-validation instead of Bayesian optimization

License

BSD 3-Clause License (same as auto-sklearn)

Citation

If you use Auto-Sklearn2 in a scientific publication, please cite the original auto-sklearn paper:

@inproceedings{feurer-neurips15a,
    title     = {Efficient and Robust Automated Machine Learning},
    author    = {Feurer, Matthias and Klein, Aaron and Eggensperger, Katharina and
                 Springenberg, Jost and Blum, Manuel and Hutter, Frank},
    booktitle = {Advances in Neural Information Processing Systems 28},
    pages     = {2962--2970},
    year      = {2015}
}

Acknowledgements

This package is inspired by and based on the original auto-sklearn package.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

auto_sklearn2-0.1.2.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

auto_sklearn2-0.1.2-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file auto_sklearn2-0.1.2.tar.gz.

File metadata

  • Download URL: auto_sklearn2-0.1.2.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for auto_sklearn2-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f96538baec3e91d8c06398ff3186db9fad9034016a0b4b6b8d493699b07d4c29
MD5 d7e19660324058343f43460e50897d78
BLAKE2b-256 177acd5e13fc146d214998cb855edc5db5ffd6e58b5e1711f78ee3464031e9eb

See more details on using hashes here.

File details

Details for the file auto_sklearn2-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: auto_sklearn2-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for auto_sklearn2-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a161f869aeb3dc67689cd926a47d67d661a5ada56fcd124fd54969adcef2351b
MD5 1228a736f8988dfd41254c3cf2681388
BLAKE2b-256 86e2870cd4efe6a3bfe66857efe7ca0faef4ba24d57107e813631c20358965e9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page