Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- from tensorflow.keras.models import Sequential
- from tensorflow.keras.layers import Dense
- import matplotlib.pyplot as plt
- # Trénovací data
- train_data = np.array([
- [332, 1], [289, 1], [250, 1], [91, 1], [-91, 1], [-206, 1], [-206, 1],
- [-228, 1], [-239, 1], [-256, 1], [-266, 1], [-278, 1], [-279, 1],
- [-289, 1], [-297, 1], [-297, 1], [-311, 1], [-312, 1], [-324, 1],
- [-348, 1], [-396, 1], [-509, 1], [-521, 1], [-526, 1], [-550, 1],
- [-606, 1], [-633, 1], [-728, 1], [550, 0], [385, 0], [341, 0], [289, 0],
- [228, 0], [137, 0], [110, 0], [75, 0], [-33, 0], [-70, 0], [-226, 0],
- [-251, 0], [-263, 0], [-273, 0], [-280, 0], [-390, 0], [-440, 0],
- [792, 0], [757, 0], [718, 0], [591, 0], [585, 0], [578, 0], [524, 0],
- [512, 0], [463, 0], [455, 0], [431, 0], [421, 0], [396, 0], [387, 0],
- [386, 0], [379, 0], [370, 0], [361, 0], [341, 0], [339, 0], [338, 0],
- [328, 0], [323, 0], [307, 0], [303, 0], [288, 0], [284, 0], [282, 0],
- [277, 0], [232, 0], [164, 0], [131, 0], [108, 0], [35, 0], [8, 0],
- [-87, 0], [-228, 0], [-230, 0], [-276, 0], [-347, 0], [-367, 0],
- [-543, 0], [294, 1], [284, 1], [104, 1], [-186, 1], [-238, 1], [-262, 1],
- [-280, 1], [-325, 1], [-326, 1], [-384, 1], [-422, 1], [-498, 1],
- [390, 0], [266, 0], [-297, 0], [-331, 0], [585, 0], [531, 0], [520, 0],
- [465, 0], [251, 0], [133, 0], [55, 0], [-228, 0], [-248, 0], [-306, 0]
- ])
- # Rozdělení na vstupy (X) a výstupy (y)
- X_train = train_data[:, 0].reshape(-1, 1)
- y_train = train_data[:, 1]
- # Definování modelu
- model = Sequential([
- Dense(10, input_dim=1, activation='relu'),
- Dense(8, activation='relu'),
- Dense(1, activation='sigmoid')
- ])
- # Kompilace modelu
- model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])
- # Trénování modelu
- model.fit(X_train, y_train, epochs=100, batch_size=10, verbose=1)
- # Vykreslení pravděpodobností výhry na základě Elo rozdílu
- elo_values = np.arange(-1000, 1000, 10)
- elo_probabilities = model.predict(elo_values)
- plt.figure(figsize=(10, 6))
- plt.plot(elo_values, elo_probabilities, label='Pravděpodobnost výhry')
- plt.xlabel('Elo rozdíl')
- plt.ylabel('Pravděpodobnost výhry')
- plt.title('Pravděpodobnost výhry na základě Elo rozdílu')
- plt.grid(True)
- plt.legend()
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement