โครงข่ายประสาทเทียม

Machine Learning สำหรับการเงินด้วย Python

Nathan George

Data Science Professor

กฎของมัวร์สำหรับ GPU

Machine Learning สำหรับการเงินด้วย Python

ศักยภาพของโครงข่ายประสาทเทียม

จุดเด่นของ Neural nets:

  • ความไม่เป็นเชิงเส้น
  • ปฏิสัมพันธ์ระหว่างตัวแปร
  • ปรับแต่งได้ตามต้องการ
Machine Learning สำหรับการเงินด้วย Python

แผนภาพโครงข่ายประสาทเทียมพื้นฐาน

Machine Learning สำหรับการเงินด้วย Python

แผนภาพโครงข่ายพร้อมการคำนวณพื้นฐาน

Machine Learning สำหรับการเงินด้วย Python

คณิตศาสตร์ในโครงข่ายประสาทเทียม

Machine Learning สำหรับการเงินด้วย Python

แผนภาพโครงข่ายประสาทเทียมพร้อม activation

Machine Learning สำหรับการเงินด้วย Python

ฟังก์ชัน activation

Machine Learning สำหรับการเงินด้วย Python

ฟังก์ชัน loss

Machine Learning สำหรับการเงินด้วย Python

การส่งผ่านไปข้างหน้า

Machine Learning สำหรับการเงินด้วย Python

การส่งผ่านย้อนกลับ

Machine Learning สำหรับการเงินด้วย Python

โลโก้ Keras และ TensorFlow

Machine Learning สำหรับการเงินด้วย Python

สร้างโครงข่ายประสาทเทียมด้วย Keras

from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
Machine Learning สำหรับการเงินด้วย Python

สร้างโครงข่ายประสาทเทียมด้วย Keras

from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense


model = Sequential()
model.add(Dense(50, input_dim=scaled_train_features.shape[1], activation='relu')) model.add(Dense(10, activation='relu')) model.add(Dense(1, activation='linear'))
Machine Learning สำหรับการเงินด้วย Python

การ fit โมเดล

model.compile(optimizer='adam', loss='mse')
history = model.fit(scaled_train_features, 
                    train_targets, 
                    epochs=50)
Machine Learning สำหรับการเงินด้วย Python
plt.plot(history.history['loss'])
plt.title('loss:' + str(round(history.history['loss'][-1], 6)))
plt.xlabel('epoch')
plt.ylabel('loss')
plt.show()

กราฟ loss

Machine Learning สำหรับการเงินด้วย Python

ตรวจสอบประสิทธิภาพของโมเดล

from sklearn.metrics import r2_score

# calculate R^2 score
train_preds = model.predict(scaled_train_features)
print(r2_score(train_targets, train_preds))
0.4771387560719418
Machine Learning สำหรับการเงินด้วย Python

พล็อตประสิทธิภาพของโมเดล

# plot predictions vs actual
plt.scatter(train_preds, train_targets)
plt.xlabel('predictions')
plt.ylabel('actual')
plt.show()

ค่าทำนายเทียบกับค่าจริง

Machine Learning สำหรับการเงินด้วย Python

มาสร้างโครงข่ายประสาทเทียมกัน!

Machine Learning สำหรับการเงินด้วย Python

Preparing Video For Download...