Skip to main content

Genetic Algorithm Driven AutoML Framework for sklearn-compatible classification pipelines

Project description

dxlearn — Genetic Algorithm Driven AutoML Framework

dxlearn is a production-grade, research-ready AutoML Python package that discovers optimal classification pipelines using a grammar-constrained Genetic Algorithm (GA) built strictly on top of scikit-learn.

Features

  • Grammar-constrained search: Pipelines follow <OptionalPreprocessor> <Scaler> <Classifier>.
  • Multi-objective fitness: Accuracy, fit time, predict time, and complexity (scalarized for selection).
  • sklearn-compatible API: fit, predict, predict_proba, score, get_params, set_params.
  • Deterministic & reproducible: Optional seeded RNG and fitness caching.
  • Extensible: Base abstractions for regression, NSGA-II, and distributed GA (future).

Requirements

  • Python 3.11+
  • numpy, scikit-learn, joblib

Installation

pip install -e .
# With dashboard (FastAPI + uvicorn):
pip install -e ".[dashboard]"

Quick Start

from dxlearn import DXClassifier
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split

X, y = load_iris(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42)

model = DXClassifier(
    population_size=30,
    generations=20,
    cv=5,
    alpha=1.0,
    beta=0.2,
    gamma=0.01,
    max_runtime=600,
    verbose=2,
    n_jobs=-1,
    deterministic=True,
    random_state=42,
)

model.fit(X_train, y_train)
preds = model.predict(X_test)
print(model.score(X_test, y_test))
print(model.best_pipeline_)
print(model.best_score_)

# Optional: launch analytical dashboard
model.dashboard()  # requires pip install dxlearn[dashboard]

Pipeline Grammar (v1)

  • OptionalPreprocessor: None | PCA | SelectKBest | PolynomialFeatures | VarianceThreshold
  • Scaler: StandardScaler | MinMaxScaler | RobustScaler
  • Classifier: LogisticRegression | RandomForestClassifier | GradientBoostingClassifier | SVC | KNeighborsClassifier | DecisionTreeClassifier

Fitness

Multi-objective vector: (accuracy, fit_time, predict_time, complexity).
Scalarized for selection: α·accuracy − β·fit_time − γ·complexity − δ·predict_time (default weights: α=1, β=0.2, γ=0.01).

Dashboard

With pip install dxlearn[dashboard], calling model.dashboard() starts a FastAPI server at http://127.0.0.1:8000 with:

  • Generation evolution curves (best fitness, best accuracy)
  • Accuracy vs time scatter
  • Mean fitness over generations
  • Best metrics summary

Package Layout

dxlearn/
├── base/           # BaseSearch, EvolutionarySearch, BaseDXEstimator
├── encoding/       # Grammar, tree, node (pipeline representation)
├── operators/      # Selection, crossover, mutation
├── search_space/   # Registry (scalers, preprocessors, classifiers)
├── evaluation/     # Evaluator, Objectives, Scalarizer
├── engine/         # GeneticSearch
├── dashboard/      # FastAPI dashboard (optional)
├── dxclassifier.py # Public API
└── config.py       # Defaults

License

MIT.

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

dxlearn-1.0.0.tar.gz (43.3 kB view details)

Uploaded Source

Built Distribution

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

dxlearn-1.0.0-py3-none-any.whl (50.9 kB view details)

Uploaded Python 3

File details

Details for the file dxlearn-1.0.0.tar.gz.

File metadata

  • Download URL: dxlearn-1.0.0.tar.gz
  • Upload date:
  • Size: 43.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for dxlearn-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f625de2df9093a0ca10dc55f986da015693821e33ab44964836d72d9392e8bf2
MD5 ad11d55838f55a9d731b4270b63a4a67
BLAKE2b-256 613cf43b02b5872637a9adcc47bd4528cd5d431b0ea49faaf5bca9861965cb1d

See more details on using hashes here.

File details

Details for the file dxlearn-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: dxlearn-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 50.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for dxlearn-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 74814e16930588d27cb53efb2bcded923e5c271307defb5bfeabe647fd1a71ed
MD5 9bdda598b512ccbb0e34b40b415618df
BLAKE2b-256 c7a82ebbba24626b9a4469d8cf3255024a708c0552ba7ddf7ed86fa1c28bd03d

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