GithubHelp home page GithubHelp logo

Comments (3)

richardliaw avatar richardliaw commented on June 26, 2024

@inventormc can you tell me how to repro this? Is there a branch + a script?

from tune-sklearn.

inventormc avatar inventormc commented on June 26, 2024

Yeah I used this script for xgb.

"""
An example training a XGBClassifier, performing
randomized search using TuneSearchCV.
"""

import warnings
from tune_sklearn import TuneSearchCV
from sklearn import datasets
from sklearn.model_selection import train_test_split
from xgboost import XGBClassifier

warnings.filterwarnings("ignore")

digits = datasets.load_digits()
x = digits.data
y = digits.target
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=.2)

# A parameter grid for XGBoost
params = {
    "min_child_weight": [1, 5, 10],
    "gamma": [0.5, 1, 1.5, 2, 5],
    "subsample": [0.6, 0.8, 1.0],
    "colsample_bytree": [0.6, 0.8, 1.0],
    "max_depth": [3, 4, 5],
}

xgb = XGBClassifier(
    learning_rate=0.02,
    n_estimators=50,
    objective="binary:logistic",
    silent=True,
    nthread=1,
)
digit_search = TuneSearchCV(
    xgb,
    param_distributions=params,
    n_iter=3,
    # use_gpu=True # Commented out for testing on travis,
    # but this is how you would use gpu
)

import time # Just to compare fit times
start = time.time()
digit_search.fit(x_train, y_train)
end = time.time()
print(end-start)
print(digit_search.cv_results_)

digit_search = TuneSearchCV(
    xgb,
    param_distributions=params,
    n_iter=3,
    early_stopping="MedianStoppingRule",
    max_iters=50
    # use_gpu=True # Commented out for testing on travis,
    # but this is how you would use gpu
)

start = time.time()
digit_search.fit(x_train, y_train)
end = time.time()
print(end-start)
print(digit_search.cv_results_)

from tune-sklearn.

richardliaw avatar richardliaw commented on June 26, 2024

Merged in #63

from tune-sklearn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.