Skip to main content

A simple machine learning package for forecasting and classification

Project description

Simplreg Documentation

Simplreg is a simple machine learning pipeline designed for beginners to quickly perform forecasting and classification tasks on supervised datasets. This package abstracts the complexities of preprocessing, model training, evaluation, and visualization into a user-friendly interface.


Installation

To install Simplreg, use pip:

pip install simplreg

Features

  • Preprocessing: Automatically splits the dataset into training and testing sets and handles basic preprocessing tasks.
  • Model Training: Supports both classification and regression tasks with pre-configured models.
  • Evaluation: Provides performance metrics for both classification and regression tasks.
  • Visualization: Displays feature importance for classification models.

Getting Started

1. Import the Package

from simplreg import simplereg_pipeline

2. Prepare Your Dataset

Ensure your dataset is in the form of a Pandas DataFrame. The target column should be specified for predictions.

Example:

import pandas as pd
from sklearn.datasets import load_iris

# Load dataset
iris = load_iris()
df = pd.DataFrame(iris.data, columns=iris.feature_names)
df['target'] = iris.target

3. Run the Pipeline

# Run the pipeline
simplereg_pipeline(df, target_column='target', task_type='classification')

API Reference

simplereg_pipeline

Definition:

def simplereg_pipeline(df, target_column, task_type):
    """Simple ML pipeline: Preprocess, train, evaluate, visualize."""

Parameters:

  • df (DataFrame): Input dataset.
  • target_column (str): Name of the column containing the target variable.
  • task_type (str): Type of task, either classification or regression.

Returns: None (Outputs results to the console and visualizes feature importance).


Under the Hood

Modules

  1. Preprocessing

    • Splits the dataset into training and testing sets.
    • Handles missing values and scaling (if necessary).
  2. Model Training

    • Uses Logistic Regression for classification tasks.
    • Uses Linear Regression for regression tasks.
  3. Evaluation

    • Classification: Outputs accuracy, precision, recall, and F1 score.
    • Regression: Outputs mean absolute error, mean squared error, and R-squared value.
  4. Visualization

    • Displays feature importance for classification tasks using bar plots.

Example Usage

Classification Example

from simplreg import simplereg_pipeline
import pandas as pd
from sklearn.datasets import load_iris

# Load dataset
iris = load_iris()
df = pd.DataFrame(iris.data, columns=iris.feature_names)
df['target'] = iris.target

# Run pipeline
simplereg_pipeline(df, target_column='target', task_type='classification')

Regression Example

from simplreg import simplereg_pipeline
import pandas as pd
import numpy as np

# Generate synthetic regression data
data = {
    'feature1': np.random.rand(100),
    'feature2': np.random.rand(100),
    'target': np.random.rand(100) * 10
}
df = pd.DataFrame(data)

# Run pipeline
simplereg_pipeline(df, target_column='target', task_type='regression')

Contributing

Contributions are welcome! If you'd like to contribute, please:

  1. Fork the repository.
  2. Create a new branch.
  3. Make your changes and commit them.
  4. Submit a pull request.

License

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


Support

If you encounter any issues or have questions, feel free to open an issue on the GitHub repository or contact the maintainer at your-email@example.com.


Acknowledgments

  • Scikit-learn: For providing robust machine learning utilities.
  • Matplotlib: For visualization capabilities.
  • Pandas: For data manipulation and analysis.

Thank you for using Simplreg! Happy learning!

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

simplreg-0.2.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

simplreg-0.2-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file simplreg-0.2.tar.gz.

File metadata

  • Download URL: simplreg-0.2.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for simplreg-0.2.tar.gz
Algorithm Hash digest
SHA256 c4aaa5b724ed9975a96144981bf0fcd5d1a9e363938ea84cbdee5ac692c98eff
MD5 e992df2988107857e4a2108e9e9a1765
BLAKE2b-256 2bd9da4cf5785ae3f389d2a6a8b2bc9640c471ed899291aa9b418716bc57f1e4

See more details on using hashes here.

File details

Details for the file simplreg-0.2-py3-none-any.whl.

File metadata

  • Download URL: simplreg-0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for simplreg-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 eaf89c9223ec6273997b4d67d06e4e180deb93d4b155928741c6a8f9ba853a0e
MD5 c9f90f22705ef45531fd0c6359fa6882
BLAKE2b-256 8d9e7c4a29fd4479eb349291225cd96c00afe17c851fb0b5ed4b3321ebbf7bc6

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