File size: 563 Bytes
39301b7
 
df12c75
 
 
 
 
39301b7
df12c75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: mit
datasets:
- scikit-learn/iris
metrics:
- precision 0.9792
- recall 0.9778
---

# Usage

```python
import torch
import datasets

dataset = load_dataset("scikit-learn/iris")["train"].class_encode_column("Species").train_test_split(
        test_size=0.3,
        seed=42,
        stratify_by_column="Species"
)
features = ["SepalLengthCm","SepalWidthCm","PetalLengthCm","PetalWidthCm"]
batch = dataset["test"].with_format("torch")[:]
x = torch.stack([batch[col] for col in features],dim=1)
model = torch.jit.load("iris_knn.pt")
preds = model(x)
```