Skip to content

Instantly share code, notes, and snippets.

View ashtom84's full-sized avatar

Thomas ashtom84

  • New-York, Paris, Basel
View GitHub Profile
%select only brands with 101 models listed at least
bkmake = bkmake[bkmake['makesize'] > 100]
bkmake['ydist'] = bkmake.km/(2017 - bkmake.year)
bkmake = bkmake.loc[np.logical_not(np.isnan(bkmake.ydist))]
# selecting only the 95% percentile
nM = 95
nR = 100
ydistmax = np.nanpercentile(bkmake.ydist, nM)
import numpy as np
import pandas as pd
import random
from xgboost import XGBClassifier
from sklearn.metrics import confusion_matrix, mean_squared_error
import sklearn.cross_validation as cv
from sklearn.cross_validation import KFold, train_test_split
from sklearn import preprocessing
import sklearn.metrics
from sklearn.grid_search import GridSearchCV