# -*- coding: utf-8 -*-
"""3-5_생각해보기_코드.ipynb

Automatically generated by Colaboratory.

Original file is located at
    https://colab.research.google.com/drive/1_gE4GugUogZIHdj473aqO3u48KI58x-E

# Scikit-learn을 활용한 모델 구현

## 데이터 불러오기
"""

#훈련 데이터 준비하기
import pandas as pd 
df_train = pd.read_csv('fashion-mnist_train.csv')
df_test = pd.read_csv('fashion-mnist_test.csv')

#학습(train) 데이터를 입력변수와 출력변수로 나누기
import numpy as np

data_train = np.array(df_train)

X_train= data_train[0:1000,1:785] 
X_train = X_train/255.
y_train = data_train[0:1000,0] 

#테스트(test) 데이터를 입력변수와 출력변수로 나누기
import numpy as np

data_test = np.array(df_test)

X_test= data_test[0:1000,1:785] 
X_test = X_test/255.
y_test = data_test[0:1000,0]

"""# 학습하기"""

#모델생성 및 피팅
from sklearn.neural_network import MLPClassifier

clf= MLPClassifier(hidden_layer_sizes = (300,300,300), max_iter = 100,alpha=1e-4,
                     solver = "sgd", learning_rate_init = 0.01, verbose = True,
                    random_state=1)
clf.fit(X_train,y_train)

"""# 성능 테스트하기"""

print("Training set score: (0)".format(clf.score(X_train, y_train)))
print("Test set score: {0}" .format(clf.score(X_test, y_test)))