π Electric Vehicle Type Classifier
Model Description
This is a PyTorch-based neural network designed to classify electric vehicles as either:
- Battery Electric Vehicle (BEV)
- Plug-in Hybrid Electric Vehicle (PHEV)
The model uses structured tabular data such as make, model, year, range, and price to predict the EV type. It is lightweight and optimized for fast inference on small-scale datasets.
π§ Model Architecture
- Input Layer: 9 features (e.g., make, model, year, range, price, etc.)
- Hidden Layers: [128, 64, 32] neurons with ReLU activations
- Output Layer: 2 neurons (BEV vs PHEV), softmax activation
- Loss Function: CrossEntropyLoss
- Optimizer: Adam
- Accuracy: ~87% on test set (replace with actual)
π¦ Usage
import torch
from model import TabularModel # Ensure this matches your module structure
# Load model checkpoint
checkpoint = torch.load('ev_classifier_model.pth')
model = TabularModel(input_size=9, hidden_sizes=[128, 64, 32], output_size=2)
model.load_state_dict(checkpoint['model_state_dict'])
model.eval()
# Example inference
sample = torch.tensor([[0.5, 0.3, 2022, 250, 35000, 1, 0, 0.8, 0.6]]) # Replace with actual feature values
output = model(sample)
predicted_class = torch.argmax(output, dim=1)
print("Predicted class:", predicted_class.item()) # 0 = BEV, 1 = PHEV
- Downloads last month
- 8
Evaluation results
- Accuracyself-reported0.999