Sinir Ağları

Python ile Finans için Machine Learning

Nathan George

Data Science Professor

GPU moore's law

Python ile Finans için Machine Learning

Sinir ağlarının potansiyeli var

Sinir ağları şunlara sahiptir:

  • doğrusal olmama
  • değişken etkileşimleri
  • özelleştirilebilirlik
Python ile Finans için Machine Learning

basic neural net diagram

Python ile Finans için Machine Learning

net diagram with basic math

Python ile Finans için Machine Learning

neural net math

Python ile Finans için Machine Learning

activation neural net diagram

Python ile Finans için Machine Learning

activation function

Python ile Finans için Machine Learning

loss function

Python ile Finans için Machine Learning

forward pass

Python ile Finans için Machine Learning

backwards pass

Python ile Finans için Machine Learning

keras and tensorflow logos

Python ile Finans için Machine Learning

Keras ile sinir ağı uygulamak

from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
Python ile Finans için Machine Learning

Keras ile sinir ağı uygulamak

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'))
Python ile Finans için Machine Learning

Modeli eğitmek

model.compile(optimizer='adam', loss='mse')
history = model.fit(scaled_train_features, 
                    train_targets, 
                    epochs=50)
Python ile Finans için Machine Learning
plt.plot(history.history['loss'])
plt.title('loss:' + str(round(history.history['loss'][-1], 6)))
plt.xlabel('epoch')
plt.ylabel('loss')
plt.show()

loss plot

Python ile Finans için Machine Learning

Performansı kontrol et

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
Python ile Finans için Machine Learning

Performansı görselleştir

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

preds vs actual

Python ile Finans için Machine Learning

Bir sinir ağı kur!

Python ile Finans için Machine Learning

Preparing Video For Download...