hypernets.model package

Submodules

hypernets.model.estimator module

class hypernets.model.estimator.CrossValidationEstimator(base_estimator, task, num_folds=3, stratified=False, shuffle=False, random_state=None)[source]

Bases: object

fit(X, y, **kwargs)[source]
predict(X)[source]
predict_proba(X)[source]
proba2predict(proba, proba_threshold=0.5)[source]
class hypernets.model.estimator.Estimator(space_sample, task='binary', discriminator=None)[source]

Bases: object

evaluate(X, y, metrics=None, **kwargs)[source]
fit(X, y, **kwargs)[source]
fit_cross_validation(X, y, stratified=True, num_folds=3, shuffle=False, random_state=9527, metrics=None)[source]
get_iteration_scores()[source]
static load(model_file)[source]
predict(X, **kwargs)[source]
predict_proba(X, **kwargs)[source]
proba2predict(proba, proba_threshold=0.5)[source]
save(model_file)[source]
set_discriminator(discriminator)[source]
summary()[source]

hypernets.model.hyper_model module

class hypernets.model.hyper_model.HyperModel(searcher, dispatcher=None, callbacks=None, reward_metric=None, task=None, discriminator=None)[source]

Bases: object

best_reward
best_trial_no
export_configuration(trials)[source]
export_trial_configuration(trial)[source]
final_train(space_sample, X, y, **kwargs)[source]
generate_dataset_id(X, y)[source]
get_best_trial()[source]
get_top_trials(top_n)[source]
infer_task_type(y)[source]
load_estimator(model_file)[source]
plot_hyperparams(destination='notebook', output='hyperparams.html')[source]
reward_metrics
search(X, y, X_eval, y_eval, X_test=None, cv=False, num_folds=3, max_trials=10, dataset_id=None, trial_store=None, **fit_kwargs)[source]
Parameters:
  • X – Pandas or Dask DataFrame, feature data for training
  • y – Pandas or Dask Series, target values for training
  • X_eval – (Pandas or Dask DataFrame) or None, feature data for evaluation
  • y_eval – (Pandas or Dask Series) or None, target values for evaluation
  • X_test – (Pandas or Dask Series) or None, target values for evaluation of indicators like PSI
  • cv – Optional, int(default=False), If set to true, use cross-validation instead of evaluation set reward to guide the search process
  • num_folds – Optional, int(default=3), Number of cross-validated folds, only valid when cv is true
  • max_trials – Optional, int(default=10), The upper limit of the number of search trials, the search process stops when the number is exceeded
  • dataset_id
  • trial_store
  • fit_kwargs – Optional, dict, parameters for fit method of model
Returns:

hypernets.model.objectives module

class hypernets.model.objectives.CVWrapperEstimator(estimators, x_vals, y_vals)[source]

Bases: object

classes_
predict(X, **kwargs)[source]
predict_proba(X, **kwargs)[source]
class hypernets.model.objectives.ElapsedObjective[source]

Bases: hypernets.core.objective.Objective

class hypernets.model.objectives.NumOfFeatures(sample_size=1000)[source]

Bases: hypernets.core.objective.Objective

Detect the number of features used (NF)

References

[1] Molnar, Christoph, Giuseppe Casalicchio, and Bernd Bischl. “Quantifying model complexity via functional decomposition for better post-hoc interpretability.” Machine Learning and Knowledge Discovery in Databases: International Workshops of ECML PKDD 2019, Würzburg, Germany, September 16–20, 2019, Proceedings, Part I. Springer International Publishing, 2020.

get_cv_used_features(estimator, X_datas)[source]
get_used_features(estimator, X_data)[source]
class hypernets.model.objectives.PSIObjective(n_bins=10, task='binary', average='macro', eps=1e-06)[source]

Bases: hypernets.core.objective.Objective

class hypernets.model.objectives.PredictionObjective(name, scorer, direction=None)[source]

Bases: hypernets.core.objective.Objective

static create(name, task='binary', pos_label=1, force_minimize=False)[source]
static create_accuracy(name, force_minimize)[source]
static create_auc(name, force_minimize)[source]
static create_f1(name, force_minimize, pos_label, average)[source]
static create_precision(name, force_minimize, pos_label, average)[source]
static create_recall(name, force_minimize, pos_label, average)[source]
get_score()[source]
class hypernets.model.objectives.PredictionPerformanceObjective[source]

Bases: hypernets.core.objective.Objective

hypernets.model.objectives.calc_psi(x_array, y_array, n_bins=10, eps=1e-06)[source]
hypernets.model.objectives.create_objective(name, **kwargs)[source]
hypernets.model.objectives.detect_used_features(estimator, X_data, sample_size=1000)[source]

Module contents