text_plain_output_1.png image_output_1.png
from scipy import stats

from sklearn.metrics import mean_absolute_error

from sklearn.model_selection import train_test_split

import numpy as np # linear algebra

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import seaborn as sns

import statsmodels.api as sm

train_data = pd.read_csv('../input/train_V2.csv')
test_data = pd.read_csv('../input/test_V2.csv')

train_data.head(10)[['damageDealt', 'winPlacePerc']]

import matplotlib.pyplot as plt
import seaborn as sns
sns.set(style='darkgrid')
data_to_plot = train_data.sample(n=200)[['damageDealt', 'winPlacePerc']]

data_to_plot = train_data[train_data.matchType.isin({'solo', 'solo-fpp'})].sample(n=200)[['damageDealt', 'winPlacePerc']]

from scipy import stats
solo_train_data = train_data[train_data.matchType.isin({'solo', 'solo-fpp'})]

import statsmodels.api as sm
sample = solo_train_data.sample(n=10)

from sklearn.model_selection import train_test_split
clean_train_data = train_data[['damageDealt', 'winPlacePerc']].dropna()
X_train, X_test, y_train, y_test = train_test_split(clean_train_data, clean_train_data.winPlacePerc, test_size=0.2)
model = sm.Logit(y_train, X_train.damageDealt)
result = model.fit()

from sklearn.metrics import mean_absolute_error
predictions = result.predict(X_test.damageDealt)

garbled_predictions = (predictions - 0.5) * 2.0
print(mean_absolute_error(y_test, garbled_predictions))
sns.scatterplot(y_test[:200], garbled_predictions[:200])