Expand description
The Tangram crate makes it easy to make predictions with your Tangram machine learning model from Rust.
§Usage
[dependencies]
tangram = "*"
let model: tangram::Model = tangram::Model::from_path("heart_disease.tangram", None).unwrap();
let input = tangram::predict_input! {
"age": 63.0,
"gender": "male",
// ...
};
let output = model.predict_one(input, None);
For more information, read the docs.
Macros§
Structs§
- BagOf
Words Cosine Similarity Feature Contribution - This describes the contribution of a feature from a bag of words cosine similarity feature group.
- BagOf
Words Feature Contribution - This describes the contribution of a feature from a bag of words feature group.
- Binary
Classification Predict Output - This is the output of calling
Model::predict
on aModel
whose task is binary classification. - Feature
Contributions - This is a description of the feature contributions for the prediction if the task is regression or binary classification, or for a single class if the task is multiclass classification.
- Identity
Feature Contribution - This describes the contribution of a feature from an identity feature group.
- Load
Model Options - These are the options passed when loading a
Model
. - LogPrediction
Args - This is the type of the argument to
Model::log_prediction
andModel::enqueue_log_prediction
which specifies the details of the prediction to log. - LogTrue
Value Args - This is the type of the argument to
Model::log_true_value
andModel::enqueue_log_true_value
which specifies the details of the true value to log. - Model
- Use this struct to load a model, make predictions, and log events to the app.
- Multiclass
Classification Predict Output - This is the output of calling
Model::predict
on aModel
whose task is multiclass classification. - Normalized
Feature Contribution - This describes the contribution of a feature from a normalized feature group.
- OneHot
Encoded Feature Contribution - Predict
Input - This is the input type of
Model::predict
. A predict input is a map whose keys are the same as the column names in the CSV the model was trained with, and whose values match the type for each column. - Predict
Options - These are the options passed to
Model::predict
. - Regression
Predict Output - This is the output of calling
Model::predict
on aModel
whose task is regression. - Word
Embedding Feature Contribution - This describes the contribution of a feature from a word vector feature group.
Enums§
- Feature
Contribution Entry - This identifies the type of a feature contribution.
- NGram
- This is a sequence of
n
tokens. Tangram currently supports unigrams and bigrams. - Number
OrString - Predict
Input Value - Predict
Output - This is the output of
Model::predict
.