siml.loss_operations package

Submodules

siml.loss_operations.loss_assignment module

class siml.loss_operations.loss_assignment.DictLossAssignment(loss_setting: dict)

Bases: ILossAssignment

property loss_names: list[str]
class siml.loss_operations.loss_assignment.ILossAssignment

Bases: object

abstract property loss_names: list[str]
class siml.loss_operations.loss_assignment.LossAssignmentCreator

Bases: object

classmethod create(loss_setting: dict | str) ILossAssignment
class siml.loss_operations.loss_assignment.StrLossAssignment(loss_setting: str)

Bases: ILossAssignment

property loss_names: list[str]

siml.loss_operations.loss_calculator module

class siml.loss_operations.loss_calculator.CoreLossCalculator(*, loss_assignment: ILossAssignment, user_loss_function_dic: dict[str, Callable[[torch.Tensor, torch.Tensor], torch.Tensor]] | None = None, loss_weights: dict[str, float] | None = None)

Bases: object

Calculate loss according to variable name and function name

class siml.loss_operations.loss_calculator.ILossCalculator

Bases: object

abstract calculate_loss_details(y_pred, y, original_shapes=None) dict[str, numpy.ndarray]
class siml.loss_operations.loss_calculator.LossCalculator(*, loss_setting: dict | str = 'mse', time_series: bool = False, output_is_dict: bool = False, output_skips=None, output_dims=None, user_loss_function_dic: dict[str, Callable[[torch.Tensor, torch.Tensor], torch.Tensor]] | None = None, loss_weights: dict[str, float] | None = None)

Bases: ILossCalculator

calculate_loss_details(y_pred, y, original_shapes=None) dict[str, numpy.ndarray]

siml.loss_operations.loss_calculator_builder module

class siml.loss_operations.loss_calculator_builder.LossCalculatorBuilder

Bases: object

static create(trainer_setting: TrainerSetting, *, pad: bool = False, allow_no_answer: bool = False, user_loss_function_dic: dict[str, Callable] | None = None) ILossCalculator
class siml.loss_operations.loss_calculator_builder.LossCalculatorNoAnswer(loss_calculator: ILossCalculator)

Bases: ILossCalculator

calculate_loss_details(y_pred, y, original_shapes=None) dict[str, numpy.ndarray]

siml.loss_operations.loss_selector module

class siml.loss_operations.loss_selector.LossFunctionSelector(loss_assignment: ILossAssignment, *, user_loss_function_dic: dict[str, Callable[[torch.Tensor, torch.Tensor], torch.Tensor]] | None = None)

Bases: object

Resposibility: Select loss function for each variable name

get_loss_function(variable_name: str) Callable[[Tensor, Tensor], Tensor]

Module contents