Skip to content

Instantly share code, notes, and snippets.

View wrwr's full-sized avatar

Wojciech Rybicki wrwr

View GitHub Profile
@wrwr
wrwr / xgboost_randomized_search.py
Last active May 26, 2024 20:15
XGBoost hyperparameter search using scikit-learn RandomizedSearchCV
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 = {
@wrwr
wrwr / load_save_npz_sparse_dataset.py
Created June 5, 2017 05:37
Load and save csr_matrix dataset as numpy npz file
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):