sys.path.append('../../') import nba_net.core.networks as net # # DB_URL = \ # "mongodb+srv://cs4701:[email protected]/" + \ # "attempt1?retryWrites=true" DB_URL = "mongodb://localhost:27017/" def get_team_stats(): """Returns a list of all the team-level ML stats for each game, as well as the outcome. Each list has the form [0..., 0..., 0..., 0..., ..., 1/0]""" # client = pymongo.MongoClient(DB_URL, ssl=True, ssl_cert_reqs=ssl.CERT_NONE) client = pymongo.MongoClient(DB_URL) db = client.attempt1 ml_stats = db.learningStats parsed_stats = [] for game_stats in ml_stats.find(): del game_stats["_id"] del game_stats["game_id"] parsed_stats.append(list(game_stats.values())) return parsed_stats if __name__ == "__main__": team_stats = get_team_stats() model = net.OneLayer(8, 5, 1) net.train_model(15000, 0.06, model, team_stats)
def exp_train(): """Exports trained model.""" team_stats = get_team_stats() model = net.OneLayer(30, 15, 1) net.train_model(10000, 0.0005, model, team_stats, no_graph=True) return model
# DB_URL = \ # "mongodb+srv://cs4701:[email protected]/" + \ # "attempt2?retryWrites=true" DB_URL = "mongodb://localhost:27017/" def get_stats(): """Returns a list of all the team-level ML stats for each game, as well as the outcome. Each list has the form [0..., 0..., 0..., 0..., ..., 1/0]""" # client = pymongo.MongoClient(DB_URL, ssl=True, ssl_cert_reqs=ssl.CERT_NONE) client = pymongo.MongoClient(DB_URL) db = client.attempt2 ml_stats = db.learningStats parsed_stats = [] for game_stats in ml_stats.find(): del game_stats["_id"] del game_stats["game_id"] winner = game_stats["winner"] del game_stats["winner"] stats = list(game_stats.values()) stats.append(winner) parsed_stats.append(stats) return parsed_stats if __name__ == "__main__": team_stats = get_stats() model = net.OneLayer(8, 7, 1) net.train_model(1750, 0.01, model, team_stats)
away_data.append(pd["plus_minus"]) return home_data, away_data def get_team_stats(): """Returns a list of all the team-level ML stats for each game, as well as the outcome. Each list has the form [0..., 0..., 0..., 0..., ..., 1/0]""" client = pymongo.MongoClient(DB_URL) db = client.attempt4 ml_stats = db.learningStats parsed_stats = [] for game_stats in ml_stats.find(): temp_list = [] del game_stats["_id"] del game_stats["game_id"] winner = game_stats["winner"] del game_stats["winner"] home_player_data, away_player_data = filter_data(game_stats) temp_list = temp_list + home_player_data temp_list = temp_list + away_player_data temp_list.append(winner) parsed_stats.append(temp_list) return parsed_stats if __name__ == "__main__": team_stats = get_team_stats() model = net.OneLayer(30, 15, 1) net.train_model(10000, 0.0005, model, team_stats)
def exp_train(): """Exports trained model.""" team_stats = get_team_stats() model = net.OneLayer(1, 5, 1) net.train_model(2000, 0.01, model, team_stats) return model
def exp_train(): """Exports trained model.""" team_stats = get_stats() model = net.OneLayer(8, 7, 1) net.train_model(1750, 0.01, model, team_stats, no_graph=True) return model