Skip to main content

A Python library for machine learning preprocessing and utilities.

Project description

mlhelper

A lightweight Python library for Machine Learning preprocessing, feature engineering, visualization, model evaluation, and utilities.


Features

  • Data preprocessing
  • Missing value handling
  • Outlier detection
  • Feature engineering
  • Encoding
  • Feature scaling
  • Model evaluation metrics
  • Data visualization
  • Model selection utilities
  • Dataset loaders
  • General utility functions

Installation

From PyPI

pip install mlhelper

From Source

git clone https://github.com/YOUR_USERNAME/mlhelper.git

cd mlhelper

pip install -e .

Requirements

  • Python 3.10+
  • NumPy
  • Pandas
  • Scikit-learn
  • SciPy
  • Matplotlib
  • Seaborn
  • Joblib

Quick Start

import pandas as pd
import mlhelper as ml

df = pd.read_csv("data.csv")

df = ml.clean_column_names(df)

df = ml.fill_mean(df)

df = ml.remove_iqr(df, "Age")

print(df.head())

Modules

preprocessing

ml.clean_column_names()

ml.remove_duplicates()

ml.drop_constant_columns()

ml.remove_whitespace()

ml.change_dtype()

missing_values

ml.fill_mean()

ml.fill_median()

ml.fill_mode()

ml.fill_constant()

ml.missing_report()

outlier

ml.detect_iqr()

ml.remove_iqr()

ml.cap_iqr()

ml.detect_zscore()

ml.remove_zscore()

feature_engineering

ml.extract_numbers()

ml.extract_text()

ml.split_unit()

ml.log_transform()

ml.sqrt_transform()

ml.frequency_encode()

encoding

ml.one_hot_encode()

ml.label_encode()

ml.ordinal_encode()

ml.binary_encode()

ml.target_encode()

scaling

ml.standard_scale()

ml.minmax_scale()

ml.robust_scale()

ml.normalize()

ml.quantile_transform()

metrics

ml.accuracy()

ml.precision()

ml.recall()

ml.f1()

ml.rmse()

ml.r2()

visualization

ml.histogram()

ml.boxplot()

ml.correlation_heatmap()

ml.scatter()

ml.learning_curve_plot()

model_selection

ml.split()

ml.cross_validation()

ml.grid_search()

ml.randomized_search()

ml.best_estimator()

datasets

iris = ml.load_iris()

wine = ml.load_wine()

digits = ml.load_digits()

housing = ml.load_california_housing()

df = ml.load_csv("train.csv")

utils

ml.data_summary()

ml.memory_usage()

ml.set_seed()

ml.save_pickle()

ml.load_pickle()

Example

import mlhelper as ml

iris = ml.load_iris()

print(iris.head())

X = iris.drop("target", axis=1)

y = iris["target"]

X_train, X_test, y_train, y_test = ml.split(X, y)

print(X_train.shape)

Testing

Install pytest

pip install pytest

Run all tests

python -m pytest -v

Coverage

python -m pytest --cov=mlhelper

Project Structure

mlhelper/
│
├── mlhelper/
│   ├── preprocessing.py
│   ├── missing_values.py
│   ├── outlier.py
│   ├── feature_engineering.py
│   ├── encoding.py
│   ├── scaling.py
│   ├── metrics.py
│   ├── visualization.py
│   ├── model_selection.py
│   ├── datasets.py
│   └── utils.py
│
├── tests/
├── examples/
├── docs/
├── README.md
├── LICENSE
├── pyproject.toml
└── requirements.txt

Roadmap

  • Preprocessing
  • Missing Values
  • Outlier Detection
  • Feature Engineering
  • Encoding
  • Scaling
  • Metrics
  • Visualization
  • Model Selection
  • Dataset Loader
  • Documentation Improvements
  • More Datasets
  • More Visualizations
  • Deep Learning Utilities

Contributing

Contributions are welcome.

  1. Fork the repository
  2. Create a new branch
  3. Commit your changes
  4. Open a Pull Request

License

MIT License


Author

Gautam

Computer Science Engineering (AI & ML)

Python • Machine Learning • Deep Learning • Open Source


If you find this project useful, consider giving it a ⭐ on 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

mlhelper_ai-0.1.0.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

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

mlhelper_ai-0.1.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file mlhelper_ai-0.1.0.tar.gz.

File metadata

  • Download URL: mlhelper_ai-0.1.0.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for mlhelper_ai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5a1aca35091fd67be8974a3accd0b562817353b2071d3f527e48c3fea005c27e
MD5 6a978f433b39210de85430dd32d7b7f5
BLAKE2b-256 b3d465a3b7139dcebf65fa54db7596d44ed59cc1044e8136b0981910e3fa4685

See more details on using hashes here.

File details

Details for the file mlhelper_ai-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mlhelper_ai-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for mlhelper_ai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2b5d3a496eddce28086742032a96f261d6752b04a0fce62bd93ffcddbfe22204
MD5 008377e66491bdf3af0b18cacb636e4e
BLAKE2b-256 43ec2b6b4f28405be76b25fdea7bc73b8f8d7e364920c6f8898a1abcb0d3e4c6

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