Downloads · 30 days
0
Jinwee0125/iris_knn
iris_knn is a machine learning model from Jinwee0125. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
Downloads · 30 days
0
Access
Public
Updated Jun 3, 2026
Repo size
11 KB
Likes
0
Public
Click a slice to open those files.
.pt5.5 KB · 73%
From the Hugging Face model README
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)