def learning(self, path: str) -> None: x = self._data.decisions.get_data() y = self._data.decisions.get_answers() Debug.learning(f'Start learning from {y.size} samples') x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.25) mlp = MLPClassifier(hidden_layer_sizes=(200, 100, 100)) mlp.fit(x_train, y_train) Debug.learning('train', mlp.score(x_train, y_train)) Debug.learning('test ', mlp.score(x_test, y_test)) if not exists('networks'): mkdir('networks') dump(mlp, open(f'networks/{path}', 'wb'))
def add_data_from_game(self, game: PokerGame) -> None: Debug.learning('Start eject data from game', game.name) for hand in game.hands: self.add_data_from_hand(game, hand)
def add_data_set(self, games_path: str) -> None: self._data.add_data_from_folder(games_path) Debug.learning('data set contains', len(self._data.decisions), 'decisions with answers')