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.16.tar.gz (5.8 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.16-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pycodeml-0.0.16.tar.gz
  • Upload date:
  • Size: 5.8 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.16.tar.gz
Algorithm Hash digest
SHA256 136fbe712a6f5270f4912fa737154c69deb72dc1d413328d9345db31fdade80b
MD5 e1bc42d5b5f9e8ceeb3fd293f241a7c0
BLAKE2b-256 156e16db83df35a19b79111741c094e2d8438805eb57a57c4728a70479b44fb1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycodeml-0.0.16-py3-none-any.whl
  • Upload date:
  • Size: 6.2 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.16-py3-none-any.whl
Algorithm Hash digest
SHA256 7fbbbfde4225ea811d65d25b60fa2da028c28971947247f54f52e3656cc9f331
MD5 5d3b92cb4e7332aff88e9d4dcfdb71ff
BLAKE2b-256 71a038a6b6653f441330bcc4b6ce477fc1203fbe457ee1c61b94dbb93605f67a

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