Welcome to Predictions Analyzer’s documentation!¶
To install
pip install predictions-analyzer
from predictions_analyzer.segmentation_analysis import analyze_preds_bias, show_many_wrongs_mask
segmentation_analysis Examples¶
To make true_list and pred_list, start with an empty list and append
true_list = []
pred_list = []
for img in true_masks:
true_list.append(img)
for img in pred_masks:
pred_list.append(img)
analyze_preds_bias(true_list, pred_list)
Can be used to predict bias in predictions with analyze_preds_bias(true_list, pred_list)
Can also be used to analyze individual predictions with show_many_wrongs_mask(true_list, pred_list)
Segmentation Analysis¶
This module contains functions and classes that perform an analysis of various predictors in a segmentation analysis.
Goal 1: Create a consistent working functional API
Goal 2: Create an OOP Design
- segmentation_analysis.analyze_preds_bias(true_mask_list, pred_mask_list, show_report=True)¶
Tries to find systematic bias in the predicted vs actual values.
- True_mask_list
List of true masks
- Pred_masks_list
List of numpy array or 3d array of predicted masks.
- Show_report
prints output of report to screen.
- Returns
mean_wrongs - an image based averaging of all the deviations.
- segmentation_analysis.best_models(true_masks, pred_masks, loss, pred_names=None)¶
Placeholder function - not made yet. Sorts models into best and worst given a loss function.
- True_masks
List or numpy array of true masks
- False_masks
List or numpy array of predicted masks.
- Loss
Callable loss function
- Pred_names
A list of the names of the predictors
- Returns
Sorted Descending List of Best Models
- segmentation_analysis.create_segmentation_masks(random_shift: bool = True, n_samples: int = 1)¶
Generates a segmentation mask for demonstration purposes.
- Parameters
random_shift – Boolean value whether you want to create randomness or not.
n_samples – How many true/false mask pairs you want to create.
- Returns
true_mask(s), predicted_mask(s)
- segmentation_analysis.find_most_diverse_good_preds()¶
Finds predictions that are most similar in score but least similar in predictions.
- Returns
- segmentation_analysis.find_most_diverse_preds(true_masks, pred_masks) → pandas.core.frame.DataFrame¶
Placeholder Function - Not made yet.
Finds the most diverse predictions that get the most different parts of the ground truth accurately regardless of how accurate they are.
To find the most accurate AND diverse predictors, use find_most_diverse_good_preds()
- True_masks
- Pred_masks
- Returns
Sorted and ranked dataframe from most diverse
to least diverse.
- segmentation_analysis.get_dice_coeff(truth: numpy.array, predicted: numpy.array) → float¶
Gets the dice coefficient from a true / predict pair.
- Parameters
truth – The true mask.
predicted – The predicted mask
- Returns
The dice coefficient
- segmentation_analysis.show_demo()¶
Shows a demo of the segmentation mask analysis with a synthetic dataset.
- Returns
None
- segmentation_analysis.show_many_wrongs_mask(truths, preds) → None¶
Shows all true/wrong mask pairs.
TODO: Will have to create a limit / range otherwise it will be too big.
- Returns
None. Just shows image.
- segmentation_analysis.show_wrong_mask(truth, predicted)¶
Show a plot of the wrong mask for comparison with the true mask.
- Parameters
truth –
predicted –
- Returns