Skip to main content

Guided baseline ML workflows (regression / classification / clustering) for engineers

Project description

EnginML

EnginML Logo

A Python package that provides guided baseline machine learning workflows (regression, classification, clustering) for engineers unfamiliar with programming. This package reproduces the tutorial in AI in Civil Engineering (2025) by M. Z. Naser.

Overview

This package is designed to make machine learning accessible to engineers with minimal programming experience. It provides:

  • Simple, one-line functions for common ML tasks
  • Automatic data loading from CSV and Excel files
  • Built-in model training and evaluation
  • Visualization of results and model explanations
  • HTML report generation
  • Command-line interface for easy use

Installation

# Basic installation
pip install EnginML

# With all optional dependencies
pip install EnginML[full]

Quick Start

Command Line Usage

The simplest way to use EnginML is through the command line:

# For regression
enginml your_data.csv --task regression --target your_target_column

# For classification
enginml your_data.csv --task classification --target your_target_column

# For clustering
enginml your_data.csv --task clustering --n-clusters 3

This will automatically:

  1. Load your data
  2. Train an appropriate model
  3. Evaluate the model
  4. Generate an HTML report with visualizations

Python API Usage

import pandas as pd
from EnginML import fit_regression, save_report

# Load your data
df = pd.read_csv('your_data.csv')

# Prepare features and target
X = df.drop(columns=['target_column']).values
y = df['target_column'].values

# Fit a regression model
result = fit_regression(X, y, model='random_forest')

# Print metrics
print(result['metrics'])

# Save HTML report
save_report(result, X, y, feature_names=df.columns[:-1])

Features

Supported Tasks

  • Regression: Predict continuous values

    • Models: Random Forest, K-Nearest Neighbors
    • Metrics: R², MAE
  • Classification: Predict categorical values

    • Models: Random Forest, K-Nearest Neighbors
    • Metrics: Accuracy, F1 Score
  • Clustering: Group similar data points

    • Models: K-Means, BIRCH, Gaussian Mixture
    • Metrics: Silhouette Score, Davies-Bouldin Index

Explainability

The package includes SHAP (SHapley Additive exPlanations) integration for model interpretability, helping engineers understand which features are most important for predictions.

Visualization

Automatic generation of relevant plots for each task type:

  • Regression: Actual vs. Predicted, Residuals, Feature Importance
  • Classification: Feature Importance, SHAP Summary
  • Clustering: Cluster Assignments

Advanced Usage

Customizing Models

from EnginML import fit_classification

# Use K-Nearest Neighbors instead of Random Forest
result = fit_classification(X, y, model='knn')

Disabling SHAP Explanations

result = fit_regression(X, y, explain=False)

Custom Report Path

save_report(result, X, y, output_path='custom_path/my_report.html')

Requirements

  • Python 3.9+
  • NumPy
  • pandas
  • scikit-learn
  • matplotlib

Optional Dependencies

  • SHAP (for model explanations)
  • Jinja2 (for HTML reports)
  • XGBoost (for additional models)

License

MIT

Citation

This package is created by Amir Rafe (amir.rafe@usu.edu) based on the paper:

Naser, M. Z. (2025). A step-by-step tutorial on machine learning for engineers unfamiliar with programming. AI in Civil Engineering. https://doi.org/10.1007/s43503-025-00053-x

If you use this package in your research, please cite the original paper.

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

enginml-0.1.1.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

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

enginml-0.1.1-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file enginml-0.1.1.tar.gz.

File metadata

  • Download URL: enginml-0.1.1.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for enginml-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6f166b300ca747d8706e6c1e298eefa3f421104e9a3cecd031e08ea5e2799f16
MD5 80a0ecf2deb8c0efc375e08c6e9bbc49
BLAKE2b-256 08a6e941d25f45dc80098ff67b2873588212532dc037b21fc2f1e83147cf0ace

See more details on using hashes here.

File details

Details for the file enginml-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: enginml-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for enginml-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1e19213ecace566840a7fbd86f18e5520d76e3d9d521c710f0d654318131b887
MD5 d4e4e891f241b100771baa661a7ef9ed
BLAKE2b-256 66e12a4d6636c1a5e72f4442058df560fbb6412259b9dbbc111ac0e7b04aaa02

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