Exemplo n.º 1
0
import numpy as np
import xgboost as xgb
from hyperopt import hp
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.pipeline import Pipeline

from config import random_seed
from utils.python_utils import quniform_int

steps = [
    ('lda', LinearDiscriminantAnalysis(n_components=55)),
    # ('xgb', xgb.XGBClassifier(n_estimators=5900, max_depth=11, min_child_weight=4, subsample=0.932626370862, gamma=0.7, colsample_bytree=0.85, learning_rate=0.125, silent=True, nthread=3, seed=random_seed))
    ('xgb',
     xgb.XGBClassifier(n_estimators=5900,
                       silent=True,
                       nthread=3,
                       seed=random_seed))
]
model = Pipeline(steps=steps)

params_space = {
    'lda__n_components': quniform_int('n_components', 10, 500, 5),
    # 'xgb__max_depth': quniform_int('max_depth', 10, 30, 1),
    # 'xgb__min_child_weight': hp.quniform('min_child_weight', 1, 20, 1),
    # 'xgb__subsample': hp.uniform('subsample', 0.8, 1),
    'xgb__n_estimators': quniform_int('n_estimators', 1000, 10000, 50),
    # 'xgb__learning_rate': hp.loguniform('learning_rate', np.log(0.0001), np.log(0.5)) - 0.0001,
    # 'xgb__gamma': hp.loguniform('gamma', np.log(0.0001), np.log(5)) - 0.0001,
    # 'xgb__colsample_bytree': hp.quniform('colsample_bytree', 0.5, 1, 0.05)
}
Exemplo n.º 2
0
          xgb.XGBClassifier(n_estimators=2900,
                            max_depth=23,
                            min_child_weight=8,
                            subsample=0.823469937115,
                            gamma=0.000220375249699,
                            colsample_bytree=0.7,
                            learning_rate=0.387889737181,
                            silent=True,
                            nthread=16,
                            seed=random_seed))]

model = Pipeline(steps=steps)

params_space = {
    'xgb__max_depth':
    quniform_int('max_depth', 5, 30, 1),
    'xgb__min_child_weight':
    hp.quniform('min_child_weight', 1, 20, 1),
    'xgb__subsample':
    hp.uniform('subsample', 0.8, 1),
    'xgb__n_estimators':
    quniform_int('n_estimators', 1000, 10000, 50),
    'xgb__learning_rate':
    hp.loguniform('learning_rate', np.log(0.0001), np.log(0.5)) - 0.0001,
    'xgb__gamma':
    hp.loguniform('gamma', np.log(0.0001), np.log(5)) - 0.0001,
    'xgb__colsample_bytree':
    hp.quniform('colsample_bytree', 0.5, 1, 0.05),
    'xgb__seed':
    random_seed
}
Exemplo n.º 3
0
from hyperopt import hp
from sklearn.ensemble import RandomForestClassifier
from sklearn.pipeline import Pipeline

from config import random_seed
from utils.python_utils import quniform_int

steps = [('rf',
          RandomForestClassifier(n_estimators=1000,
                                 n_jobs=2,
                                 random_state=random_seed))]

model = Pipeline(steps=steps)

params_space = {
    'rf__max_depth': quniform_int('max_depth', 2, 30, 1),
    'rf__criterion': hp.choice('criterion', ["gini", "entropy"]),
    'rf__n_estimators': quniform_int('n_estimators', 1000, 10000, 50),
    'rf__min_samples_split': quniform_int('min_samples_split', 2, 100, 1),
}
import numpy as np
from hyperopt import hp
from sklearn.neighbors import KNeighborsClassifier
from config import random_seed
from utils.python_utils import quniform_int
from imblearn.pipeline import Pipeline
from imblearn.over_sampling import EditedNearestNeighbours
steps = [
    ('oversampler', EditedNearestNeighbours(random_state=random_seed)),
    ('knn', KNeighborsClassifier(n_neighbors=5, n_jobs=-1)),
]

