File size: 1,756 Bytes
7f1b875
 
97cf1ac
 
 
 
 
 
 
 
 
 
 
 
 
 
4c3c59f
97cf1ac
 
 
7f1b875
 
 
97cf1ac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7f1b875
 
 
97cf1ac
7f1b875
97cf1ac
7f1b875
 
 
97cf1ac
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
---
license: mit
tags:
  - tabular-classification
  - pytorch
  - electric-vehicles
  - binary-classification
model-index:
  - name: Electric Vehicle Type Classifier
    results:
      - task:
          type: tabular-classification
          name: Tabular Classification
        metrics:
          - name: Accuracy
            type: accuracy
            value: 0.9989
---

# 🚗 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

```python
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