Python API
Generated from miter 0.1.0 by docs/scripts/api_reference.py.
miter.MiterRegressor
Section titled “miter.MiterRegressor”Gradient-boosted decision tree regressor (L2 loss).
miter.MiterRegressor( *, n_estimators: int = 5000, learning_rate: float = 0.05, num_leaves: int = 31, max_depth: int = -1, grow_policy: str = 'symmetric', min_data_in_leaf: int | None = None, min_sum_hessian_in_leaf: float = 0.001, lambda_l2: float | None = None, min_gain_to_split: float = 0.0, max_bin: int = 255, max_cat_to_onehot: int = 4, min_data_per_group: int = 100, max_categories: int = 253, cat_smooth: float = 10.0, cat_l2: float = 10.0, max_cat_threshold: int = 32, m_mult: int | None = None, k_proj: int = 0, preset: str = 'default', feature_fraction: float = 1.0, bagging_fraction: float = 1.0, extra_trees: bool = False, oblique_min_distinct: int = 0, oblique_sample_rows: int = 65536, efb: bool = True, oblique_binary_penalty: float = 0.0, oblique_gain_margin: float = 0.0, robust: bool = False, cat_mode: str = 'k1', cat_oblique_ts: bool = False, cat_ts_smooth: float = 10.0, max_ctr_complexity: int | str = 0, ctr_prior_weight: float = 1.0, ctr_n_permutations: int = 1, ctr_max_borders: int = 15, ctr_model_size_reg: float = 0.5, quantizer: str = 'linear', early_stopping_rounds: int | None = 50, time_limit: float | None = None, n_jobs: int = -1, random_state: int = 0,) -> NoneSee Parameters for what each parameter does.
MiterRegressor.fit
Section titled “MiterRegressor.fit”MiterRegressor.fit( X: Any, y: Any, *, sample_weight: Any = None, eval_set: Sequence[tuple[Any, Any]] | None = None, categorical_feature: str | Sequence[int | str] | None = 'auto',) -> MiterRegressorTrain the model. eval_set=[(X_val, y_val)] enables early stopping (early_stopping_rounds); without it all n_estimators trees are built. categorical_feature takes indices or column names; "auto" uses pandas category columns.
MiterRegressor.predict
Section titled “MiterRegressor.predict”MiterRegressor.predict(X: Any, num_iteration: int | None = None) -> NDArray[np.float64]Predictions (regression: values; classification: class labels). num_iteration uses the first trees only (default: the best iteration).
MiterRegressor.save_model
Section titled “MiterRegressor.save_model”MiterRegressor.save_model(path: str) -> NoneWrite the model as miter JSON. Loading it gives bit-identical predictions.
MiterRegressor.load_model
Section titled “MiterRegressor.load_model”MiterRegressor.load_model(path: str) -> MiterRegressorClass method: read a model written by save_model. A classifier’s labels come back as 0..K-1; pickle keeps the original labels.
MiterRegressor.get_params
Section titled “MiterRegressor.get_params”MiterRegressor.get_params(self: _BaseMiterEstimator, deep: bool = True) -> dict[str, Any]scikit-learn: the constructor parameters.
MiterRegressor.set_params
Section titled “MiterRegressor.set_params”MiterRegressor.set_params(self: _BaseMiterEstimator, **params: Any) -> _BaseMiterEstimatorscikit-learn: set constructor parameters.
Fitted attributes
Section titled “Fitted attributes”| attribute | meaning |
|---|---|
best_iteration_ |
Number of trees kept (the best validation iteration with early stopping). |
feature_importances_ |
Split counts per input feature (oblique splits count for each feature they use). |
feature_importances_gain_ |
Total gain per input feature. |
n_features_in_ |
Number of features seen in fit. |
feature_names_in_ |
Column names seen in fit (DataFrame input only). |
train_loss_ |
Training loss after each iteration. |
val_loss_ |
Validation loss after each iteration (with eval_set). |
miter.MiterClassifier
Section titled “miter.MiterClassifier”Gradient-boosted decision tree classifier (binary log-loss and multiclass softmax).
miter.MiterClassifier( *, n_estimators: int = 5000, learning_rate: float = 0.05, num_leaves: int = 31, max_depth: int = -1, grow_policy: str = 'symmetric', min_data_in_leaf: int | None = None, min_sum_hessian_in_leaf: float = 0.001, lambda_l2: float | None = None, min_gain_to_split: float = 0.0, max_bin: int = 255, max_cat_to_onehot: int = 4, min_data_per_group: int = 100, max_categories: int = 253, cat_smooth: float = 10.0, cat_l2: float = 10.0, max_cat_threshold: int = 32, m_mult: int | None = None, k_proj: int = 0, preset: str = 'default', feature_fraction: float = 1.0, bagging_fraction: float = 1.0, extra_trees: bool = False, oblique_min_distinct: int = 0, oblique_sample_rows: int = 65536, efb: bool = True, oblique_binary_penalty: float = 0.0, oblique_gain_margin: float = 0.0, robust: bool = False, cat_mode: str = 'k1', cat_oblique_ts: bool = False, cat_ts_smooth: float = 10.0, max_ctr_complexity: int | str = 0, ctr_prior_weight: float = 1.0, ctr_n_permutations: int = 1, ctr_max_borders: int = 15, ctr_model_size_reg: float = 0.5, quantizer: str = 'linear', early_stopping_rounds: int | None = 50, time_limit: float | None = None, n_jobs: int = -1, random_state: int = 0,) -> NoneSee Parameters for what each parameter does.
MiterClassifier.fit
Section titled “MiterClassifier.fit”MiterClassifier.fit( X: Any, y: Any, *, sample_weight: Any = None, eval_set: Sequence[tuple[Any, Any]] | None = None, categorical_feature: str | Sequence[int | str] | None = 'auto',) -> MiterClassifierTrain the model. eval_set=[(X_val, y_val)] enables early stopping (early_stopping_rounds); without it all n_estimators trees are built. categorical_feature takes indices or column names; "auto" uses pandas category columns.
MiterClassifier.predict
Section titled “MiterClassifier.predict”MiterClassifier.predict(X: Any, num_iteration: int | None = None) -> NDArray[Any]Predictions (regression: values; classification: class labels). num_iteration uses the first trees only (default: the best iteration).
MiterClassifier.predict_proba
Section titled “MiterClassifier.predict_proba”MiterClassifier.predict_proba(X: Any, num_iteration: int | None = None) -> NDArray[np.float64]Class probabilities, shape (n, n_classes).
MiterClassifier.save_model
Section titled “MiterClassifier.save_model”MiterClassifier.save_model(path: str) -> NoneWrite the model as miter JSON. Loading it gives bit-identical predictions.
MiterClassifier.load_model
Section titled “MiterClassifier.load_model”MiterClassifier.load_model(path: str) -> MiterClassifierClass method: read a model written by save_model. A classifier’s labels come back as 0..K-1; pickle keeps the original labels.
MiterClassifier.get_params
Section titled “MiterClassifier.get_params”MiterClassifier.get_params(self: _BaseMiterEstimator, deep: bool = True) -> dict[str, Any]scikit-learn: the constructor parameters.
MiterClassifier.set_params
Section titled “MiterClassifier.set_params”MiterClassifier.set_params(self: _BaseMiterEstimator, **params: Any) -> _BaseMiterEstimatorscikit-learn: set constructor parameters.
Fitted attributes
Section titled “Fitted attributes”| attribute | meaning |
|---|---|
best_iteration_ |
Number of trees kept (the best validation iteration with early stopping). |
feature_importances_ |
Split counts per input feature (oblique splits count for each feature they use). |
feature_importances_gain_ |
Total gain per input feature. |
n_features_in_ |
Number of features seen in fit. |
feature_names_in_ |
Column names seen in fit (DataFrame input only). |
classes_ |
Class labels (classifier only). |
train_loss_ |
Training loss after each iteration. |
val_loss_ |
Validation loss after each iteration (with eval_set). |
Build information
Section titled “Build information”| function | returns |
|---|---|
miter.has_openmp() |
whether the library was built with OpenMP |
miter.openmp_max_threads() |
the number of threads n_jobs=-1 uses |
miter.lignum_linked() |
whether predictions run through lignum |
miter.__version__ |
the package version |