Last active
June 29, 2020 11:13
-
-
Save bharatc9530/7a0581df5a493d44b75a9c636ddbf24b to your computer and use it in GitHub Desktop.
model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
import pickle | |
df = pd.read_csv('iris.data') | |
X = np.array(df.iloc[:, 0:4]) | |
y = np.array(df.iloc[:, 4:]) | |
from sklearn.preprocessing import LabelEncoder | |
le = LabelEncoder() | |
y = le.fit_transform(y) | |
from sklearn.model_selection import train_test_split | |
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2) | |
from sklearn.svm import SVC | |
sv = SVC(kernel='linear').fit(X_train,y_train) | |
pickle.dump(sv, open('iri.pkl', 'wb')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment