Skip to content

tensormetric

tensormetric

Module for TensorMetric

Classes

TensorMetric

TensorMetric(key)

Bases: ABC

The tensormetric is used in the tensorgraphanalyzer

Source code in niceml/mlcomponents/resultanalyzers/tensors/tensormetric.py
def __init__(self, key: str):
    self.output_folder = None
    self.dataset_name = None
    self.data_description = None
    self.exp_context = None
    self.key = key
Functions
analyse_datapoint abstractmethod
analyse_datapoint(
    data_key,
    data_predicted,
    data_loaded,
    additional_data,
    **kwargs
)

Abstract method to analyze one datapoint

Source code in niceml/mlcomponents/resultanalyzers/tensors/tensormetric.py
@abstractmethod
def analyse_datapoint(
    self,
    data_key: str,
    data_predicted,
    data_loaded,
    additional_data: dict,
    **kwargs,
) -> Optional[Any]:
    """Abstract method to analyze one datapoint"""
get_final_metric abstractmethod
get_final_metric()

This method is executed after all datapoints are processed

Source code in niceml/mlcomponents/resultanalyzers/tensors/tensormetric.py
@abstractmethod
def get_final_metric(self) -> Optional[dict]:
    """This method is executed after all datapoints are processed"""
initialize
initialize(data_description, exp_context, dataset_name)

required parameters for initialization

Source code in niceml/mlcomponents/resultanalyzers/tensors/tensormetric.py
def initialize(
    self,
    data_description: DataDescription,
    exp_context: ExperimentContext,
    dataset_name: str,
):
    """required parameters for initialization"""
    self.data_description = data_description
    self.exp_context = exp_context
    self.dataset_name = dataset_name
start_analysis
start_analysis()

everything that needs to be done before the analysis

Source code in niceml/mlcomponents/resultanalyzers/tensors/tensormetric.py
def start_analysis(self):
    """everything that needs to be done before the analysis"""