guide.GuideClassifier¶
- class guide.GuideClassifier(*, node_model='constant', max_depth=10, min_samples_leaf=2, min_gain=1e-12, interactions=True, linear_splits=False, significance_level=0.1, max_split_candidates=100, pruning='cv', cv_folds=10, cv_standard_errors=0.25, ccp_alpha=0.0, max_leaves=None, class_priors=None, class_costs=None, pruning_loss='misclassification', categorical_features=None, feature_roles=None, periodic_features=None, missing_flags=None, n_jobs=None, random_state=0)¶
GUIDE classification tree.
- Parameters:
- node_model{“constant”, “lda”, “lda_splits”}, default=”constant”
Model fitted in each node.
"lda"grows GUIDE’s linear discriminant trees: each node selects features, splits on its first discriminant coordinate and classifies with an LDA leaf."lda_splits"splits the same way but cuts by Gini impurity and classifies with constant leaves (GUIDE’s option 7). Numeric features enter as values and categorical features as dummies of their levels, and both default to the"both"role; every feature must then have role"fit"or"both"(exclude others, such as periodic features, withfeature_roles).class_costsis not supported. A node splits only with at least 2.5 timesmin_samples_leafrows; GUIDE’s default is 10 for"lda"and 2 for"lda_splits".- linear_splitsbool, default=False
Also test bivariate discriminant splits.
- class_priorsarray-like of shape (n_classes,), default=None
Prior probabilities in the order of
classes_. By default they are estimated from the training data.- class_costsarray-like of shape (n_classes, n_classes), default=None
class_costs[i][j]is the cost of predicting classjfor a sample of classi, in the order ofclasses_.- pruning_loss{“misclassification”, “log_loss”, “brier”}, default=”misclassification”
Held-out loss that chooses the tree size in cross-validation and validation pruning (along GUIDE’s cost-complexity sequence), and that forests report as
oob_loss_. GUIDE uses misclassification cost; log loss and the Brier score are proper scoring rules that judge the predicted probabilities and are usually the better choice. They are guide-rs extensions and cannot be combined withclass_costs.- The remaining parameters are those of :class:`GuideRegressor` that apply
- to classification; ``feature_roles`` accepts ``”split”`` and
- ``”excluded”``. Sample weights are treated as 0 (excluded) or 1,
- following GUIDE.
- __init__(*, node_model='constant', max_depth=10, min_samples_leaf=2, min_gain=1e-12, interactions=True, linear_splits=False, significance_level=0.1, max_split_candidates=100, pruning='cv', cv_folds=10, cv_standard_errors=0.25, ccp_alpha=0.0, max_leaves=None, class_priors=None, class_costs=None, pruning_loss='misclassification', categorical_features=None, feature_roles=None, periodic_features=None, missing_flags=None, n_jobs=None, random_state=0)¶
Methods
__init__(*[, node_model, max_depth, ...])apply(X)Terminal node id of each sample.
fit(X, y[, sample_weight, validation_data])Fit the model.
get_depth()Depth of the fitted tree; a single leaf has depth 0.
get_metadata_routing()Get metadata routing of this object.
get_n_leaves()Number of terminal nodes in the fitted tree.
get_params([deep])Get parameters for this estimator.
predict(X)Predicted class labels (cost-minimizing when costs are given).
predict_proba(X)Class probabilities in the order of
classes_.score(X, y[, sample_weight])Return accuracy on provided data and labels.
set_fit_request(*[, sample_weight, ...])Configure whether metadata should be requested to be passed to the
fitmethod.set_params(**params)Set the parameters of this estimator.
set_score_request(*[, sample_weight])Configure whether metadata should be requested to be passed to the
scoremethod.to_dot()The fitted model in Graphviz DOT format.
to_json()The fitted model in the format saved by the guide-rs CLI.
to_text()The fitted model as indented text.