Inspect

We can learn more about our model with the tangram app. Run tangram app and open your browser to http://localhost:8080, or use the cloud hosted app at https://app.tangram.dev.

Click the “Create Repo” button to create a new repo. Repos allow you to manage and compare multiple versions of the same model, just like git repos hold multiple versions of the same codebase. Click “Upload Model” to upload the first version of your model.

Click Training Metrics in the sidebar and have a look at the confusion matrix.

Training Metrics

Actual
positive
Actual Not
positive
Predicted
positive
Predicted Not
positive
True Positives
400
54.20%
False Positives
19
2.57%
False Negatives
20
2.71%
True Negatives
299
40.51%

It looks like false negatives are a bit high. This means we are predicting people are healthy when they actually aren’t. It would be better if the model had fewer false negatives, even if it means more false positives, because doctors can rule out heart disease with further testing. Let’s make that change by going to the Tuning page. Drag the tuning slider to see how different thresholds affect precision and recall.

0.5
85.67%
Accuracy
78.91%
Precision
56.58%
Recall
1
2
// Update your code to use the selected threshold. model.predict(input, { threshold: 0.50 })

When we lower the threhold, we predict that more people have heart disease which results in lower precision but higher recall. Once you’ve chosen a threshold, you can update your prediction code to use it.

predict_options = %Tangram.PredictOptions{ threshold: 0.5, compute_feature_contributions: false } output = Tangram.predict(model, input, predict_options)
predictOptions := tangram.PredictOptions{ Threshold: 0.5, ComputeFeatureContributions: false, } output := model.PredictOne(input, &predictOptions)
options = { threshold: 0.5, computeFeatureContributions: true } let output = model.predict(input, options)
$options = new \tangram::PredictOptions('true', 0.5); $output = model->predict($input, $options);
predict_options = tangram.PredictOptions( threshold=0.5, compute_feature_contributions=True ) output = model.predict(input, predict_options)
options = Tangram::PredictOptions.new( threshold: 0.5, compute_feature_contributions: true ) output = model.predict(input, options: options)
let options = tangram::PredictOptions { threshold: Some(0.5), compute_feature_contributions: Some(true), }; let output = model.predict_one(input.clone(), Some(options.clone()));