def test_ant(): # test function on i.antipiev logs with open('../logs_ant/result_boosted.txt', 'w') as f: for time_window in range(5000, 30001, 5000): print('Working with time window equals to {} ms...'.format(time_window), file=f) bot_parser = Parser('../logs_ant/log_bot_Game.csv', '../logs_ant/log_bot_Touch.csv', step=time_window) human_parser = Parser('../logs_ant/log_human_Game.csv', '../logs_ant/log_human_Touch.csv', step=time_window) bot_parser.set_label(1) human_parser.set_label(0) data = pd.concat([bot_parser.df, human_parser.df], ignore_index=True) features, targets = prepare_data(data) clf = Classifier(boosted=True).get_data(features, targets, test_size=0.25).fit() print('Score:', clf.score(), file=f) print('Confusion matrix:\n{}\n'.format(clf.confusion_matrix()), file=f)
def human_vs_human_3(): # Human vs human vs human classification with open('human_vs_human_3.txt', 'w') as f: for time_window in range(5000, 30001, 5000): print('Working with {} second window...'.format(time_window)) h1_logs = Parser('../logs/human_game_logs_1.csv', '../logs/human_touch_logs_1.csv', step=time_window) h2_logs = Parser('../logs_new/human/session_2019-01-27_15-01-22/gamelog_Game_2019-01-27_15-01-22.csv', '../logs_new/human/session_2019-01-27_15-01-22/gamelog_Touch_2019-01-27_15-01-22.csv', step=time_window) h3_logs = Parser('../logs_new/human/session_2019-01-25_14-10-15/gamelog_Game_2019-01-25_14-10-15.csv', '../logs_new/human/session_2019-01-25_14-10-15/gamelog_Touch_2019-01-25_14-10-15.csv', step=time_window) h1_logs.set_label(1) h2_logs.set_label(2) h3_logs.set_label(3) data = pd.concat([h1_logs.df, h2_logs.df, h3_logs.df], ignore_index=True) features, targets = prepare_data(data) if time_window == 20000: scatter(features, targets, save='h_3') simple_plot(features, targets, save='h_3') tsne_plot(features, targets, perp=10, save='h_3') clf = Classifier(boosted=False).get_data(features, targets, test_size=0.25).fit() print('Score:', clf.score(), file=f) print('Confusion matrix:\n{}\n'.format(clf.confusion_matrix()), file=f)