Instructions to use amarakoon2001/ev-purchase-prediction with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Scikit-learn
How to use amarakoon2001/ev-purchase-prediction with Scikit-learn:
from huggingface_hub import hf_hub_download import joblib model = joblib.load( hf_hub_download("amarakoon2001/ev-purchase-prediction", "sklearn_model.joblib") ) # only load pickle files from sources you trust # read more about it here https://skops.readthedocs.io/en/stable/persistence.html - Notebooks
- Google Colab
- Kaggle
Electric Vehicle Purchase Prediction
A scikit-learn Logistic Regression pipeline that estimates the probability of a customer purchasing an electric vehicle.
Created by Anjula Prasad for the Kaggle Playground Series S6E9 competition.
Training notebook and source code
Model details
- Task: Binary classification
- Target:
Will_Buy_EV - Classes:
No,Yes - Input features: 13 customer attributes
- Numeric preprocessing: StandardScaler
- Categorical preprocessing: OneHotEncoder
- Classifier: Logistic Regression
- Evaluation metric: ROC-AUC
The uploaded bundle contains the fitted preprocessing and classifier, input column names, positive-class label, training scikit-learn version, and validation ROC-AUC.
Input features
| Numerical | Categorical |
|---|---|
| Age | Gender |
| Annual_Income_USD | City_Type |
| Daily_Commute_km | Current_Car_Type |
| Number_of_Cars_Owned | Home_Charging_Possible |
| Charging_Stations_Near_Home | Subsidy_Available |
| Charging_Stations_Near_Work | Range_Anxiety_Level |
| Environmental_Concern_Level |
The id column is excluded from training.
Evaluation
| Evaluation | ROC-AUC |
|---|---|
| Local validation โ notebook output | 0.93796 |
| Kaggle public leaderboard โ author reported | 0.93737 |
The dataset contains 668,665 training rows. A stratified 80/20 split
with random_state=42 produces:
- Training: 534,932 customers
- Validation: 133,733 customers
Preprocessing was fitted only on the training partition. The saved baseline was trained on that partition.
The leaderboard score is reported in the source repository and has not been independently verified here.
Usage
Use the training environment's dependency versions from the
source repository.
Install huggingface_hub if needed:
pip install huggingface_hub
Prepare a customers.csv file containing the 13 input columns above.
Use the same categorical labels and numeric units as the competition data.
import joblib
import pandas as pd
from huggingface_hub import hf_hub_download
path = hf_hub_download(
repo_id="amarakoon2001/ev-purchase-prediction",
filename="ev_purchase_pipeline_bundle.joblib",
)
bundle = joblib.load(path)
pipeline = bundle["pipeline"]
customers = pd.read_csv("customers.csv")
X = customers[bundle["input_columns"]]
positive_index = list(pipeline.classes_).index(
bundle["positive_class"]
)
probabilities = pipeline.predict_proba(X)[:, positive_index]
results = customers.copy()
results["EV_purchase_probability"] = probabilities
print(results)
The output is the estimated probability of class Yes.
No custom classification threshold was selected for this release.
Only load Joblib files from trusted sources. Use dependency versions compatible with the training environment; the bundle records the training scikit-learn version.
Intended use and limitations
This is a competition baseline and educational portfolio project.
Performance on competition data does not establish performance for real customers, other regions, or future market conditions. ROC-AUC measures ranking performance and does not establish probability calibration.
The model has not been validated for production marketing or customer decisions. It predicts associations and does not establish causal effects.
Author
Anjula Prasad
University of Moratuwa โ Information Technology
- Downloads last month
- -