Skip to main content

Automatically train multiple regression models and return the best one.

Project description

PyCodeML

PyCodeML is a Python package designed to automate the training, evaluation, tuning, and selection of the best-performing machine learning models for regression and classification tasks. It simplifies the process of model training, comparison, tuning, and deployment.

✅ Features

  • Supports Regression and (soon) Classification tasks
  • Evaluates multiple models and selects the best one
  • Hyperparameter tuning support for optimized performance
  • Saves and loads trained models for future use
  • Simple and intuitive API for fast prototyping and deployment

📦 Installation

pip install pycodeml

💻 Usage

1️⃣ Train and Save the Best Model

import pandas as pd
from pycodeml.regressor import RegressorTrainer  # For regression tasks

# Load dataset from a CSV file (Ensure target column exists)
df = pd.read_csv("data.csv")

# Initialize and train the model
trainer = RegressorTrainer(df, "target", data_sample_percent=100)
best_model = trainer.train_and_get_best_model()

# Save the best model
trainer.save_best_model("best_model.pkl")

2️⃣ Load and Use the Saved Model

import pandas as pd
from pycodeml.utils import load_model

# Load the saved model
model = load_model("best_model.pkl")

# Load new data from a CSV file (without target column)
new_data = pd.read_csv("new_data.csv")

# Make predictions
prediction = model.predict(new_data)
print("Predicted Values:", prediction)

3️⃣ Tune the Best Model

from pycodeml.tunner import RegressorTuner

# Perform hyperparameter tuning on the best model
tuner = RegressorTuner(
    model=best_model,
    dataset=df,
    target_column="target",
    model_name="Random Forest"  # Must match one of the supported models
)

# Get the tuned model
tuned_model,score = tuner.tune()

📊 Supported Models Regression

  • Linear Regression
  • Decision Tree Regressor
  • Random Forest Regressor
  • Support Vector Machine (SVR)
  • Gradient Boosting Regressor
  • Ridge Regression
  • Lasso Regression
  • Elastic Net

Classification (Coming Soon) Logistic Regression

  • Logistic Regression
  • Random Forest Classifier
  • Support Vector Machine (SVM)
  • Gradient Boosting Classifier
  • K-Nearest Neighbors (KNN)

🤝 Contributing Contributions are welcome! If you'd like to improve this package, feel free to fork the repository and submit a pull request.

🔗 GitHub: https://github.com/Nachiket858/PyCodeML

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

pycodeml-0.0.17.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

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

pycodeml-0.0.17-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file pycodeml-0.0.17.tar.gz.

File metadata

  • Download URL: pycodeml-0.0.17.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for pycodeml-0.0.17.tar.gz
Algorithm Hash digest
SHA256 fce8b4a4255558fc71f3962fc3a82a5239cf6a22512a2810a5003e82863c743a
MD5 bb8e38b53d6af3497715d82af079c91c
BLAKE2b-256 b8d42cea81e609d62ebfbcc3dd7560487c9e250adcd94f3d7ba579a383bf256b

See more details on using hashes here.

File details

Details for the file pycodeml-0.0.17-py3-none-any.whl.

File metadata

  • Download URL: pycodeml-0.0.17-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for pycodeml-0.0.17-py3-none-any.whl
Algorithm Hash digest
SHA256 afcdb351a3bcfdef011c8ea14bf6296652d2a716606cb588cda1bcb08354374b
MD5 f5e5187c0c32fd3070b1d209ad58815c
BLAKE2b-256 d3756fd537b4d99d15bb35f72a3dee28d78859636f1b020511caac21629ea571

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