Downloads · 30 days
0
adityasuyal/auto-mpg-random-forest
auto-mpg-random-forest is a tabular regression model from adityasuyal. Use it for the tabular regression task on the model card, and read the license before you ship it in a product. It is set up for sklearn. The card lists the license as mit.
This model is trained on the Auto MPG dataset. It predicts fuel efficiency (mpg) from car features such as cylinders, horsepower, weight, and more.
Downloads · 30 days
0
Access
Public
Updated Sep 20, 2026
Repo size
19.8 MB
Likes
1
Public
Click a slice to open those files.
.pkl19.5 MB · 98%
From the Hugging Face model README
This model is trained on the Auto MPG dataset.
It predicts fuel efficiency (mpg) from car features such as cylinders, horsepower, weight, and more.
Best Test R² : 0.9178 — Tuned using RandomizedSearchCV with 5-Fold Cross-Validation.
| Property | Value |
|---|---|
| Algorithm | Random Forest Regressor |
| Library | scikit-learn |
| Tuning Method | RandomizedSearchCV (50 iterations) |
| Cross-Validation | 5-Fold KFold |
| Target Variable | Miles Per Gallon (mpg) |
| Train / Test Split | 80% / 20% |
| Random State | 42 |
| Metric | Untuned RF | Tuned RF | Improvement |
|---|---|---|---|
| R² | 0.8923 | 0.9178 | ▲ +0.0255 |
| RMSE | 2.3443 | 2.0521 | ▼ −0.2922 |
| MAE | 1.6481 | 1.4237 | ▼ −0.2244 |
| Metric | Mean | Std |
|---|---|---|
| CV R² | 0.9041 | ±0.0198 |
| CV RMSE | 2.1834 | — |
| Model | Test R² | Test RMSE | Test MAE |
|---|---|---|---|
| Tuned Random Forest | 0.9178 | 2.0521 | 1.4237 |
| Random Forest (Untuned) | 0.8923 | 2.3443 | 1.6481 |
| Gradient Boosting | 0.8743 | 2.5324 | 1.7661 |
| Polynomial Regression | 0.8473 | 2.7917 | 2.0755 |
| Ridge Regression | 0.7903 | 3.2715 | 2.4190 |
| Linear Regression | 0.7902 | 3.2727 | 2.4198 |
| Lasso Regression | 0.7901 | 3.2730 | 2.4193 |
| Parameter | Value |
|---|---|
n_estimators | 300 |
max_depth | None |
min_samples_split | 2 |
min_samples_leaf | 1 |
max_features | sqrt |
| Feature | Description |
|---|---|
cylinders | Number of engine cylinders |
displacement | Engine displacement (cubic inches) |
horsepower | Engine horsepower |
weight | Vehicle weight (lbs) |
acceleration | 0–60 mph acceleration time (seconds) |
model year | Year of manufacture (70–82) |
origin | Region of manufacture (1=USA, 2=Europe, 3=Japan) |
import joblib
import numpy as np
from huggingface_hub import hf_hub_download
# Download the model
model_path = hf_hub_download(
repo_id="rohansuyal/auto-mpg-random-forest",
filename="tuned_random_forest.pkl"
)
# Load the model
model = joblib.load(model_path)
# Make a prediction
# [cylinders, displacement, horsepower, weight, acceleration, model_year, origin]
sample = np.array([[4, 120.0, 79.0, 2625, 18.6, 82, 1]])
predicted_mpg = model.predict(sample)
print(f"Predicted MPG: {predicted_mpg[0]:.2f}")
# Output: Predicted MPG: 32.47
| File | Description |
|---|---|
tuned_random_forest.pkl | Trained & tuned model (joblib format) |
tune.py | Full hyperparameter tuning script |
random_forest_tuning_results.csv | All 50 tuning trial results |
cleaned_data.csv | Preprocessed Auto MPG dataset (392 rows) |
pip install scikit-learn joblib huggingface_hub numpy
@misc{auto-mpg-rf-2024,
author = {rohansuyal},
title = {Auto MPG — Tuned Random Forest Regressor},
year = {2024},
url = {https://huggingface.co/rohansuyal/auto-mpg-random-forest}
}