YAML Metadata
Warning:
empty or missing yaml metadata in repo card
(https://huggingface.co/docs/hub/model-cards#model-card-metadata)
F1MLModel
Predictive models for Lewis Hamilton / Ferrari performance in the 2025 F1 season.
This repository contains a small machine-learning project used to train and persist models that predict race-related outcomes (classification and regression) and a ready-to-use serialized predictor for making predictions.
Contents
hamilton_ferrari_predictor.pklβ A serialized (pickled) model or pipeline ready for inference.imputer.pklβ Serialized imputer used during preprocessing.scaler.pklβ Serialized scaler used during preprocessing.hamilton_ferrari_2025_predictions.csvβ Example / output predictions produced by the model.model/β Source code for model classes and training/experiment code.ClassificationModel.pyHalfDataModel.pyRegressionModel.py
data/β Raw and preprocessed CSV datasets used for training and analysis (races, drivers, lap times, etc.).requirements.txtβ Python dependencies for running and developing with this project.
Project goals
- Provide a compact pipeline to predict aspects of race performance using historical F1 data.
- Ship a ready-to-run predictor for quick inference on new examples.
Quick start
- Create and activate a virtual environment (recommended):
python3 -m venv .venv
source .venv/bin/activate
- Install dependencies:
pip install -r requirements.txt
- Run an interactive Python session or script to load the predictor and call
.predict.
Example usage (replace X with your feature matrix / DataFrame formatted for the model):
import joblib
import pandas as pd
# Load artifacts
predictor = joblib.load('hamilton_ferrari_predictor.pkl')
scaler = joblib.load('scaler.pkl')
imputer = joblib.load('imputer.pkl')
# Prepare input. The model expects the same features used during training.
# Here we load a CSV from the `data/` folder as an example β adapt to your features.
df = pd.read_csv('data/lewishamilton.csv')
# Example preprocessing pipeline (adapt to the project's feature set):
# - fill missing values with the imputer
# - scale numeric features with the scaler
# The exact columns used by the pipeline depend on how the model was trained. See `model/` for details.
# This is a placeholder; replace with the real column list used by the model
# features = df[ ['col1', 'col2', 'col3'] ]
# features = imputer.transform(features)
# features = scaler.transform(features)
# Make predictions
# preds = predictor.predict(features)
# Save predictions
# pd.DataFrame({'prediction': preds}).to_csv('my_predictions.csv', index=False)
print('Loaded predictor; adapt input features and uncomment prediction lines to run inference.')
Notes:
- The pickled
predictormay be a scikit-learnPipeline, a single model object, or a custom class β call.predictor.predict_probadepending on the object's API. - Inspect the files in
model/to determine the expected input feature names and preprocessing steps.
Reproducing / Training
The model/ directory contains the model code. Use those files as a starting point to retrain or modify models. Typical steps:
- Inspect and prepare data in
data/(join race, qualifying, driver stats, etc.). - Implement preprocessing (imputation, scaling, feature engineering) consistent with the serialized artifacts.
- Train a model and persist artifacts using
joblib.dump.
If you add a training script, consider producing the following artifacts and committing them:
*.pklfor the trained model/pipeline- a small
notebooks/orscripts/folder with reproducible steps (data cleaning, feature engineering, training)
Files of interest
hamilton_ferrari_predictor.pklβ inference artifact. Load withjoblib.load.model/ClassificationModel.pyβ classification training/definition code.model/RegressionModel.pyβ regression training/definition code.
Tips and troubleshooting
- If
joblib.loadfails with aModuleNotFoundError, ensure you are running inside the python environment that has the same package structure and that themodelpackage path is available (run from the repository root). - If predictions don't match expectations, re-check feature ordering and preprocessing steps (scaler and imputer must be applied in the same way as during training).
- To inspect the trained pipeline's feature names (if it is a scikit-learn
Pipelinewith aColumnTransformer), try:
import joblib
pipe = joblib.load('hamilton_ferrari_predictor.pkl')
print(pipe)
License
This project currently has is under the Apache 2.0 License.
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
π
Ask for provider support