Inspect

We can learn more about our model with the modelfox app. Run modelfox app and open your browser to http://localhost:8080.

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 = %ModelFox.PredictOptions{ threshold: 0.5, compute_feature_contributions: false } output = ModelFox.predict(model, input, predict_options)
predictOptions := modelfox.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 \modelfox::PredictOptions('true', 0.5); $output = model->predict($input, $options);
predict_options = modelfox.PredictOptions( threshold=0.5, compute_feature_contributions=True ) output = model.predict(input, predict_options)
options = ModelFox::PredictOptions.new( threshold: 0.5, compute_feature_contributions: true ) output = model.predict(input, options: options)
let options = modelfox::PredictOptions { threshold: Some(0.5), compute_feature_contributions: Some(true), }; let output = model.predict_one(input.clone(), Some(options.clone()));