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.py
    • HalfDataModel.py
    • RegressionModel.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

  1. Create and activate a virtual environment (recommended):
python3 -m venv .venv
source .venv/bin/activate
  1. Install dependencies:
pip install -r requirements.txt
  1. 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 predictor may be a scikit-learn Pipeline, a single model object, or a custom class β€” call .predict or .predict_proba depending 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:

  1. Inspect and prepare data in data/ (join race, qualifying, driver stats, etc.).
  2. Implement preprocessing (imputation, scaling, feature engineering) consistent with the serialized artifacts.
  3. Train a model and persist artifacts using joblib.dump.

If you add a training script, consider producing the following artifacts and committing them:

  • *.pkl for the trained model/pipeline
  • a small notebooks/ or scripts/ folder with reproducible steps (data cleaning, feature engineering, training)

Files of interest

  • hamilton_ferrari_predictor.pkl β€” inference artifact. Load with joblib.load.
  • model/ClassificationModel.py β€” classification training/definition code.
  • model/RegressionModel.py β€” regression training/definition code.

Tips and troubleshooting

  • If joblib.load fails with a ModuleNotFoundError, ensure you are running inside the python environment that has the same package structure and that the model package 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 Pipeline with a ColumnTransformer), try:
import joblib
pipe = joblib.load('hamilton_ferrari_predictor.pkl')
print(pipe)

License

This project currently has is under the Apache 2.0 License.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support