Simple python ML example
unknown
python
3 years ago
679 B
2
Indexable
import pandas as pd import numpy as np import sklearn from sklearn import linear_model df = pd.read_csv('MatchTimelinesFirst15.csv', delimiter=',') predict = "blue_win" df = df.drop('Unnamed: 0', axis=1) df = df.drop('redDragonKills', axis=1) df = df.drop('blueDragonKills', axis=1) # print(df.describe()) x = np.array(df.drop([predict], axis=1)) y = np.array(df[predict]) x_train, x_test, y_train, y_test = sklearn.model_selection.train_test_split(x, y, test_size=0.2) #print('{0}, {1}'.format(type(x_train), x_train)) linear = linear_model.LinearRegression() # trains model linear.fit(x_train, y_train) acc = linear.score(x_test, y_test) print('Acc {0}'.format(acc))