matchclot.embedding.catalyst_tools module

Summary

Classes:

CustomMetric

Top1, Top5 accuracy metrics and competition score, without applying the matching algorithm.

scRNARunner

Reference

class scRNARunner(*args, **kwargs)[source]

Bases: Runner

handle_batch(batch)[source]

Inner method to handle specified data batch. Used to make a train/valid/infer step during Experiment run.

Parameters:

batch (Mapping[str, Any]) – dictionary with data batches from DataLoader.

get_loggers()[source]

Returns the loggers for the experiment.

class CustomMetric(compute_on_call=True, prefix=None, suffix=None)[source]

Bases: ICallbackLoaderMetric

Top1, Top5 accuracy metrics and competition score, without applying the matching algorithm.

reset(num_batches, num_samples)[source]

Resets the metric to it’s initial state.

By default, this is called at the start of each loader (on_loader_start event).

Parameters:
  • num_batches (int) – number of expected batches.

  • num_samples (int) – number of expected samples.

Return type:

None

update(*args, **kwargs)[source]

Updates the metrics state using the passed data.

By default, this is called at the end of each batch (on_batch_end event).

Parameters:
  • *args – some args :)

  • **kwargs – some kwargs ;)

Return type:

None

compute()[source]

Computes the metric based on it’s accumulated state.

By default, this is called at the end of each loader (on_loader_end event).

Returns:

computed value, # noqa: DAR202 it’s better to return key-value

Return type:

Any

compute_key_value()[source]

Computes the metric based on it’s accumulated state.

By default, this is called at the end of each loader (on_loader_end event).

Returns:

computed value in key-value format. # noqa: DAR202

Return type:

Dict