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 | |
from scipy.sparse import csr_matrix | |
def save_dataset(filename, x, y): | |
np.savez(filename, data=x.data, indices=x.indices, | |
indptr=x.indptr, shape=x.shape, target=y) | |
def load_dataset(filename): |
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 time | |
import xgboost as xgb | |
from sklearn.model_selection import RandomizedSearchCV | |
x_train, y_train, x_valid, y_valid, x_test, y_test = # load datasets | |
clf = xgb.XGBClassifier() | |
param_grid = { |