This QIIME 2 plugin supports methods for supervised classification and regression of sample metadata, and other supervised machine learning methods.
- version:
2024.10.0
- website: https://
github .com /qiime2 /q2 -sample -classifier - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org - citations:
- Bokulich et al., 2018; Pedregosa et al., 2011
Actions¶
Name | Type | Short Description |
---|---|---|
regress-samples-ncv | method | Nested cross-validated supervised learning regressor. |
classify-samples-ncv | method | Nested cross-validated supervised learning classifier. |
fit-classifier | method | Fit a supervised learning classifier. |
fit-regressor | method | Fit a supervised learning regressor. |
predict-classification | method | Use trained classifier to predict target values for new samples. |
predict-regression | method | Use trained regressor to predict target values for new samples. |
split-table | method | Split a feature table into training and testing sets. |
scatterplot | visualizer | Make 2D scatterplot and linear regression of regressor predictions. |
confusion-matrix | visualizer | Make a confusion matrix from sample classifier predictions. |
summarize | visualizer | Summarize parameter and feature extraction information for a trained estimator. |
classify-samples | pipeline | Train and test a cross-validated supervised learning classifier. |
classify-samples-from-dist | pipeline | Run k-nearest-neighbors on a labeled distance matrix. |
regress-samples | pipeline | Train and test a cross-validated supervised learning regressor. |
metatable | pipeline | Convert (and merge) positive numeric metadata (in)to feature table. |
heatmap | pipeline | Generate heatmap of important features. |
Artifact Classes¶
Formats¶
sample-classifier regress-samples-ncv¶
Predicts a continuous sample metadata column using a supervised learning regressor. Uses nested stratified k-fold cross validation for automated hyperparameter optimization and sample prediction. Outputs predicted values for each input sample, and relative importance of each feature for model accuracy.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
]
Numeric metadata column to use as prediction target.[required]
- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestRegressor', 'ExtraTreesRegressor', 'GradientBoostingRegressor', 'AdaBoostRegressor[DecisionTree]', 'AdaBoostRegressor[ExtraTrees]', 'ElasticNet', 'Ridge', 'Lasso', 'KNeighborsRegressor', 'LinearSVR', 'SVR')
Estimator method to use for sample prediction.[default:
'RandomForestRegressor'
]- stratify:
Bool
Evenly stratify training and test data among metadata categories. If True, all values in column must match at least two samples.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- predictions:
SampleData[RegressorPredictions]
Predicted target values for each input sample.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
sample-classifier classify-samples-ncv¶
Predicts a categorical sample metadata column using a supervised learning classifier. Uses nested stratified k-fold cross validation for automated hyperparameter optimization and sample prediction. Outputs predicted values for each input sample, and relative importance of each feature for model accuracy.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Categorical metadata column to use as prediction target.[required]
- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestClassifier', 'ExtraTreesClassifier', 'GradientBoostingClassifier', 'AdaBoostClassifier[DecisionTree]', 'AdaBoostClassifier[ExtraTrees]', 'KNeighborsClassifier', 'LinearSVC', 'SVC')
Estimator method to use for sample prediction.[default:
'RandomForestClassifier'
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- predictions:
SampleData[ClassifierPredictions]
Predicted target values for each input sample.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[required]
sample-classifier fit-classifier¶
Fit a supervised learning classifier. Outputs the fit estimator (for prediction of test samples and/or unknown samples) and the relative importance of each feature for model accuracy. Optionally use k-fold cross-validation for automatic recursive feature elimination and hyperparameter tuning.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Numeric metadata column to use as prediction target.[required]
- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestClassifier', 'ExtraTreesClassifier', 'GradientBoostingClassifier', 'AdaBoostClassifier[DecisionTree]', 'AdaBoostClassifier[ExtraTrees]', 'KNeighborsClassifier', 'LinearSVC', 'SVC')
Estimator method to use for sample prediction.[default:
'RandomForestClassifier'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Classifier]
Trained sample classifier.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
sample-classifier fit-regressor¶
Fit a supervised learning regressor. Outputs the fit estimator (for prediction of test samples and/or unknown samples) and the relative importance of each feature for model accuracy. Optionally use k-fold cross-validation for automatic recursive feature elimination and hyperparameter tuning.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
]
Numeric metadata column to use as prediction target.[required]
- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestRegressor', 'ExtraTreesRegressor', 'GradientBoostingRegressor', 'AdaBoostRegressor[DecisionTree]', 'AdaBoostRegressor[ExtraTrees]', 'ElasticNet', 'Ridge', 'Lasso', 'KNeighborsRegressor', 'LinearSVR', 'SVR')
Estimator method to use for sample prediction.[default:
'RandomForestRegressor'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Regressor]
<no description>[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
sample-classifier predict-classification¶
Use trained estimator to predict target values for new samples. These will typically be unseen samples, e.g., test data (derived manually or from split_table) or samples with unknown values, but can theoretically be any samples present in a feature table that contain overlapping features with the feature table used to train the estimator.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
- sample_estimator:
SampleEstimator[Classifier]
Sample classifier trained with fit_classifier.[required]
Parameters¶
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]
Outputs¶
- predictions:
SampleData[ClassifierPredictions]
Predicted target values for each input sample.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[required]
sample-classifier predict-regression¶
Use trained estimator to predict target values for new samples. These will typically be unseen samples, e.g., test data (derived manually or from split_table) or samples with unknown values, but can theoretically be any samples present in a feature table that contain overlapping features with the feature table used to train the estimator.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
- sample_estimator:
SampleEstimator[Regressor]
Sample regressor trained with fit_regressor.[required]
Parameters¶
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]
Outputs¶
- predictions:
SampleData[RegressorPredictions]
Predicted target values for each input sample.[required]
sample-classifier split-table¶
Split a feature table into training and testing sets. By default stratifies training and test sets on a metadata column, such that values in that column are evenly represented across training and test sets.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Balance⁴ | PercentileNormalized⁵ | Design⁶ | Composition⁷]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
|
Categorical
]
Numeric metadata column to use as prediction target.[required]
- test_size:
Float
%
Range
(0.0, 1.0)
Fraction of input samples to exclude from training set and use for classifier testing.[default:
0.2
]- random_state:
Int
Seed used by random number generator.[optional]
- stratify:
Bool
Evenly stratify training and test data among metadata categories. If True, all values in column must match at least two samples.[default:
True
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- training_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Balance⁴ | PercentileNormalized⁵ | Design⁶ | Composition⁷]
Feature table containing training samples[required]
- test_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Balance⁴ | PercentileNormalized⁵ | Design⁶ | Composition⁷]
Feature table containing test samples[required]
- training_targets:
SampleData[TrueTargets]
Series containing true target values of train samples[required]
- test_targets:
SampleData[TrueTargets]
Series containing true target values of test samples[required]
sample-classifier scatterplot¶
Make a 2D scatterplot and linear regression of predicted vs. true values for a set of samples predicted using a sample regressor.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- predictions:
SampleData[RegressorPredictions]
Predicted values to plot on y axis. Must be predictions of numeric data produced by a sample regressor.[required]
Parameters¶
- truth:
MetadataColumn
[
Numeric
]
Metadata column (true values) to plot on x axis.[required]
- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
sample-classifier confusion-matrix¶
Make a confusion matrix and calculate accuracy of predicted vs. true values for a set of samples classified using a sample classifier. If per-sample class probabilities are provided, will also generate Receiver Operating Characteristic curves and calculate area under the curve for each class.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- predictions:
SampleData[ClassifierPredictions]
Predicted values to plot on x axis. Should be predictions of categorical data produced by a sample classifier.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[optional]
Parameters¶
- truth:
MetadataColumn
[
Categorical
]
Metadata column (true values) to plot on y axis.[required]
- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]- vmin:
Float
|
Str
%
Choices
('auto')
The minimum value to use for anchoring the colormap. If "auto", vmin is set to the minimum value in the data.[default:
'auto'
]- vmax:
Float
|
Str
%
Choices
('auto')
The maximum value to use for anchoring the colormap. If "auto", vmax is set to the maximum value in the data.[default:
'auto'
]- palette:
Str
%
Choices
('YellowOrangeBrown', 'YellowOrangeRed', 'OrangeRed', 'PurpleRed', 'RedPurple', 'BluePurple', 'GreenBlue', 'PurpleBlue', 'YellowGreen', 'summer', 'copper', 'viridis', 'cividis', 'plasma', 'inferno', 'magma', 'sirocco', 'drifting', 'melancholy', 'enigma', 'eros', 'spectre', 'ambition', 'mysteriousstains', 'daydream', 'solano', 'navarro', 'dandelions', 'deepblue', 'verve', 'greyscale')
The color palette to use for plotting.[default:
'sirocco'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
sample-classifier summarize¶
Summarize parameter and feature extraction information for a trained estimator.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- sample_estimator:
SampleEstimator[Classifier | Regressor]
Sample estimator trained with fit_classifier or fit_regressor.[required]
Outputs¶
- visualization:
Visualization
<no description>[required]
sample-classifier classify-samples¶
Predicts a categorical sample metadata column using a supervised learning classifier. Splits input data into training and test sets. The training set is used to train and test the estimator using a stratified k-fold cross-validation scheme. This includes optional steps for automated feature extraction and hyperparameter optimization. The test set validates classification accuracy of the optimized estimator. Outputs classification results for test set. For more details on the learning algorithm, see http://
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Categorical metadata column to use as prediction target.[required]
- test_size:
Float
%
Range
(0.0, 1.0)
Fraction of input samples to exclude from training set and use for classifier testing.[default:
0.2
]- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestClassifier', 'ExtraTreesClassifier', 'GradientBoostingClassifier', 'AdaBoostClassifier[DecisionTree]', 'AdaBoostClassifier[ExtraTrees]', 'KNeighborsClassifier', 'LinearSVC', 'SVC')
Estimator method to use for sample prediction.[default:
'RandomForestClassifier'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- palette:
Str
%
Choices
('YellowOrangeBrown', 'YellowOrangeRed', 'OrangeRed', 'PurpleRed', 'RedPurple', 'BluePurple', 'GreenBlue', 'PurpleBlue', 'YellowGreen', 'summer', 'copper', 'viridis', 'cividis', 'plasma', 'inferno', 'magma', 'sirocco', 'drifting', 'melancholy', 'enigma', 'eros', 'spectre', 'ambition', 'mysteriousstains', 'daydream', 'solano', 'navarro', 'dandelions', 'deepblue', 'verve', 'greyscale')
The color palette to use for plotting.[default:
'sirocco'
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Classifier]
Trained sample estimator.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
- predictions:
SampleData[ClassifierPredictions]
Predicted target values for each input sample.[required]
- model_summary:
Visualization
Summarized parameter and (if enabled) feature selection information for the trained estimator.[required]
- accuracy_results:
Visualization
Accuracy results visualization.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[required]
- heatmap:
Visualization
A heatmap of the top 50 most important features from the table.[required]
- training_targets:
SampleData[TrueTargets]
Series containing true target values of train samples[required]
- test_targets:
SampleData[TrueTargets]
Series containing true target values of test samples[required]
sample-classifier classify-samples-from-dist¶
Run k-nearest-neighbors on a labeled distance matrix. Return cross-validated (leave one out) predictions and accuracy. k = 1 by default
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- distance_matrix:
DistanceMatrix
a distance matrix[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Categorical metadata column to use as prediction target.[required]
- k:
Int
Number of nearest neighbors[default:
1
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- palette:
Str
%
Choices
('YellowOrangeBrown', 'YellowOrangeRed', 'OrangeRed', 'PurpleRed', 'RedPurple', 'BluePurple', 'GreenBlue', 'PurpleBlue', 'YellowGreen', 'summer', 'copper', 'viridis', 'cividis', 'plasma', 'inferno', 'magma', 'sirocco', 'drifting', 'melancholy', 'enigma', 'eros', 'spectre', 'ambition', 'mysteriousstains', 'daydream', 'solano', 'navarro', 'dandelions', 'deepblue', 'verve', 'greyscale')
The color palette to use for plotting.[default:
'sirocco'
]
Outputs¶
- predictions:
SampleData[ClassifierPredictions]
leave one out predictions for each sample[required]
- accuracy_results:
Visualization
Accuracy results visualization.[required]
sample-classifier regress-samples¶
Predicts a continuous sample metadata column using a supervised learning regressor. Splits input data into training and test sets. The training set is used to train and test the estimator using a stratified k-fold cross-validation scheme. This includes optional steps for automated feature extraction and hyperparameter optimization. The test set validates classification accuracy of the optimized estimator. Outputs classification results for test set. For more details on the learning algorithm, see http://
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
]
Numeric metadata column to use as prediction target.[required]
- test_size:
Float
%
Range
(0.0, 1.0)
Fraction of input samples to exclude from training set and use for classifier testing.[default:
0.2
]- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestRegressor', 'ExtraTreesRegressor', 'GradientBoostingRegressor', 'AdaBoostRegressor[DecisionTree]', 'AdaBoostRegressor[ExtraTrees]', 'ElasticNet', 'Ridge', 'Lasso', 'KNeighborsRegressor', 'LinearSVR', 'SVR')
Estimator method to use for sample prediction.[default:
'RandomForestRegressor'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- stratify:
Bool
Evenly stratify training and test data among metadata categories. If True, all values in column must match at least two samples.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Regressor]
Trained sample estimator.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
- predictions:
SampleData[RegressorPredictions]
Predicted target values for each input sample.[required]
- model_summary:
Visualization
Summarized parameter and (if enabled) feature selection information for the trained estimator.[required]
- accuracy_results:
Visualization
Accuracy results visualization.[required]
sample-classifier metatable¶
Convert numeric sample metadata from TSV file into a feature table. Optionally merge with an existing feature table. Only numeric metadata will be converted; categorical columns will be silently dropped. By default, if a table is used as input only samples found in both the table and metadata (intersection) are merged, and others are silently dropped. Set missing_samples="error" to raise an error if samples found in the table are missing from the metadata file. The metadata file can always contain a superset of samples. Note that columns will be dropped if they are non-numeric, contain no unique values (zero variance), contain only empty cells, or contain negative values. This method currently only converts postive numeric metadata into feature data. Tip: convert categorical columns to dummy variables to include them in the output feature table.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[optional]
Parameters¶
- metadata:
Metadata
Metadata file to convert to feature table.[required]
- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'ignore'
]- missing_values:
Str
%
Choices
('drop_samples', 'drop_features', 'error', 'fill')
How to handle missing values (nans) in metadata. Either "drop_samples" with missing values, "drop_features" with missing values, "fill" missing values with zeros, or "error" if any missing values are found.[default:
'error'
]- drop_all_unique:
Bool
If True, columns that contain a unique value for every ID will be dropped.[default:
False
]
Outputs¶
- converted_table:
FeatureTable[Frequency]
Converted feature table[required]
sample-classifier heatmap¶
Generate a heatmap of important features. Features are filtered based on importance scores; samples are optionally grouped by sample metadata; and a heatmap is generated that displays (normalized) feature abundances per sample.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
- importance:
FeatureData[Importance]
Feature importances.[required]
Parameters¶
- sample_metadata:
MetadataColumn
[
Categorical
]
Sample metadata column to use for sample labeling or grouping.[optional]
- feature_metadata:
MetadataColumn
[
Categorical
]
Feature metadata (e.g., taxonomy) to use for labeling features in the heatmap.[optional]
- feature_count:
Int
%
Range
(0, None)
Filter feature table to include top N most important features. Set to zero to include all features.[default:
50
]- importance_threshold:
Float
%
Range
(0, None)
Filter feature table to exclude any features with an importance score less than this threshold. Set to zero to include all features.[default:
0
]- group_samples:
Bool
Group samples by sample metadata.[default:
False
]- normalize:
Bool
Normalize the feature table by adding a psuedocount of 1 and then taking the log10 of the table.[default:
True
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'ignore'
]- metric:
Str
%
Choices
('braycurtis', 'canberra', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', 'jaccard', 'kulsinski', 'mahalanobis', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule')
Metrics exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'braycurtis'
]- method:
Str
%
Choices
('average', 'centroid', 'complete', 'median', 'single', 'ward', 'weighted')
Clustering methods exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'average'
]- cluster:
Str
%
Choices
('both', 'features', 'none', 'samples')
Specify which axes to cluster.[default:
'features'
]- color_scheme:
Str
%
Choices
('Accent', 'Accent_r', 'Blues', 'Blues_r', 'BrBG', 'BrBG_r', 'BuGn', 'BuGn_r', 'BuPu', 'BuPu_r', 'CMRmap', 'CMRmap_r', 'Dark2', 'Dark2_r', 'GnBu', 'GnBu_r', 'Greens', 'Greens_r', 'Greys', 'Greys_r', 'OrRd', 'OrRd_r', 'Oranges', 'Oranges_r', 'PRGn', 'PRGn_r', 'Paired', 'Paired_r', 'Pastel1', 'Pastel1_r', 'Pastel2', 'Pastel2_r', 'PiYG', 'PiYG_r', 'PuBu', 'PuBuGn', 'PuBuGn_r', 'PuBu_r', 'PuOr', 'PuOr_r', 'PuRd', 'PuRd_r', 'Purples', 'Purples_r', 'RdBu', 'RdBu_r', 'RdGy', 'RdGy_r', 'RdPu', 'RdPu_r', 'RdYlBu', 'RdYlBu_r', 'RdYlGn', 'RdYlGn_r', 'Reds', 'Reds_r', 'Set1', 'Set1_r', 'Set2', 'Set2_r', 'Set3', 'Set3_r', 'Spectral', 'Spectral_r', 'Vega10', 'Vega10_r', 'Vega20', 'Vega20_r', 'Vega20b', 'Vega20b_r', 'Vega20c', 'Vega20c_r', 'Wistia', 'Wistia_r', 'YlGn', 'YlGnBu', 'YlGnBu_r', 'YlGn_r', 'YlOrBr', 'YlOrBr_r', 'YlOrRd', 'YlOrRd_r', 'afmhot', 'afmhot_r', 'autumn', 'autumn_r', 'binary', 'binary_r', 'bone', 'bone_r', 'brg', 'brg_r', 'bwr', 'bwr_r', 'cividis', 'cividis_r', 'cool', 'cool_r', 'coolwarm', 'coolwarm_r', 'copper', 'copper_r', 'cubehelix', 'cubehelix_r', 'flag', 'flag_r', 'gist_earth', 'gist_earth_r', 'gist_gray', 'gist_gray_r', 'gist_heat', 'gist_heat_r', 'gist_ncar', 'gist_ncar_r', 'gist_rainbow', 'gist_rainbow_r', 'gist_stern', 'gist_stern_r', 'gist_yarg', 'gist_yarg_r', 'gnuplot', 'gnuplot2', 'gnuplot2_r', 'gnuplot_r', 'gray', 'gray_r', 'hot', 'hot_r', 'hsv', 'hsv_r', 'icefire', 'icefire_r', 'inferno', 'inferno_r', 'jet', 'jet_r', 'magma', 'magma_r', 'mako', 'mako_r', 'nipy_spectral', 'nipy_spectral_r', 'ocean', 'ocean_r', 'pink', 'pink_r', 'plasma', 'plasma_r', 'prism', 'prism_r', 'rainbow', 'rainbow_r', 'rocket', 'rocket_r', 'seismic', 'seismic_r', 'spectral', 'spectral_r', 'spring', 'spring_r', 'summer', 'summer_r', 'tab10', 'tab10_r', 'tab20', 'tab20_r', 'tab20b', 'tab20b_r', 'tab20c', 'tab20c_r', 'terrain', 'terrain_r', 'viridis', 'viridis_r', 'vlag', 'vlag_r', 'winter', 'winter_r')
Color scheme for heatmap.[default:
'rocket'
]
Outputs¶
- heatmap:
Visualization
Heatmap of important features.[required]
- filtered_table:
FeatureTable[Frequency]
Filtered feature table containing data displayed in heatmap.[required]
This QIIME 2 plugin supports methods for supervised classification and regression of sample metadata, and other supervised machine learning methods.
- version:
2024.10.0
- website: https://
github .com /qiime2 /q2 -sample -classifier - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org - citations:
- Bokulich et al., 2018; Pedregosa et al., 2011
Actions¶
Name | Type | Short Description |
---|---|---|
regress-samples-ncv | method | Nested cross-validated supervised learning regressor. |
classify-samples-ncv | method | Nested cross-validated supervised learning classifier. |
fit-classifier | method | Fit a supervised learning classifier. |
fit-regressor | method | Fit a supervised learning regressor. |
predict-classification | method | Use trained classifier to predict target values for new samples. |
predict-regression | method | Use trained regressor to predict target values for new samples. |
split-table | method | Split a feature table into training and testing sets. |
scatterplot | visualizer | Make 2D scatterplot and linear regression of regressor predictions. |
confusion-matrix | visualizer | Make a confusion matrix from sample classifier predictions. |
summarize | visualizer | Summarize parameter and feature extraction information for a trained estimator. |
classify-samples | pipeline | Train and test a cross-validated supervised learning classifier. |
classify-samples-from-dist | pipeline | Run k-nearest-neighbors on a labeled distance matrix. |
regress-samples | pipeline | Train and test a cross-validated supervised learning regressor. |
metatable | pipeline | Convert (and merge) positive numeric metadata (in)to feature table. |
heatmap | pipeline | Generate heatmap of important features. |
Artifact Classes¶
Formats¶
sample-classifier regress-samples-ncv¶
Predicts a continuous sample metadata column using a supervised learning regressor. Uses nested stratified k-fold cross validation for automated hyperparameter optimization and sample prediction. Outputs predicted values for each input sample, and relative importance of each feature for model accuracy.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
]
Numeric metadata column to use as prediction target.[required]
- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestRegressor', 'ExtraTreesRegressor', 'GradientBoostingRegressor', 'AdaBoostRegressor[DecisionTree]', 'AdaBoostRegressor[ExtraTrees]', 'ElasticNet', 'Ridge', 'Lasso', 'KNeighborsRegressor', 'LinearSVR', 'SVR')
Estimator method to use for sample prediction.[default:
'RandomForestRegressor'
]- stratify:
Bool
Evenly stratify training and test data among metadata categories. If True, all values in column must match at least two samples.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- predictions:
SampleData[RegressorPredictions]
Predicted target values for each input sample.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
sample-classifier classify-samples-ncv¶
Predicts a categorical sample metadata column using a supervised learning classifier. Uses nested stratified k-fold cross validation for automated hyperparameter optimization and sample prediction. Outputs predicted values for each input sample, and relative importance of each feature for model accuracy.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Categorical metadata column to use as prediction target.[required]
- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestClassifier', 'ExtraTreesClassifier', 'GradientBoostingClassifier', 'AdaBoostClassifier[DecisionTree]', 'AdaBoostClassifier[ExtraTrees]', 'KNeighborsClassifier', 'LinearSVC', 'SVC')
Estimator method to use for sample prediction.[default:
'RandomForestClassifier'
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- predictions:
SampleData[ClassifierPredictions]
Predicted target values for each input sample.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[required]
sample-classifier fit-classifier¶
Fit a supervised learning classifier. Outputs the fit estimator (for prediction of test samples and/or unknown samples) and the relative importance of each feature for model accuracy. Optionally use k-fold cross-validation for automatic recursive feature elimination and hyperparameter tuning.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Numeric metadata column to use as prediction target.[required]
- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestClassifier', 'ExtraTreesClassifier', 'GradientBoostingClassifier', 'AdaBoostClassifier[DecisionTree]', 'AdaBoostClassifier[ExtraTrees]', 'KNeighborsClassifier', 'LinearSVC', 'SVC')
Estimator method to use for sample prediction.[default:
'RandomForestClassifier'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Classifier]
Trained sample classifier.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
sample-classifier fit-regressor¶
Fit a supervised learning regressor. Outputs the fit estimator (for prediction of test samples and/or unknown samples) and the relative importance of each feature for model accuracy. Optionally use k-fold cross-validation for automatic recursive feature elimination and hyperparameter tuning.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
]
Numeric metadata column to use as prediction target.[required]
- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestRegressor', 'ExtraTreesRegressor', 'GradientBoostingRegressor', 'AdaBoostRegressor[DecisionTree]', 'AdaBoostRegressor[ExtraTrees]', 'ElasticNet', 'Ridge', 'Lasso', 'KNeighborsRegressor', 'LinearSVR', 'SVR')
Estimator method to use for sample prediction.[default:
'RandomForestRegressor'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Regressor]
<no description>[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
sample-classifier predict-classification¶
Use trained estimator to predict target values for new samples. These will typically be unseen samples, e.g., test data (derived manually or from split_table) or samples with unknown values, but can theoretically be any samples present in a feature table that contain overlapping features with the feature table used to train the estimator.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
- sample_estimator:
SampleEstimator[Classifier]
Sample classifier trained with fit_classifier.[required]
Parameters¶
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]
Outputs¶
- predictions:
SampleData[ClassifierPredictions]
Predicted target values for each input sample.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[required]
sample-classifier predict-regression¶
Use trained estimator to predict target values for new samples. These will typically be unseen samples, e.g., test data (derived manually or from split_table) or samples with unknown values, but can theoretically be any samples present in a feature table that contain overlapping features with the feature table used to train the estimator.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
- sample_estimator:
SampleEstimator[Regressor]
Sample regressor trained with fit_regressor.[required]
Parameters¶
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]
Outputs¶
- predictions:
SampleData[RegressorPredictions]
Predicted target values for each input sample.[required]
sample-classifier split-table¶
Split a feature table into training and testing sets. By default stratifies training and test sets on a metadata column, such that values in that column are evenly represented across training and test sets.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Balance⁴ | PercentileNormalized⁵ | Design⁶ | Composition⁷]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
|
Categorical
]
Numeric metadata column to use as prediction target.[required]
- test_size:
Float
%
Range
(0.0, 1.0)
Fraction of input samples to exclude from training set and use for classifier testing.[default:
0.2
]- random_state:
Int
Seed used by random number generator.[optional]
- stratify:
Bool
Evenly stratify training and test data among metadata categories. If True, all values in column must match at least two samples.[default:
True
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- training_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Balance⁴ | PercentileNormalized⁵ | Design⁶ | Composition⁷]
Feature table containing training samples[required]
- test_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Balance⁴ | PercentileNormalized⁵ | Design⁶ | Composition⁷]
Feature table containing test samples[required]
- training_targets:
SampleData[TrueTargets]
Series containing true target values of train samples[required]
- test_targets:
SampleData[TrueTargets]
Series containing true target values of test samples[required]
sample-classifier scatterplot¶
Make a 2D scatterplot and linear regression of predicted vs. true values for a set of samples predicted using a sample regressor.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- predictions:
SampleData[RegressorPredictions]
Predicted values to plot on y axis. Must be predictions of numeric data produced by a sample regressor.[required]
Parameters¶
- truth:
MetadataColumn
[
Numeric
]
Metadata column (true values) to plot on x axis.[required]
- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
sample-classifier confusion-matrix¶
Make a confusion matrix and calculate accuracy of predicted vs. true values for a set of samples classified using a sample classifier. If per-sample class probabilities are provided, will also generate Receiver Operating Characteristic curves and calculate area under the curve for each class.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- predictions:
SampleData[ClassifierPredictions]
Predicted values to plot on x axis. Should be predictions of categorical data produced by a sample classifier.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[optional]
Parameters¶
- truth:
MetadataColumn
[
Categorical
]
Metadata column (true values) to plot on y axis.[required]
- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]- vmin:
Float
|
Str
%
Choices
('auto')
The minimum value to use for anchoring the colormap. If "auto", vmin is set to the minimum value in the data.[default:
'auto'
]- vmax:
Float
|
Str
%
Choices
('auto')
The maximum value to use for anchoring the colormap. If "auto", vmax is set to the maximum value in the data.[default:
'auto'
]- palette:
Str
%
Choices
('YellowOrangeBrown', 'YellowOrangeRed', 'OrangeRed', 'PurpleRed', 'RedPurple', 'BluePurple', 'GreenBlue', 'PurpleBlue', 'YellowGreen', 'summer', 'copper', 'viridis', 'cividis', 'plasma', 'inferno', 'magma', 'sirocco', 'drifting', 'melancholy', 'enigma', 'eros', 'spectre', 'ambition', 'mysteriousstains', 'daydream', 'solano', 'navarro', 'dandelions', 'deepblue', 'verve', 'greyscale')
The color palette to use for plotting.[default:
'sirocco'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
sample-classifier summarize¶
Summarize parameter and feature extraction information for a trained estimator.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- sample_estimator:
SampleEstimator[Classifier | Regressor]
Sample estimator trained with fit_classifier or fit_regressor.[required]
Outputs¶
- visualization:
Visualization
<no description>[required]
sample-classifier classify-samples¶
Predicts a categorical sample metadata column using a supervised learning classifier. Splits input data into training and test sets. The training set is used to train and test the estimator using a stratified k-fold cross-validation scheme. This includes optional steps for automated feature extraction and hyperparameter optimization. The test set validates classification accuracy of the optimized estimator. Outputs classification results for test set. For more details on the learning algorithm, see http://
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Categorical metadata column to use as prediction target.[required]
- test_size:
Float
%
Range
(0.0, 1.0)
Fraction of input samples to exclude from training set and use for classifier testing.[default:
0.2
]- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestClassifier', 'ExtraTreesClassifier', 'GradientBoostingClassifier', 'AdaBoostClassifier[DecisionTree]', 'AdaBoostClassifier[ExtraTrees]', 'KNeighborsClassifier', 'LinearSVC', 'SVC')
Estimator method to use for sample prediction.[default:
'RandomForestClassifier'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- palette:
Str
%
Choices
('YellowOrangeBrown', 'YellowOrangeRed', 'OrangeRed', 'PurpleRed', 'RedPurple', 'BluePurple', 'GreenBlue', 'PurpleBlue', 'YellowGreen', 'summer', 'copper', 'viridis', 'cividis', 'plasma', 'inferno', 'magma', 'sirocco', 'drifting', 'melancholy', 'enigma', 'eros', 'spectre', 'ambition', 'mysteriousstains', 'daydream', 'solano', 'navarro', 'dandelions', 'deepblue', 'verve', 'greyscale')
The color palette to use for plotting.[default:
'sirocco'
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Classifier]
Trained sample estimator.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
- predictions:
SampleData[ClassifierPredictions]
Predicted target values for each input sample.[required]
- model_summary:
Visualization
Summarized parameter and (if enabled) feature selection information for the trained estimator.[required]
- accuracy_results:
Visualization
Accuracy results visualization.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[required]
- heatmap:
Visualization
A heatmap of the top 50 most important features from the table.[required]
- training_targets:
SampleData[TrueTargets]
Series containing true target values of train samples[required]
- test_targets:
SampleData[TrueTargets]
Series containing true target values of test samples[required]
sample-classifier classify-samples-from-dist¶
Run k-nearest-neighbors on a labeled distance matrix. Return cross-validated (leave one out) predictions and accuracy. k = 1 by default
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- distance_matrix:
DistanceMatrix
a distance matrix[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Categorical metadata column to use as prediction target.[required]
- k:
Int
Number of nearest neighbors[default:
1
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- palette:
Str
%
Choices
('YellowOrangeBrown', 'YellowOrangeRed', 'OrangeRed', 'PurpleRed', 'RedPurple', 'BluePurple', 'GreenBlue', 'PurpleBlue', 'YellowGreen', 'summer', 'copper', 'viridis', 'cividis', 'plasma', 'inferno', 'magma', 'sirocco', 'drifting', 'melancholy', 'enigma', 'eros', 'spectre', 'ambition', 'mysteriousstains', 'daydream', 'solano', 'navarro', 'dandelions', 'deepblue', 'verve', 'greyscale')
The color palette to use for plotting.[default:
'sirocco'
]
Outputs¶
- predictions:
SampleData[ClassifierPredictions]
leave one out predictions for each sample[required]
- accuracy_results:
Visualization
Accuracy results visualization.[required]
sample-classifier regress-samples¶
Predicts a continuous sample metadata column using a supervised learning regressor. Splits input data into training and test sets. The training set is used to train and test the estimator using a stratified k-fold cross-validation scheme. This includes optional steps for automated feature extraction and hyperparameter optimization. The test set validates classification accuracy of the optimized estimator. Outputs classification results for test set. For more details on the learning algorithm, see http://
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
]
Numeric metadata column to use as prediction target.[required]
- test_size:
Float
%
Range
(0.0, 1.0)
Fraction of input samples to exclude from training set and use for classifier testing.[default:
0.2
]- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestRegressor', 'ExtraTreesRegressor', 'GradientBoostingRegressor', 'AdaBoostRegressor[DecisionTree]', 'AdaBoostRegressor[ExtraTrees]', 'ElasticNet', 'Ridge', 'Lasso', 'KNeighborsRegressor', 'LinearSVR', 'SVR')
Estimator method to use for sample prediction.[default:
'RandomForestRegressor'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- stratify:
Bool
Evenly stratify training and test data among metadata categories. If True, all values in column must match at least two samples.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Regressor]
Trained sample estimator.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
- predictions:
SampleData[RegressorPredictions]
Predicted target values for each input sample.[required]
- model_summary:
Visualization
Summarized parameter and (if enabled) feature selection information for the trained estimator.[required]
- accuracy_results:
Visualization
Accuracy results visualization.[required]
sample-classifier metatable¶
Convert numeric sample metadata from TSV file into a feature table. Optionally merge with an existing feature table. Only numeric metadata will be converted; categorical columns will be silently dropped. By default, if a table is used as input only samples found in both the table and metadata (intersection) are merged, and others are silently dropped. Set missing_samples="error" to raise an error if samples found in the table are missing from the metadata file. The metadata file can always contain a superset of samples. Note that columns will be dropped if they are non-numeric, contain no unique values (zero variance), contain only empty cells, or contain negative values. This method currently only converts postive numeric metadata into feature data. Tip: convert categorical columns to dummy variables to include them in the output feature table.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[optional]
Parameters¶
- metadata:
Metadata
Metadata file to convert to feature table.[required]
- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'ignore'
]- missing_values:
Str
%
Choices
('drop_samples', 'drop_features', 'error', 'fill')
How to handle missing values (nans) in metadata. Either "drop_samples" with missing values, "drop_features" with missing values, "fill" missing values with zeros, or "error" if any missing values are found.[default:
'error'
]- drop_all_unique:
Bool
If True, columns that contain a unique value for every ID will be dropped.[default:
False
]
Outputs¶
- converted_table:
FeatureTable[Frequency]
Converted feature table[required]
sample-classifier heatmap¶
Generate a heatmap of important features. Features are filtered based on importance scores; samples are optionally grouped by sample metadata; and a heatmap is generated that displays (normalized) feature abundances per sample.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
- importance:
FeatureData[Importance]
Feature importances.[required]
Parameters¶
- sample_metadata:
MetadataColumn
[
Categorical
]
Sample metadata column to use for sample labeling or grouping.[optional]
- feature_metadata:
MetadataColumn
[
Categorical
]
Feature metadata (e.g., taxonomy) to use for labeling features in the heatmap.[optional]
- feature_count:
Int
%
Range
(0, None)
Filter feature table to include top N most important features. Set to zero to include all features.[default:
50
]- importance_threshold:
Float
%
Range
(0, None)
Filter feature table to exclude any features with an importance score less than this threshold. Set to zero to include all features.[default:
0
]- group_samples:
Bool
Group samples by sample metadata.[default:
False
]- normalize:
Bool
Normalize the feature table by adding a psuedocount of 1 and then taking the log10 of the table.[default:
True
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'ignore'
]- metric:
Str
%
Choices
('braycurtis', 'canberra', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', 'jaccard', 'kulsinski', 'mahalanobis', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule')
Metrics exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'braycurtis'
]- method:
Str
%
Choices
('average', 'centroid', 'complete', 'median', 'single', 'ward', 'weighted')
Clustering methods exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'average'
]- cluster:
Str
%
Choices
('both', 'features', 'none', 'samples')
Specify which axes to cluster.[default:
'features'
]- color_scheme:
Str
%
Choices
('Accent', 'Accent_r', 'Blues', 'Blues_r', 'BrBG', 'BrBG_r', 'BuGn', 'BuGn_r', 'BuPu', 'BuPu_r', 'CMRmap', 'CMRmap_r', 'Dark2', 'Dark2_r', 'GnBu', 'GnBu_r', 'Greens', 'Greens_r', 'Greys', 'Greys_r', 'OrRd', 'OrRd_r', 'Oranges', 'Oranges_r', 'PRGn', 'PRGn_r', 'Paired', 'Paired_r', 'Pastel1', 'Pastel1_r', 'Pastel2', 'Pastel2_r', 'PiYG', 'PiYG_r', 'PuBu', 'PuBuGn', 'PuBuGn_r', 'PuBu_r', 'PuOr', 'PuOr_r', 'PuRd', 'PuRd_r', 'Purples', 'Purples_r', 'RdBu', 'RdBu_r', 'RdGy', 'RdGy_r', 'RdPu', 'RdPu_r', 'RdYlBu', 'RdYlBu_r', 'RdYlGn', 'RdYlGn_r', 'Reds', 'Reds_r', 'Set1', 'Set1_r', 'Set2', 'Set2_r', 'Set3', 'Set3_r', 'Spectral', 'Spectral_r', 'Vega10', 'Vega10_r', 'Vega20', 'Vega20_r', 'Vega20b', 'Vega20b_r', 'Vega20c', 'Vega20c_r', 'Wistia', 'Wistia_r', 'YlGn', 'YlGnBu', 'YlGnBu_r', 'YlGn_r', 'YlOrBr', 'YlOrBr_r', 'YlOrRd', 'YlOrRd_r', 'afmhot', 'afmhot_r', 'autumn', 'autumn_r', 'binary', 'binary_r', 'bone', 'bone_r', 'brg', 'brg_r', 'bwr', 'bwr_r', 'cividis', 'cividis_r', 'cool', 'cool_r', 'coolwarm', 'coolwarm_r', 'copper', 'copper_r', 'cubehelix', 'cubehelix_r', 'flag', 'flag_r', 'gist_earth', 'gist_earth_r', 'gist_gray', 'gist_gray_r', 'gist_heat', 'gist_heat_r', 'gist_ncar', 'gist_ncar_r', 'gist_rainbow', 'gist_rainbow_r', 'gist_stern', 'gist_stern_r', 'gist_yarg', 'gist_yarg_r', 'gnuplot', 'gnuplot2', 'gnuplot2_r', 'gnuplot_r', 'gray', 'gray_r', 'hot', 'hot_r', 'hsv', 'hsv_r', 'icefire', 'icefire_r', 'inferno', 'inferno_r', 'jet', 'jet_r', 'magma', 'magma_r', 'mako', 'mako_r', 'nipy_spectral', 'nipy_spectral_r', 'ocean', 'ocean_r', 'pink', 'pink_r', 'plasma', 'plasma_r', 'prism', 'prism_r', 'rainbow', 'rainbow_r', 'rocket', 'rocket_r', 'seismic', 'seismic_r', 'spectral', 'spectral_r', 'spring', 'spring_r', 'summer', 'summer_r', 'tab10', 'tab10_r', 'tab20', 'tab20_r', 'tab20b', 'tab20b_r', 'tab20c', 'tab20c_r', 'terrain', 'terrain_r', 'viridis', 'viridis_r', 'vlag', 'vlag_r', 'winter', 'winter_r')
Color scheme for heatmap.[default:
'rocket'
]
Outputs¶
- heatmap:
Visualization
Heatmap of important features.[required]
- filtered_table:
FeatureTable[Frequency]
Filtered feature table containing data displayed in heatmap.[required]
This QIIME 2 plugin supports methods for supervised classification and regression of sample metadata, and other supervised machine learning methods.
- version:
2024.10.0
- website: https://
github .com /qiime2 /q2 -sample -classifier - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org - citations:
- Bokulich et al., 2018; Pedregosa et al., 2011
Actions¶
Name | Type | Short Description |
---|---|---|
regress-samples-ncv | method | Nested cross-validated supervised learning regressor. |
classify-samples-ncv | method | Nested cross-validated supervised learning classifier. |
fit-classifier | method | Fit a supervised learning classifier. |
fit-regressor | method | Fit a supervised learning regressor. |
predict-classification | method | Use trained classifier to predict target values for new samples. |
predict-regression | method | Use trained regressor to predict target values for new samples. |
split-table | method | Split a feature table into training and testing sets. |
scatterplot | visualizer | Make 2D scatterplot and linear regression of regressor predictions. |
confusion-matrix | visualizer | Make a confusion matrix from sample classifier predictions. |
summarize | visualizer | Summarize parameter and feature extraction information for a trained estimator. |
classify-samples | pipeline | Train and test a cross-validated supervised learning classifier. |
classify-samples-from-dist | pipeline | Run k-nearest-neighbors on a labeled distance matrix. |
regress-samples | pipeline | Train and test a cross-validated supervised learning regressor. |
metatable | pipeline | Convert (and merge) positive numeric metadata (in)to feature table. |
heatmap | pipeline | Generate heatmap of important features. |
Artifact Classes¶
Formats¶
sample-classifier regress-samples-ncv¶
Predicts a continuous sample metadata column using a supervised learning regressor. Uses nested stratified k-fold cross validation for automated hyperparameter optimization and sample prediction. Outputs predicted values for each input sample, and relative importance of each feature for model accuracy.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
]
Numeric metadata column to use as prediction target.[required]
- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestRegressor', 'ExtraTreesRegressor', 'GradientBoostingRegressor', 'AdaBoostRegressor[DecisionTree]', 'AdaBoostRegressor[ExtraTrees]', 'ElasticNet', 'Ridge', 'Lasso', 'KNeighborsRegressor', 'LinearSVR', 'SVR')
Estimator method to use for sample prediction.[default:
'RandomForestRegressor'
]- stratify:
Bool
Evenly stratify training and test data among metadata categories. If True, all values in column must match at least two samples.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- predictions:
SampleData[RegressorPredictions]
Predicted target values for each input sample.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
sample-classifier classify-samples-ncv¶
Predicts a categorical sample metadata column using a supervised learning classifier. Uses nested stratified k-fold cross validation for automated hyperparameter optimization and sample prediction. Outputs predicted values for each input sample, and relative importance of each feature for model accuracy.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Categorical metadata column to use as prediction target.[required]
- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestClassifier', 'ExtraTreesClassifier', 'GradientBoostingClassifier', 'AdaBoostClassifier[DecisionTree]', 'AdaBoostClassifier[ExtraTrees]', 'KNeighborsClassifier', 'LinearSVC', 'SVC')
Estimator method to use for sample prediction.[default:
'RandomForestClassifier'
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- predictions:
SampleData[ClassifierPredictions]
Predicted target values for each input sample.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[required]
sample-classifier fit-classifier¶
Fit a supervised learning classifier. Outputs the fit estimator (for prediction of test samples and/or unknown samples) and the relative importance of each feature for model accuracy. Optionally use k-fold cross-validation for automatic recursive feature elimination and hyperparameter tuning.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Numeric metadata column to use as prediction target.[required]
- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestClassifier', 'ExtraTreesClassifier', 'GradientBoostingClassifier', 'AdaBoostClassifier[DecisionTree]', 'AdaBoostClassifier[ExtraTrees]', 'KNeighborsClassifier', 'LinearSVC', 'SVC')
Estimator method to use for sample prediction.[default:
'RandomForestClassifier'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Classifier]
Trained sample classifier.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
sample-classifier fit-regressor¶
Fit a supervised learning regressor. Outputs the fit estimator (for prediction of test samples and/or unknown samples) and the relative importance of each feature for model accuracy. Optionally use k-fold cross-validation for automatic recursive feature elimination and hyperparameter tuning.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
]
Numeric metadata column to use as prediction target.[required]
- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestRegressor', 'ExtraTreesRegressor', 'GradientBoostingRegressor', 'AdaBoostRegressor[DecisionTree]', 'AdaBoostRegressor[ExtraTrees]', 'ElasticNet', 'Ridge', 'Lasso', 'KNeighborsRegressor', 'LinearSVR', 'SVR')
Estimator method to use for sample prediction.[default:
'RandomForestRegressor'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Regressor]
<no description>[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
sample-classifier predict-classification¶
Use trained estimator to predict target values for new samples. These will typically be unseen samples, e.g., test data (derived manually or from split_table) or samples with unknown values, but can theoretically be any samples present in a feature table that contain overlapping features with the feature table used to train the estimator.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
- sample_estimator:
SampleEstimator[Classifier]
Sample classifier trained with fit_classifier.[required]
Parameters¶
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]
Outputs¶
- predictions:
SampleData[ClassifierPredictions]
Predicted target values for each input sample.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[required]
sample-classifier predict-regression¶
Use trained estimator to predict target values for new samples. These will typically be unseen samples, e.g., test data (derived manually or from split_table) or samples with unknown values, but can theoretically be any samples present in a feature table that contain overlapping features with the feature table used to train the estimator.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
- sample_estimator:
SampleEstimator[Regressor]
Sample regressor trained with fit_regressor.[required]
Parameters¶
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]
Outputs¶
- predictions:
SampleData[RegressorPredictions]
Predicted target values for each input sample.[required]
sample-classifier split-table¶
Split a feature table into training and testing sets. By default stratifies training and test sets on a metadata column, such that values in that column are evenly represented across training and test sets.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Balance⁴ | PercentileNormalized⁵ | Design⁶ | Composition⁷]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
|
Categorical
]
Numeric metadata column to use as prediction target.[required]
- test_size:
Float
%
Range
(0.0, 1.0)
Fraction of input samples to exclude from training set and use for classifier testing.[default:
0.2
]- random_state:
Int
Seed used by random number generator.[optional]
- stratify:
Bool
Evenly stratify training and test data among metadata categories. If True, all values in column must match at least two samples.[default:
True
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- training_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Balance⁴ | PercentileNormalized⁵ | Design⁶ | Composition⁷]
Feature table containing training samples[required]
- test_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Balance⁴ | PercentileNormalized⁵ | Design⁶ | Composition⁷]
Feature table containing test samples[required]
- training_targets:
SampleData[TrueTargets]
Series containing true target values of train samples[required]
- test_targets:
SampleData[TrueTargets]
Series containing true target values of test samples[required]
sample-classifier scatterplot¶
Make a 2D scatterplot and linear regression of predicted vs. true values for a set of samples predicted using a sample regressor.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- predictions:
SampleData[RegressorPredictions]
Predicted values to plot on y axis. Must be predictions of numeric data produced by a sample regressor.[required]
Parameters¶
- truth:
MetadataColumn
[
Numeric
]
Metadata column (true values) to plot on x axis.[required]
- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
sample-classifier confusion-matrix¶
Make a confusion matrix and calculate accuracy of predicted vs. true values for a set of samples classified using a sample classifier. If per-sample class probabilities are provided, will also generate Receiver Operating Characteristic curves and calculate area under the curve for each class.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- predictions:
SampleData[ClassifierPredictions]
Predicted values to plot on x axis. Should be predictions of categorical data produced by a sample classifier.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[optional]
Parameters¶
- truth:
MetadataColumn
[
Categorical
]
Metadata column (true values) to plot on y axis.[required]
- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]- vmin:
Float
|
Str
%
Choices
('auto')
The minimum value to use for anchoring the colormap. If "auto", vmin is set to the minimum value in the data.[default:
'auto'
]- vmax:
Float
|
Str
%
Choices
('auto')
The maximum value to use for anchoring the colormap. If "auto", vmax is set to the maximum value in the data.[default:
'auto'
]- palette:
Str
%
Choices
('YellowOrangeBrown', 'YellowOrangeRed', 'OrangeRed', 'PurpleRed', 'RedPurple', 'BluePurple', 'GreenBlue', 'PurpleBlue', 'YellowGreen', 'summer', 'copper', 'viridis', 'cividis', 'plasma', 'inferno', 'magma', 'sirocco', 'drifting', 'melancholy', 'enigma', 'eros', 'spectre', 'ambition', 'mysteriousstains', 'daydream', 'solano', 'navarro', 'dandelions', 'deepblue', 'verve', 'greyscale')
The color palette to use for plotting.[default:
'sirocco'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
sample-classifier summarize¶
Summarize parameter and feature extraction information for a trained estimator.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- sample_estimator:
SampleEstimator[Classifier | Regressor]
Sample estimator trained with fit_classifier or fit_regressor.[required]
Outputs¶
- visualization:
Visualization
<no description>[required]
sample-classifier classify-samples¶
Predicts a categorical sample metadata column using a supervised learning classifier. Splits input data into training and test sets. The training set is used to train and test the estimator using a stratified k-fold cross-validation scheme. This includes optional steps for automated feature extraction and hyperparameter optimization. The test set validates classification accuracy of the optimized estimator. Outputs classification results for test set. For more details on the learning algorithm, see http://
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Categorical metadata column to use as prediction target.[required]
- test_size:
Float
%
Range
(0.0, 1.0)
Fraction of input samples to exclude from training set and use for classifier testing.[default:
0.2
]- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestClassifier', 'ExtraTreesClassifier', 'GradientBoostingClassifier', 'AdaBoostClassifier[DecisionTree]', 'AdaBoostClassifier[ExtraTrees]', 'KNeighborsClassifier', 'LinearSVC', 'SVC')
Estimator method to use for sample prediction.[default:
'RandomForestClassifier'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- palette:
Str
%
Choices
('YellowOrangeBrown', 'YellowOrangeRed', 'OrangeRed', 'PurpleRed', 'RedPurple', 'BluePurple', 'GreenBlue', 'PurpleBlue', 'YellowGreen', 'summer', 'copper', 'viridis', 'cividis', 'plasma', 'inferno', 'magma', 'sirocco', 'drifting', 'melancholy', 'enigma', 'eros', 'spectre', 'ambition', 'mysteriousstains', 'daydream', 'solano', 'navarro', 'dandelions', 'deepblue', 'verve', 'greyscale')
The color palette to use for plotting.[default:
'sirocco'
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Classifier]
Trained sample estimator.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
- predictions:
SampleData[ClassifierPredictions]
Predicted target values for each input sample.[required]
- model_summary:
Visualization
Summarized parameter and (if enabled) feature selection information for the trained estimator.[required]
- accuracy_results:
Visualization
Accuracy results visualization.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[required]
- heatmap:
Visualization
A heatmap of the top 50 most important features from the table.[required]
- training_targets:
SampleData[TrueTargets]
Series containing true target values of train samples[required]
- test_targets:
SampleData[TrueTargets]
Series containing true target values of test samples[required]
sample-classifier classify-samples-from-dist¶
Run k-nearest-neighbors on a labeled distance matrix. Return cross-validated (leave one out) predictions and accuracy. k = 1 by default
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- distance_matrix:
DistanceMatrix
a distance matrix[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Categorical metadata column to use as prediction target.[required]
- k:
Int
Number of nearest neighbors[default:
1
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- palette:
Str
%
Choices
('YellowOrangeBrown', 'YellowOrangeRed', 'OrangeRed', 'PurpleRed', 'RedPurple', 'BluePurple', 'GreenBlue', 'PurpleBlue', 'YellowGreen', 'summer', 'copper', 'viridis', 'cividis', 'plasma', 'inferno', 'magma', 'sirocco', 'drifting', 'melancholy', 'enigma', 'eros', 'spectre', 'ambition', 'mysteriousstains', 'daydream', 'solano', 'navarro', 'dandelions', 'deepblue', 'verve', 'greyscale')
The color palette to use for plotting.[default:
'sirocco'
]
Outputs¶
- predictions:
SampleData[ClassifierPredictions]
leave one out predictions for each sample[required]
- accuracy_results:
Visualization
Accuracy results visualization.[required]
sample-classifier regress-samples¶
Predicts a continuous sample metadata column using a supervised learning regressor. Splits input data into training and test sets. The training set is used to train and test the estimator using a stratified k-fold cross-validation scheme. This includes optional steps for automated feature extraction and hyperparameter optimization. The test set validates classification accuracy of the optimized estimator. Outputs classification results for test set. For more details on the learning algorithm, see http://
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
]
Numeric metadata column to use as prediction target.[required]
- test_size:
Float
%
Range
(0.0, 1.0)
Fraction of input samples to exclude from training set and use for classifier testing.[default:
0.2
]- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestRegressor', 'ExtraTreesRegressor', 'GradientBoostingRegressor', 'AdaBoostRegressor[DecisionTree]', 'AdaBoostRegressor[ExtraTrees]', 'ElasticNet', 'Ridge', 'Lasso', 'KNeighborsRegressor', 'LinearSVR', 'SVR')
Estimator method to use for sample prediction.[default:
'RandomForestRegressor'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- stratify:
Bool
Evenly stratify training and test data among metadata categories. If True, all values in column must match at least two samples.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Regressor]
Trained sample estimator.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
- predictions:
SampleData[RegressorPredictions]
Predicted target values for each input sample.[required]
- model_summary:
Visualization
Summarized parameter and (if enabled) feature selection information for the trained estimator.[required]
- accuracy_results:
Visualization
Accuracy results visualization.[required]
sample-classifier metatable¶
Convert numeric sample metadata from TSV file into a feature table. Optionally merge with an existing feature table. Only numeric metadata will be converted; categorical columns will be silently dropped. By default, if a table is used as input only samples found in both the table and metadata (intersection) are merged, and others are silently dropped. Set missing_samples="error" to raise an error if samples found in the table are missing from the metadata file. The metadata file can always contain a superset of samples. Note that columns will be dropped if they are non-numeric, contain no unique values (zero variance), contain only empty cells, or contain negative values. This method currently only converts postive numeric metadata into feature data. Tip: convert categorical columns to dummy variables to include them in the output feature table.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[optional]
Parameters¶
- metadata:
Metadata
Metadata file to convert to feature table.[required]
- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'ignore'
]- missing_values:
Str
%
Choices
('drop_samples', 'drop_features', 'error', 'fill')
How to handle missing values (nans) in metadata. Either "drop_samples" with missing values, "drop_features" with missing values, "fill" missing values with zeros, or "error" if any missing values are found.[default:
'error'
]- drop_all_unique:
Bool
If True, columns that contain a unique value for every ID will be dropped.[default:
False
]
Outputs¶
- converted_table:
FeatureTable[Frequency]
Converted feature table[required]
sample-classifier heatmap¶
Generate a heatmap of important features. Features are filtered based on importance scores; samples are optionally grouped by sample metadata; and a heatmap is generated that displays (normalized) feature abundances per sample.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
- importance:
FeatureData[Importance]
Feature importances.[required]
Parameters¶
- sample_metadata:
MetadataColumn
[
Categorical
]
Sample metadata column to use for sample labeling or grouping.[optional]
- feature_metadata:
MetadataColumn
[
Categorical
]
Feature metadata (e.g., taxonomy) to use for labeling features in the heatmap.[optional]
- feature_count:
Int
%
Range
(0, None)
Filter feature table to include top N most important features. Set to zero to include all features.[default:
50
]- importance_threshold:
Float
%
Range
(0, None)
Filter feature table to exclude any features with an importance score less than this threshold. Set to zero to include all features.[default:
0
]- group_samples:
Bool
Group samples by sample metadata.[default:
False
]- normalize:
Bool
Normalize the feature table by adding a psuedocount of 1 and then taking the log10 of the table.[default:
True
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'ignore'
]- metric:
Str
%
Choices
('braycurtis', 'canberra', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', 'jaccard', 'kulsinski', 'mahalanobis', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule')
Metrics exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'braycurtis'
]- method:
Str
%
Choices
('average', 'centroid', 'complete', 'median', 'single', 'ward', 'weighted')
Clustering methods exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'average'
]- cluster:
Str
%
Choices
('both', 'features', 'none', 'samples')
Specify which axes to cluster.[default:
'features'
]- color_scheme:
Str
%
Choices
('Accent', 'Accent_r', 'Blues', 'Blues_r', 'BrBG', 'BrBG_r', 'BuGn', 'BuGn_r', 'BuPu', 'BuPu_r', 'CMRmap', 'CMRmap_r', 'Dark2', 'Dark2_r', 'GnBu', 'GnBu_r', 'Greens', 'Greens_r', 'Greys', 'Greys_r', 'OrRd', 'OrRd_r', 'Oranges', 'Oranges_r', 'PRGn', 'PRGn_r', 'Paired', 'Paired_r', 'Pastel1', 'Pastel1_r', 'Pastel2', 'Pastel2_r', 'PiYG', 'PiYG_r', 'PuBu', 'PuBuGn', 'PuBuGn_r', 'PuBu_r', 'PuOr', 'PuOr_r', 'PuRd', 'PuRd_r', 'Purples', 'Purples_r', 'RdBu', 'RdBu_r', 'RdGy', 'RdGy_r', 'RdPu', 'RdPu_r', 'RdYlBu', 'RdYlBu_r', 'RdYlGn', 'RdYlGn_r', 'Reds', 'Reds_r', 'Set1', 'Set1_r', 'Set2', 'Set2_r', 'Set3', 'Set3_r', 'Spectral', 'Spectral_r', 'Vega10', 'Vega10_r', 'Vega20', 'Vega20_r', 'Vega20b', 'Vega20b_r', 'Vega20c', 'Vega20c_r', 'Wistia', 'Wistia_r', 'YlGn', 'YlGnBu', 'YlGnBu_r', 'YlGn_r', 'YlOrBr', 'YlOrBr_r', 'YlOrRd', 'YlOrRd_r', 'afmhot', 'afmhot_r', 'autumn', 'autumn_r', 'binary', 'binary_r', 'bone', 'bone_r', 'brg', 'brg_r', 'bwr', 'bwr_r', 'cividis', 'cividis_r', 'cool', 'cool_r', 'coolwarm', 'coolwarm_r', 'copper', 'copper_r', 'cubehelix', 'cubehelix_r', 'flag', 'flag_r', 'gist_earth', 'gist_earth_r', 'gist_gray', 'gist_gray_r', 'gist_heat', 'gist_heat_r', 'gist_ncar', 'gist_ncar_r', 'gist_rainbow', 'gist_rainbow_r', 'gist_stern', 'gist_stern_r', 'gist_yarg', 'gist_yarg_r', 'gnuplot', 'gnuplot2', 'gnuplot2_r', 'gnuplot_r', 'gray', 'gray_r', 'hot', 'hot_r', 'hsv', 'hsv_r', 'icefire', 'icefire_r', 'inferno', 'inferno_r', 'jet', 'jet_r', 'magma', 'magma_r', 'mako', 'mako_r', 'nipy_spectral', 'nipy_spectral_r', 'ocean', 'ocean_r', 'pink', 'pink_r', 'plasma', 'plasma_r', 'prism', 'prism_r', 'rainbow', 'rainbow_r', 'rocket', 'rocket_r', 'seismic', 'seismic_r', 'spectral', 'spectral_r', 'spring', 'spring_r', 'summer', 'summer_r', 'tab10', 'tab10_r', 'tab20', 'tab20_r', 'tab20b', 'tab20b_r', 'tab20c', 'tab20c_r', 'terrain', 'terrain_r', 'viridis', 'viridis_r', 'vlag', 'vlag_r', 'winter', 'winter_r')
Color scheme for heatmap.[default:
'rocket'
]
Outputs¶
- heatmap:
Visualization
Heatmap of important features.[required]
- filtered_table:
FeatureTable[Frequency]
Filtered feature table containing data displayed in heatmap.[required]
This QIIME 2 plugin supports methods for supervised classification and regression of sample metadata, and other supervised machine learning methods.
- version:
2024.10.0
- website: https://
github .com /qiime2 /q2 -sample -classifier - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org - citations:
- Bokulich et al., 2018; Pedregosa et al., 2011
Actions¶
Name | Type | Short Description |
---|---|---|
regress-samples-ncv | method | Nested cross-validated supervised learning regressor. |
classify-samples-ncv | method | Nested cross-validated supervised learning classifier. |
fit-classifier | method | Fit a supervised learning classifier. |
fit-regressor | method | Fit a supervised learning regressor. |
predict-classification | method | Use trained classifier to predict target values for new samples. |
predict-regression | method | Use trained regressor to predict target values for new samples. |
split-table | method | Split a feature table into training and testing sets. |
scatterplot | visualizer | Make 2D scatterplot and linear regression of regressor predictions. |
confusion-matrix | visualizer | Make a confusion matrix from sample classifier predictions. |
summarize | visualizer | Summarize parameter and feature extraction information for a trained estimator. |
classify-samples | pipeline | Train and test a cross-validated supervised learning classifier. |
classify-samples-from-dist | pipeline | Run k-nearest-neighbors on a labeled distance matrix. |
regress-samples | pipeline | Train and test a cross-validated supervised learning regressor. |
metatable | pipeline | Convert (and merge) positive numeric metadata (in)to feature table. |
heatmap | pipeline | Generate heatmap of important features. |
Artifact Classes¶
Formats¶
sample-classifier regress-samples-ncv¶
Predicts a continuous sample metadata column using a supervised learning regressor. Uses nested stratified k-fold cross validation for automated hyperparameter optimization and sample prediction. Outputs predicted values for each input sample, and relative importance of each feature for model accuracy.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
]
Numeric metadata column to use as prediction target.[required]
- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestRegressor', 'ExtraTreesRegressor', 'GradientBoostingRegressor', 'AdaBoostRegressor[DecisionTree]', 'AdaBoostRegressor[ExtraTrees]', 'ElasticNet', 'Ridge', 'Lasso', 'KNeighborsRegressor', 'LinearSVR', 'SVR')
Estimator method to use for sample prediction.[default:
'RandomForestRegressor'
]- stratify:
Bool
Evenly stratify training and test data among metadata categories. If True, all values in column must match at least two samples.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- predictions:
SampleData[RegressorPredictions]
Predicted target values for each input sample.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
sample-classifier classify-samples-ncv¶
Predicts a categorical sample metadata column using a supervised learning classifier. Uses nested stratified k-fold cross validation for automated hyperparameter optimization and sample prediction. Outputs predicted values for each input sample, and relative importance of each feature for model accuracy.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Categorical metadata column to use as prediction target.[required]
- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestClassifier', 'ExtraTreesClassifier', 'GradientBoostingClassifier', 'AdaBoostClassifier[DecisionTree]', 'AdaBoostClassifier[ExtraTrees]', 'KNeighborsClassifier', 'LinearSVC', 'SVC')
Estimator method to use for sample prediction.[default:
'RandomForestClassifier'
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- predictions:
SampleData[ClassifierPredictions]
Predicted target values for each input sample.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[required]
sample-classifier fit-classifier¶
Fit a supervised learning classifier. Outputs the fit estimator (for prediction of test samples and/or unknown samples) and the relative importance of each feature for model accuracy. Optionally use k-fold cross-validation for automatic recursive feature elimination and hyperparameter tuning.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Numeric metadata column to use as prediction target.[required]
- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestClassifier', 'ExtraTreesClassifier', 'GradientBoostingClassifier', 'AdaBoostClassifier[DecisionTree]', 'AdaBoostClassifier[ExtraTrees]', 'KNeighborsClassifier', 'LinearSVC', 'SVC')
Estimator method to use for sample prediction.[default:
'RandomForestClassifier'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Classifier]
Trained sample classifier.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
sample-classifier fit-regressor¶
Fit a supervised learning regressor. Outputs the fit estimator (for prediction of test samples and/or unknown samples) and the relative importance of each feature for model accuracy. Optionally use k-fold cross-validation for automatic recursive feature elimination and hyperparameter tuning.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
]
Numeric metadata column to use as prediction target.[required]
- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestRegressor', 'ExtraTreesRegressor', 'GradientBoostingRegressor', 'AdaBoostRegressor[DecisionTree]', 'AdaBoostRegressor[ExtraTrees]', 'ElasticNet', 'Ridge', 'Lasso', 'KNeighborsRegressor', 'LinearSVR', 'SVR')
Estimator method to use for sample prediction.[default:
'RandomForestRegressor'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Regressor]
<no description>[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
sample-classifier predict-classification¶
Use trained estimator to predict target values for new samples. These will typically be unseen samples, e.g., test data (derived manually or from split_table) or samples with unknown values, but can theoretically be any samples present in a feature table that contain overlapping features with the feature table used to train the estimator.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
- sample_estimator:
SampleEstimator[Classifier]
Sample classifier trained with fit_classifier.[required]
Parameters¶
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]
Outputs¶
- predictions:
SampleData[ClassifierPredictions]
Predicted target values for each input sample.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[required]
sample-classifier predict-regression¶
Use trained estimator to predict target values for new samples. These will typically be unseen samples, e.g., test data (derived manually or from split_table) or samples with unknown values, but can theoretically be any samples present in a feature table that contain overlapping features with the feature table used to train the estimator.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
- sample_estimator:
SampleEstimator[Regressor]
Sample regressor trained with fit_regressor.[required]
Parameters¶
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]
Outputs¶
- predictions:
SampleData[RegressorPredictions]
Predicted target values for each input sample.[required]
sample-classifier split-table¶
Split a feature table into training and testing sets. By default stratifies training and test sets on a metadata column, such that values in that column are evenly represented across training and test sets.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Balance⁴ | PercentileNormalized⁵ | Design⁶ | Composition⁷]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
|
Categorical
]
Numeric metadata column to use as prediction target.[required]
- test_size:
Float
%
Range
(0.0, 1.0)
Fraction of input samples to exclude from training set and use for classifier testing.[default:
0.2
]- random_state:
Int
Seed used by random number generator.[optional]
- stratify:
Bool
Evenly stratify training and test data among metadata categories. If True, all values in column must match at least two samples.[default:
True
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- training_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Balance⁴ | PercentileNormalized⁵ | Design⁶ | Composition⁷]
Feature table containing training samples[required]
- test_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Balance⁴ | PercentileNormalized⁵ | Design⁶ | Composition⁷]
Feature table containing test samples[required]
- training_targets:
SampleData[TrueTargets]
Series containing true target values of train samples[required]
- test_targets:
SampleData[TrueTargets]
Series containing true target values of test samples[required]
sample-classifier scatterplot¶
Make a 2D scatterplot and linear regression of predicted vs. true values for a set of samples predicted using a sample regressor.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- predictions:
SampleData[RegressorPredictions]
Predicted values to plot on y axis. Must be predictions of numeric data produced by a sample regressor.[required]
Parameters¶
- truth:
MetadataColumn
[
Numeric
]
Metadata column (true values) to plot on x axis.[required]
- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
sample-classifier confusion-matrix¶
Make a confusion matrix and calculate accuracy of predicted vs. true values for a set of samples classified using a sample classifier. If per-sample class probabilities are provided, will also generate Receiver Operating Characteristic curves and calculate area under the curve for each class.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- predictions:
SampleData[ClassifierPredictions]
Predicted values to plot on x axis. Should be predictions of categorical data produced by a sample classifier.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[optional]
Parameters¶
- truth:
MetadataColumn
[
Categorical
]
Metadata column (true values) to plot on y axis.[required]
- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]- vmin:
Float
|
Str
%
Choices
('auto')
The minimum value to use for anchoring the colormap. If "auto", vmin is set to the minimum value in the data.[default:
'auto'
]- vmax:
Float
|
Str
%
Choices
('auto')
The maximum value to use for anchoring the colormap. If "auto", vmax is set to the maximum value in the data.[default:
'auto'
]- palette:
Str
%
Choices
('YellowOrangeBrown', 'YellowOrangeRed', 'OrangeRed', 'PurpleRed', 'RedPurple', 'BluePurple', 'GreenBlue', 'PurpleBlue', 'YellowGreen', 'summer', 'copper', 'viridis', 'cividis', 'plasma', 'inferno', 'magma', 'sirocco', 'drifting', 'melancholy', 'enigma', 'eros', 'spectre', 'ambition', 'mysteriousstains', 'daydream', 'solano', 'navarro', 'dandelions', 'deepblue', 'verve', 'greyscale')
The color palette to use for plotting.[default:
'sirocco'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
sample-classifier summarize¶
Summarize parameter and feature extraction information for a trained estimator.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- sample_estimator:
SampleEstimator[Classifier | Regressor]
Sample estimator trained with fit_classifier or fit_regressor.[required]
Outputs¶
- visualization:
Visualization
<no description>[required]
sample-classifier classify-samples¶
Predicts a categorical sample metadata column using a supervised learning classifier. Splits input data into training and test sets. The training set is used to train and test the estimator using a stratified k-fold cross-validation scheme. This includes optional steps for automated feature extraction and hyperparameter optimization. The test set validates classification accuracy of the optimized estimator. Outputs classification results for test set. For more details on the learning algorithm, see http://
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Categorical metadata column to use as prediction target.[required]
- test_size:
Float
%
Range
(0.0, 1.0)
Fraction of input samples to exclude from training set and use for classifier testing.[default:
0.2
]- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestClassifier', 'ExtraTreesClassifier', 'GradientBoostingClassifier', 'AdaBoostClassifier[DecisionTree]', 'AdaBoostClassifier[ExtraTrees]', 'KNeighborsClassifier', 'LinearSVC', 'SVC')
Estimator method to use for sample prediction.[default:
'RandomForestClassifier'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- palette:
Str
%
Choices
('YellowOrangeBrown', 'YellowOrangeRed', 'OrangeRed', 'PurpleRed', 'RedPurple', 'BluePurple', 'GreenBlue', 'PurpleBlue', 'YellowGreen', 'summer', 'copper', 'viridis', 'cividis', 'plasma', 'inferno', 'magma', 'sirocco', 'drifting', 'melancholy', 'enigma', 'eros', 'spectre', 'ambition', 'mysteriousstains', 'daydream', 'solano', 'navarro', 'dandelions', 'deepblue', 'verve', 'greyscale')
The color palette to use for plotting.[default:
'sirocco'
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Classifier]
Trained sample estimator.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
- predictions:
SampleData[ClassifierPredictions]
Predicted target values for each input sample.[required]
- model_summary:
Visualization
Summarized parameter and (if enabled) feature selection information for the trained estimator.[required]
- accuracy_results:
Visualization
Accuracy results visualization.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[required]
- heatmap:
Visualization
A heatmap of the top 50 most important features from the table.[required]
- training_targets:
SampleData[TrueTargets]
Series containing true target values of train samples[required]
- test_targets:
SampleData[TrueTargets]
Series containing true target values of test samples[required]
sample-classifier classify-samples-from-dist¶
Run k-nearest-neighbors on a labeled distance matrix. Return cross-validated (leave one out) predictions and accuracy. k = 1 by default
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- distance_matrix:
DistanceMatrix
a distance matrix[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Categorical metadata column to use as prediction target.[required]
- k:
Int
Number of nearest neighbors[default:
1
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- palette:
Str
%
Choices
('YellowOrangeBrown', 'YellowOrangeRed', 'OrangeRed', 'PurpleRed', 'RedPurple', 'BluePurple', 'GreenBlue', 'PurpleBlue', 'YellowGreen', 'summer', 'copper', 'viridis', 'cividis', 'plasma', 'inferno', 'magma', 'sirocco', 'drifting', 'melancholy', 'enigma', 'eros', 'spectre', 'ambition', 'mysteriousstains', 'daydream', 'solano', 'navarro', 'dandelions', 'deepblue', 'verve', 'greyscale')
The color palette to use for plotting.[default:
'sirocco'
]
Outputs¶
- predictions:
SampleData[ClassifierPredictions]
leave one out predictions for each sample[required]
- accuracy_results:
Visualization
Accuracy results visualization.[required]
sample-classifier regress-samples¶
Predicts a continuous sample metadata column using a supervised learning regressor. Splits input data into training and test sets. The training set is used to train and test the estimator using a stratified k-fold cross-validation scheme. This includes optional steps for automated feature extraction and hyperparameter optimization. The test set validates classification accuracy of the optimized estimator. Outputs classification results for test set. For more details on the learning algorithm, see http://
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
]
Numeric metadata column to use as prediction target.[required]
- test_size:
Float
%
Range
(0.0, 1.0)
Fraction of input samples to exclude from training set and use for classifier testing.[default:
0.2
]- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestRegressor', 'ExtraTreesRegressor', 'GradientBoostingRegressor', 'AdaBoostRegressor[DecisionTree]', 'AdaBoostRegressor[ExtraTrees]', 'ElasticNet', 'Ridge', 'Lasso', 'KNeighborsRegressor', 'LinearSVR', 'SVR')
Estimator method to use for sample prediction.[default:
'RandomForestRegressor'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- stratify:
Bool
Evenly stratify training and test data among metadata categories. If True, all values in column must match at least two samples.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Regressor]
Trained sample estimator.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
- predictions:
SampleData[RegressorPredictions]
Predicted target values for each input sample.[required]
- model_summary:
Visualization
Summarized parameter and (if enabled) feature selection information for the trained estimator.[required]
- accuracy_results:
Visualization
Accuracy results visualization.[required]
sample-classifier metatable¶
Convert numeric sample metadata from TSV file into a feature table. Optionally merge with an existing feature table. Only numeric metadata will be converted; categorical columns will be silently dropped. By default, if a table is used as input only samples found in both the table and metadata (intersection) are merged, and others are silently dropped. Set missing_samples="error" to raise an error if samples found in the table are missing from the metadata file. The metadata file can always contain a superset of samples. Note that columns will be dropped if they are non-numeric, contain no unique values (zero variance), contain only empty cells, or contain negative values. This method currently only converts postive numeric metadata into feature data. Tip: convert categorical columns to dummy variables to include them in the output feature table.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[optional]
Parameters¶
- metadata:
Metadata
Metadata file to convert to feature table.[required]
- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'ignore'
]- missing_values:
Str
%
Choices
('drop_samples', 'drop_features', 'error', 'fill')
How to handle missing values (nans) in metadata. Either "drop_samples" with missing values, "drop_features" with missing values, "fill" missing values with zeros, or "error" if any missing values are found.[default:
'error'
]- drop_all_unique:
Bool
If True, columns that contain a unique value for every ID will be dropped.[default:
False
]
Outputs¶
- converted_table:
FeatureTable[Frequency]
Converted feature table[required]
sample-classifier heatmap¶
Generate a heatmap of important features. Features are filtered based on importance scores; samples are optionally grouped by sample metadata; and a heatmap is generated that displays (normalized) feature abundances per sample.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
- importance:
FeatureData[Importance]
Feature importances.[required]
Parameters¶
- sample_metadata:
MetadataColumn
[
Categorical
]
Sample metadata column to use for sample labeling or grouping.[optional]
- feature_metadata:
MetadataColumn
[
Categorical
]
Feature metadata (e.g., taxonomy) to use for labeling features in the heatmap.[optional]
- feature_count:
Int
%
Range
(0, None)
Filter feature table to include top N most important features. Set to zero to include all features.[default:
50
]- importance_threshold:
Float
%
Range
(0, None)
Filter feature table to exclude any features with an importance score less than this threshold. Set to zero to include all features.[default:
0
]- group_samples:
Bool
Group samples by sample metadata.[default:
False
]- normalize:
Bool
Normalize the feature table by adding a psuedocount of 1 and then taking the log10 of the table.[default:
True
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'ignore'
]- metric:
Str
%
Choices
('braycurtis', 'canberra', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', 'jaccard', 'kulsinski', 'mahalanobis', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule')
Metrics exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'braycurtis'
]- method:
Str
%
Choices
('average', 'centroid', 'complete', 'median', 'single', 'ward', 'weighted')
Clustering methods exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'average'
]- cluster:
Str
%
Choices
('both', 'features', 'none', 'samples')
Specify which axes to cluster.[default:
'features'
]- color_scheme:
Str
%
Choices
('Accent', 'Accent_r', 'Blues', 'Blues_r', 'BrBG', 'BrBG_r', 'BuGn', 'BuGn_r', 'BuPu', 'BuPu_r', 'CMRmap', 'CMRmap_r', 'Dark2', 'Dark2_r', 'GnBu', 'GnBu_r', 'Greens', 'Greens_r', 'Greys', 'Greys_r', 'OrRd', 'OrRd_r', 'Oranges', 'Oranges_r', 'PRGn', 'PRGn_r', 'Paired', 'Paired_r', 'Pastel1', 'Pastel1_r', 'Pastel2', 'Pastel2_r', 'PiYG', 'PiYG_r', 'PuBu', 'PuBuGn', 'PuBuGn_r', 'PuBu_r', 'PuOr', 'PuOr_r', 'PuRd', 'PuRd_r', 'Purples', 'Purples_r', 'RdBu', 'RdBu_r', 'RdGy', 'RdGy_r', 'RdPu', 'RdPu_r', 'RdYlBu', 'RdYlBu_r', 'RdYlGn', 'RdYlGn_r', 'Reds', 'Reds_r', 'Set1', 'Set1_r', 'Set2', 'Set2_r', 'Set3', 'Set3_r', 'Spectral', 'Spectral_r', 'Vega10', 'Vega10_r', 'Vega20', 'Vega20_r', 'Vega20b', 'Vega20b_r', 'Vega20c', 'Vega20c_r', 'Wistia', 'Wistia_r', 'YlGn', 'YlGnBu', 'YlGnBu_r', 'YlGn_r', 'YlOrBr', 'YlOrBr_r', 'YlOrRd', 'YlOrRd_r', 'afmhot', 'afmhot_r', 'autumn', 'autumn_r', 'binary', 'binary_r', 'bone', 'bone_r', 'brg', 'brg_r', 'bwr', 'bwr_r', 'cividis', 'cividis_r', 'cool', 'cool_r', 'coolwarm', 'coolwarm_r', 'copper', 'copper_r', 'cubehelix', 'cubehelix_r', 'flag', 'flag_r', 'gist_earth', 'gist_earth_r', 'gist_gray', 'gist_gray_r', 'gist_heat', 'gist_heat_r', 'gist_ncar', 'gist_ncar_r', 'gist_rainbow', 'gist_rainbow_r', 'gist_stern', 'gist_stern_r', 'gist_yarg', 'gist_yarg_r', 'gnuplot', 'gnuplot2', 'gnuplot2_r', 'gnuplot_r', 'gray', 'gray_r', 'hot', 'hot_r', 'hsv', 'hsv_r', 'icefire', 'icefire_r', 'inferno', 'inferno_r', 'jet', 'jet_r', 'magma', 'magma_r', 'mako', 'mako_r', 'nipy_spectral', 'nipy_spectral_r', 'ocean', 'ocean_r', 'pink', 'pink_r', 'plasma', 'plasma_r', 'prism', 'prism_r', 'rainbow', 'rainbow_r', 'rocket', 'rocket_r', 'seismic', 'seismic_r', 'spectral', 'spectral_r', 'spring', 'spring_r', 'summer', 'summer_r', 'tab10', 'tab10_r', 'tab20', 'tab20_r', 'tab20b', 'tab20b_r', 'tab20c', 'tab20c_r', 'terrain', 'terrain_r', 'viridis', 'viridis_r', 'vlag', 'vlag_r', 'winter', 'winter_r')
Color scheme for heatmap.[default:
'rocket'
]
Outputs¶
- heatmap:
Visualization
Heatmap of important features.[required]
- filtered_table:
FeatureTable[Frequency]
Filtered feature table containing data displayed in heatmap.[required]
This QIIME 2 plugin supports methods for supervised classification and regression of sample metadata, and other supervised machine learning methods.
- version:
2024.10.0
- website: https://
github .com /qiime2 /q2 -sample -classifier - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org - citations:
- Bokulich et al., 2018; Pedregosa et al., 2011
Actions¶
Name | Type | Short Description |
---|---|---|
regress-samples-ncv | method | Nested cross-validated supervised learning regressor. |
classify-samples-ncv | method | Nested cross-validated supervised learning classifier. |
fit-classifier | method | Fit a supervised learning classifier. |
fit-regressor | method | Fit a supervised learning regressor. |
predict-classification | method | Use trained classifier to predict target values for new samples. |
predict-regression | method | Use trained regressor to predict target values for new samples. |
split-table | method | Split a feature table into training and testing sets. |
scatterplot | visualizer | Make 2D scatterplot and linear regression of regressor predictions. |
confusion-matrix | visualizer | Make a confusion matrix from sample classifier predictions. |
summarize | visualizer | Summarize parameter and feature extraction information for a trained estimator. |
classify-samples | pipeline | Train and test a cross-validated supervised learning classifier. |
classify-samples-from-dist | pipeline | Run k-nearest-neighbors on a labeled distance matrix. |
regress-samples | pipeline | Train and test a cross-validated supervised learning regressor. |
metatable | pipeline | Convert (and merge) positive numeric metadata (in)to feature table. |
heatmap | pipeline | Generate heatmap of important features. |
Artifact Classes¶
Formats¶
sample-classifier regress-samples-ncv¶
Predicts a continuous sample metadata column using a supervised learning regressor. Uses nested stratified k-fold cross validation for automated hyperparameter optimization and sample prediction. Outputs predicted values for each input sample, and relative importance of each feature for model accuracy.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
]
Numeric metadata column to use as prediction target.[required]
- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestRegressor', 'ExtraTreesRegressor', 'GradientBoostingRegressor', 'AdaBoostRegressor[DecisionTree]', 'AdaBoostRegressor[ExtraTrees]', 'ElasticNet', 'Ridge', 'Lasso', 'KNeighborsRegressor', 'LinearSVR', 'SVR')
Estimator method to use for sample prediction.[default:
'RandomForestRegressor'
]- stratify:
Bool
Evenly stratify training and test data among metadata categories. If True, all values in column must match at least two samples.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- predictions:
SampleData[RegressorPredictions]
Predicted target values for each input sample.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
sample-classifier classify-samples-ncv¶
Predicts a categorical sample metadata column using a supervised learning classifier. Uses nested stratified k-fold cross validation for automated hyperparameter optimization and sample prediction. Outputs predicted values for each input sample, and relative importance of each feature for model accuracy.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Categorical metadata column to use as prediction target.[required]
- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestClassifier', 'ExtraTreesClassifier', 'GradientBoostingClassifier', 'AdaBoostClassifier[DecisionTree]', 'AdaBoostClassifier[ExtraTrees]', 'KNeighborsClassifier', 'LinearSVC', 'SVC')
Estimator method to use for sample prediction.[default:
'RandomForestClassifier'
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- predictions:
SampleData[ClassifierPredictions]
Predicted target values for each input sample.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[required]
sample-classifier fit-classifier¶
Fit a supervised learning classifier. Outputs the fit estimator (for prediction of test samples and/or unknown samples) and the relative importance of each feature for model accuracy. Optionally use k-fold cross-validation for automatic recursive feature elimination and hyperparameter tuning.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Numeric metadata column to use as prediction target.[required]
- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestClassifier', 'ExtraTreesClassifier', 'GradientBoostingClassifier', 'AdaBoostClassifier[DecisionTree]', 'AdaBoostClassifier[ExtraTrees]', 'KNeighborsClassifier', 'LinearSVC', 'SVC')
Estimator method to use for sample prediction.[default:
'RandomForestClassifier'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Classifier]
Trained sample classifier.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
sample-classifier fit-regressor¶
Fit a supervised learning regressor. Outputs the fit estimator (for prediction of test samples and/or unknown samples) and the relative importance of each feature for model accuracy. Optionally use k-fold cross-validation for automatic recursive feature elimination and hyperparameter tuning.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
]
Numeric metadata column to use as prediction target.[required]
- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestRegressor', 'ExtraTreesRegressor', 'GradientBoostingRegressor', 'AdaBoostRegressor[DecisionTree]', 'AdaBoostRegressor[ExtraTrees]', 'ElasticNet', 'Ridge', 'Lasso', 'KNeighborsRegressor', 'LinearSVR', 'SVR')
Estimator method to use for sample prediction.[default:
'RandomForestRegressor'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Regressor]
<no description>[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
sample-classifier predict-classification¶
Use trained estimator to predict target values for new samples. These will typically be unseen samples, e.g., test data (derived manually or from split_table) or samples with unknown values, but can theoretically be any samples present in a feature table that contain overlapping features with the feature table used to train the estimator.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
- sample_estimator:
SampleEstimator[Classifier]
Sample classifier trained with fit_classifier.[required]
Parameters¶
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]
Outputs¶
- predictions:
SampleData[ClassifierPredictions]
Predicted target values for each input sample.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[required]
sample-classifier predict-regression¶
Use trained estimator to predict target values for new samples. These will typically be unseen samples, e.g., test data (derived manually or from split_table) or samples with unknown values, but can theoretically be any samples present in a feature table that contain overlapping features with the feature table used to train the estimator.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
- sample_estimator:
SampleEstimator[Regressor]
Sample regressor trained with fit_regressor.[required]
Parameters¶
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]
Outputs¶
- predictions:
SampleData[RegressorPredictions]
Predicted target values for each input sample.[required]
sample-classifier split-table¶
Split a feature table into training and testing sets. By default stratifies training and test sets on a metadata column, such that values in that column are evenly represented across training and test sets.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Balance⁴ | PercentileNormalized⁵ | Design⁶ | Composition⁷]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
|
Categorical
]
Numeric metadata column to use as prediction target.[required]
- test_size:
Float
%
Range
(0.0, 1.0)
Fraction of input samples to exclude from training set and use for classifier testing.[default:
0.2
]- random_state:
Int
Seed used by random number generator.[optional]
- stratify:
Bool
Evenly stratify training and test data among metadata categories. If True, all values in column must match at least two samples.[default:
True
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- training_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Balance⁴ | PercentileNormalized⁵ | Design⁶ | Composition⁷]
Feature table containing training samples[required]
- test_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Balance⁴ | PercentileNormalized⁵ | Design⁶ | Composition⁷]
Feature table containing test samples[required]
- training_targets:
SampleData[TrueTargets]
Series containing true target values of train samples[required]
- test_targets:
SampleData[TrueTargets]
Series containing true target values of test samples[required]
sample-classifier scatterplot¶
Make a 2D scatterplot and linear regression of predicted vs. true values for a set of samples predicted using a sample regressor.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- predictions:
SampleData[RegressorPredictions]
Predicted values to plot on y axis. Must be predictions of numeric data produced by a sample regressor.[required]
Parameters¶
- truth:
MetadataColumn
[
Numeric
]
Metadata column (true values) to plot on x axis.[required]
- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
sample-classifier confusion-matrix¶
Make a confusion matrix and calculate accuracy of predicted vs. true values for a set of samples classified using a sample classifier. If per-sample class probabilities are provided, will also generate Receiver Operating Characteristic curves and calculate area under the curve for each class.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- predictions:
SampleData[ClassifierPredictions]
Predicted values to plot on x axis. Should be predictions of categorical data produced by a sample classifier.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[optional]
Parameters¶
- truth:
MetadataColumn
[
Categorical
]
Metadata column (true values) to plot on y axis.[required]
- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]- vmin:
Float
|
Str
%
Choices
('auto')
The minimum value to use for anchoring the colormap. If "auto", vmin is set to the minimum value in the data.[default:
'auto'
]- vmax:
Float
|
Str
%
Choices
('auto')
The maximum value to use for anchoring the colormap. If "auto", vmax is set to the maximum value in the data.[default:
'auto'
]- palette:
Str
%
Choices
('YellowOrangeBrown', 'YellowOrangeRed', 'OrangeRed', 'PurpleRed', 'RedPurple', 'BluePurple', 'GreenBlue', 'PurpleBlue', 'YellowGreen', 'summer', 'copper', 'viridis', 'cividis', 'plasma', 'inferno', 'magma', 'sirocco', 'drifting', 'melancholy', 'enigma', 'eros', 'spectre', 'ambition', 'mysteriousstains', 'daydream', 'solano', 'navarro', 'dandelions', 'deepblue', 'verve', 'greyscale')
The color palette to use for plotting.[default:
'sirocco'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
sample-classifier summarize¶
Summarize parameter and feature extraction information for a trained estimator.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- sample_estimator:
SampleEstimator[Classifier | Regressor]
Sample estimator trained with fit_classifier or fit_regressor.[required]
Outputs¶
- visualization:
Visualization
<no description>[required]
sample-classifier classify-samples¶
Predicts a categorical sample metadata column using a supervised learning classifier. Splits input data into training and test sets. The training set is used to train and test the estimator using a stratified k-fold cross-validation scheme. This includes optional steps for automated feature extraction and hyperparameter optimization. The test set validates classification accuracy of the optimized estimator. Outputs classification results for test set. For more details on the learning algorithm, see http://
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Categorical metadata column to use as prediction target.[required]
- test_size:
Float
%
Range
(0.0, 1.0)
Fraction of input samples to exclude from training set and use for classifier testing.[default:
0.2
]- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestClassifier', 'ExtraTreesClassifier', 'GradientBoostingClassifier', 'AdaBoostClassifier[DecisionTree]', 'AdaBoostClassifier[ExtraTrees]', 'KNeighborsClassifier', 'LinearSVC', 'SVC')
Estimator method to use for sample prediction.[default:
'RandomForestClassifier'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- palette:
Str
%
Choices
('YellowOrangeBrown', 'YellowOrangeRed', 'OrangeRed', 'PurpleRed', 'RedPurple', 'BluePurple', 'GreenBlue', 'PurpleBlue', 'YellowGreen', 'summer', 'copper', 'viridis', 'cividis', 'plasma', 'inferno', 'magma', 'sirocco', 'drifting', 'melancholy', 'enigma', 'eros', 'spectre', 'ambition', 'mysteriousstains', 'daydream', 'solano', 'navarro', 'dandelions', 'deepblue', 'verve', 'greyscale')
The color palette to use for plotting.[default:
'sirocco'
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Classifier]
Trained sample estimator.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
- predictions:
SampleData[ClassifierPredictions]
Predicted target values for each input sample.[required]
- model_summary:
Visualization
Summarized parameter and (if enabled) feature selection information for the trained estimator.[required]
- accuracy_results:
Visualization
Accuracy results visualization.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[required]
- heatmap:
Visualization
A heatmap of the top 50 most important features from the table.[required]
- training_targets:
SampleData[TrueTargets]
Series containing true target values of train samples[required]
- test_targets:
SampleData[TrueTargets]
Series containing true target values of test samples[required]
sample-classifier classify-samples-from-dist¶
Run k-nearest-neighbors on a labeled distance matrix. Return cross-validated (leave one out) predictions and accuracy. k = 1 by default
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- distance_matrix:
DistanceMatrix
a distance matrix[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Categorical metadata column to use as prediction target.[required]
- k:
Int
Number of nearest neighbors[default:
1
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- palette:
Str
%
Choices
('YellowOrangeBrown', 'YellowOrangeRed', 'OrangeRed', 'PurpleRed', 'RedPurple', 'BluePurple', 'GreenBlue', 'PurpleBlue', 'YellowGreen', 'summer', 'copper', 'viridis', 'cividis', 'plasma', 'inferno', 'magma', 'sirocco', 'drifting', 'melancholy', 'enigma', 'eros', 'spectre', 'ambition', 'mysteriousstains', 'daydream', 'solano', 'navarro', 'dandelions', 'deepblue', 'verve', 'greyscale')
The color palette to use for plotting.[default:
'sirocco'
]
Outputs¶
- predictions:
SampleData[ClassifierPredictions]
leave one out predictions for each sample[required]
- accuracy_results:
Visualization
Accuracy results visualization.[required]
sample-classifier regress-samples¶
Predicts a continuous sample metadata column using a supervised learning regressor. Splits input data into training and test sets. The training set is used to train and test the estimator using a stratified k-fold cross-validation scheme. This includes optional steps for automated feature extraction and hyperparameter optimization. The test set validates classification accuracy of the optimized estimator. Outputs classification results for test set. For more details on the learning algorithm, see http://
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
]
Numeric metadata column to use as prediction target.[required]
- test_size:
Float
%
Range
(0.0, 1.0)
Fraction of input samples to exclude from training set and use for classifier testing.[default:
0.2
]- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestRegressor', 'ExtraTreesRegressor', 'GradientBoostingRegressor', 'AdaBoostRegressor[DecisionTree]', 'AdaBoostRegressor[ExtraTrees]', 'ElasticNet', 'Ridge', 'Lasso', 'KNeighborsRegressor', 'LinearSVR', 'SVR')
Estimator method to use for sample prediction.[default:
'RandomForestRegressor'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- stratify:
Bool
Evenly stratify training and test data among metadata categories. If True, all values in column must match at least two samples.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Regressor]
Trained sample estimator.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
- predictions:
SampleData[RegressorPredictions]
Predicted target values for each input sample.[required]
- model_summary:
Visualization
Summarized parameter and (if enabled) feature selection information for the trained estimator.[required]
- accuracy_results:
Visualization
Accuracy results visualization.[required]
sample-classifier metatable¶
Convert numeric sample metadata from TSV file into a feature table. Optionally merge with an existing feature table. Only numeric metadata will be converted; categorical columns will be silently dropped. By default, if a table is used as input only samples found in both the table and metadata (intersection) are merged, and others are silently dropped. Set missing_samples="error" to raise an error if samples found in the table are missing from the metadata file. The metadata file can always contain a superset of samples. Note that columns will be dropped if they are non-numeric, contain no unique values (zero variance), contain only empty cells, or contain negative values. This method currently only converts postive numeric metadata into feature data. Tip: convert categorical columns to dummy variables to include them in the output feature table.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[optional]
Parameters¶
- metadata:
Metadata
Metadata file to convert to feature table.[required]
- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'ignore'
]- missing_values:
Str
%
Choices
('drop_samples', 'drop_features', 'error', 'fill')
How to handle missing values (nans) in metadata. Either "drop_samples" with missing values, "drop_features" with missing values, "fill" missing values with zeros, or "error" if any missing values are found.[default:
'error'
]- drop_all_unique:
Bool
If True, columns that contain a unique value for every ID will be dropped.[default:
False
]
Outputs¶
- converted_table:
FeatureTable[Frequency]
Converted feature table[required]
sample-classifier heatmap¶
Generate a heatmap of important features. Features are filtered based on importance scores; samples are optionally grouped by sample metadata; and a heatmap is generated that displays (normalized) feature abundances per sample.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
- importance:
FeatureData[Importance]
Feature importances.[required]
Parameters¶
- sample_metadata:
MetadataColumn
[
Categorical
]
Sample metadata column to use for sample labeling or grouping.[optional]
- feature_metadata:
MetadataColumn
[
Categorical
]
Feature metadata (e.g., taxonomy) to use for labeling features in the heatmap.[optional]
- feature_count:
Int
%
Range
(0, None)
Filter feature table to include top N most important features. Set to zero to include all features.[default:
50
]- importance_threshold:
Float
%
Range
(0, None)
Filter feature table to exclude any features with an importance score less than this threshold. Set to zero to include all features.[default:
0
]- group_samples:
Bool
Group samples by sample metadata.[default:
False
]- normalize:
Bool
Normalize the feature table by adding a psuedocount of 1 and then taking the log10 of the table.[default:
True
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'ignore'
]- metric:
Str
%
Choices
('braycurtis', 'canberra', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', 'jaccard', 'kulsinski', 'mahalanobis', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule')
Metrics exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'braycurtis'
]- method:
Str
%
Choices
('average', 'centroid', 'complete', 'median', 'single', 'ward', 'weighted')
Clustering methods exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'average'
]- cluster:
Str
%
Choices
('both', 'features', 'none', 'samples')
Specify which axes to cluster.[default:
'features'
]- color_scheme:
Str
%
Choices
('Accent', 'Accent_r', 'Blues', 'Blues_r', 'BrBG', 'BrBG_r', 'BuGn', 'BuGn_r', 'BuPu', 'BuPu_r', 'CMRmap', 'CMRmap_r', 'Dark2', 'Dark2_r', 'GnBu', 'GnBu_r', 'Greens', 'Greens_r', 'Greys', 'Greys_r', 'OrRd', 'OrRd_r', 'Oranges', 'Oranges_r', 'PRGn', 'PRGn_r', 'Paired', 'Paired_r', 'Pastel1', 'Pastel1_r', 'Pastel2', 'Pastel2_r', 'PiYG', 'PiYG_r', 'PuBu', 'PuBuGn', 'PuBuGn_r', 'PuBu_r', 'PuOr', 'PuOr_r', 'PuRd', 'PuRd_r', 'Purples', 'Purples_r', 'RdBu', 'RdBu_r', 'RdGy', 'RdGy_r', 'RdPu', 'RdPu_r', 'RdYlBu', 'RdYlBu_r', 'RdYlGn', 'RdYlGn_r', 'Reds', 'Reds_r', 'Set1', 'Set1_r', 'Set2', 'Set2_r', 'Set3', 'Set3_r', 'Spectral', 'Spectral_r', 'Vega10', 'Vega10_r', 'Vega20', 'Vega20_r', 'Vega20b', 'Vega20b_r', 'Vega20c', 'Vega20c_r', 'Wistia', 'Wistia_r', 'YlGn', 'YlGnBu', 'YlGnBu_r', 'YlGn_r', 'YlOrBr', 'YlOrBr_r', 'YlOrRd', 'YlOrRd_r', 'afmhot', 'afmhot_r', 'autumn', 'autumn_r', 'binary', 'binary_r', 'bone', 'bone_r', 'brg', 'brg_r', 'bwr', 'bwr_r', 'cividis', 'cividis_r', 'cool', 'cool_r', 'coolwarm', 'coolwarm_r', 'copper', 'copper_r', 'cubehelix', 'cubehelix_r', 'flag', 'flag_r', 'gist_earth', 'gist_earth_r', 'gist_gray', 'gist_gray_r', 'gist_heat', 'gist_heat_r', 'gist_ncar', 'gist_ncar_r', 'gist_rainbow', 'gist_rainbow_r', 'gist_stern', 'gist_stern_r', 'gist_yarg', 'gist_yarg_r', 'gnuplot', 'gnuplot2', 'gnuplot2_r', 'gnuplot_r', 'gray', 'gray_r', 'hot', 'hot_r', 'hsv', 'hsv_r', 'icefire', 'icefire_r', 'inferno', 'inferno_r', 'jet', 'jet_r', 'magma', 'magma_r', 'mako', 'mako_r', 'nipy_spectral', 'nipy_spectral_r', 'ocean', 'ocean_r', 'pink', 'pink_r', 'plasma', 'plasma_r', 'prism', 'prism_r', 'rainbow', 'rainbow_r', 'rocket', 'rocket_r', 'seismic', 'seismic_r', 'spectral', 'spectral_r', 'spring', 'spring_r', 'summer', 'summer_r', 'tab10', 'tab10_r', 'tab20', 'tab20_r', 'tab20b', 'tab20b_r', 'tab20c', 'tab20c_r', 'terrain', 'terrain_r', 'viridis', 'viridis_r', 'vlag', 'vlag_r', 'winter', 'winter_r')
Color scheme for heatmap.[default:
'rocket'
]
Outputs¶
- heatmap:
Visualization
Heatmap of important features.[required]
- filtered_table:
FeatureTable[Frequency]
Filtered feature table containing data displayed in heatmap.[required]
This QIIME 2 plugin supports methods for supervised classification and regression of sample metadata, and other supervised machine learning methods.
- version:
2024.10.0
- website: https://
github .com /qiime2 /q2 -sample -classifier - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org - citations:
- Bokulich et al., 2018; Pedregosa et al., 2011
Actions¶
Name | Type | Short Description |
---|---|---|
regress-samples-ncv | method | Nested cross-validated supervised learning regressor. |
classify-samples-ncv | method | Nested cross-validated supervised learning classifier. |
fit-classifier | method | Fit a supervised learning classifier. |
fit-regressor | method | Fit a supervised learning regressor. |
predict-classification | method | Use trained classifier to predict target values for new samples. |
predict-regression | method | Use trained regressor to predict target values for new samples. |
split-table | method | Split a feature table into training and testing sets. |
scatterplot | visualizer | Make 2D scatterplot and linear regression of regressor predictions. |
confusion-matrix | visualizer | Make a confusion matrix from sample classifier predictions. |
summarize | visualizer | Summarize parameter and feature extraction information for a trained estimator. |
classify-samples | pipeline | Train and test a cross-validated supervised learning classifier. |
classify-samples-from-dist | pipeline | Run k-nearest-neighbors on a labeled distance matrix. |
regress-samples | pipeline | Train and test a cross-validated supervised learning regressor. |
metatable | pipeline | Convert (and merge) positive numeric metadata (in)to feature table. |
heatmap | pipeline | Generate heatmap of important features. |
Artifact Classes¶
Formats¶
sample-classifier regress-samples-ncv¶
Predicts a continuous sample metadata column using a supervised learning regressor. Uses nested stratified k-fold cross validation for automated hyperparameter optimization and sample prediction. Outputs predicted values for each input sample, and relative importance of each feature for model accuracy.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
]
Numeric metadata column to use as prediction target.[required]
- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestRegressor', 'ExtraTreesRegressor', 'GradientBoostingRegressor', 'AdaBoostRegressor[DecisionTree]', 'AdaBoostRegressor[ExtraTrees]', 'ElasticNet', 'Ridge', 'Lasso', 'KNeighborsRegressor', 'LinearSVR', 'SVR')
Estimator method to use for sample prediction.[default:
'RandomForestRegressor'
]- stratify:
Bool
Evenly stratify training and test data among metadata categories. If True, all values in column must match at least two samples.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- predictions:
SampleData[RegressorPredictions]
Predicted target values for each input sample.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
sample-classifier classify-samples-ncv¶
Predicts a categorical sample metadata column using a supervised learning classifier. Uses nested stratified k-fold cross validation for automated hyperparameter optimization and sample prediction. Outputs predicted values for each input sample, and relative importance of each feature for model accuracy.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Categorical metadata column to use as prediction target.[required]
- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestClassifier', 'ExtraTreesClassifier', 'GradientBoostingClassifier', 'AdaBoostClassifier[DecisionTree]', 'AdaBoostClassifier[ExtraTrees]', 'KNeighborsClassifier', 'LinearSVC', 'SVC')
Estimator method to use for sample prediction.[default:
'RandomForestClassifier'
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- predictions:
SampleData[ClassifierPredictions]
Predicted target values for each input sample.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[required]
sample-classifier fit-classifier¶
Fit a supervised learning classifier. Outputs the fit estimator (for prediction of test samples and/or unknown samples) and the relative importance of each feature for model accuracy. Optionally use k-fold cross-validation for automatic recursive feature elimination and hyperparameter tuning.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Numeric metadata column to use as prediction target.[required]
- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestClassifier', 'ExtraTreesClassifier', 'GradientBoostingClassifier', 'AdaBoostClassifier[DecisionTree]', 'AdaBoostClassifier[ExtraTrees]', 'KNeighborsClassifier', 'LinearSVC', 'SVC')
Estimator method to use for sample prediction.[default:
'RandomForestClassifier'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Classifier]
Trained sample classifier.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
sample-classifier fit-regressor¶
Fit a supervised learning regressor. Outputs the fit estimator (for prediction of test samples and/or unknown samples) and the relative importance of each feature for model accuracy. Optionally use k-fold cross-validation for automatic recursive feature elimination and hyperparameter tuning.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
]
Numeric metadata column to use as prediction target.[required]
- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestRegressor', 'ExtraTreesRegressor', 'GradientBoostingRegressor', 'AdaBoostRegressor[DecisionTree]', 'AdaBoostRegressor[ExtraTrees]', 'ElasticNet', 'Ridge', 'Lasso', 'KNeighborsRegressor', 'LinearSVR', 'SVR')
Estimator method to use for sample prediction.[default:
'RandomForestRegressor'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Regressor]
<no description>[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
sample-classifier predict-classification¶
Use trained estimator to predict target values for new samples. These will typically be unseen samples, e.g., test data (derived manually or from split_table) or samples with unknown values, but can theoretically be any samples present in a feature table that contain overlapping features with the feature table used to train the estimator.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
- sample_estimator:
SampleEstimator[Classifier]
Sample classifier trained with fit_classifier.[required]
Parameters¶
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]
Outputs¶
- predictions:
SampleData[ClassifierPredictions]
Predicted target values for each input sample.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[required]
sample-classifier predict-regression¶
Use trained estimator to predict target values for new samples. These will typically be unseen samples, e.g., test data (derived manually or from split_table) or samples with unknown values, but can theoretically be any samples present in a feature table that contain overlapping features with the feature table used to train the estimator.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
- sample_estimator:
SampleEstimator[Regressor]
Sample regressor trained with fit_regressor.[required]
Parameters¶
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]
Outputs¶
- predictions:
SampleData[RegressorPredictions]
Predicted target values for each input sample.[required]
sample-classifier split-table¶
Split a feature table into training and testing sets. By default stratifies training and test sets on a metadata column, such that values in that column are evenly represented across training and test sets.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Balance⁴ | PercentileNormalized⁵ | Design⁶ | Composition⁷]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
|
Categorical
]
Numeric metadata column to use as prediction target.[required]
- test_size:
Float
%
Range
(0.0, 1.0)
Fraction of input samples to exclude from training set and use for classifier testing.[default:
0.2
]- random_state:
Int
Seed used by random number generator.[optional]
- stratify:
Bool
Evenly stratify training and test data among metadata categories. If True, all values in column must match at least two samples.[default:
True
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- training_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Balance⁴ | PercentileNormalized⁵ | Design⁶ | Composition⁷]
Feature table containing training samples[required]
- test_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Balance⁴ | PercentileNormalized⁵ | Design⁶ | Composition⁷]
Feature table containing test samples[required]
- training_targets:
SampleData[TrueTargets]
Series containing true target values of train samples[required]
- test_targets:
SampleData[TrueTargets]
Series containing true target values of test samples[required]
sample-classifier scatterplot¶
Make a 2D scatterplot and linear regression of predicted vs. true values for a set of samples predicted using a sample regressor.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- predictions:
SampleData[RegressorPredictions]
Predicted values to plot on y axis. Must be predictions of numeric data produced by a sample regressor.[required]
Parameters¶
- truth:
MetadataColumn
[
Numeric
]
Metadata column (true values) to plot on x axis.[required]
- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
sample-classifier confusion-matrix¶
Make a confusion matrix and calculate accuracy of predicted vs. true values for a set of samples classified using a sample classifier. If per-sample class probabilities are provided, will also generate Receiver Operating Characteristic curves and calculate area under the curve for each class.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- predictions:
SampleData[ClassifierPredictions]
Predicted values to plot on x axis. Should be predictions of categorical data produced by a sample classifier.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[optional]
Parameters¶
- truth:
MetadataColumn
[
Categorical
]
Metadata column (true values) to plot on y axis.[required]
- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]- vmin:
Float
|
Str
%
Choices
('auto')
The minimum value to use for anchoring the colormap. If "auto", vmin is set to the minimum value in the data.[default:
'auto'
]- vmax:
Float
|
Str
%
Choices
('auto')
The maximum value to use for anchoring the colormap. If "auto", vmax is set to the maximum value in the data.[default:
'auto'
]- palette:
Str
%
Choices
('YellowOrangeBrown', 'YellowOrangeRed', 'OrangeRed', 'PurpleRed', 'RedPurple', 'BluePurple', 'GreenBlue', 'PurpleBlue', 'YellowGreen', 'summer', 'copper', 'viridis', 'cividis', 'plasma', 'inferno', 'magma', 'sirocco', 'drifting', 'melancholy', 'enigma', 'eros', 'spectre', 'ambition', 'mysteriousstains', 'daydream', 'solano', 'navarro', 'dandelions', 'deepblue', 'verve', 'greyscale')
The color palette to use for plotting.[default:
'sirocco'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
sample-classifier summarize¶
Summarize parameter and feature extraction information for a trained estimator.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- sample_estimator:
SampleEstimator[Classifier | Regressor]
Sample estimator trained with fit_classifier or fit_regressor.[required]
Outputs¶
- visualization:
Visualization
<no description>[required]
sample-classifier classify-samples¶
Predicts a categorical sample metadata column using a supervised learning classifier. Splits input data into training and test sets. The training set is used to train and test the estimator using a stratified k-fold cross-validation scheme. This includes optional steps for automated feature extraction and hyperparameter optimization. The test set validates classification accuracy of the optimized estimator. Outputs classification results for test set. For more details on the learning algorithm, see http://
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Categorical metadata column to use as prediction target.[required]
- test_size:
Float
%
Range
(0.0, 1.0)
Fraction of input samples to exclude from training set and use for classifier testing.[default:
0.2
]- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestClassifier', 'ExtraTreesClassifier', 'GradientBoostingClassifier', 'AdaBoostClassifier[DecisionTree]', 'AdaBoostClassifier[ExtraTrees]', 'KNeighborsClassifier', 'LinearSVC', 'SVC')
Estimator method to use for sample prediction.[default:
'RandomForestClassifier'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- palette:
Str
%
Choices
('YellowOrangeBrown', 'YellowOrangeRed', 'OrangeRed', 'PurpleRed', 'RedPurple', 'BluePurple', 'GreenBlue', 'PurpleBlue', 'YellowGreen', 'summer', 'copper', 'viridis', 'cividis', 'plasma', 'inferno', 'magma', 'sirocco', 'drifting', 'melancholy', 'enigma', 'eros', 'spectre', 'ambition', 'mysteriousstains', 'daydream', 'solano', 'navarro', 'dandelions', 'deepblue', 'verve', 'greyscale')
The color palette to use for plotting.[default:
'sirocco'
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Classifier]
Trained sample estimator.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
- predictions:
SampleData[ClassifierPredictions]
Predicted target values for each input sample.[required]
- model_summary:
Visualization
Summarized parameter and (if enabled) feature selection information for the trained estimator.[required]
- accuracy_results:
Visualization
Accuracy results visualization.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[required]
- heatmap:
Visualization
A heatmap of the top 50 most important features from the table.[required]
- training_targets:
SampleData[TrueTargets]
Series containing true target values of train samples[required]
- test_targets:
SampleData[TrueTargets]
Series containing true target values of test samples[required]
sample-classifier classify-samples-from-dist¶
Run k-nearest-neighbors on a labeled distance matrix. Return cross-validated (leave one out) predictions and accuracy. k = 1 by default
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- distance_matrix:
DistanceMatrix
a distance matrix[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Categorical metadata column to use as prediction target.[required]
- k:
Int
Number of nearest neighbors[default:
1
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- palette:
Str
%
Choices
('YellowOrangeBrown', 'YellowOrangeRed', 'OrangeRed', 'PurpleRed', 'RedPurple', 'BluePurple', 'GreenBlue', 'PurpleBlue', 'YellowGreen', 'summer', 'copper', 'viridis', 'cividis', 'plasma', 'inferno', 'magma', 'sirocco', 'drifting', 'melancholy', 'enigma', 'eros', 'spectre', 'ambition', 'mysteriousstains', 'daydream', 'solano', 'navarro', 'dandelions', 'deepblue', 'verve', 'greyscale')
The color palette to use for plotting.[default:
'sirocco'
]
Outputs¶
- predictions:
SampleData[ClassifierPredictions]
leave one out predictions for each sample[required]
- accuracy_results:
Visualization
Accuracy results visualization.[required]
sample-classifier regress-samples¶
Predicts a continuous sample metadata column using a supervised learning regressor. Splits input data into training and test sets. The training set is used to train and test the estimator using a stratified k-fold cross-validation scheme. This includes optional steps for automated feature extraction and hyperparameter optimization. The test set validates classification accuracy of the optimized estimator. Outputs classification results for test set. For more details on the learning algorithm, see http://
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
]
Numeric metadata column to use as prediction target.[required]
- test_size:
Float
%
Range
(0.0, 1.0)
Fraction of input samples to exclude from training set and use for classifier testing.[default:
0.2
]- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestRegressor', 'ExtraTreesRegressor', 'GradientBoostingRegressor', 'AdaBoostRegressor[DecisionTree]', 'AdaBoostRegressor[ExtraTrees]', 'ElasticNet', 'Ridge', 'Lasso', 'KNeighborsRegressor', 'LinearSVR', 'SVR')
Estimator method to use for sample prediction.[default:
'RandomForestRegressor'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- stratify:
Bool
Evenly stratify training and test data among metadata categories. If True, all values in column must match at least two samples.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Regressor]
Trained sample estimator.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
- predictions:
SampleData[RegressorPredictions]
Predicted target values for each input sample.[required]
- model_summary:
Visualization
Summarized parameter and (if enabled) feature selection information for the trained estimator.[required]
- accuracy_results:
Visualization
Accuracy results visualization.[required]
sample-classifier metatable¶
Convert numeric sample metadata from TSV file into a feature table. Optionally merge with an existing feature table. Only numeric metadata will be converted; categorical columns will be silently dropped. By default, if a table is used as input only samples found in both the table and metadata (intersection) are merged, and others are silently dropped. Set missing_samples="error" to raise an error if samples found in the table are missing from the metadata file. The metadata file can always contain a superset of samples. Note that columns will be dropped if they are non-numeric, contain no unique values (zero variance), contain only empty cells, or contain negative values. This method currently only converts postive numeric metadata into feature data. Tip: convert categorical columns to dummy variables to include them in the output feature table.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[optional]
Parameters¶
- metadata:
Metadata
Metadata file to convert to feature table.[required]
- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'ignore'
]- missing_values:
Str
%
Choices
('drop_samples', 'drop_features', 'error', 'fill')
How to handle missing values (nans) in metadata. Either "drop_samples" with missing values, "drop_features" with missing values, "fill" missing values with zeros, or "error" if any missing values are found.[default:
'error'
]- drop_all_unique:
Bool
If True, columns that contain a unique value for every ID will be dropped.[default:
False
]
Outputs¶
- converted_table:
FeatureTable[Frequency]
Converted feature table[required]
sample-classifier heatmap¶
Generate a heatmap of important features. Features are filtered based on importance scores; samples are optionally grouped by sample metadata; and a heatmap is generated that displays (normalized) feature abundances per sample.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
- importance:
FeatureData[Importance]
Feature importances.[required]
Parameters¶
- sample_metadata:
MetadataColumn
[
Categorical
]
Sample metadata column to use for sample labeling or grouping.[optional]
- feature_metadata:
MetadataColumn
[
Categorical
]
Feature metadata (e.g., taxonomy) to use for labeling features in the heatmap.[optional]
- feature_count:
Int
%
Range
(0, None)
Filter feature table to include top N most important features. Set to zero to include all features.[default:
50
]- importance_threshold:
Float
%
Range
(0, None)
Filter feature table to exclude any features with an importance score less than this threshold. Set to zero to include all features.[default:
0
]- group_samples:
Bool
Group samples by sample metadata.[default:
False
]- normalize:
Bool
Normalize the feature table by adding a psuedocount of 1 and then taking the log10 of the table.[default:
True
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'ignore'
]- metric:
Str
%
Choices
('braycurtis', 'canberra', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', 'jaccard', 'kulsinski', 'mahalanobis', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule')
Metrics exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'braycurtis'
]- method:
Str
%
Choices
('average', 'centroid', 'complete', 'median', 'single', 'ward', 'weighted')
Clustering methods exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'average'
]- cluster:
Str
%
Choices
('both', 'features', 'none', 'samples')
Specify which axes to cluster.[default:
'features'
]- color_scheme:
Str
%
Choices
('Accent', 'Accent_r', 'Blues', 'Blues_r', 'BrBG', 'BrBG_r', 'BuGn', 'BuGn_r', 'BuPu', 'BuPu_r', 'CMRmap', 'CMRmap_r', 'Dark2', 'Dark2_r', 'GnBu', 'GnBu_r', 'Greens', 'Greens_r', 'Greys', 'Greys_r', 'OrRd', 'OrRd_r', 'Oranges', 'Oranges_r', 'PRGn', 'PRGn_r', 'Paired', 'Paired_r', 'Pastel1', 'Pastel1_r', 'Pastel2', 'Pastel2_r', 'PiYG', 'PiYG_r', 'PuBu', 'PuBuGn', 'PuBuGn_r', 'PuBu_r', 'PuOr', 'PuOr_r', 'PuRd', 'PuRd_r', 'Purples', 'Purples_r', 'RdBu', 'RdBu_r', 'RdGy', 'RdGy_r', 'RdPu', 'RdPu_r', 'RdYlBu', 'RdYlBu_r', 'RdYlGn', 'RdYlGn_r', 'Reds', 'Reds_r', 'Set1', 'Set1_r', 'Set2', 'Set2_r', 'Set3', 'Set3_r', 'Spectral', 'Spectral_r', 'Vega10', 'Vega10_r', 'Vega20', 'Vega20_r', 'Vega20b', 'Vega20b_r', 'Vega20c', 'Vega20c_r', 'Wistia', 'Wistia_r', 'YlGn', 'YlGnBu', 'YlGnBu_r', 'YlGn_r', 'YlOrBr', 'YlOrBr_r', 'YlOrRd', 'YlOrRd_r', 'afmhot', 'afmhot_r', 'autumn', 'autumn_r', 'binary', 'binary_r', 'bone', 'bone_r', 'brg', 'brg_r', 'bwr', 'bwr_r', 'cividis', 'cividis_r', 'cool', 'cool_r', 'coolwarm', 'coolwarm_r', 'copper', 'copper_r', 'cubehelix', 'cubehelix_r', 'flag', 'flag_r', 'gist_earth', 'gist_earth_r', 'gist_gray', 'gist_gray_r', 'gist_heat', 'gist_heat_r', 'gist_ncar', 'gist_ncar_r', 'gist_rainbow', 'gist_rainbow_r', 'gist_stern', 'gist_stern_r', 'gist_yarg', 'gist_yarg_r', 'gnuplot', 'gnuplot2', 'gnuplot2_r', 'gnuplot_r', 'gray', 'gray_r', 'hot', 'hot_r', 'hsv', 'hsv_r', 'icefire', 'icefire_r', 'inferno', 'inferno_r', 'jet', 'jet_r', 'magma', 'magma_r', 'mako', 'mako_r', 'nipy_spectral', 'nipy_spectral_r', 'ocean', 'ocean_r', 'pink', 'pink_r', 'plasma', 'plasma_r', 'prism', 'prism_r', 'rainbow', 'rainbow_r', 'rocket', 'rocket_r', 'seismic', 'seismic_r', 'spectral', 'spectral_r', 'spring', 'spring_r', 'summer', 'summer_r', 'tab10', 'tab10_r', 'tab20', 'tab20_r', 'tab20b', 'tab20b_r', 'tab20c', 'tab20c_r', 'terrain', 'terrain_r', 'viridis', 'viridis_r', 'vlag', 'vlag_r', 'winter', 'winter_r')
Color scheme for heatmap.[default:
'rocket'
]
Outputs¶
- heatmap:
Visualization
Heatmap of important features.[required]
- filtered_table:
FeatureTable[Frequency]
Filtered feature table containing data displayed in heatmap.[required]
This QIIME 2 plugin supports methods for supervised classification and regression of sample metadata, and other supervised machine learning methods.
- version:
2024.10.0
- website: https://
github .com /qiime2 /q2 -sample -classifier - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org - citations:
- Bokulich et al., 2018; Pedregosa et al., 2011
Actions¶
Name | Type | Short Description |
---|---|---|
regress-samples-ncv | method | Nested cross-validated supervised learning regressor. |
classify-samples-ncv | method | Nested cross-validated supervised learning classifier. |
fit-classifier | method | Fit a supervised learning classifier. |
fit-regressor | method | Fit a supervised learning regressor. |
predict-classification | method | Use trained classifier to predict target values for new samples. |
predict-regression | method | Use trained regressor to predict target values for new samples. |
split-table | method | Split a feature table into training and testing sets. |
scatterplot | visualizer | Make 2D scatterplot and linear regression of regressor predictions. |
confusion-matrix | visualizer | Make a confusion matrix from sample classifier predictions. |
summarize | visualizer | Summarize parameter and feature extraction information for a trained estimator. |
classify-samples | pipeline | Train and test a cross-validated supervised learning classifier. |
classify-samples-from-dist | pipeline | Run k-nearest-neighbors on a labeled distance matrix. |
regress-samples | pipeline | Train and test a cross-validated supervised learning regressor. |
metatable | pipeline | Convert (and merge) positive numeric metadata (in)to feature table. |
heatmap | pipeline | Generate heatmap of important features. |
Artifact Classes¶
Formats¶
sample-classifier regress-samples-ncv¶
Predicts a continuous sample metadata column using a supervised learning regressor. Uses nested stratified k-fold cross validation for automated hyperparameter optimization and sample prediction. Outputs predicted values for each input sample, and relative importance of each feature for model accuracy.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
]
Numeric metadata column to use as prediction target.[required]
- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestRegressor', 'ExtraTreesRegressor', 'GradientBoostingRegressor', 'AdaBoostRegressor[DecisionTree]', 'AdaBoostRegressor[ExtraTrees]', 'ElasticNet', 'Ridge', 'Lasso', 'KNeighborsRegressor', 'LinearSVR', 'SVR')
Estimator method to use for sample prediction.[default:
'RandomForestRegressor'
]- stratify:
Bool
Evenly stratify training and test data among metadata categories. If True, all values in column must match at least two samples.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- predictions:
SampleData[RegressorPredictions]
Predicted target values for each input sample.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
sample-classifier classify-samples-ncv¶
Predicts a categorical sample metadata column using a supervised learning classifier. Uses nested stratified k-fold cross validation for automated hyperparameter optimization and sample prediction. Outputs predicted values for each input sample, and relative importance of each feature for model accuracy.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Categorical metadata column to use as prediction target.[required]
- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestClassifier', 'ExtraTreesClassifier', 'GradientBoostingClassifier', 'AdaBoostClassifier[DecisionTree]', 'AdaBoostClassifier[ExtraTrees]', 'KNeighborsClassifier', 'LinearSVC', 'SVC')
Estimator method to use for sample prediction.[default:
'RandomForestClassifier'
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- predictions:
SampleData[ClassifierPredictions]
Predicted target values for each input sample.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[required]
sample-classifier fit-classifier¶
Fit a supervised learning classifier. Outputs the fit estimator (for prediction of test samples and/or unknown samples) and the relative importance of each feature for model accuracy. Optionally use k-fold cross-validation for automatic recursive feature elimination and hyperparameter tuning.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Numeric metadata column to use as prediction target.[required]
- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestClassifier', 'ExtraTreesClassifier', 'GradientBoostingClassifier', 'AdaBoostClassifier[DecisionTree]', 'AdaBoostClassifier[ExtraTrees]', 'KNeighborsClassifier', 'LinearSVC', 'SVC')
Estimator method to use for sample prediction.[default:
'RandomForestClassifier'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Classifier]
Trained sample classifier.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
sample-classifier fit-regressor¶
Fit a supervised learning regressor. Outputs the fit estimator (for prediction of test samples and/or unknown samples) and the relative importance of each feature for model accuracy. Optionally use k-fold cross-validation for automatic recursive feature elimination and hyperparameter tuning.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
]
Numeric metadata column to use as prediction target.[required]
- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestRegressor', 'ExtraTreesRegressor', 'GradientBoostingRegressor', 'AdaBoostRegressor[DecisionTree]', 'AdaBoostRegressor[ExtraTrees]', 'ElasticNet', 'Ridge', 'Lasso', 'KNeighborsRegressor', 'LinearSVR', 'SVR')
Estimator method to use for sample prediction.[default:
'RandomForestRegressor'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Regressor]
<no description>[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
sample-classifier predict-classification¶
Use trained estimator to predict target values for new samples. These will typically be unseen samples, e.g., test data (derived manually or from split_table) or samples with unknown values, but can theoretically be any samples present in a feature table that contain overlapping features with the feature table used to train the estimator.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
- sample_estimator:
SampleEstimator[Classifier]
Sample classifier trained with fit_classifier.[required]
Parameters¶
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]
Outputs¶
- predictions:
SampleData[ClassifierPredictions]
Predicted target values for each input sample.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[required]
sample-classifier predict-regression¶
Use trained estimator to predict target values for new samples. These will typically be unseen samples, e.g., test data (derived manually or from split_table) or samples with unknown values, but can theoretically be any samples present in a feature table that contain overlapping features with the feature table used to train the estimator.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
- sample_estimator:
SampleEstimator[Regressor]
Sample regressor trained with fit_regressor.[required]
Parameters¶
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]
Outputs¶
- predictions:
SampleData[RegressorPredictions]
Predicted target values for each input sample.[required]
sample-classifier split-table¶
Split a feature table into training and testing sets. By default stratifies training and test sets on a metadata column, such that values in that column are evenly represented across training and test sets.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Balance⁴ | PercentileNormalized⁵ | Design⁶ | Composition⁷]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
|
Categorical
]
Numeric metadata column to use as prediction target.[required]
- test_size:
Float
%
Range
(0.0, 1.0)
Fraction of input samples to exclude from training set and use for classifier testing.[default:
0.2
]- random_state:
Int
Seed used by random number generator.[optional]
- stratify:
Bool
Evenly stratify training and test data among metadata categories. If True, all values in column must match at least two samples.[default:
True
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- training_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Balance⁴ | PercentileNormalized⁵ | Design⁶ | Composition⁷]
Feature table containing training samples[required]
- test_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Balance⁴ | PercentileNormalized⁵ | Design⁶ | Composition⁷]
Feature table containing test samples[required]
- training_targets:
SampleData[TrueTargets]
Series containing true target values of train samples[required]
- test_targets:
SampleData[TrueTargets]
Series containing true target values of test samples[required]
sample-classifier scatterplot¶
Make a 2D scatterplot and linear regression of predicted vs. true values for a set of samples predicted using a sample regressor.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- predictions:
SampleData[RegressorPredictions]
Predicted values to plot on y axis. Must be predictions of numeric data produced by a sample regressor.[required]
Parameters¶
- truth:
MetadataColumn
[
Numeric
]
Metadata column (true values) to plot on x axis.[required]
- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
sample-classifier confusion-matrix¶
Make a confusion matrix and calculate accuracy of predicted vs. true values for a set of samples classified using a sample classifier. If per-sample class probabilities are provided, will also generate Receiver Operating Characteristic curves and calculate area under the curve for each class.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- predictions:
SampleData[ClassifierPredictions]
Predicted values to plot on x axis. Should be predictions of categorical data produced by a sample classifier.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[optional]
Parameters¶
- truth:
MetadataColumn
[
Categorical
]
Metadata column (true values) to plot on y axis.[required]
- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]- vmin:
Float
|
Str
%
Choices
('auto')
The minimum value to use for anchoring the colormap. If "auto", vmin is set to the minimum value in the data.[default:
'auto'
]- vmax:
Float
|
Str
%
Choices
('auto')
The maximum value to use for anchoring the colormap. If "auto", vmax is set to the maximum value in the data.[default:
'auto'
]- palette:
Str
%
Choices
('YellowOrangeBrown', 'YellowOrangeRed', 'OrangeRed', 'PurpleRed', 'RedPurple', 'BluePurple', 'GreenBlue', 'PurpleBlue', 'YellowGreen', 'summer', 'copper', 'viridis', 'cividis', 'plasma', 'inferno', 'magma', 'sirocco', 'drifting', 'melancholy', 'enigma', 'eros', 'spectre', 'ambition', 'mysteriousstains', 'daydream', 'solano', 'navarro', 'dandelions', 'deepblue', 'verve', 'greyscale')
The color palette to use for plotting.[default:
'sirocco'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
sample-classifier summarize¶
Summarize parameter and feature extraction information for a trained estimator.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- sample_estimator:
SampleEstimator[Classifier | Regressor]
Sample estimator trained with fit_classifier or fit_regressor.[required]
Outputs¶
- visualization:
Visualization
<no description>[required]
sample-classifier classify-samples¶
Predicts a categorical sample metadata column using a supervised learning classifier. Splits input data into training and test sets. The training set is used to train and test the estimator using a stratified k-fold cross-validation scheme. This includes optional steps for automated feature extraction and hyperparameter optimization. The test set validates classification accuracy of the optimized estimator. Outputs classification results for test set. For more details on the learning algorithm, see http://
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Categorical metadata column to use as prediction target.[required]
- test_size:
Float
%
Range
(0.0, 1.0)
Fraction of input samples to exclude from training set and use for classifier testing.[default:
0.2
]- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestClassifier', 'ExtraTreesClassifier', 'GradientBoostingClassifier', 'AdaBoostClassifier[DecisionTree]', 'AdaBoostClassifier[ExtraTrees]', 'KNeighborsClassifier', 'LinearSVC', 'SVC')
Estimator method to use for sample prediction.[default:
'RandomForestClassifier'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- palette:
Str
%
Choices
('YellowOrangeBrown', 'YellowOrangeRed', 'OrangeRed', 'PurpleRed', 'RedPurple', 'BluePurple', 'GreenBlue', 'PurpleBlue', 'YellowGreen', 'summer', 'copper', 'viridis', 'cividis', 'plasma', 'inferno', 'magma', 'sirocco', 'drifting', 'melancholy', 'enigma', 'eros', 'spectre', 'ambition', 'mysteriousstains', 'daydream', 'solano', 'navarro', 'dandelions', 'deepblue', 'verve', 'greyscale')
The color palette to use for plotting.[default:
'sirocco'
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Classifier]
Trained sample estimator.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
- predictions:
SampleData[ClassifierPredictions]
Predicted target values for each input sample.[required]
- model_summary:
Visualization
Summarized parameter and (if enabled) feature selection information for the trained estimator.[required]
- accuracy_results:
Visualization
Accuracy results visualization.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[required]
- heatmap:
Visualization
A heatmap of the top 50 most important features from the table.[required]
- training_targets:
SampleData[TrueTargets]
Series containing true target values of train samples[required]
- test_targets:
SampleData[TrueTargets]
Series containing true target values of test samples[required]
sample-classifier classify-samples-from-dist¶
Run k-nearest-neighbors on a labeled distance matrix. Return cross-validated (leave one out) predictions and accuracy. k = 1 by default
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- distance_matrix:
DistanceMatrix
a distance matrix[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Categorical metadata column to use as prediction target.[required]
- k:
Int
Number of nearest neighbors[default:
1
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- palette:
Str
%
Choices
('YellowOrangeBrown', 'YellowOrangeRed', 'OrangeRed', 'PurpleRed', 'RedPurple', 'BluePurple', 'GreenBlue', 'PurpleBlue', 'YellowGreen', 'summer', 'copper', 'viridis', 'cividis', 'plasma', 'inferno', 'magma', 'sirocco', 'drifting', 'melancholy', 'enigma', 'eros', 'spectre', 'ambition', 'mysteriousstains', 'daydream', 'solano', 'navarro', 'dandelions', 'deepblue', 'verve', 'greyscale')
The color palette to use for plotting.[default:
'sirocco'
]
Outputs¶
- predictions:
SampleData[ClassifierPredictions]
leave one out predictions for each sample[required]
- accuracy_results:
Visualization
Accuracy results visualization.[required]
sample-classifier regress-samples¶
Predicts a continuous sample metadata column using a supervised learning regressor. Splits input data into training and test sets. The training set is used to train and test the estimator using a stratified k-fold cross-validation scheme. This includes optional steps for automated feature extraction and hyperparameter optimization. The test set validates classification accuracy of the optimized estimator. Outputs classification results for test set. For more details on the learning algorithm, see http://
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
]
Numeric metadata column to use as prediction target.[required]
- test_size:
Float
%
Range
(0.0, 1.0)
Fraction of input samples to exclude from training set and use for classifier testing.[default:
0.2
]- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestRegressor', 'ExtraTreesRegressor', 'GradientBoostingRegressor', 'AdaBoostRegressor[DecisionTree]', 'AdaBoostRegressor[ExtraTrees]', 'ElasticNet', 'Ridge', 'Lasso', 'KNeighborsRegressor', 'LinearSVR', 'SVR')
Estimator method to use for sample prediction.[default:
'RandomForestRegressor'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- stratify:
Bool
Evenly stratify training and test data among metadata categories. If True, all values in column must match at least two samples.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Regressor]
Trained sample estimator.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
- predictions:
SampleData[RegressorPredictions]
Predicted target values for each input sample.[required]
- model_summary:
Visualization
Summarized parameter and (if enabled) feature selection information for the trained estimator.[required]
- accuracy_results:
Visualization
Accuracy results visualization.[required]
sample-classifier metatable¶
Convert numeric sample metadata from TSV file into a feature table. Optionally merge with an existing feature table. Only numeric metadata will be converted; categorical columns will be silently dropped. By default, if a table is used as input only samples found in both the table and metadata (intersection) are merged, and others are silently dropped. Set missing_samples="error" to raise an error if samples found in the table are missing from the metadata file. The metadata file can always contain a superset of samples. Note that columns will be dropped if they are non-numeric, contain no unique values (zero variance), contain only empty cells, or contain negative values. This method currently only converts postive numeric metadata into feature data. Tip: convert categorical columns to dummy variables to include them in the output feature table.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[optional]
Parameters¶
- metadata:
Metadata
Metadata file to convert to feature table.[required]
- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'ignore'
]- missing_values:
Str
%
Choices
('drop_samples', 'drop_features', 'error', 'fill')
How to handle missing values (nans) in metadata. Either "drop_samples" with missing values, "drop_features" with missing values, "fill" missing values with zeros, or "error" if any missing values are found.[default:
'error'
]- drop_all_unique:
Bool
If True, columns that contain a unique value for every ID will be dropped.[default:
False
]
Outputs¶
- converted_table:
FeatureTable[Frequency]
Converted feature table[required]
sample-classifier heatmap¶
Generate a heatmap of important features. Features are filtered based on importance scores; samples are optionally grouped by sample metadata; and a heatmap is generated that displays (normalized) feature abundances per sample.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
- importance:
FeatureData[Importance]
Feature importances.[required]
Parameters¶
- sample_metadata:
MetadataColumn
[
Categorical
]
Sample metadata column to use for sample labeling or grouping.[optional]
- feature_metadata:
MetadataColumn
[
Categorical
]
Feature metadata (e.g., taxonomy) to use for labeling features in the heatmap.[optional]
- feature_count:
Int
%
Range
(0, None)
Filter feature table to include top N most important features. Set to zero to include all features.[default:
50
]- importance_threshold:
Float
%
Range
(0, None)
Filter feature table to exclude any features with an importance score less than this threshold. Set to zero to include all features.[default:
0
]- group_samples:
Bool
Group samples by sample metadata.[default:
False
]- normalize:
Bool
Normalize the feature table by adding a psuedocount of 1 and then taking the log10 of the table.[default:
True
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'ignore'
]- metric:
Str
%
Choices
('braycurtis', 'canberra', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', 'jaccard', 'kulsinski', 'mahalanobis', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule')
Metrics exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'braycurtis'
]- method:
Str
%
Choices
('average', 'centroid', 'complete', 'median', 'single', 'ward', 'weighted')
Clustering methods exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'average'
]- cluster:
Str
%
Choices
('both', 'features', 'none', 'samples')
Specify which axes to cluster.[default:
'features'
]- color_scheme:
Str
%
Choices
('Accent', 'Accent_r', 'Blues', 'Blues_r', 'BrBG', 'BrBG_r', 'BuGn', 'BuGn_r', 'BuPu', 'BuPu_r', 'CMRmap', 'CMRmap_r', 'Dark2', 'Dark2_r', 'GnBu', 'GnBu_r', 'Greens', 'Greens_r', 'Greys', 'Greys_r', 'OrRd', 'OrRd_r', 'Oranges', 'Oranges_r', 'PRGn', 'PRGn_r', 'Paired', 'Paired_r', 'Pastel1', 'Pastel1_r', 'Pastel2', 'Pastel2_r', 'PiYG', 'PiYG_r', 'PuBu', 'PuBuGn', 'PuBuGn_r', 'PuBu_r', 'PuOr', 'PuOr_r', 'PuRd', 'PuRd_r', 'Purples', 'Purples_r', 'RdBu', 'RdBu_r', 'RdGy', 'RdGy_r', 'RdPu', 'RdPu_r', 'RdYlBu', 'RdYlBu_r', 'RdYlGn', 'RdYlGn_r', 'Reds', 'Reds_r', 'Set1', 'Set1_r', 'Set2', 'Set2_r', 'Set3', 'Set3_r', 'Spectral', 'Spectral_r', 'Vega10', 'Vega10_r', 'Vega20', 'Vega20_r', 'Vega20b', 'Vega20b_r', 'Vega20c', 'Vega20c_r', 'Wistia', 'Wistia_r', 'YlGn', 'YlGnBu', 'YlGnBu_r', 'YlGn_r', 'YlOrBr', 'YlOrBr_r', 'YlOrRd', 'YlOrRd_r', 'afmhot', 'afmhot_r', 'autumn', 'autumn_r', 'binary', 'binary_r', 'bone', 'bone_r', 'brg', 'brg_r', 'bwr', 'bwr_r', 'cividis', 'cividis_r', 'cool', 'cool_r', 'coolwarm', 'coolwarm_r', 'copper', 'copper_r', 'cubehelix', 'cubehelix_r', 'flag', 'flag_r', 'gist_earth', 'gist_earth_r', 'gist_gray', 'gist_gray_r', 'gist_heat', 'gist_heat_r', 'gist_ncar', 'gist_ncar_r', 'gist_rainbow', 'gist_rainbow_r', 'gist_stern', 'gist_stern_r', 'gist_yarg', 'gist_yarg_r', 'gnuplot', 'gnuplot2', 'gnuplot2_r', 'gnuplot_r', 'gray', 'gray_r', 'hot', 'hot_r', 'hsv', 'hsv_r', 'icefire', 'icefire_r', 'inferno', 'inferno_r', 'jet', 'jet_r', 'magma', 'magma_r', 'mako', 'mako_r', 'nipy_spectral', 'nipy_spectral_r', 'ocean', 'ocean_r', 'pink', 'pink_r', 'plasma', 'plasma_r', 'prism', 'prism_r', 'rainbow', 'rainbow_r', 'rocket', 'rocket_r', 'seismic', 'seismic_r', 'spectral', 'spectral_r', 'spring', 'spring_r', 'summer', 'summer_r', 'tab10', 'tab10_r', 'tab20', 'tab20_r', 'tab20b', 'tab20b_r', 'tab20c', 'tab20c_r', 'terrain', 'terrain_r', 'viridis', 'viridis_r', 'vlag', 'vlag_r', 'winter', 'winter_r')
Color scheme for heatmap.[default:
'rocket'
]
Outputs¶
- heatmap:
Visualization
Heatmap of important features.[required]
- filtered_table:
FeatureTable[Frequency]
Filtered feature table containing data displayed in heatmap.[required]
This QIIME 2 plugin supports methods for supervised classification and regression of sample metadata, and other supervised machine learning methods.
- version:
2024.10.0
- website: https://
github .com /qiime2 /q2 -sample -classifier - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org - citations:
- Bokulich et al., 2018; Pedregosa et al., 2011
Actions¶
Name | Type | Short Description |
---|---|---|
regress-samples-ncv | method | Nested cross-validated supervised learning regressor. |
classify-samples-ncv | method | Nested cross-validated supervised learning classifier. |
fit-classifier | method | Fit a supervised learning classifier. |
fit-regressor | method | Fit a supervised learning regressor. |
predict-classification | method | Use trained classifier to predict target values for new samples. |
predict-regression | method | Use trained regressor to predict target values for new samples. |
split-table | method | Split a feature table into training and testing sets. |
scatterplot | visualizer | Make 2D scatterplot and linear regression of regressor predictions. |
confusion-matrix | visualizer | Make a confusion matrix from sample classifier predictions. |
summarize | visualizer | Summarize parameter and feature extraction information for a trained estimator. |
classify-samples | pipeline | Train and test a cross-validated supervised learning classifier. |
classify-samples-from-dist | pipeline | Run k-nearest-neighbors on a labeled distance matrix. |
regress-samples | pipeline | Train and test a cross-validated supervised learning regressor. |
metatable | pipeline | Convert (and merge) positive numeric metadata (in)to feature table. |
heatmap | pipeline | Generate heatmap of important features. |
Artifact Classes¶
Formats¶
sample-classifier regress-samples-ncv¶
Predicts a continuous sample metadata column using a supervised learning regressor. Uses nested stratified k-fold cross validation for automated hyperparameter optimization and sample prediction. Outputs predicted values for each input sample, and relative importance of each feature for model accuracy.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
]
Numeric metadata column to use as prediction target.[required]
- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestRegressor', 'ExtraTreesRegressor', 'GradientBoostingRegressor', 'AdaBoostRegressor[DecisionTree]', 'AdaBoostRegressor[ExtraTrees]', 'ElasticNet', 'Ridge', 'Lasso', 'KNeighborsRegressor', 'LinearSVR', 'SVR')
Estimator method to use for sample prediction.[default:
'RandomForestRegressor'
]- stratify:
Bool
Evenly stratify training and test data among metadata categories. If True, all values in column must match at least two samples.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- predictions:
SampleData[RegressorPredictions]
Predicted target values for each input sample.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
sample-classifier classify-samples-ncv¶
Predicts a categorical sample metadata column using a supervised learning classifier. Uses nested stratified k-fold cross validation for automated hyperparameter optimization and sample prediction. Outputs predicted values for each input sample, and relative importance of each feature for model accuracy.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Categorical metadata column to use as prediction target.[required]
- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestClassifier', 'ExtraTreesClassifier', 'GradientBoostingClassifier', 'AdaBoostClassifier[DecisionTree]', 'AdaBoostClassifier[ExtraTrees]', 'KNeighborsClassifier', 'LinearSVC', 'SVC')
Estimator method to use for sample prediction.[default:
'RandomForestClassifier'
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- predictions:
SampleData[ClassifierPredictions]
Predicted target values for each input sample.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[required]
sample-classifier fit-classifier¶
Fit a supervised learning classifier. Outputs the fit estimator (for prediction of test samples and/or unknown samples) and the relative importance of each feature for model accuracy. Optionally use k-fold cross-validation for automatic recursive feature elimination and hyperparameter tuning.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Numeric metadata column to use as prediction target.[required]
- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestClassifier', 'ExtraTreesClassifier', 'GradientBoostingClassifier', 'AdaBoostClassifier[DecisionTree]', 'AdaBoostClassifier[ExtraTrees]', 'KNeighborsClassifier', 'LinearSVC', 'SVC')
Estimator method to use for sample prediction.[default:
'RandomForestClassifier'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Classifier]
Trained sample classifier.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
sample-classifier fit-regressor¶
Fit a supervised learning regressor. Outputs the fit estimator (for prediction of test samples and/or unknown samples) and the relative importance of each feature for model accuracy. Optionally use k-fold cross-validation for automatic recursive feature elimination and hyperparameter tuning.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
]
Numeric metadata column to use as prediction target.[required]
- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestRegressor', 'ExtraTreesRegressor', 'GradientBoostingRegressor', 'AdaBoostRegressor[DecisionTree]', 'AdaBoostRegressor[ExtraTrees]', 'ElasticNet', 'Ridge', 'Lasso', 'KNeighborsRegressor', 'LinearSVR', 'SVR')
Estimator method to use for sample prediction.[default:
'RandomForestRegressor'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Regressor]
<no description>[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
sample-classifier predict-classification¶
Use trained estimator to predict target values for new samples. These will typically be unseen samples, e.g., test data (derived manually or from split_table) or samples with unknown values, but can theoretically be any samples present in a feature table that contain overlapping features with the feature table used to train the estimator.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
- sample_estimator:
SampleEstimator[Classifier]
Sample classifier trained with fit_classifier.[required]
Parameters¶
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]
Outputs¶
- predictions:
SampleData[ClassifierPredictions]
Predicted target values for each input sample.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[required]
sample-classifier predict-regression¶
Use trained estimator to predict target values for new samples. These will typically be unseen samples, e.g., test data (derived manually or from split_table) or samples with unknown values, but can theoretically be any samples present in a feature table that contain overlapping features with the feature table used to train the estimator.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
- sample_estimator:
SampleEstimator[Regressor]
Sample regressor trained with fit_regressor.[required]
Parameters¶
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]
Outputs¶
- predictions:
SampleData[RegressorPredictions]
Predicted target values for each input sample.[required]
sample-classifier split-table¶
Split a feature table into training and testing sets. By default stratifies training and test sets on a metadata column, such that values in that column are evenly represented across training and test sets.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Balance⁴ | PercentileNormalized⁵ | Design⁶ | Composition⁷]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
|
Categorical
]
Numeric metadata column to use as prediction target.[required]
- test_size:
Float
%
Range
(0.0, 1.0)
Fraction of input samples to exclude from training set and use for classifier testing.[default:
0.2
]- random_state:
Int
Seed used by random number generator.[optional]
- stratify:
Bool
Evenly stratify training and test data among metadata categories. If True, all values in column must match at least two samples.[default:
True
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- training_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Balance⁴ | PercentileNormalized⁵ | Design⁶ | Composition⁷]
Feature table containing training samples[required]
- test_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Balance⁴ | PercentileNormalized⁵ | Design⁶ | Composition⁷]
Feature table containing test samples[required]
- training_targets:
SampleData[TrueTargets]
Series containing true target values of train samples[required]
- test_targets:
SampleData[TrueTargets]
Series containing true target values of test samples[required]
sample-classifier scatterplot¶
Make a 2D scatterplot and linear regression of predicted vs. true values for a set of samples predicted using a sample regressor.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- predictions:
SampleData[RegressorPredictions]
Predicted values to plot on y axis. Must be predictions of numeric data produced by a sample regressor.[required]
Parameters¶
- truth:
MetadataColumn
[
Numeric
]
Metadata column (true values) to plot on x axis.[required]
- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
sample-classifier confusion-matrix¶
Make a confusion matrix and calculate accuracy of predicted vs. true values for a set of samples classified using a sample classifier. If per-sample class probabilities are provided, will also generate Receiver Operating Characteristic curves and calculate area under the curve for each class.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- predictions:
SampleData[ClassifierPredictions]
Predicted values to plot on x axis. Should be predictions of categorical data produced by a sample classifier.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[optional]
Parameters¶
- truth:
MetadataColumn
[
Categorical
]
Metadata column (true values) to plot on y axis.[required]
- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]- vmin:
Float
|
Str
%
Choices
('auto')
The minimum value to use for anchoring the colormap. If "auto", vmin is set to the minimum value in the data.[default:
'auto'
]- vmax:
Float
|
Str
%
Choices
('auto')
The maximum value to use for anchoring the colormap. If "auto", vmax is set to the maximum value in the data.[default:
'auto'
]- palette:
Str
%
Choices
('YellowOrangeBrown', 'YellowOrangeRed', 'OrangeRed', 'PurpleRed', 'RedPurple', 'BluePurple', 'GreenBlue', 'PurpleBlue', 'YellowGreen', 'summer', 'copper', 'viridis', 'cividis', 'plasma', 'inferno', 'magma', 'sirocco', 'drifting', 'melancholy', 'enigma', 'eros', 'spectre', 'ambition', 'mysteriousstains', 'daydream', 'solano', 'navarro', 'dandelions', 'deepblue', 'verve', 'greyscale')
The color palette to use for plotting.[default:
'sirocco'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
sample-classifier summarize¶
Summarize parameter and feature extraction information for a trained estimator.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- sample_estimator:
SampleEstimator[Classifier | Regressor]
Sample estimator trained with fit_classifier or fit_regressor.[required]
Outputs¶
- visualization:
Visualization
<no description>[required]
sample-classifier classify-samples¶
Predicts a categorical sample metadata column using a supervised learning classifier. Splits input data into training and test sets. The training set is used to train and test the estimator using a stratified k-fold cross-validation scheme. This includes optional steps for automated feature extraction and hyperparameter optimization. The test set validates classification accuracy of the optimized estimator. Outputs classification results for test set. For more details on the learning algorithm, see http://
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Categorical metadata column to use as prediction target.[required]
- test_size:
Float
%
Range
(0.0, 1.0)
Fraction of input samples to exclude from training set and use for classifier testing.[default:
0.2
]- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestClassifier', 'ExtraTreesClassifier', 'GradientBoostingClassifier', 'AdaBoostClassifier[DecisionTree]', 'AdaBoostClassifier[ExtraTrees]', 'KNeighborsClassifier', 'LinearSVC', 'SVC')
Estimator method to use for sample prediction.[default:
'RandomForestClassifier'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- palette:
Str
%
Choices
('YellowOrangeBrown', 'YellowOrangeRed', 'OrangeRed', 'PurpleRed', 'RedPurple', 'BluePurple', 'GreenBlue', 'PurpleBlue', 'YellowGreen', 'summer', 'copper', 'viridis', 'cividis', 'plasma', 'inferno', 'magma', 'sirocco', 'drifting', 'melancholy', 'enigma', 'eros', 'spectre', 'ambition', 'mysteriousstains', 'daydream', 'solano', 'navarro', 'dandelions', 'deepblue', 'verve', 'greyscale')
The color palette to use for plotting.[default:
'sirocco'
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Classifier]
Trained sample estimator.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
- predictions:
SampleData[ClassifierPredictions]
Predicted target values for each input sample.[required]
- model_summary:
Visualization
Summarized parameter and (if enabled) feature selection information for the trained estimator.[required]
- accuracy_results:
Visualization
Accuracy results visualization.[required]
- probabilities:
SampleData[Probabilities]
Predicted class probabilities for each input sample.[required]
- heatmap:
Visualization
A heatmap of the top 50 most important features from the table.[required]
- training_targets:
SampleData[TrueTargets]
Series containing true target values of train samples[required]
- test_targets:
SampleData[TrueTargets]
Series containing true target values of test samples[required]
sample-classifier classify-samples-from-dist¶
Run k-nearest-neighbors on a labeled distance matrix. Return cross-validated (leave one out) predictions and accuracy. k = 1 by default
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- distance_matrix:
DistanceMatrix
a distance matrix[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
Categorical metadata column to use as prediction target.[required]
- k:
Int
Number of nearest neighbors[default:
1
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- palette:
Str
%
Choices
('YellowOrangeBrown', 'YellowOrangeRed', 'OrangeRed', 'PurpleRed', 'RedPurple', 'BluePurple', 'GreenBlue', 'PurpleBlue', 'YellowGreen', 'summer', 'copper', 'viridis', 'cividis', 'plasma', 'inferno', 'magma', 'sirocco', 'drifting', 'melancholy', 'enigma', 'eros', 'spectre', 'ambition', 'mysteriousstains', 'daydream', 'solano', 'navarro', 'dandelions', 'deepblue', 'verve', 'greyscale')
The color palette to use for plotting.[default:
'sirocco'
]
Outputs¶
- predictions:
SampleData[ClassifierPredictions]
leave one out predictions for each sample[required]
- accuracy_results:
Visualization
Accuracy results visualization.[required]
sample-classifier regress-samples¶
Predicts a continuous sample metadata column using a supervised learning regressor. Splits input data into training and test sets. The training set is used to train and test the estimator using a stratified k-fold cross-validation scheme. This includes optional steps for automated feature extraction and hyperparameter optimization. The test set validates classification accuracy of the optimized estimator. Outputs classification results for test set. For more details on the learning algorithm, see http://
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
Parameters¶
- metadata:
MetadataColumn
[
Numeric
]
Numeric metadata column to use as prediction target.[required]
- test_size:
Float
%
Range
(0.0, 1.0)
Fraction of input samples to exclude from training set and use for classifier testing.[default:
0.2
]- step:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
If optimize_feature_selection is True, step is the percentage of features to remove at each iteration.[default:
0.05
]- cv:
Int
%
Range
(1, None)
Number of k-fold cross-validations to perform.[default:
5
]- random_state:
Int
Seed used by random number generator.[optional]
- n_jobs:
Threads
Number of jobs to run in parallel.[default:
1
]- n_estimators:
Int
%
Range
(1, None)
Number of trees to grow for estimation. More trees will improve predictive accuracy up to a threshold level, but will also increase time and memory requirements. This parameter only affects ensemble estimators, such as Random Forest, AdaBoost, ExtraTrees, and GradientBoosting.[default:
100
]- estimator:
Str
%
Choices
('RandomForestRegressor', 'ExtraTreesRegressor', 'GradientBoostingRegressor', 'AdaBoostRegressor[DecisionTree]', 'AdaBoostRegressor[ExtraTrees]', 'ElasticNet', 'Ridge', 'Lasso', 'KNeighborsRegressor', 'LinearSVR', 'SVR')
Estimator method to use for sample prediction.[default:
'RandomForestRegressor'
]- optimize_feature_selection:
Bool
Automatically optimize input feature selection using recursive feature elimination.[default:
False
]- stratify:
Bool
Evenly stratify training and test data among metadata categories. If True, all values in column must match at least two samples.[default:
False
]- parameter_tuning:
Bool
Automatically tune hyperparameters using random grid search.[default:
False
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'error'
]
Outputs¶
- sample_estimator:
SampleEstimator[Regressor]
Trained sample estimator.[required]
- feature_importance:
FeatureData[Importance]
Importance of each input feature to model accuracy.[required]
- predictions:
SampleData[RegressorPredictions]
Predicted target values for each input sample.[required]
- model_summary:
Visualization
Summarized parameter and (if enabled) feature selection information for the trained estimator.[required]
- accuracy_results:
Visualization
Accuracy results visualization.[required]
sample-classifier metatable¶
Convert numeric sample metadata from TSV file into a feature table. Optionally merge with an existing feature table. Only numeric metadata will be converted; categorical columns will be silently dropped. By default, if a table is used as input only samples found in both the table and metadata (intersection) are merged, and others are silently dropped. Set missing_samples="error" to raise an error if samples found in the table are missing from the metadata file. The metadata file can always contain a superset of samples. Note that columns will be dropped if they are non-numeric, contain no unique values (zero variance), contain only empty cells, or contain negative values. This method currently only converts postive numeric metadata into feature data. Tip: convert categorical columns to dummy variables to include them in the output feature table.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[optional]
Parameters¶
- metadata:
Metadata
Metadata file to convert to feature table.[required]
- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'ignore'
]- missing_values:
Str
%
Choices
('drop_samples', 'drop_features', 'error', 'fill')
How to handle missing values (nans) in metadata. Either "drop_samples" with missing values, "drop_features" with missing values, "fill" missing values with zeros, or "error" if any missing values are found.[default:
'error'
]- drop_all_unique:
Bool
If True, columns that contain a unique value for every ID will be dropped.[default:
False
]
Outputs¶
- converted_table:
FeatureTable[Frequency]
Converted feature table[required]
sample-classifier heatmap¶
Generate a heatmap of important features. Features are filtered based on importance scores; samples are optionally grouped by sample metadata; and a heatmap is generated that displays (normalized) feature abundances per sample.
Citations¶
Bokulich et al., 2018; Pedregosa et al., 2011
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence | Composition]
Feature table containing all features that should be used for target prediction.[required]
- importance:
FeatureData[Importance]
Feature importances.[required]
Parameters¶
- sample_metadata:
MetadataColumn
[
Categorical
]
Sample metadata column to use for sample labeling or grouping.[optional]
- feature_metadata:
MetadataColumn
[
Categorical
]
Feature metadata (e.g., taxonomy) to use for labeling features in the heatmap.[optional]
- feature_count:
Int
%
Range
(0, None)
Filter feature table to include top N most important features. Set to zero to include all features.[default:
50
]- importance_threshold:
Float
%
Range
(0, None)
Filter feature table to exclude any features with an importance score less than this threshold. Set to zero to include all features.[default:
0
]- group_samples:
Bool
Group samples by sample metadata.[default:
False
]- normalize:
Bool
Normalize the feature table by adding a psuedocount of 1 and then taking the log10 of the table.[default:
True
]- missing_samples:
Str
%
Choices
('error', 'ignore')
How to handle missing samples in metadata. "error" will fail if missing samples are detected. "ignore" will cause the feature table and metadata to be filtered, so that only samples found in both files are retained.[default:
'ignore'
]- metric:
Str
%
Choices
('braycurtis', 'canberra', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', 'jaccard', 'kulsinski', 'mahalanobis', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule')
Metrics exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'braycurtis'
]- method:
Str
%
Choices
('average', 'centroid', 'complete', 'median', 'single', 'ward', 'weighted')
Clustering methods exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'average'
]- cluster:
Str
%
Choices
('both', 'features', 'none', 'samples')
Specify which axes to cluster.[default:
'features'
]- color_scheme:
Str
%
Choices
('Accent', 'Accent_r', 'Blues', 'Blues_r', 'BrBG', 'BrBG_r', 'BuGn', 'BuGn_r', 'BuPu', 'BuPu_r', 'CMRmap', 'CMRmap_r', 'Dark2', 'Dark2_r', 'GnBu', 'GnBu_r', 'Greens', 'Greens_r', 'Greys', 'Greys_r', 'OrRd', 'OrRd_r', 'Oranges', 'Oranges_r', 'PRGn', 'PRGn_r', 'Paired', 'Paired_r', 'Pastel1', 'Pastel1_r', 'Pastel2', 'Pastel2_r', 'PiYG', 'PiYG_r', 'PuBu', 'PuBuGn', 'PuBuGn_r', 'PuBu_r', 'PuOr', 'PuOr_r', 'PuRd', 'PuRd_r', 'Purples', 'Purples_r', 'RdBu', 'RdBu_r', 'RdGy', 'RdGy_r', 'RdPu', 'RdPu_r', 'RdYlBu', 'RdYlBu_r', 'RdYlGn', 'RdYlGn_r', 'Reds', 'Reds_r', 'Set1', 'Set1_r', 'Set2', 'Set2_r', 'Set3', 'Set3_r', 'Spectral', 'Spectral_r', 'Vega10', 'Vega10_r', 'Vega20', 'Vega20_r', 'Vega20b', 'Vega20b_r', 'Vega20c', 'Vega20c_r', 'Wistia', 'Wistia_r', 'YlGn', 'YlGnBu', 'YlGnBu_r', 'YlGn_r', 'YlOrBr', 'YlOrBr_r', 'YlOrRd', 'YlOrRd_r', 'afmhot', 'afmhot_r', 'autumn', 'autumn_r', 'binary', 'binary_r', 'bone', 'bone_r', 'brg', 'brg_r', 'bwr', 'bwr_r', 'cividis', 'cividis_r', 'cool', 'cool_r', 'coolwarm', 'coolwarm_r', 'copper', 'copper_r', 'cubehelix', 'cubehelix_r', 'flag', 'flag_r', 'gist_earth', 'gist_earth_r', 'gist_gray', 'gist_gray_r', 'gist_heat', 'gist_heat_r', 'gist_ncar', 'gist_ncar_r', 'gist_rainbow', 'gist_rainbow_r', 'gist_stern', 'gist_stern_r', 'gist_yarg', 'gist_yarg_r', 'gnuplot', 'gnuplot2', 'gnuplot2_r', 'gnuplot_r', 'gray', 'gray_r', 'hot', 'hot_r', 'hsv', 'hsv_r', 'icefire', 'icefire_r', 'inferno', 'inferno_r', 'jet', 'jet_r', 'magma', 'magma_r', 'mako', 'mako_r', 'nipy_spectral', 'nipy_spectral_r', 'ocean', 'ocean_r', 'pink', 'pink_r', 'plasma', 'plasma_r', 'prism', 'prism_r', 'rainbow', 'rainbow_r', 'rocket', 'rocket_r', 'seismic', 'seismic_r', 'spectral', 'spectral_r', 'spring', 'spring_r', 'summer', 'summer_r', 'tab10', 'tab10_r', 'tab20', 'tab20_r', 'tab20b', 'tab20b_r', 'tab20c', 'tab20c_r', 'terrain', 'terrain_r', 'viridis', 'viridis_r', 'vlag', 'vlag_r', 'winter', 'winter_r')
Color scheme for heatmap.[default:
'rocket'
]
Outputs¶
- heatmap:
Visualization
Heatmap of important features.[required]
- filtered_table:
FeatureTable[Frequency]
Filtered feature table containing data displayed in heatmap.[required]
- Links
- Documentation
- Source Code
- Stars
- 6
- Last Commit
- f4db42f
- Available Distros
- 2024.10
- 2024.10/amplicon
- 2024.10/metagenome
- 2024.10/pathogenome
- 2024.5
- 2024.5/amplicon
- 2024.5/metagenome
- 2024.2
- 2024.2/amplicon
- 2023.9
- 2023.9/amplicon
- 2023.7
- 2023.7/core