import numpy as np
from sklearn.datasets import load_iris
from sklearn.preprocessing import MinMaxScaler, StandardScaler
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score
from sklearn.pipeline import make_pipeline
from sklearn.svm import SVC
#1. 데이터
x, y = load_iris(return_X_y=True)
x_train, x_test, y_train, y_test = train_test_split(
x,y, train_size=0.8, shuffle=True, random_state=337
)
# scaler = MinMaxScaler()
# x_train = scaler.fit_transform(x_train)
# x_test = scaler.transform(x_test)
#2. 모델
# model = RandomForestClassifier()
# model = make_pipeline(MinMaxScaler(), RandomForestClassifier())#앞부분에 내가 사용할 스케일링, 이후에 모델 기재하면 됨
# model = make_pipeline(StandardScaler(), RandomForestClassifier())
model = make_pipeline(StandardScaler(), SVC())
#3. 훈련
model.fit(x_train, y_train)
#4. 평가, 예측
result = model.score(x_test, y_test)
print('model.score :', result)
y_predict = model.predict(x_test)
print('ACC :', accuracy_score(y_test, y_predict))
m17_make_pipeline2_01_classifier
m17_make_pipeline2_02_regressor