Tangram for Elixir
The Tangram Elixir library makes it easy to make predictions with your Tangram machine learning model from Elixir.
Usage
# mix.exs
def deps do
[
{:tangram, "~> 0.1.0"}
]
end
model = Tangram.load_model_from_file("heart_disease.tangram")
input = %{
"age" => 63.0,
"gender" => "male",
# ...
}
output = Tangram.predict(model, input)
For more information, read the docs.
Platform Support
Tangram for Elixir is currently supported on Linux, macOS, and Windows with AMD64 CPUs. Are you interested in another platform? Open an issue or send us an email at help@tangram.xyz.
Examples
This folder contains two examples, examples/basic.exs and examples/advanced.exs.
Basic
This example demonstrates loading a model from a .tangram
file and making a prediction.
To run the example:
$ mix run examples/basic.exs
Advanced
This example demonstrates logging predictions and true values to the Tangram reporting and monitoring web app. Before running the example, run tangram app
to start the app running locally, open http://localhost:8080
in your browser, and upload the file examples/heart_disease.tangram
to it.
Then you can run the example:
$ TANGRAM_URL=http://localhost:8080 mix run examples/advanced.exs
Now if you refresh the production stats or production metrics tabs for the model you uploaded, you should see predictions and true values being reported.
For more information on reporting and monitoring, read the docs.
Notes
- On Alpine Linux, Tangram for Elixir requires the
gcompat
andlibgcc
libraries to be installed. You can runapk add gcompat libgcc
to install them.