This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |