def predictor_wed_server(payload): model = payload['model'] num = payload['num'] j = parse_json(j=payload) x, player_info = j.get_Info(num) new_client = client() # load specified model if model == 'NN': new_client.load_model(f'Models/NN_Model_{num}') else: new_client.load_model(f'Models/SVM_Model_{num}.pkl') # predict prediction = new_client.predict(x) # format prediction player_info['team'] = 'Blue' if player_info['team'] == 'CHAOS': prediction = 1 - prediction player_info['team'] = 'Red' prediction = "{:.2f}".format(prediction * 100) prediction = f'{player_info["summoner_name"]}, {player_info["champion"]} has a {prediction}% of winning on the {player_info["team"]} team after {num} minutes since the game\'s start.' return prediction
def NN_Model(num): # get info depending on 10 or 15 path, label, d = get_info(num) # preprocess csv file newClient = client(path) newClient.preprocess(label=label, d=d) newClient.train_NN() return newClient.model
from Code.client import client # dense_layers = [3,4] # layer_sizes = [32, 64, 128] # drop_ratios = [0.6, 0.8] dense_layers = [3] layer_sizes = [32] drop_ratios = [0.4] # preprocess data train_path = "/Users/rostamvakhshoori/Desktop/MatchTimelinesFirst10.csv" newClient = client(train_path) newClient.preprocess( label='blueWins', d=['gameId', 'blueWins', 'blueTotalExperience', 'redTotalExperience']) newClient.train_NN() newClient.analysis() # train_path = "/Users/rostamvakhshoori/Desktop/MatchTimelinesFirst15.csv" # X_train, X_test, y_train, y_test = preprocess(train_path) # logisitic_regression_model = LogisticRegression() # logisitic_regression_model.fit(X_train, y_train) # print(logisitic_regression_model.score(X_test, y_test)) # clf = svm.SVC() # clf.fit(X_train, y_train) # print(clf.score(X_test, y_test)) # for dense_layer in dense_layers: # for layer_size in layer_sizes: