Crate tangram

Source
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§

predict_input

Structs§

BagOfWordsCosineSimilarityFeatureContribution
This describes the contribution of a feature from a bag of words cosine similarity feature group.
BagOfWordsFeatureContribution
This describes the contribution of a feature from a bag of words feature group.
BinaryClassificationPredictOutput
This is the output of calling Model::predict on a Model whose task is binary classification.
FeatureContributions
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.
IdentityFeatureContribution
This describes the contribution of a feature from an identity feature group.
LoadModelOptions
These are the options passed when loading a Model.
LogPredictionArgs
This is the type of the argument to Model::log_prediction and Model::enqueue_log_prediction which specifies the details of the prediction to log.
LogTrueValueArgs
This is the type of the argument to Model::log_true_value and Model::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.
MulticlassClassificationPredictOutput
This is the output of calling Model::predict on a Model whose task is multiclass classification.
NormalizedFeatureContribution
This describes the contribution of a feature from a normalized feature group.
OneHotEncodedFeatureContribution
PredictInput
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.
PredictOptions
These are the options passed to Model::predict.
RegressionPredictOutput
This is the output of calling Model::predict on a Model whose task is regression.
WordEmbeddingFeatureContribution
This describes the contribution of a feature from a word vector feature group.

Enums§

FeatureContributionEntry
This identifies the type of a feature contribution.
NGram
This is a sequence of n tokens. Tangram currently supports unigrams and bigrams.
NumberOrString
PredictInputValue
PredictOutput
This is the output of Model::predict.

Traits§

ClassificationOutputValue

Derive Macros§

ClassificationOutputValue
PredictInput
PredictInputValue