iris-svm
sklearnv1.0.0A beginner-friendly multi-class classification model using Support Vector Machine with RBF kernel on the classic Iris dataset. Uses scikit-learn Pipeline with StandardScaler preprocessing and cross-validation for evaluation. Reports per-class precision, recall, and F1 scores.
Classificationtabularmulti-classsvmbeginner
Install
1openmodelstudio install iris-svm
SDK Usage
1import openmodelstudio as oms23model = oms.use_model("iris-svm")4handle = oms.register_model("my-iris-svm", model=model)5job = oms.start_training(handle.model_id, wait=True)
Source Preview(76 lines)
View full source1"""Iris flower classification with SVM."""23import numpy as np4from sklearn.svm import SVC5from sklearn.model_selection import cross_val_score6from sklearn.preprocessing import StandardScaler7from sklearn.pipeline import Pipeline89def train(ctx):10 hp = ctx.hyperparameters11 C = float(hp.get("C", 1.0))12 kernel = hp.get("kernel", "rbf")1314 model = Pipeline([15 ("scaler", StandardScaler()),16 ("svc", SVC(C=C, kernel=kernel, probability=True)),17 ])1819 from sklearn.datasets import load_iris20 data = load_iris()21 X, y = data.data, data.target22 # ... cross-validation, metrics logging
Details
- Author
- openmodelstudio
- License
- MIT
- Source
- 76 lines
- Version
- 1.0.0
Dependencies
scikit-learn>=1.3numpy>=1.24Hyperparameters
C1.0Regularization parameter
kernelrbfKernel type (rbf, linear, poly)
gammascaleKernel coefficient
View on GitHub