src.classification package

Subpackages

Submodules

src.classification.classifier_factory module

src.classification.emotion_classifier module

Implement an emotion classifier base class

class src.classification.emotion_classifier.EmotionClassifier(name: str = 'base', data_type: Optional[str] = None, parameters: Optional[Dict] = None)

Bases: ABC

This class is the base class for all emotion classifiers

abstract classify(parameters: Dict, **kwargs) array

The virtual classification method for interfacing

Parameters:
  • parameters – Parameter dictionary used for classification

  • kwargs – Additional kwargs parameters

Returns:

An array with predicted emotion indices

get_class_weights(which_set: Set, parameters: Optional[Dict] = None) Dict[int, int]

Function that returns a class weights dictionary for a given dataset. The dictionary’s keys are the labels and the values are the counts.

Parameters:
  • which_set – Which set to use for calculating the class weights.

  • parameters – Parameter dictionary

Returns:

Dictionary with the class weights

static init_parameters(parameters: Optional[Dict] = None, **kwargs) Dict

Function that merges the parameters and kwargs

Parameters:
  • parameters – Parameter dictionary

  • kwargs – Additional parameters in kwargs

Returns:

Combined dictionary with parameters

abstract load(parameters: Optional[Dict] = None, **kwargs) None

Loading method that loads a previously trained model from disk.

Parameters:
  • parameters – Parameters required for loading the model

  • kwargs – Additional kwargs parameters

abstract save(parameters: Optional[Dict] = None, **kwargs) None

Saving method that saves a previously trained model on disk.

Parameters:
  • parameters – Parameters required for storing the model

  • kwargs – Additional kwargs parameters

abstract train(parameters: Dict, **kwargs) None

The virtual training method for interfacing

Parameters:
  • parameters – Parameter dictionary used for training

  • kwargs – Additional kwargs parameters

Module contents

Package responsible for emotion classification