model = Pipeline(steps=steps)
params_space = {
    'knn__n_neighbors': quniform_int('n_neighbors', 1, 50, 2),
    'knn__weights': hp.choice('weights', ['uniform', 'distance']),
    'knn__p': hp.quniform('p', 2.5, 5.5, 1),
}
          xgb.XGBClassifier(n_estimators=6700,
                            max_depth=11,
                            min_child_weight=9,
                            subsample=0.900152352061,
                            gamma=0.188234394605,
                            colsample_bytree=0.8,
                            learning_rate=0.00540318190441,
                            silent=True,
                            nthread=1,
                            seed=random_seed))]

model = Pipeline(steps=steps)

params_space = {
    'pca__n_components':
    quniform_int('n_components', 10, 75, 1),
    'xgb__max_depth':
    quniform_int('max_depth', 10, 30, 1),
    'xgb__min_child_weight':
    hp.quniform('min_child_weight', 1, 20, 1),
    'xgb__subsample':
    hp.uniform('subsample', 0.8, 1),
    'xgb__n_estimators':
    quniform_int('n_estimators', 1000, 10000, 50),
    'xgb__learning_rate':
    hp.loguniform('learning_rate', np.log(0.0001), np.log(0.5)) - 0.0001,
    'xgb__gamma':
    hp.loguniform('gamma', np.log(0.0001), np.log(5)) - 0.0001,
    'xgb__colsample_bytree':
    hp.quniform('colsample_bytree', 0.5, 1, 0.05)
}
Exemplo n.º 6
0
import numpy as np
import xgboost as xgb
from hyperopt import hp
from sklearn.decomposition import FastICA
from sklearn.pipeline import Pipeline

from config import random_seed
from utils.python_utils import quniform_int

steps = [
    ('ica', FastICA(n_components=51, random_state=random_seed)),
    ('xgb', xgb.XGBClassifier(n_estimators=5900, max_depth=11, min_child_weight=4, subsample=0.932626370862, gamma=0.7, colsample_bytree=0.85, learning_rate=0.125, silent=True, nthread=1, seed=random_seed))
]

model = Pipeline(steps=steps)

params_space = {
    'pca__n_components': quniform_int('n_components', 10, 75, 1),
    'xgb__max_depth': quniform_int('max_depth', 10, 30, 1),
    'xgb__min_child_weight': hp.quniform('min_child_weight', 1, 20, 1),
    'xgb__subsample': hp.uniform('subsample', 0.8, 1),
    'xgb__n_estimators': quniform_int('n_estimators', 1000, 10000, 50),
    'xgb__learning_rate': hp.loguniform('learning_rate', np.log(0.0001), np.log(0.5)) - 0.0001,
    'xgb__gamma': hp.loguniform('gamma', np.log(0.0001), np.log(5)) - 0.0001,
    'xgb__colsample_bytree': hp.quniform('colsample_bytree', 0.5, 1, 0.05)
}
Exemplo n.º 7
0
import numpy as np
import xgboost as xgb
from hyperopt import hp
from imblearn.pipeline import Pipeline
from imblearn.under_sampling import OneSidedSelection

from config import random_seed
from utils.python_utils import quniform_int

steps = [
    ('undersampler', OneSidedSelection(random_state = random_seed)),
    ('xgb', xgb.XGBClassifier(n_estimators=1000, silent=True, nthread=3, seed=random_seed))
]

model = Pipeline(steps=steps)

params_space = {
    'xgb__max_depth': quniform_int('max_depth', 10, 30, 1),
    'xgb__min_child_weight': hp.quniform('min_child_weight', 1, 20, 1),
    'xgb__subsample': hp.uniform('subsample', 0.8, 1),
    'xgb__n_estimators': quniform_int('n_estimators', 1000, 10000, 50),
    'xgb__learning_rate': hp.loguniform('learning_rate', np.log(0.0001), np.log(0.5)) - 0.0001,
    'xgb__gamma': hp.loguniform('gamma', np.log(0.0001), np.log(5)) - 0.0001,
    'xgb__colsample_bytree': hp.quniform('colsample_bytree', 0.5, 1, 0.05)
}