Technique Catalog¶
Every technique in amos, by the stage (worker) that usually uses it. A
technique is named in settings by the name in the first column, and its class
is in the module of its step (for example, random_forest is
amos.models.RandomForest). Each name links to its class in the API
reference. The advanced user guide
describes how techniques work, their parameters, and how to write your own.
Each technique is listed with the tool it wraps. Optional packages are only
imported when a technique that needs them is used (see the extras in the
overview). Most models do both tasks. The cat_boost encoder
(CatBoost-style target encoding, from category_encoders) is not the
catboost model.
Metrics are listed after the techniques. They are not
techniques, so they are not steps of a workflow: name one as a worker's
criterion, or in the metrics of a technique that uses them (such as
scorecard or a validator).
Pipelines are listed last. A pipeline is not a technique
either: it is a set of settings for the analyst, critic, and artist of a
study, which you name with pipeline (see pipeline).
Every model has a pipeline of its own for each task that it can do. The
pipeline chart shows the steps of every pipeline side by side.
Loaders (wrangler)¶
| Name | Description |
|---|---|
download |
Downloads a file from a URL, or a dataset from OpenML, and loads it. |
load_chunks |
Loads chosen rows and columns of a huge CSV file, a chunk at a time. |
load_file |
Loads a data file in any format that the clerk knows. |
load_files |
Loads a batch of files into one table. |
Parsers (wrangler)¶
| Name | Description |
|---|---|
parse_all |
Finds information in text with a rulebook. |
parse_categories |
Lists the value of every pattern that text matches, in order. |
parse_category |
Gives each text the value of the first pattern that it matches. |
parse_counts |
Counts the matches of a pattern in text. |
parse_fields |
Makes a column for each labeled section of text. |
parse_flags |
Flags whether text matches a pattern. |
parse_match |
Keeps the first match of a pattern in text (or the groups of a match). |
parse_matches |
Keeps every match of a pattern in text (or the groups of each match). |
parse_names |
Finds the names in text. |
parse_replace |
Replaces the matches of a pattern in text. |
parse_split |
Splits text into columns where a pattern matches. |
Cleaners (wrangler)¶
| Name | Description |
|---|---|
clean_booleans |
Turns text such as "yes" and "no" into booleans. |
clean_dates |
Turns text into dates. |
clean_numbers |
Turns text such as "$1,234.50" into numbers. |
drop_columns |
Removes columns. |
drop_constant |
Removes columns that have only one value (and so tell you nothing). |
drop_duplicates |
Removes rows that duplicate an earlier row. |
drop_missing |
Removes rows with missing values. |
filter_rows |
Keeps the rows that match a query, or a condition for each column. |
keep_columns |
Keeps only some columns. The label and groups are always kept. |
rename_columns |
Renames columns, including the label and groups of the dataset. |
Mungers (wrangler)¶
| Name | Description |
|---|---|
auto_categorize |
Makes columns with few unique values categorical. |
coalesce |
Takes the first value that is not missing from several columns. |
combine_flags |
Combines flags into one: whether any or all are true, or how many are. |
convert_types |
Changes the data types of columns. |
derive_columns |
Makes columns from expressions of other columns, such as "a / b". |
html_to_text |
Converts columns of HTML or XML to plain text. |
map_values |
Replaces values with others, such as "N/A" with a missing value. |
normalize_text |
Normalizes the spaces, case, accents, and punctuation of text. |
set_kinds |
Sets the kind of each column, with the smallest type that holds it. |
strip_text |
Trims spaces from text, and optionally makes it lowercase. |
Mergers (wrangler)¶
| Name | Description |
|---|---|
merge_keys |
Adds columns from another table's row that has the same keys. |
merge_nearest |
Adds columns from another table's row with the nearest date or number. |
merge_ranges |
Adds columns from another table's row whose range has a date or number. |
merge_summary |
Adds summaries of the rows of another table that have the same keys. |
Shapers (wrangler)¶
| Name | Description |
|---|---|
group_rows |
Makes one row for each group of rows, with summaries of its columns. |
lists_to_rows |
Makes a row for each item of a list, such as each author of a book. |
long_to_wide |
Spreads the rows of each group into columns, such as one for each year. |
wide_to_long |
Stacks columns into rows, such as a row for each year. |
Savers (wrangler)¶
| Name | Description |
|---|---|
save_data |
Saves the whole dataset, so that a later run can go on from it. |
Describers (explorer)¶
| Name | Description |
|---|---|
association_rules |
Finds rules of which values tend to appear in the same rows. |
correlations |
Tabulates the correlations between the numeric columns and the label. |
describe |
Tabulates pandas' description of every column, one row per column. |
distributions |
Finds the distribution that fits each column best, and its skew. |
frequencies |
Counts each value of the categorical columns, with its share. |
is_bernoulli |
Tests whether each column is a Bernoulli distribution (0s and 1s). |
is_beta |
Tests whether each column fits a beta distribution. |
is_bimodal |
Tests whether each column has more than one peak (Hartigan's dip test). |
is_binomial |
Tests whether each column fits a binomial distribution. |
is_exponential |
Tests whether each column fits an exponential distribution. |
is_left_skewed |
Tests whether each column is skewed to the left. |
is_log_normal |
Tests whether each column fits a log-normal distribution. |
is_normal |
Tests whether each column fits a normal distribution. |
is_poisson |
Tests whether each column fits a Poisson distribution. |
is_right_skewed |
Tests whether each column is skewed to the right. |
is_student |
Tests whether each column fits a Student's t distribution. |
is_uniform |
Tests whether each column fits a uniform distribution. |
kaplan_meier |
Estimates the share of rows still without an event over time. |
label_balance |
Counts each value of the label, with its share. |
missing_values |
Counts the missing values in each column, with their share. |
summarize |
Tabulates the summary statistics of numeric columns that papers report. |
Splitters (analyst)¶
| Name | Description |
|---|---|
group_split |
Keeps all of the rows of each group in the same set. |
stratified |
Splits at random, keeping the share of each class in both sets. |
time_split |
Uses the latest rows as the test set. |
train_test |
Splits the rows at random. |
Imputers (analyst)¶
| Name | Tool | Description |
|---|---|---|
iterative_impute |
sklearn. |
Fills missing values by modeling each feature from the others. |
knn_impute |
sklearn. |
Fills missing values with the average of the most similar rows. |
mean_impute |
sklearn. |
Fills missing values with the mean of the training rows. |
median_impute |
sklearn. |
Fills missing values with the median of the training rows. |
mode_impute |
sklearn. |
Fills missing values with the most common value of the training rows. |
Scalers (analyst)¶
| Name | Tool | Description |
|---|---|---|
binarize |
sklearn. |
Makes each feature 1 if it is above a threshold (0 by default). |
bins |
sklearn. |
Sorts each feature into bins with about the same number of rows. |
gauss |
sklearn. |
Makes each feature more like a normal distribution (Yeo-Johnson). |
max_abs |
sklearn. |
Divides each feature by its largest absolute value. |
min_max |
sklearn. |
Rescales each feature to the range from 0 to 1. |
normalize |
sklearn. |
Rescales each row to a length of 1. |
quantile |
sklearn. |
Replaces each value with its quantile in the training rows. |
robust |
sklearn. |
Centers on the median and scales by the interquartile range. |
standard |
sklearn. |
Centers each feature on 0 with a standard deviation of 1. |
Encoders (analyst)¶
| Name | Tool | Description |
|---|---|---|
backward_difference |
category_encoders. |
Compares each category to the one before it. |
base_n |
category_encoders. |
Writes the number of each category in base N (4 by default). |
binary |
category_encoders. |
Writes the number of each category in binary digits. |
cat_boost |
category_encoders. |
Target encoding in the manner of CatBoost, which limits leakage. |
count |
category_encoders. |
Replaces each category with how often it is in the training rows. |
date_parts |
skrub. |
Splits dates and times into parts: year, month, day, and so on. |
gap |
skrub. |
Encodes messy text as a mix of topics of its substrings. |
hashing |
category_encoders. |
Hashes the categories into a fixed number of columns. |
helmert |
category_encoders. |
Compares each category to the mean of the categories before it. |
james_stein |
category_encoders. |
Target encoding shrunk toward the overall mean (James-Stein). |
leave_one_out |
category_encoders. |
Target encoding that leaves out each row's own label. |
m_estimate |
category_encoders. |
Target encoding shrunk toward the overall mean by m rows. |
min_hash |
skrub. |
Encodes messy text by hashing its substrings, which is fast and robust. |
one_hot |
sklearn. |
Makes a column of 0s and 1s for each category (dummy variables). |
ordinal |
sklearn. |
Numbers the categories (0, 1, 2, ...) in sorted order. |
polynomial_coding |
category_encoders. |
Contrasts categories as an ordered (polynomial) sequence. |
sum_coding |
category_encoders. |
Compares each category to the mean of all categories (effect coding). |
target |
category_encoders. |
Replaces each category with the mean label of its training rows. |
tfidf |
skrub. |
Encodes text by the TF-IDF of its substrings, reduced with SVD. |
weight_of_evidence |
category_encoders. |
Replaces each category with its weight of evidence (binary labels). |
Mixers (analyst)¶
| Name | Tool | Description |
|---|---|---|
interactions |
sklearn. |
Adds the product of each pair of features, or of the terms of formulas. |
polynomial |
sklearn. |
Adds the squares and products of the features (degree 2 by default). |
splines |
sklearn. |
Replaces each feature with a set of spline curves. |
Selectors (analyst)¶
| Name | Tool | Description |
|---|---|---|
exhaustive_selection |
mlxtend. |
Keeps the best of every set of 1 to 3 features (by cross-validation). |
feature_group |
Keeps the features that the settings list, and removes the others. | |
generic_univariate |
sklearn. |
Keeps the features most related to the label, by a mode it is given. |
k_best |
sklearn. |
Keeps the k features (10 by default) most related to the label. |
recursive_elimination |
sklearn. |
Removes the least important feature of a model, again and again. |
recursive_elimination_cv |
sklearn. |
Removes features as recursive_elimination does, keeping the best. |
select_fdr |
sklearn. |
Keeps the features related to the label, controlling false discovery. |
select_fpr |
sklearn. |
Keeps the features related to the label, controlling false positives. |
select_from_model |
sklearn. |
Keeps the features that a model finds most important. |
select_fwe |
sklearn. |
Keeps the features related to the label, controlling family-wise error. |
select_percentile |
sklearn. |
Keeps the features (50% by default) most related to the label. |
sequential_selection |
mlxtend. |
Adds (or removes) features one at a time while the score improves. |
sequential_selection_sk |
sklearn. |
Adds (or removes) features one at a time until it keeps enough. |
variance_threshold |
sklearn. |
Removes features whose variance is at or below a threshold (0). |
Reducers (analyst)¶
| Name | Tool | Description |
|---|---|---|
pca_reduce |
sklearn. |
Replaces the features with their principal components. |
Samplers (analyst)¶
| Name | Tool | Description |
|---|---|---|
adasyn |
imblearn. |
Adds synthetic rows where the rare class is hardest to learn. |
borderline_smote |
imblearn. |
Adds synthetic rows near the border between the classes. |
near_miss |
imblearn. |
Removes rows of the common classes that are far from the rare rows. |
random_over |
imblearn. |
Duplicates random rows of the rare classes. |
random_under |
imblearn. |
Removes random rows of the common classes. |
smote |
imblearn. |
Adds synthetic rows between rare rows and their nearest neighbors. |
smote_enn |
imblearn. |
Applies smote and then removes rows that their neighbors misclassify. |
smote_tomek |
imblearn. |
Applies smote and then removes Tomek links. |
tomek_links |
imblearn. |
Removes rows of the common class that are paired with rare rows. |
Pretests (analyst)¶
| Name | Description |
|---|---|
check_assumptions |
Checks every assumption and need of the techniques that has a pretest. |
check_continuity |
Checks whether rows bunch on one side of a cutoff. |
check_dispersion |
Checks whether counts vary as a Poisson model assumes. |
check_features |
Checks whether the features have missing values or are not numbers. |
check_instrument |
Checks whether an instrument is strong enough. |
check_label |
Checks whether the label is the kind that techniques are for. |
check_linearity |
Checks whether the label (or its log-odds) is linear in the features. |
check_missingness |
Checks whether values are missing completely at random. |
check_multicollinearity |
Checks whether any feature is nearly a linear function of the others. |
check_normality |
Checks whether the errors of a regression and the features are normal. |
check_overlap |
Checks whether every row could have been treated or not. |
check_parallel_trends |
Checks whether treated units trended differently before treatment. |
check_proportional_odds |
Checks whether features have the same effect at every cutoff. |
check_sample_size |
Checks whether there are enough (or too many) rows and features. |
check_scales |
Checks whether the features are on similar scales. |
check_stationarity |
Checks whether each time series is stationary. |
Models (analyst)¶
| Name | Classify | Regress | Description |
|---|---|---|---|
adaboost |
sklearn. |
sklearn. |
Fits AdaBoost: small trees in sequence, each correcting the last. |
bambi |
amos. |
amos. |
Fits a Bayesian regression (with random intercepts) with Bambi. |
baseline |
sklearn. |
sklearn. |
Predicts the most common class (or the mean) for every row. |
binomial_bayes_mixedglm |
amos. |
Fits a Bayesian logistic regression with a random intercept per group. | |
catboost |
catboost. |
catboost. |
Fits CatBoost gradient boosting, which handles categorical features. |
cox |
amos. |
Fits a Cox proportional hazards regression of the time until an event. | |
decision_tree |
sklearn. |
sklearn. |
Fits a single decision tree. |
elastic_net |
sklearn. |
Fits a linear regression with both lasso and ridge penalties. | |
explainable_boosting |
interpret. |
interpret. |
Fits an Explainable Boosting Machine from InterpretML. |
extra_trees |
sklearn. |
sklearn. |
Fits an ensemble of extremely randomized trees. |
fixest |
amos. |
amos. |
Fits a regression with fixed effects and clustered standard errors. |
gee |
amos. |
amos. |
Fits generalized estimating equations from statsmodels, with inference. |
generalized_poisson |
amos. |
Fits a generalized Poisson regression of counts, with inference. | |
glm |
amos. |
amos. |
Fits a generalized linear model from statsmodels, with inference. |
gpboost |
amos. |
amos. |
Fits GPBoost: gradient boosting with random effects for groups. |
gradient_boosting |
sklearn. |
sklearn. |
Fits histogram-based gradient boosting from scikit-learn. |
knn |
sklearn. |
sklearn. |
Predicts from the k nearest training rows (5 by default). |
lasso |
sklearn. |
Fits a linear regression with a lasso (L1) penalty. | |
lightgbm |
lightgbm. |
lightgbm. |
Fits LightGBM gradient boosting. |
linear |
sklearn. |
Fits an ordinary least squares regression from scikit-learn. | |
logit |
sklearn. |
Fits a logistic regression from scikit-learn. | |
logit_sm |
amos. |
Fits a logistic regression from statsmodels, with inference. | |
mixedlm |
amos. |
Fits a linear mixed model from statsmodels, with inference. | |
mnlogit |
amos. |
Fits a multinomial logistic regression from statsmodels, with inference. | |
naive_bayes |
sklearn. |
Fits a Gaussian naive Bayes classifier. | |
negative_binomial |
amos. |
Fits a negative binomial regression of counts, with inference. | |
neural_network |
sklearn. |
sklearn. |
Fits a multi-layer perceptron (a simple neural network). |
ols |
amos. |
Fits ordinary least squares from statsmodels, with inference. | |
ordinal_regression |
amos. |
Fits an ordinal regression (ordered logit or probit) from statsmodels. | |
poisson |
amos. |
Fits a Poisson regression of counts (such as the number of visits). | |
probit |
amos. |
Fits a probit regression of two classes from statsmodels, with inference. | |
pymc |
amos. |
amos. |
Fits Bayesian additive regression trees (BART) with PyMC. |
quantile_regression |
amos. |
Fits a quantile regression from statsmodels, with inference. | |
random_forest |
sklearn. |
sklearn. |
Fits a random forest. |
ridge |
sklearn. |
Fits a linear regression with a ridge (L2) penalty. | |
robust_regression |
amos. |
Fits a robust linear regression from statsmodels, with inference. | |
svm |
sklearn. |
sklearn. |
Fits a support vector machine (with probabilities for classification). |
tabpfn |
tabpfn. |
tabpfn. |
Fits TabPFN, a pretrained model that is often best on small data. |
wls |
amos. |
Fits weighted least squares from statsmodels, with inference. | |
xgboost |
xgboost. |
xgboost. |
Fits XGBoost gradient boosting. |
zero_inflated_poisson |
amos. |
Fits a zero-inflated Poisson regression of counts, with inference. |
Validators (analyst)¶
| Name | Tool | Description |
|---|---|---|
group_k_fold |
sklearn. |
Folds that keep all of the rows of each group in the same fold. |
group_shuffle_split |
sklearn. |
Repeated random splits of the groups (not the rows) into two sets. |
k_fold |
sklearn. |
Divides the rows into folds ("n_splits", 5 by default) at random. |
leave_one_group_out |
sklearn. |
Scores each group with a copy of the model fitted to the other groups. |
leave_one_row_out |
sklearn. |
Predicts each row with a copy of the model fitted to every other row. |
repeated_k_fold |
sklearn. |
k_fold repeated with different random folds ("n_repeats" times). |
repeated_stratified_k_fold |
sklearn. |
stratified_k_fold repeated with different random folds. |
shuffle_split |
sklearn. |
Repeated random splits of the rows into two sets (Monte Carlo). |
stratified_group_k_fold |
sklearn. |
Folds that keep each group together and the classes in proportion. |
stratified_k_fold |
sklearn. |
Folds that keep the share of each class the same in every fold. |
stratified_shuffle_split |
sklearn. |
Repeated random splits into two sets, with the classes in proportion. |
time_series_split |
sklearn. |
Scores later rows with copies of the model fitted to earlier rows. |
Evaluators (critic)¶
| Name | Description |
|---|---|
bias_variance |
Splits the model's expected test error into bias and variance. |
classification_report |
Tabulates the precision, recall, f1, and number of rows of each class. |
conformal |
Makes prediction intervals (or sets) with a known rate of coverage. |
confusion |
Counts how many rows of each class were predicted to be each class. |
explain_weights |
Tabulates eli5's explanation of the weights of the model's features. |
factor_analysis |
Finds the hidden factors that explain the correlations of features. |
fairness |
Compares how the model does for each group, with the gaps between them. |
feature_importance |
Tabulates the importance that the model itself gives each feature. |
pca |
Measures how much of the features' variance each principal component has. |
permutation_importance |
Measures how much the model's score drops when a feature is shuffled. |
regression_table |
Puts the estimates of every model side by side, ready to publish. |
scorecard |
Tabulates the results of every branch of an analysis, ready to publish. |
shap_importance |
Tabulates the mean absolute SHAP value of each feature. |
Audits (critic)¶
| Name | Description |
|---|---|
audit_assumptions |
Checks every assumption of the model that has an audit. |
audit_errors |
Checks whether the model's errors have constant variance. |
audit_independence |
Checks whether the model's errors are independent. |
audit_proportional_hazards |
Checks whether each feature's effect on a Cox model's hazard is constant. |
audit_residuals |
Checks whether the model's errors are normal. |
Inferers (critic)¶
| Name | Tool | Description |
|---|---|---|
difference_in_differences |
doubleml. |
Estimates a treatment's effect over time by difference-in-differences. |
distance_matching |
dowhy. |
Estimates an effect by matching treated rows with similar untreated ones. |
doubly_robust |
dowhy. |
Estimates an effect with a doubly robust estimator (augmented IPW). |
dr_learner |
causalml. |
Estimates a treatment's effect with a doubly robust learner. |
glm_adjustment |
dowhy. |
Estimates an effect with a generalized linear model of the label. |
instrumental_variable |
dowhy. |
Estimates an effect through an instrumental variable. |
interactive_iv |
doubleml. |
Estimates a treatment's effect on compliers, with an instrument (LATE). |
interactive_regression |
doubleml. |
Estimates the average effect of a treatment with two values. |
lpcmci |
tigramite. |
Finds causes in time series, allowing for hidden causes (LPCMCI). |
partially_linear |
doubleml. |
Estimates a treatment effect that is the same for every row. |
partially_linear_iv |
doubleml. |
Estimates a constant treatment effect with an instrument. |
partially_linear_panel |
doubleml. |
Estimates a constant treatment effect in a panel: units seen over time. |
partially_logistic |
doubleml. |
Estimates a treatment's effect on a label with two classes. |
pcmci |
tigramite. |
Finds which variables cause which others at later times (PCMCI). |
pcmci_plus |
tigramite. |
Finds causes at later times and at the same time (PCMCI+). |
potential_outcomes |
doubleml. |
Estimates the effect of each level of a treatment, against one of them. |
propensity_matching |
dowhy. |
Estimates an effect by matching rows on their propensity scores. |
propensity_stratification |
dowhy. |
Estimates an effect by comparing rows within strata of propensity. |
propensity_weighting |
dowhy. |
Estimates an effect by inverse propensity weighting. |
quantile_effects |
doubleml. |
Estimates a treatment's effects on quantiles of the label. |
regression_adjustment |
dowhy. |
Estimates an effect with a linear regression adjusted for the features. |
regression_discontinuity |
doubleml. |
Estimates a treatment's effect at a cutoff (regression discontinuity). |
s_learner |
causalml. |
Estimates effects with one model that includes the treatment (S-learner). |
sample_selection |
doubleml. |
Estimates a treatment's effect when the label is only sometimes seen. |
t_learner |
causalml. |
Estimates effects with a separate model for each group (T-learner). |
time_series_effect |
tigramite. |
Estimates the causal effect of one series (the treatment) on the label. |
tmle |
causalml. |
Estimates an average effect by targeted maximum likelihood (TMLE). |
x_learner |
causalml. |
Estimates effects with an X-learner, which suits a rare treatment. |
Plots (artist)¶
| Name | Description |
|---|---|
actual_vs_predicted |
Plots the label against the model's predictions (regression). |
association_rules_plot |
Plots each association rule's support and confidence, colored by lift. |
bias_variance_plot |
Plots the model's expected loss beside its bias and variance, as bars. |
box_plots |
Draws each numeric feature as a box, split by class. |
calibration_curve |
Plots the share of rows in each class against its predicted probability. |
causal_graph |
Draws the causal links that tigramite found, as a graph of the variables. |
classification_report_heatmap |
Draws the precision, recall, and f1 of each class as a heatmap. |
coefficient_plot |
Plots coefficients with their confidence intervals (a forest plot). |
confusion_heatmap |
Draws the confusion matrix as a heatmap (classification). |
correlation_heatmap |
Draws the correlations between the numeric columns as a heatmap. |
count_plots |
Plots the count of each value of each categorical feature, by class. |
decision_regions |
Shows the class that the model predicts across two features. |
det_curve |
Plots the detection error tradeoff (DET) curve (classification). |
distribution_fits |
Draws each column's histogram with a fitted distribution over it. |
distribution_plots |
Plots the distribution of every column, in a grid. |
estimates_plot |
Plots every model's estimates with their confidence intervals. |
fairness_plot |
Plots the model's fairness metrics for each group, as bars. |
frequency_plots |
Plots the share of the rows with each value of each column, in a grid. |
histograms |
Plots the distribution of each numeric feature, in a grid. |
importance_plot |
Plots the most important features, as horizontal bars. |
influence_plot |
Plots the influence of each training row on a statsmodels regression. |
label_plot |
Plots the label's distribution: a bar for each class, or a histogram. |
learning_curve |
Plots the model's score as it learns from more of the training rows. |
loadings_heatmap |
Shows how strongly each feature loads on each factor, as a heatmap. |
missing_bars |
Plots the share of each column's values that are missing, as bars. |
missing_heatmap |
Shows where values are missing, as a heatmap of the rows and columns. |
pair_plot |
Plots each pair of numeric features against each other, by class. |
partial_dependence |
Plots the model's average prediction as features change. |
precision_recall_curve |
Plots precision against recall at every threshold (classification). |
prediction_intervals |
Plots conformal prediction intervals of the test rows (or set sizes). |
qq_plot |
Plots the quantiles of the residuals against a normal distribution's. |
residual_plot |
Plots the model's errors against its predictions (regression). |
roc_curve |
Plots the receiver operating characteristic (ROC) curve (classification). |
scorecard_plot |
Plots each branch's score on each metric of a scorecard, as dots. |
scree_plot |
Plots the share of the variance that each principal component explains. |
search_plot |
Plots the cross-validated score of each try in a hyperparameter search. |
shap_bar |
Plots the mean absolute SHAP value of the most important features. |
shap_beeswarm |
Plots the SHAP value of each row for the most important features. |
shap_decision |
Plots how the features move each row's prediction, as lines. |
shap_embedding |
Plots the rows by their SHAP values, colored by one feature's. |
shap_force |
Shows how each feature pushes one row's prediction up or down. |
shap_group_difference |
Plots how the SHAP values of the features differ between two groups. |
shap_heatmap |
Draws the SHAP values of every explained row as a heatmap. |
shap_partial_dependence |
Plots the model's prediction as one feature changes, with each row's. |
shap_scatter |
Plots a feature's SHAP values against its values (a dependence plot). |
shap_violin |
Plots the distribution of the SHAP values of the most important features. |
shap_waterfall |
Shows how each feature moves one row's prediction (a waterfall plot). |
shape_functions |
Plots an explainable boosting model's contribution from each feature. |
survival_curves |
Plots the share of rows without an event over time (Kaplan-Meier). |
tree_feature_space |
Shows how a decision tree divides one or two features. |
tree_leaf_distributions |
Plots the label of the training rows in each leaf of a decision tree. |
tree_leaf_purity |
Plots the impurity of each leaf of a decision tree. |
tree_leaf_sizes |
Plots the number of training rows in each leaf of a decision tree. |
tree_plot |
Draws the splits of a decision tree (or of one tree of a forest). |
tree_prediction_path |
Shows how much each feature decides one row's path down a decision tree. |
validation_curve |
Plots the model's score as one of its parameters changes. |
weights_plot |
Plots the weights of the features that eli5 explains, as bars. |
Choosers (any stage)¶
| Name | Description |
|---|---|
auto |
Chooses the techniques of the step that it is in. |
auto_encoder |
Encodes each categorical feature in the way that suits it. |
auto_evaluator |
Applies the evaluators that suit the task and the model. |
auto_imputer |
Fills missing values in the ways that suit the features. |
auto_model |
Fits the best of the models whose needs and assumptions the data meets. |
auto_plot |
Draws the figures that suit the data and the model. |
auto_sampler |
Chooses a sampler that suits the classes and the features, or none. |
Metrics¶
| Name | Tool | Task | Better | Description |
|---|---|---|---|---|
accuracy |
sklearn. |
classify | higher | The share of rows classified correctly. |
average_precision |
sklearn. |
classify | higher | The area under the precision-recall curve. |
balanced_accuracy |
sklearn. |
classify | higher | The average share of each class classified correctly. |
brier |
sklearn. |
classify | lower | The mean squared error of the predicted probabilities (lower is better). |
cohen_kappa |
sklearn. |
classify | higher | Agreement between the predictions and labels beyond chance. |
concordance |
amos. |
regress | higher | How often the model orders pairs of times correctly (Harrell's C). |
demographic_parity |
fairlearn. |
classify | lower | The largest gap between groups in the share predicted to be positive. |
demographic_parity_ratio |
fairlearn. |
classify | higher | The smallest group's share predicted positive over the largest's. |
equal_opportunity |
fairlearn. |
classify | lower | The largest gap between groups in the true positive rate. |
equal_opportunity_ratio |
fairlearn. |
classify | higher | The smallest group's true positive rate over the largest's. |
equalized_odds |
fairlearn. |
classify | lower | The larger gap between groups in true or false positive rates. |
equalized_odds_ratio |
fairlearn. |
classify | higher | The smaller ratio between groups of true or false positive rates. |
explained_variance |
sklearn. |
regress | higher | The share of the variance of the label that the model explains. |
f1 |
sklearn. |
classify | higher | The harmonic mean of precision and recall. |
log_loss |
sklearn. |
classify | lower | The negative log-likelihood of the true labels (lower is better). |
mae |
sklearn. |
regress | lower | The mean absolute error (lower is better). |
mape |
sklearn. |
regress | lower | The mean absolute percentage error (lower is better). |
matthews |
sklearn. |
classify | higher | The Matthews correlation coefficient (phi for two classes). |
mse |
sklearn. |
regress | lower | The mean squared error (lower is better). |
precision |
sklearn. |
classify | higher | The share of rows predicted to be positive that are positive. |
r2 |
sklearn. |
regress | higher | The coefficient of determination (R squared). |
recall |
sklearn. |
classify | higher | The share of positive rows that are predicted to be positive. |
rmse |
sklearn. |
regress | lower | The root mean squared error (lower is better). |
roc_auc |
sklearn. |
classify | higher | The area under the receiver operating characteristic (ROC) curve. |
Pipelines¶
| Name | Task | Models | Analyst | Description |
|---|---|---|---|---|
adaboost_classification |
classify | adaboost |
split: stratified → impute: auto → encode: auto → sample: auto → model: adaboost | Classifies with AdaBoost, resampling rare classes. AdaBoost chases rows that it gets wrong, so noise and outliers sway it: a grid search tunes its learning rate, which tempers that. |
adaboost_regression |
regress | adaboost |
split: train_test → impute: auto → encode: auto → model: adaboost | Regresses with AdaBoost, which chases rows that it gets wrong (so outliers sway it), with a grid search of its learning rate and number of trees. |
bambi_classification |
classify | bambi |
split: group_split → impute: auto → encode: auto → model: bambi | Estimates the effects of the features on two classes with a Bayesian logit model with a random intercept for each group (Bambi), with the posterior of each coefficient, tested on groups that it has not seen. |
bambi_regression |
regress | bambi |
split: group_split → impute: auto → encode: auto → model: bambi | Estimates the effects of the features on a number with a Bayesian linear model with a random intercept for each group (Bambi), with the posterior of each coefficient, tested on groups that it has not seen. |
baseline_classification |
classify | baseline |
split: stratified → encode: auto → model: baseline | Predicts the most common class for every row: the score that every other model must beat, drawn beside the share of each class. |
baseline_regression |
regress | baseline |
split: train_test → encode: auto → model: baseline | Predicts the mean label for every row: the score that every other model must beat, drawn beside the distribution of the label. |
binomial_bayes_mixedglm_classification |
classify | binomial_bayes_mixedglm |
split: group_split → impute: auto → encode: auto → model: binomial_bayes_mixedglm | Estimates the effects of the features on two classes with a Bayesian logit model with a random intercept for each group, tested on groups that it has not seen. |
catboost_classification |
classify | catboost |
split: stratified → encode: auto → model: catboost | Classifies with CatBoost, which handles missing values itself and whose ordered boosting resists overfitting without a search, with the classes weighted by how rare they are. |
catboost_regression |
regress | catboost |
split: train_test → encode: auto → model: catboost | Regresses with CatBoost, which handles missing values itself and whose ordered boosting resists overfitting without a search. |
classification |
classify | logit, random_forest, gradient_boosting, baseline |
split: stratified → impute: auto → scale: standard → encode: auto → sample: auto → model: logit, random_forest, gradient_boosting, baseline | Predicts classes, comparing a logit model, a random forest, and gradient boosting by the Matthews correlation coefficient. |
classification_inference |
classify | ordinal_regression, logit_sm, mnlogit |
split: stratified → impute: auto → encode: auto → model: auto | Estimates the effects of the features on classes with a logit, multinomial logit, or ordinal model. |
count_inference |
regress | poisson, negative_binomial, zero_inflated_poisson |
split: train_test → impute: auto → encode: auto → model: auto | Estimates the effects of the features on counts with the Poisson, negative binomial, or zero-inflated Poisson model that suits their dispersion. |
count_regression |
regress | poisson, negative_binomial, random_forest, gradient_boosting, baseline |
split: train_test → impute: auto → scale: standard → encode: auto → model: poisson, negative_binomial, random_forest, gradient_boosting, baseline | Predicts counts, comparing Poisson and negative binomial regression with a random forest and gradient boosting fitted for counts, by RMSE. |
cox_regression |
regress | cox |
split: train_test → impute: auto → encode: auto → model: cox | Estimates the hazard ratios of the features for the time until an event with a Cox model, with Kaplan-Meier survival curves. Set "event" in the "cox_parameters" section. |
decision_tree_classification |
classify | decision_tree |
split: stratified → impute: auto → encode: auto → model: decision_tree | Classifies with one decision tree, drawn split by split. A single tree overfits, so a grid search limits its depth and the size of its leaves; the classes are weighted by rarity. |
decision_tree_regression |
regress | decision_tree |
split: train_test → impute: auto → encode: auto → model: decision_tree | Regresses with one decision tree, drawn split by split. A single tree overfits, so a grid search limits its depth and the size of its leaves. |
elastic_net_regression |
regress | elastic_net |
split: train_test → impute: auto → scale: standard → encode: auto → model: elastic_net | Regresses with both lasso and ridge penalties on standardized features, which suits correlated features, with a grid search of the strength and mix of the penalties. |
explainable_boosting_classification |
classify | explainable_boosting |
split: stratified → encode: auto → model: explainable_boosting | Classifies with an explainable boosting machine, which handles missing values and needs no scaling, with the shape function of each feature. Classes are not resampled, so the shapes show the real odds. |
explainable_boosting_regression |
regress | explainable_boosting |
split: train_test → encode: auto → model: explainable_boosting | Regresses with an explainable boosting machine, which handles missing values and needs no scaling, with the shape function of each feature. |
extra_trees_classification |
classify | extra_trees |
split: stratified → impute: auto → encode: auto → model: extra_trees | Classifies with 300 extremely randomized trees, which need no scaling, weighting the classes by how rare they are. |
extra_trees_regression |
regress | extra_trees |
split: train_test → impute: auto → encode: auto → model: extra_trees | Regresses with 300 extremely randomized trees, which need no scaling and vary less than a random forest. |
gee_classification |
classify | gee |
split: group_split → impute: auto → encode: auto → model: gee | Estimates the average effects of the features on two classes across groups with generalized estimating equations, which allow for exchangeable correlation within each group. |
gee_regression |
regress | gee |
split: group_split → impute: auto → encode: auto → model: gee | Estimates the average effects of the features on a number across groups with generalized estimating equations, which allow for exchangeable correlation within each group. |
generalized_poisson_regression |
regress | generalized_poisson |
split: train_test → impute: auto → encode: auto → model: generalized_poisson | Estimates the effects of the features on counts that vary more (or less) than a Poisson distribution allows, with generalized Poisson regression. |
glm_classification |
classify | glm |
split: stratified → impute: auto → encode: auto → model: glm | Estimates the effects of the features on two classes with a binomial generalized linear model, checking its calibration and influential rows. |
glm_regression |
regress | glm |
split: train_test → impute: auto → encode: auto → model: glm | Estimates the effects of the features on a number with a gaussian generalized linear model (set "family" for another), checking its errors and influential rows. |
gpboost_classification |
classify | gpboost |
split: group_split → encode: auto → model: gpboost | Classifies with GPBoost: gradient boosting fitted together with a random intercept for each group, which handles missing values itself, with a random search of its learning rate and tree size, tested on groups that it has not seen. |
gpboost_regression |
regress | gpboost |
split: group_split → encode: auto → model: gpboost | Regresses with GPBoost: gradient boosting fitted together with a random intercept for each group, which handles missing values itself, with a random search of its learning rate and tree size, tested on groups that it has not seen. |
gradient_boosting_classification |
classify | gradient_boosting |
split: stratified → encode: auto → model: gradient_boosting | Classifies with histogram gradient boosting, which handles missing values itself, with a random search of its learning rate, tree size, and penalty, weighting the classes by rarity. |
gradient_boosting_regression |
regress | gradient_boosting |
split: train_test → encode: auto → model: gradient_boosting | Regresses with histogram gradient boosting, which handles missing values itself, with a random search of its learning rate, tree size, and penalty. |
knn_classification |
classify | knn |
split: stratified → impute: auto → scale: standard → encode: auto → select: k_best → sample: auto → model: knn | Classifies by the nearest training rows on standardized features, keeping the 20 most related features (distances mean little in many dimensions) and resampling rare classes, with a grid search of the neighbors and their weights. |
knn_regression |
regress | knn |
split: train_test → impute: auto → scale: standard → encode: auto → select: k_best → model: knn | Regresses by the nearest training rows on standardized features, keeping the 20 most related features (distances mean little in many dimensions), with a grid search of the neighbors and their weights. |
lasso_regression |
regress | lasso |
split: train_test → impute: auto → scale: standard → encode: auto → model: lasso | Regresses with a lasso penalty on standardized features, which drops weak features, with a grid search of the penalty. |
lightgbm_classification |
classify | lightgbm |
split: stratified → encode: auto → model: lightgbm | Classifies with LightGBM, which handles missing values itself, with a random search of its learning rate, leaves, and penalties, weighting the classes by how rare they are. |
lightgbm_regression |
regress | lightgbm |
split: train_test → encode: auto → model: lightgbm | Regresses with LightGBM, which handles missing values itself, with a random search of its learning rate, leaves, and penalties. |
linear_regression |
regress | linear |
split: train_test → impute: auto → encode: auto → model: linear | Regresses by ordinary least squares (scikit-learn), encoding categories against a reference level so the dummy variables are not collinear, and checking its errors with a Q-Q plot. |
logit_classification |
classify | logit |
split: stratified → impute: auto → scale: standard → encode: auto → model: logit | Classifies with a penalized logit model on standardized features, weighting the classes by how rare they are, with a grid search of the penalty. |
logit_sm_classification |
classify | logit_sm |
split: stratified → impute: auto → encode: auto → model: logit_sm | Estimates the effects of the features on two classes with a logit model, checking that its probabilities are calibrated. |
mixedlm_regression |
regress | mixedlm |
split: group_split → impute: auto → encode: auto → model: mixedlm | Estimates the effects of the features on a number with a linear mixed model, with a random intercept for each group, tested on groups that it has not seen. |
mnlogit_classification |
classify | mnlogit |
split: stratified → impute: auto → encode: auto → model: mnlogit | Estimates the effects of the features on three or more classes with a multinomial logit model, each class compared with the reference class. |
naive_bayes_classification |
classify | naive_bayes |
split: stratified → impute: auto → scale: gauss → encode: auto → sample: auto → model: naive_bayes | Classifies with Gaussian naive Bayes, after making the features more normal (as it assumes) and resampling rare classes, checking its probabilities, which are often poorly calibrated. |
negative_binomial_regression |
regress | negative_binomial |
split: train_test → impute: auto → encode: auto → model: negative_binomial | Estimates the effects of the features on counts that vary more than a Poisson distribution allows (overdispersion), with negative binomial regression. |
neural_network_classification |
classify | neural_network |
split: stratified → impute: auto → scale: standard → encode: auto → sample: auto → model: neural_network | Classifies with a neural network on standardized features, stopping early to avoid overfitting and resampling rare classes, with a grid search of its penalty and learning rate and a learning curve. |
neural_network_regression |
regress | neural_network |
split: train_test → impute: auto → scale: standard → encode: auto → model: neural_network | Regresses with a neural network on standardized features, stopping early to avoid overfitting, with a grid search of its penalty and learning rate and a learning curve. |
ols_regression |
regress | ols |
split: train_test → impute: auto → encode: auto → model: ols | Estimates the effects of the features on a number by ordinary least squares, checking its normal errors (Q-Q plot), equal variance (residuals), and influential rows. |
ordinal_inference |
classify | ordinal_regression |
split: stratified → impute: auto → encode: auto → model: ordinal_regression | Estimates the effects of the features on ordered classes with an ordered logit model. |
panel_classification |
classify | fixest |
split: stratified → impute: auto → encode: auto → model: fixest | Estimates the effects of the features on classes in panel data with a fixed effects logit model and standard errors clustered by group. |
panel_regression |
regress | fixest |
split: train_test → impute: auto → encode: auto → model: fixest | Estimates the effects of the features on a number in panel data with a fixed effects model and standard errors clustered by group. |
poisson_regression |
regress | poisson |
split: train_test → impute: auto → encode: auto → model: poisson | Estimates the effects of the features on counts with Poisson regression, which assumes that their variance equals their mean (the residuals show if it does not). |
probit_classification |
classify | probit |
split: stratified → impute: auto → encode: auto → model: probit | Estimates the effects of the features on two classes with a probit model, checking that its probabilities are calibrated. |
pymc_classification |
classify | pymc |
split: stratified → impute: auto → encode: auto → model: pymc | Classifies with Bayesian additive regression trees (PyMC), which need no scaling and find curves and interactions themselves, explained by the share of their splits on each feature. |
pymc_regression |
regress | pymc |
split: train_test → impute: auto → encode: auto → model: pymc | Regresses with Bayesian additive regression trees (PyMC), which need no scaling and find curves and interactions themselves, explained by the share of their splits on each feature. |
quantile_inference |
regress | quantile_regression |
split: train_test → impute: auto → encode: auto → model: quantile_regression | Estimates the effects of the features on the median of the label, which outliers and skewed errors sway less than the mean. |
random_forest_classification |
classify | random_forest |
split: stratified → impute: auto → encode: auto → model: random_forest | Classifies with a random forest of 300 trees, which needs no scaling, weighting the classes in the sample of each tree by how rare they are. |
random_forest_regression |
regress | random_forest |
split: train_test → impute: auto → encode: auto → model: random_forest | Regresses with a random forest of 300 trees, which needs no scaling. |
regression |
regress | ridge, random_forest, gradient_boosting, baseline |
split: train_test → impute: auto → scale: standard → encode: auto → model: ridge, random_forest, gradient_boosting, baseline | Predicts a number, comparing ridge regression, a random forest, and gradient boosting by RMSE. |
regression_inference |
regress | robust_regression, ols |
split: train_test → impute: auto → encode: auto → model: auto | Estimates the effects of the features on a number with ordinary least squares, or robust regression for errors with outliers. |
ridge_regression |
regress | ridge |
split: train_test → impute: auto → scale: standard → encode: auto → model: ridge | Regresses with a ridge penalty on standardized features, which steadies the coefficients of correlated features, with a grid search of the penalty. |
robust_inference |
regress | robust_regression |
split: train_test → impute: auto → encode: auto → model: robust_regression | Estimates the effects of the features on a number with robust regression, which gives less weight to rows with outlying errors. |
svm_classification |
classify | svm |
split: stratified → impute: auto → scale: standard → encode: auto → model: svm | Classifies with a support vector machine on standardized features, weighting the classes by how rare they are, with a grid search of its penalty and kernel width. It is slow with more than about 10,000 rows. |
svm_regression |
regress | svm |
split: train_test → impute: auto → scale: standard → encode: auto → model: svm | Regresses with a support vector machine on standardized features, with a grid search of its penalty and kernel width. It is slow with more than about 10,000 rows. |
tabpfn_classification |
classify | tabpfn |
split: stratified → encode: auto → model: tabpfn | Classifies with TabPFN, which fills, scales, and weighs the features itself. It suits up to about 10,000 rows and 500 features. |
tabpfn_regression |
regress | tabpfn |
split: train_test → encode: auto → model: tabpfn | Regresses with TabPFN, which fills, scales, and weighs the features itself. It suits up to about 10,000 rows and 500 features. |
wls_regression |
regress | wls |
split: train_test → impute: auto → encode: auto → model: wls | Estimates the effects of the features on a number by weighted least squares, for errors whose variance differs from row to row. Set "weights" in the "wls_parameters" section. |
xgboost_classification |
classify | xgboost |
split: stratified → encode: auto → sample: auto → model: xgboost | Classifies with XGBoost, which handles missing values itself, resampling rare classes, with a random search of its learning rate, depth, and sampling of rows and features. |
xgboost_regression |
regress | xgboost |
split: train_test → encode: auto → model: xgboost | Regresses with XGBoost, which handles missing values itself, with a random search of its learning rate, depth, and sampling of rows and features. |
zero_inflated_poisson_regression |
regress | zero_inflated_poisson |
split: train_test → impute: auto → encode: auto → model: zero_inflated_poisson | Estimates the effects of the features on counts with more zeros than a Poisson distribution has, with zero-inflated Poisson regression. |