adityasuyal/auto-mpg-random-forest
1
Auto MPG — Tuned Random Forest Regressor
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.
Model Details
Performance Metrics
Tuned Model — Test Set Results
Cross-Validation (Training Set)
All Models Comparison
Best Hyperparameters (Found via RandomizedSearchCV)
Features Used
How to Use
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.47Files
Dataset
- Source: UCI Auto MPG Dataset
- Samples: 392 (after cleaning — removed missing horsepower values)
- Train samples: 313
- Test samples: 79
Installation
pip install scikit-learn joblib huggingface_hub numpyCitation
@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}
}