Connection / Add 다르게 해서 모델 설계하기 약간 multi-task learning이랑 비슷해보여서 헷갈렸는데, Iris 데이터를 보면 sepal length / sepal width / petal length / petal width가 있다. length는 length 끼리 묶고, width는 width끼리 묶어서 모델에게 넣어주고 마지막에 모델을 붙여보자. 데이터 불러오기 import numpy as np import pandas as pd import tensorflow as tf from tensorflow import keras from sklearn.datasets import load_iris iris = load_iris() x = iris.data y = iris.targe..
CIFAR 이번엔 CIFAR - 10 데이터 써보자 flatten() 평탄화 - 말 그대로 쫙 펴주는거다. 어제 reshape로 했던 것을 그냥 코드 내부에서 flatten()으로 자동으로 처리해줄 수 있다. model.add(keras.layers.Flatten()) 그냥 얘만 추가해주면 나머지는 똑같다. 데이터 불러오기 import numpy as np import pandas as pd import matplotlib.pyplot as plt import random as rd from sklearn.metrics import accuracy_score import tensorflow as tf from tensorflow import keras 라이브러리 불러오고, (train_x, train_y..
은닉층 추가 어제 만들었던 모델에 은닉층을 추가해보자. = Hidden Layer 라이브러리를 먼저 불러와준다. from sklearn.datasets import fetch_california_housing california = fetch_california_housing() x = california.data y = california.target x.shape, y.shape# (20640,8) (20640,) import tensorflow as tf import pandas as pd import numpy as np from tensorflow import keras 어제 배운대로 모델 구조를 하나씩 쌓아가자. keras.backend.clear_session() model = keras.m..