Tangram (tangram v0.7.0) View Source
This is the main module in the tangram
package.
Link to this section Summary
Types
This identifies the type of a feature contribution.
This is the input type of Tangram.predict
. A predict input is a map from atoms or strings to strings or floats. The keys should match the columns in the CSV file you trained your model with.
This is the return type of Tangram.predict
.
Functions
Add a prediction event to the queue. Remember to call Tangram.flush_log_queue
at a later point to send the event to the app.
Add a true value event to the queue. Remember to call Tangram.flush_log_queue
at a later point to send the event to the app.
Send all events in the queue to the app.
Load a model from a binary instead of a file. You should use this only if you already have a .tangram
loaded into memory. Otherwise, use Tangram.load_model_from_path
, which is faster because it memory maps the file.
Load a model from a .tangram
file at path
.
Send a prediction event to the app. If you want to batch events, you can use Tangram.enqueue_log_prediction
instead.
Send a true value event to the app. If you want to batch events, you can use Tangram.enqueue_log_true_value
instead.
Retrieve the model's id.
Make a prediction!
Link to this section Types
Specs
event() :: PredictionEvent.t() | TrueValueEvent.t()
Specs
feature_contribution_entry() :: {:identity, IdentityFeatureContribution.t()} | {:normalized, NormalizedFeatureContribution.t()} | {:one_hot_encoded, OneHotEncodedFeatureContribution.t()} | {:bag_of_words, BagOfWordsFeatureContribution.t()} | {:bag_of_words_cosine_similarity, BagOfWordsCosineSimilarityFeatureContribution.t()} | {:word_embedding, WordEmbeddingFeatureContribution.t()}
This identifies the type of a feature contribution.
Specs
This is the input type of Tangram.predict
. A predict input is a map from atoms or strings to strings or floats. The keys should match the columns in the CSV file you trained your model with.
Specs
predict_output() :: {:regression, RegressionPredictOutput.t()} | {:binary_classification, BinaryClassificationPredictOutput.t()} | {:multiclass_classification, MulticlassClassificationPredictOutput.t()}
This is the return type of Tangram.predict
.
Specs
Link to this section Functions
Specs
enqueue_log_prediction(Tangram.Model.t(), Tangram.LogPredictionArgs.t()) :: Tangram.Model.t()
Add a prediction event to the queue. Remember to call Tangram.flush_log_queue
at a later point to send the event to the app.
Specs
enqueue_log_true_value(Tangram.Model.t(), Tangram.LogTrueValueArgs.t()) :: Tangram.Model.t()
Add a true value event to the queue. Remember to call Tangram.flush_log_queue
at a later point to send the event to the app.
Specs
flush_log_queue(Tangram.Model.t()) :: Tangram.Model.t()
Send all events in the queue to the app.
Specs
load_model_from_binary(String.t(), Tangram.LoadModelOptions | nil) :: Tangram.Model.t()
Load a model from a binary instead of a file. You should use this only if you already have a .tangram
loaded into memory. Otherwise, use Tangram.load_model_from_path
, which is faster because it memory maps the file.
Specs
load_model_from_path(String.t(), Tangram.LoadModelOptions | nil) :: Tangram.Model.t()
Load a model from a .tangram
file at path
.
Specs
log_prediction(Tangram.Model.t(), Tangram.LogPredictionArgs.t()) :: {:ok, any()} | {:error, any()}
Send a prediction event to the app. If you want to batch events, you can use Tangram.enqueue_log_prediction
instead.
Specs
log_true_value(Tangram.Model.t(), Tangram.LogTrueValueArgs.t()) :: {:ok, any()} | {:error, any()}
Send a true value event to the app. If you want to batch events, you can use Tangram.enqueue_log_true_value
instead.
Specs
model_id(Tangram.Model.t()) :: String.t()
Retrieve the model's id.
Specs
predict(Tangram.Model.t(), predict_input(), Tangram.PredictOptions.t() | nil) :: predict_output()
Make a prediction!