Exemplo n.º 1
0
sys.path.insert(0, os.getcwd())

import workdir.classes.config
from qml.cv import QCV
from qml.models import QXgb, QXgb2
from workdir.classes.models import qm

if __name__ == "__main__":
    CV_SCORE_TO_STOP = 0.5417
    DATAS = [27]

    EVALS_ROUNDS = 100000

    rounds = EVALS_ROUNDS

    cv = QCV(qm)
    counter = 0

    def fn(params):
        global counter

        counter += 1
        data_id = params['data_id']
        del params['data_id']
        params['num_boost_rounds'] = int(1.3**params['num_boost_rounds'])
        params['eta'] = round(1 / (1.3**params['eta']), 4)
        params['lr_decay'] = round(1 / (2**params['lr_decay']), 4)
        params['subsample'] = params['subsample'] / 10
        params['colsample_bytree'] = params['colsample_bytree'] / 10
        params['colsample_bylevel'] = params['colsample_bylevel'] / 10
Exemplo n.º 2
0
import datetime
import numpy as np

from hyperopt import hp, fmin, tpe
import os
import sys

sys.path.insert(0, os.getcwd())
import workdir.classes.config
from qml.cv import QCV
from qml.models import QXgb, QAvg, QAvgOneModelData
from workdir.classes.models import qm

cv = QCV(qm)

# model_id = qm.add_by_params(
#     QXgb(
# ** {"alpha": 1.0, "booster": "gbtree", "colsample_bylevel": 0.7, "colsample_bytree": 0.8, "eta": 0.004, "eval_metric": "logloss",
#     "gamma": 0.2, "max_depth": 4, "num_boost_round": 2015, "objective": "binary:logistic", "subsample": 0.8, "tree_method": "hist"}
#     ),
#     'hyperopt xgb', level=-1
# )

model_id = qm.add_by_params(QAvgOneModelData(416, 2), level=-2)

