Skip to main content

Automated machine learning preprocessing and modeling tool

Project description

Auto ML Processor

A Python package for automated machine learning preprocessing and model training. This package streamlines common data preprocessing tasks and model training for classification and regression problems.

Features

  • Automated data loading from multiple sources:
    • Local files (CSV, Excel, JSON, Parquet, Feather, Pickle)
    • URLs (direct downloads with format detection)
    • Hugging Face datasets
    • Kaggle datasets
    • OpenML datasets
  • Intelligent missing value handling with configurable thresholds
  • Automatic feature type detection (categorical vs. numerical)
  • Standardized preprocessing pipeline for feature engineering
  • Built-in model training for common algorithms (XGBoost, KNN, Random Forest)
  • Simple evaluation and saving of models
  • One-line full processing option for quick execution

Installation

pip install auto-ml-processor

Quick Start

from auto_ml_processor import AutoMLProcessor

# Initialize processor
processor = AutoMLProcessor()

# Process data and train model in one line
metrics = processor.full_process(
    file_path='your_data.csv',
    target_col='target_column',
    fill_na_threshold=0.6,  # Remove columns with ≥60% missing values
    model_name='xgboost'
)

print(f"Model performance: {metrics}")

Loading Data from Different Sources

# From a URL
processor.load_data(
    'https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data',
    source_type='url'
)

# From Hugging Face datasets
processor.load_data(
    'mnist',
    source_type='huggingface',
    split='train'  # Load the training split
)

# From Kaggle
processor.load_data(
    'uciml/iris',
    source_type='kaggle',
    download_path='./kaggle_data'
)

# From OpenML
processor.load_data(
    'iris',  # Dataset name or ID
    source_type='openml'
)

Step-by-Step Usage

# Initialize
processor = AutoMLProcessor(verbose=True)

# Load data
df = processor.load_data('dataset.csv')

# Handle missing values
processor.handle_missing_values(fill_na_threshold=0.6)

# Prepare data
processor.prepare_data(target_col='target', test_size=0.2)

# Train model
processor.train_model(model_name='knn')

# Evaluate
metrics = processor.evaluate_model()

# Save model
processor.save_model('output_directory')

Making Predictions

# Load saved model
loaded_processor = AutoMLProcessor.load_model('output_directory')

# Make predictions on new data
import pandas as pd
new_data = pd.read_csv('new_data.csv')
predictions = loaded_processor.predict(new_data)

Second Stage

Handling Categorical Targets

The package automatically detects and encodes categorical target variables:

# Process Iris dataset with categorical target (species)
processor = AutoMLProcessor()
metrics = processor.full_process(
    file_path='https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data',
    source_type='url',
    target_col=4,  # The Iris species column (last column)
    model_name='random_forest'
)

# Predictions are automatically converted back to original labels
new_data = pd.DataFrame({
    0: [5.1, 3.5, 1.4, 0.2],  # Features for a new sample
    1: [4.9, 3.0, 1.4, 0.2],
    2: [7.0, 3.2, 4.7, 1.4]
})
predictions = processor.predict(new_data)
print(f"Predicted species: {predictions}")  # Shows "Iris-setosa", etc.
```# Auto ML Processor

A Python package for automated machine learning preprocessing and model training. This package streamlines common data preprocessing tasks and model training for classification and regression problems.

## Key Features

- **Automated data loading** from multiple sources
- **Intelligent missing value handling** with configurable thresholds
- **Automatic feature type detection** (categorical vs. numerical)
- **Automatic target variable encoding** for categorical targets
- **Standardized preprocessing pipeline** for feature engineering
- **Built-in model training** for common algorithms (XGBoost, KNN, Random Forest)
- **Simple evaluation and saving** of models
- **One-line full processing** option for quick execution

## Installation

```bash
pip install auto-ml-processor

Quick Start

from auto_ml_processor import AutoMLProcessor

# Initialize processor
processor = AutoMLProcessor()

# Process data and train model in one line
metrics = processor.full_process(
    file_path='your_data.csv',
    target_col='target_column',
    fill_na_threshold=0.6,  # Remove columns with ≥60% missing values
    model_name='xgboost'
)

print(f"Model performance: {metrics}")

Loading Data from Different Sources

# From a URL
processor.load_data(
    'https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data',
    source_type='url'
)

# From Hugging Face datasets
processor.load_data(
    'mnist',
    source_type='huggingface',
    split='train'  # Load the training split
)

# From Kaggle
processor.load_data(
    'uciml/iris',
    source_type='kaggle',
    download_path='./kaggle_data'
)

# From OpenML
processor.load_data(
    'iris',  # Dataset name or ID
    source_type='openml'
)

Step-by-Step Usage

# Initialize
processor = AutoMLProcessor(verbose=True)

# Load data
df = processor.load_data('dataset.csv')

# Handle missing values
processor.handle_missing_values(fill_na_threshold=0.6)

# Prepare data
processor.prepare_data(target_col='target', test_size=0.2)

# Train model
processor.train_model(model_name='knn')

# Evaluate
metrics = processor.evaluate_model()

# Save model
processor.save_model('output_directory')

Making Predictions

# Load saved model
loaded_processor = AutoMLProcessor.load_model('output_directory')

# Make predictions on new data
import pandas as pd
new_data = pd.read_csv('new_data.csv')
predictions = loaded_processor.predict(new_data)

License

MIT License

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

auto_ml_processor-0.1.2.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

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

auto_ml_processor-0.1.2-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file auto_ml_processor-0.1.2.tar.gz.

File metadata

  • Download URL: auto_ml_processor-0.1.2.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for auto_ml_processor-0.1.2.tar.gz
Algorithm Hash digest
SHA256 97bac702bbf0d118ac5f07f609831fff9cb68db69fceded004451d3f898ad827
MD5 cec51ed21743157308a1e3bd606cdcc7
BLAKE2b-256 824e926b3c45b4fd431828c9b07619eed16653df326ed360aa24aebfcac49ede

See more details on using hashes here.

File details

Details for the file auto_ml_processor-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for auto_ml_processor-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b685185d875041f19e28bbcda81b19aee0281ba32c459f73539bb25556381edd
MD5 950d1f7ad7fe0c30f4d0f4dc2052dd71
BLAKE2b-256 42faa013664d8e384072c3098c9430ba454c83c28cd680b896ac03d36baaf38e

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