<jupyter_start><jupyter_text>Hyperopt<jupyter_code>def obj_func(params):
  print('Training with params: ')
  print(params)

  mean_mae, score_std = run_model(xgb.XGBRegressor(** params), feats)
  return {'loss' : np.abs(mean_mae), 'status' : STATUS_OK} #blackbox z input i output

  #space
xgb_reg_params = {
    'learning_rate' :     hp.choice('learning_rate',    np.arange(0.05, 0.31, 0.05)), # choice, wybór; między 0.05 i 0.31 z krokiem 0.05
    'max_depth' :         hp.choice('max_depth',        np.arange(5, 16, 1, dtype=int)), # między 5 a 16 z krokiem 1
    'subsample' :         hp.quniform('subsample', 0.5, 1, 0.05), # przestrzeń od 0.5 do 1, z krokiem 0.05; float z quniform
    'colsample_bytree' :  hp.quniform('colsample_bytree', 0.5, 1, 0.05),
    'objective' :         'reg:squarederror',
    'n_estimators' :  100,
    'seed' :  0
}

  ## run
best = fmin(obj_func, xgb_reg_params, algo=tpe.suggest, max_evals=25) #max_evals liczba iteracji

best<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1488933601609658, 'fraction_numerical': 0.05030181086519115, 'mean_word_length': 3.693396226415094, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '340524', 'license': 'MIT', 'n_tokens_mistral': 457, 'n_tokens_neox': 411, 'n_words': 87, 'path': 'day5.ipynb', 'repo_name': 'alexapril/dw_matrix_car', 'size': '994'}