Skip to main content

A tool for creating machine learning pipelines with custom preprocessing and model selection

Project description

onelineml

onelineml is a Python package designed to simplify the process of creating machine learning pipelines. It allows you to easily handle data preprocessing, model selection, and model evaluation with a few simple function calls.

Features

  • Customizable missing value handling for numerical and categorical features.
  • Support for multiple machine learning models including:
    • Random Forest
    • Logistic Regression
    • Decision Tree
    • Support Vector Machine (SVM)
    • K-Nearest Neighbors (KNN)
    • Gradient Boosting Classifier (XGBoost)
    • Naive Bayes
  • Easy to integrate into your machine learning workflows.
  • Built-in model evaluation with accuracy score and classification report.

Installation

You can install onelineml directly from PyPI (if published) or locally from the source.

From PyPI

pip install onelineml

From Source

To install onelineml from the source, follow these steps:

  1. Clone the repository:

    git clone https://github.com/gaharivatsa/easyml.git
    
  2. Navigate to the project directory:

    cd onelineml
    
  3. Install the package:

    pip install .
    

Usage

Here's a step-by-step guide on how to use onelineml in your projects.

1. Import the Package

Start by importing the create_ml_pipeline function from the onelineml package.

from onelineml import create_ml_pipeline

2. Prepare Your Data

Ensure your dataset is in a CSV format and includes a target column that you want to predict.

# Example: Load your dataset
dataset = 'path_to_your_dataset.csv'
target = 'target_column_name'

3. Create and Run the Pipeline

Use the create_ml_pipeline function to build and run the pipeline. You can specify the missing value handling strategies, the model, and any model-specific parameters.

pipeline = create_ml_pipeline(
    numerical_na_method='mean',            # Strategy for imputing missing values in numerical columns
    categorical_na_method='most_frequent', # Strategy for imputing missing values in categorical columns
    model_name='knn',                      # Choose the model (e.g., 'knn', 'random_forest', etc.)
    model_params={'n_neighbors': 5},       # Model-specific parameters
    dataset=dataset,                       # Path to your dataset
    target=target,                         # Target column name
    splitting_ratio=0.25                   # Ratio for splitting the dataset into training and testing sets
)

4. View Results

The function will output the accuracy and classification report after training the model.

5. Save the Pipeline

The trained pipeline is automatically saved as a .pkl file for future use.

# Example: Load and use the saved pipeline
import joblib

loaded_pipeline = joblib.load('knn_pipeline.pkl')

6. Customize Further

Feel free to customize the pipeline further by adjusting the model parameters, trying different models, or even extending the functionality by modifying the source code.

Example Projects

You can find example projects and more detailed tutorials in the examples/ directory of the repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request or open an Issue on GitHub.

Author

Harivatsa G A - GitHub

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

onelineml-0.2.2.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

onelineml-0.2.2-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file onelineml-0.2.2.tar.gz.

File metadata

  • Download URL: onelineml-0.2.2.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.4

File hashes

Hashes for onelineml-0.2.2.tar.gz
Algorithm Hash digest
SHA256 9c439178c8a1287871816d16d80cd2eb784e98e5df098184b64996be57f7cc57
MD5 7e8b20c7a7181cacebabc25a88897c13
BLAKE2b-256 b24d451e235f93cd9368c39e82c57f0931abd21312529e9119011e88fb24de0c

See more details on using hashes here.

File details

Details for the file onelineml-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: onelineml-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.4

File hashes

Hashes for onelineml-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fc43c539a0f91245f674e2a2dc9c0589971c726611f4e59a1900921bb80cc7f3
MD5 46d5878ea67cb8692e6e78441b63c294
BLAKE2b-256 0a1e78d20cf6ade07f4f0636f234a7bc156e7592fb6a3ac2d0e054de67838a17

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