Update README.md
Browse files
README.md
CHANGED
|
@@ -1,22 +1,60 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
## Model Description
|
| 6 |
-
A PyTorch neural network that classifies electric vehicles as Battery Electric Vehicle (BEV) or Plug-in Hybrid Electric Vehicle (PHEV) based on vehicle characteristics.
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
-
|
| 11 |
-
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
## Usage
|
| 15 |
```python
|
| 16 |
import torch
|
| 17 |
-
from model import TabularModel
|
| 18 |
|
| 19 |
-
# Load model
|
| 20 |
checkpoint = torch.load('ev_classifier_model.pth')
|
| 21 |
model = TabularModel(input_size=9, hidden_sizes=[128, 64, 32], output_size=2)
|
| 22 |
model.load_state_dict(checkpoint['model_state_dict'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- tabular-classification
|
| 5 |
+
- pytorch
|
| 6 |
+
- electric-vehicles
|
| 7 |
+
- binary-classification
|
| 8 |
+
model-index:
|
| 9 |
+
- name: Electric Vehicle Type Classifier
|
| 10 |
+
results:
|
| 11 |
+
- task:
|
| 12 |
+
type: tabular-classification
|
| 13 |
+
name: Tabular Classification
|
| 14 |
+
metrics:
|
| 15 |
+
- name: Accuracy
|
| 16 |
+
type: accuracy
|
| 17 |
+
value: 0.87 # Replace with actual test accuracy
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
# 🚗 Electric Vehicle Type Classifier
|
| 21 |
|
| 22 |
## Model Description
|
|
|
|
| 23 |
|
| 24 |
+
This is a PyTorch-based neural network designed to classify electric vehicles as either:
|
| 25 |
+
|
| 26 |
+
- **Battery Electric Vehicle (BEV)**
|
| 27 |
+
- **Plug-in Hybrid Electric Vehicle (PHEV)**
|
| 28 |
+
|
| 29 |
+
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.
|
| 30 |
+
|
| 31 |
+
---
|
| 32 |
+
|
| 33 |
+
## 🧠 Model Architecture
|
| 34 |
+
|
| 35 |
+
- **Input Layer**: 9 features (e.g., make, model, year, range, price, etc.)
|
| 36 |
+
- **Hidden Layers**: [128, 64, 32] neurons with ReLU activations
|
| 37 |
+
- **Output Layer**: 2 neurons (BEV vs PHEV), softmax activation
|
| 38 |
+
- **Loss Function**: CrossEntropyLoss
|
| 39 |
+
- **Optimizer**: Adam
|
| 40 |
+
- **Accuracy**: ~87% on test set (replace with actual)
|
| 41 |
+
|
| 42 |
+
---
|
| 43 |
+
|
| 44 |
+
## 📦 Usage
|
| 45 |
|
|
|
|
| 46 |
```python
|
| 47 |
import torch
|
| 48 |
+
from model import TabularModel # Ensure this matches your module structure
|
| 49 |
|
| 50 |
+
# Load model checkpoint
|
| 51 |
checkpoint = torch.load('ev_classifier_model.pth')
|
| 52 |
model = TabularModel(input_size=9, hidden_sizes=[128, 64, 32], output_size=2)
|
| 53 |
model.load_state_dict(checkpoint['model_state_dict'])
|
| 54 |
+
model.eval()
|
| 55 |
+
|
| 56 |
+
# Example inference
|
| 57 |
+
sample = torch.tensor([[0.5, 0.3, 2022, 250, 35000, 1, 0, 0.8, 0.6]]) # Replace with actual feature values
|
| 58 |
+
output = model(sample)
|
| 59 |
+
predicted_class = torch.argmax(output, dim=1)
|
| 60 |
+
print("Predicted class:", predicted_class.item()) # 0 = BEV, 1 = PHEV
|