cv.features_sel_del(
    model_id,
    23,
    early_stop_cv=lambda x: x < 0.557,  # minmax
    log_file='workdir/logs/data23_sub_cols3.txt',
    exclude=[
Exemplo n.º 3
0
from hyperopt import hp, fmin, tpe

import os
import sys
sys.path.insert(0, os.getcwd())

import workdir.classes.config
from qml.cv import QCV
from qml.helpers import get_engine
from qml.models import QXgb, QAvg, QRankedAvg, QRankedByLineAvg, QStackModel
from workdir.classes.models import qm

if __name__ == "__main__":
    _, conn = get_engine()
    cv = QCV(qm)

    CV_SCORE_TO_SELECT = 0.56
    CV_SCORE_TO_STOP = 0.5416


    ROUNDS = 20000


    res = conn.execute(
        """
            select data_id, cls, descr, 
            substring_index(group_concat(model_id order by cv_score), ',', 5) as models
            from qml_results r 
            inner join qml_models m using(model_id) 
            where m.level=1 and cv_score < {} and data_id in (66, 69, 266, 269, 47 )
Exemplo n.º 4
0
import datetime
import numpy as np

from hyperopt import hp, fmin, tpe
import os
import sys

sys.path.insert(0, os.getcwd())
import workdir.classes.config
from qml.cv import QCV
from qml.models import QXgb, QAvg, QAvgOneModelData
from workdir.classes.models import qm

cv = QCV(qm)

# model_id = qm.add_by_params(
#     QXgb(
# ** {"alpha": 1.0, "booster": "gbtree", "colsample_bylevel": 0.7, "colsample_bytree": 0.8, "eta": 0.004, "eval_metric": "logloss",
#     "gamma": 0.2, "max_depth": 4, "num_boost_round": 2015, "objective": "binary:logistic", "subsample": 0.8, "tree_method": "hist"}
#     ),
#     'hyperopt xgb', level=-1
# )

model_id = qm.add_by_params(QAvgOneModelData(416, 2), level=-2)

cv.features_sel_del(
    model_id,
    13,
    early_stop_cv=lambda x: x < 0.53,  # minmax
    log_file='workdir/logs/data13_sub_cols2.txt',
    exclude=[],
Exemplo n.º 5
0
import datetime
import numpy as np

from hyperopt import hp, fmin, tpe
import os
import sys
sys.path.insert(0, os.getcwd())
import workdir.classes.config
from qml.cv import QCV
from qml.models import QXgb, QAvg, QAvgOneModelData
from workdir.classes.models import qm



cv = QCV(qm)

model_id = qm.add_by_params(
    QXgb(
** {"alpha": 1.0, "booster": "gbtree", "colsample_bylevel": 0.7, "colsample_bytree": 0.8, "eta": 0.004, "eval_metric": "logloss",
    "gamma": 0.2, "max_depth": 4, "num_boost_round": 2015, "objective": "binary:logistic", "subsample": 0.8, "tree_method": "hist"}
    ),
    'hyperopt xgb', level=-1
)

model_id =qm.add_by_params(QAvgOneModelData(model_id, 3), level=-2)

cv.features_sel_del(model_id, 66, early_stop_cv=lambda x: x>0.5414, log_file='workdir/logs/feat19.txt', exclude=[])


Exemplo n.º 6
0
import datetime
import numpy as np

from hyperopt import hp, fmin, tpe
import os
import sys
sys.path.insert(0, os.getcwd())
import workdir.classes.config
from qml.cv import QCV
from qml.models import QXgb, QAvg, QAvgOneModelData
from workdir.classes.models import qm



cv = QCV(qm)

# model_id = qm.add_by_params(
#     QXgb(
# ** {"alpha": 1.0, "booster": "gbtree", "colsample_bylevel": 0.7, "colsample_bytree": 0.8, "eta": 0.004, "eval_metric": "logloss",
#     "gamma": 0.2, "max_depth": 4, "num_boost_round": 2015, "objective": "binary:logistic", "subsample": 0.8, "tree_method": "hist"}
#     ),
#     'hyperopt xgb', level=-1
# )

model_id =qm.add_by_params(QAvgOneModelData(416, 2), level=-2)

cv.features_sel_del(model_id, 3, early_stop_cv=lambda x: x>0.53, log_file='workdir/logs/feat19.txt', exclude=['category_2_82'])


Exemplo n.º 7
0
import datetime
import numpy as np

import os
import sys
sys.path.insert(0, os.getcwd())

from hyperopt import hp, fmin, tpe

import workdir.classes.config
from qml.cv import QCV
from qml.models import QXgb, QAvg, QAvgOneModelData
from workdir.classes.models import qm

cv = QCV(qm)

model_id = qm.add_by_params(
    QXgb(
        **{
            "alpha": 0.008,
            "booster": "gbtree",
            "colsample_bylevel": 0.9,
            "colsample_bytree": 0.9,
            "eta": 0.0024,
            "eval_metric": "logloss",
            "gamma": 0.04,
            "max_depth": 4,
            "num_boost_round": 2619,
            "objective": "binary:logistic",
            "subsample": 0.7,
            "tree_method": "hist"
Exemplo n.º 8
0
import datetime
import numpy as np

from hyperopt import hp, fmin, tpe
import os
import sys
sys.path.insert(0, os.getcwd())
import workdir.classes.config
from qml.cv import QCV
from qml.models import QXgb, QAvg, QAvgOneModelData
from workdir.classes.models import qm



cv = QCV(qm)

# model_id = qm.add_by_params(
#     QXgb(
# ** {"alpha": 1.0, "booster": "gbtree", "colsample_bylevel": 0.7, "colsample_bytree": 0.8, "eta": 0.004, "eval_metric": "logloss",
#     "gamma": 0.2, "max_depth": 4, "num_boost_round": 2015, "objective": "binary:logistic", "subsample": 0.8, "tree_method": "hist"}
#     ),
#     'hyperopt xgb', level=-1
# )

model_id =qm.add_by_params(QAvgOneModelData(416, 2), level=-2)

cv.features_sel_del(
    model_id, 19,
    early_stop_cv=lambda x: x<0.557, # minmax
    log_file='workdir/logs/data19_sub_cols1.txt',
    exclude=[