def invoke_xgb(data_train, data_test, params): dtrain = survival_dmat(data_train, t_col=col_t, e_col=col_e, label_col="Y") dtest = survival_dmat(data_test, t_col=col_t, e_col=col_e, label_col="Y") # params params_model = { 'eta': params['eta'], 'max_depth': params['max_depth'], 'min_child_weight': params['min_child_weight'], 'subsample': params['subsample'], 'colsample_bytree': params['colsample_bytree'], 'lambda': params['reg_lambda'], 'gamma': params['reg_gamma'], 'silent': 1 } # Build and train model model = BecCox( params_model, loss_alpha=params["loss_alpha"] ) eval_result = model.train( dtrain, num_rounds=params['nrounds'], silent=True, plot=False ) # Evaluation return model.evals(dtest)
def invoke_xgb(data_train, data_test, params): #print params dtrain = survival_dmat(data_train, t_col=T_col, e_col=E_col, label_col="Y") dtest = survival_dmat(data_test, t_col=T_col, e_col=E_col, label_col="Y") params_xgb = { 'eta': params['eta'], 'max_depth': params['max_depth'], 'min_child_weight': params['min_child_weight'], 'subsample': params['subsample'], 'colsample_bytree': params['colsample_bytree'], 'lambda': params['reg_lambda'], 'gamma': params['reg_gamma'], 'objective': 'multi:softprob', 'num_class': K + 1, 'silent': 1, 'seed': 42 } # Build and train model model = HitBoost(params_xgb, loss_alpha=params['loss_alpha'], loss_gamma=params['loss_gamma']) eval_result = model.train(dtrain, num_rounds=params['nrounds'], silent=True, plot=False) # Evaluation return model.evals(dtest)