aliby.track.benchmark.CellBenchmarker

class CellBenchmarker(meta, model, bak_model, nstepsback=None)[source]

Bases: object

Takes a metadata dataframe and a model and estimates the prediction in a trap-wise manner.

This class can also produce confusion matrices for a given Tracker and validation dataset.

Attributes
masks
traps_loc

Generates a list of trap locations using the metadata.

Methods

calculate_errsum()

Calculate all errors, addresses of images with errors and error fractions.

compare_traps(exp, pos, trap)

Error calculator for testing model and assignment heuristics.

gen_cm_stats(pair[, thresh])

Calculate confusion matrix for a pair of pos-timepoints

gen_errorplots()

Calculates the trap-wise error and averages across a position.

get_frac_error_df()

Calculates the trap-wise error and averages across a position.

get_truth_matrix_from_pair(pair)

Requires self.meta

predict_all()

Predict all datasets defined in self.traps_loc

predict_set(exp, pos, trap[, tp])

Predict labels using tp1-tp2 accuracy of prediction

df_get_imglist

extract_pairs_from_trap

gen_cm_from_pairs

gen_pairlist

get_mota_stats

predict_lbls_from_tpimgs

__init__(meta, model, bak_model, nstepsback=None)[source]

Methods

__init__(meta, model, bak_model[, nstepsback])

calculate_errsum()

Calculate all errors, addresses of images with errors and error fractions.

compare_traps(exp, pos, trap)

Error calculator for testing model and assignment heuristics.

df_get_imglist(exp, pos, trap[, tp])

extract_pairs_from_trap(trap_loc)

gen_cm_from_pairs([thresh])

gen_cm_stats(pair[, thresh])

Calculate confusion matrix for a pair of pos-timepoints

gen_errorplots()

Calculates the trap-wise error and averages across a position.

gen_pairlist()

get_frac_error_df()

Calculates the trap-wise error and averages across a position.

get_mota_stats(pair)

get_truth_matrix_from_pair(pair)

Requires self.meta

predict_all()

Predict all datasets defined in self.traps_loc

predict_lbls_from_tpimgs(tp_img_tuple)

predict_set(exp, pos, trap[, tp])

Predict labels using tp1-tp2 accuracy of prediction

Attributes

masks

traps_loc

Generates a list of trap locations using the metadata.

calculate_errsum()[source]

Calculate all errors, addresses of images with errors and error fractions.

compare_traps(exp, pos, trap)[source]

Error calculator for testing model and assignment heuristics.

Uses the trap id to compare the amount of cells correctly predicted. This uses local indices, not whole timepoints. It returns the fraction of cells correctly predicted, and the timepoints of mistakes

Returns: float: Fraction of cells correctly predicted list of 2-sized tuples: list of tp id of errors and the mistaken cell

gen_cm_stats(pair, thresh=0.7, *args, **kwargs)[source]

Calculate confusion matrix for a pair of pos-timepoints

gen_errorplots()[source]

Calculates the trap-wise error and averages across a position.

get_frac_error_df()[source]

Calculates the trap-wise error and averages across a position.

get_truth_matrix_from_pair(pair)[source]

Requires self.meta

args: :pair: tuple of size 4 (experimentID, position, trap (tp1, tp2))

returns

Truth_mat

boolean ndarray of shape (ncells(tp1) x ncells(tp2) links cells in tp1 to cells in tp2

predict_all()[source]

Predict all datasets defined in self.traps_loc

predict_set(exp, pos, trap, tp=None)[source]

Predict labels using tp1-tp2 accuracy of prediction

property traps_loc

Generates a list of trap locations using the metadata.