You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The maximum number of boosting steps. If validation error does not flatten out at the end of the ***m***th boosting step, then try increasing it (or alternatively increase the learning rate).
9
+
10
+
#### v (default = 0.1)
11
+
The learning rate. Must be greater than zero and not more than one. The higher the faster the algorithm learns and the lower ***m*** is required. However, empirical evidence suggests that ***v <= 0.1*** gives better results. If the algorithm learns too fast (requires few boosting steps to converge) then try lowering the learning rate. Computational costs can be reduced by increasing the learning rate while simultaneously decreasing ***m***, potentially at the expense of predictiveness.
12
+
13
+
#### random_state (default = 0)
14
+
Used to randomly split training observations into training and validation if ***validation_set_indexes*** is not specified when fitting.
15
+
16
+
#### n_jobs (default = 0)
17
+
Multi-threading parameter. If ***0*** then uses all available cores for multi-threading. Any other positive integer specifies the number of cores to use (***1*** means single-threading).
18
+
19
+
#### validation_ratio (default = 0.2)
20
+
The ratio of training observations to use for validation instead of training. The number of boosting steps is automatically tuned to minimize validation error.
21
+
22
+
#### bins (default = 300)
23
+
Specifies the maximum number of bins to discretize the data into when searching for the best split. The default value works well according to empirical results. This hyperparameter is intended for reducing computational costs. Must be greater than 1.
24
+
25
+
#### verbosity (default = 0)
26
+
***0*** does not print progress reports during fitting. ***1*** prints a summary after running the ***fit*** method. ***2*** prints a summary after each boosting step.
27
+
28
+
#### max_interaction_level (default = 1)
29
+
Specifies the maximum allowed depth of interaction terms. ***0*** means that interactions are not allowed. This hyperparameter should be tuned.
30
+
31
+
#### max_interactions (default = 100000)
32
+
The maximum number of interactions allowed. A lower value may be used to reduce computational time.
33
+
34
+
#### min_observations_in_split (default = 20)
35
+
The minimum effective number of observations that a term in the model must rely on. This hyperparameter should be tuned. Larger values are more appropriate for larger datasets. Larger values result in more robust models (lower variance), potentially at the expense of increased bias.
Controls how many boosting steps a term that becomes ineligible has to remain ineligible. The default value works well according to empirical results. This hyperparameter is intended for reducing computational costs.
39
+
40
+
#### max_eligible_terms (default = 5)
41
+
Limits 1) the number of terms already in the model that can be considered as interaction partners in a boosting step and 2) how many terms remain eligible in the next boosting step. The default value works well according to empirical results. This hyperparameter is intended for reducing computational costs.
An optional numpy vector with sample weights. If not specified then the observations are weighted equally.
58
+
59
+
#### X_names
60
+
An optional list of strings containing names for each predictor in ***X***. Naming predictors may increase model readability because model terms get names based on ***X_names***.
61
+
62
+
#### validation_set_indexes
63
+
An optional list of integers specifying the indexes of observations to be used for validation instead of training. If this is specified then ***validation_ratio*** is not used. Specifying ***validation_set_indexes*** may be useful for example when modelling time series data (you can place more recent observations in the validation set).
64
+
65
+
#### prioritized_predictors_indexes
66
+
An optional list of integers specifying the indexes of predictors (columns) in ***X*** that should be prioritized. Terms of the prioritized predictors will enter the model as long as they reduce the training error and do not contain too few effective observations. They will also be updated more often.
67
+
68
+
#### monotonic_constraints
69
+
An optional list of integers specifying monotonic constraints on model terms. For example, if there are three predictors in ***X***, then monotonic_constraints = [1,0,-1] means that 1) the first predictor in ***X*** cannot be used in interaction terms as a secondary effect and all terms using the first predictor in ***X*** as a main effect must have positive regression coefficients, 2) there are no monotonic constraints on terms using the second predictor in ***X***, and 3) the third predictor in ***X*** cannot be used in interaction terms as a secondary effect and all terms using the third predictor in ***X*** as a main effect must have negative regression coefficients.
70
+
71
+
#### interaction_constraints
72
+
An optional list of integers specifying interaction constraints on model terms. For example, if there are three predictors in ***X***, then interaction_constraints = [1,0,2] means that 1) the first predictor in ***X*** cannot be used in interaction terms as a secondary effect, 2) there are no interaction constraints on terms using the second predictor in ***X***, and 3) the third predictor in ***X*** cannot be used in any interaction terms.
***Returns a numpy matrix containing predictions of the data in X. Requires that the model has been fitted with the fit method.***
78
+
79
+
### Parameters
80
+
81
+
#### X
82
+
A numpy matrix with predictor values.
83
+
84
+
#### cap_predictions_to_minmax_in_training
85
+
If ***True*** then for each underlying logit model the predictions are capped so that they are not less than the minimum and not greater than the maximum prediction or response in the training dataset.
***Returns a list of strings containing predictions of the data in X. An observation is classified to the category with the highest predicted class probability. Requires that the model has been fitted with the fit method.***
91
+
92
+
### Parameters
93
+
Parameters are the same as in ***predict_class_probabilities()***.
***Returns a numpy matrix containing local feature importance for new data by each predictor in X.***
99
+
100
+
### Parameters
101
+
102
+
#### X
103
+
A numpy matrix with predictor values.
104
+
105
+
106
+
## Method: get_categories()
107
+
108
+
***Returns a list containing the names of each category.***
109
+
110
+
111
+
## Method: get_logit_model(category:str)
112
+
113
+
***Returns the logit model (of type APLRRegressor) that predicts whether an observation belongs to class ***category*** or not. The logit model can be used for example to inspect which terms are in the model.***
114
+
115
+
### Parameters
116
+
117
+
#### category
118
+
A string specifying the label of the category.
119
+
120
+
121
+
## Method: get_validation_indexes()
122
+
123
+
***Returns a list of integers containing the indexes of the training data observations used for validation and not training.***
124
+
125
+
126
+
## Method: get_validation_error_steps()
127
+
128
+
***Returns a numpy vector containing the validation error by boosting step (average of log loss for each underlying logit model). Use this to determine if the maximum number of boosting steps (m) or learning rate (v) should be changed.***
129
+
130
+
131
+
## Method: get_validation_error()
132
+
133
+
***Returns the validation error measured by the average of log loss for each underlying logit model.***
134
+
135
+
136
+
## Method: get_feature_importance()
137
+
138
+
***Returns a numpy vector containing the feature importance of each predictor, estimated on the validation set as an average of feature importances for the underlying logit models.***
Copy file name to clipboardExpand all lines: README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
Automatic Piecewise Linear Regression.
3
3
4
4
# About
5
-
Build predictive and interpretable parametric machine learning models in Python based on the Automatic Piecewise Linear Regression (APLR) methodology developed by Mathias von Ottenbreit. APLR is often able to compete with Random Forest on predictiveness, but unlike Random Forest and other tree-based methods APLR is interpretable. See the ***documentation*** folder for more information.
5
+
Build predictive and interpretable parametric regression or classification machine learning models in Python based on the Automatic Piecewise Linear Regression (APLR) methodology developed by Mathias von Ottenbreit. APLR is often able to compete with Random Forest on predictiveness, but unlike Random Forest and other tree-based methods APLR is interpretable. See the ***documentation*** folder for more information.
6
6
7
7
# How to install
8
8
***pip install aplr***
@@ -17,4 +17,4 @@ Please see the two example Python scripts in the ***examples*** folder. They cov
17
17
Please consider sponsoring Ottenbreit Data Science by clicking on the Sponsor button. Sufficient funding will enable maintenance of APLR and further development.
18
18
19
19
# API reference
20
-
Please see ***API_REFERENCE.md***
20
+
Please see ***API_REFERENCE_FOR_REGRESSION.md*** and ***API_REFERENCE_FOR_CLASSIFICATION.md***.
0 commit comments