gilbutitbook / 080228 Goto Github PK
View Code? Open in Web Editor NEW모두의딥러닝(개정2판)
모두의딥러닝(개정2판)
4장 '오차 수정하기: 경사 하강법' 실습 코드에 오류가 있습니다.
책에 나오는 코드는 이상이 없으나, github에 제공되는 코드에는 이상이 있습니다.
경사 하강법을 계산하는 반복문 로직에서 학습률을 곱해 기존의 a, b 값을 업데이트하는데 사용된 변수명이 올바르지 않습니다. 또한 y_pred로 작성되어야 하는 변수명이 y_hat으로 작성되어 있습니다.
관련해서 pull request 작성하였습니다.
pip install tensorflow로 설치하면 오류가 발생합니다.
대신 pip install tensorflow==2.0.0으로 설치해야 오류없이 작동됩니다.
케라스(Keras)의 버전이 올라가면서 예제 코드가 정상적으로 동작하지 않습니다.
케라스의 "fit()" 함수가 반환하는 "history" 정보에서 정확도 값을 가져오기 위해 "history.history['acc']"가 아닌 "history.history['accuracy']"를 사용해야 합니다.
다음과 같이 바뀌어야 하네요. (p.312)
acc= history.history['acc']
val_acc= history.history['val_acc']
만약 jupyter에서 기울기와 절편이 0으로 찍힐때
len(x_data)에서 float(len(x_data) 로 바꾸면 실행 됩니다.
예제 코드 : deeplearning/run_project/02_Pima_Indian.ipynb // deeplearning/run_project/py/02_Pima_Indian.py
주피터 노트북 파일 기준으로 In [6] 부분이 책과 주석에서는 데이터 중 임신 정보와 클래스 만을 출력해 봅니다.
라고 하는데 실제 코드는 포도당 부하 검사 2시간 후 공복 혈당 농도와 클래스를 출력하도록 작성되어 있습니다.
run_project/07_Sonar-K-fold.ipynb
코드에서
ValueError Traceback (most recent call last)
in
39 optimizer='adam',
40 metrics=['accuracy'])
---> 41 model.fit((X[train], Y[train]), epochs=100, batch_size=5)
42 k_accuracy = "%.4f" % (model.evaluate(X[test], Y[test])[1])
43 accuracy.append(k_accuracy)
이런 오류 발생 됩니다.
==> 입력가중치와 출력가중치를 모두 훈련하려면 어떻게 해야 하나요?
issues test~~
책에 있는 코드 그대로 입력한 것 같은데
예상 가격이 6.342로 똑같이 나옵니다.
제가 오타가 있는 건지 한번 확인 부탁드립니다.
from keras.models import Sequential
from keras.layers import Dense
from sklearn.model_selection import train_test_split
import numpy
import pandas as pd
import tensorflow as tf
seed = 0
numpy.random.seed(seed)
tf.random.set_seed(3)
df = pd.read_csv('housing.csv', delim_whitespace=True, header=None)
dataset = df.values
X = dataset[:,0:13]
Y = dataset[:,13]
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.3, random_state=seed)
model = Sequential()
model.add(Dense(30, input_dim=13, activation='relu'))
model.add(Dense(6, activation='relu'))
model.add(Dense(1))
model.compile(loss='mean_squared_error',
optimizer='adam')
model.fit(X_train, Y_train, epochs=200, batch_size=10)
Y_prediction = model.predict(X_test).flatten()
for i in range(10):
label = Y_test[i]
prediction = Y_prediction[i]
print("실제가격: {:.3f}, 예상가격: {:.3f}".format(label, prediction))
오차함수를 a1, a2로 각각 미분한 값이
a1_diff = -(1/len(x1_data)) * sum(x1_data*(error))
라고 되어있는데 2/len(x1_data)라고 생각하였습니다
혹시 제가 놓치고 있는게 있을까요?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.