src.classification.watch package¶
Submodules¶
src.classification.watch.dense_classifier module¶
This file implements a Fully Connected classifier for the watch data.
- class src.classification.watch.dense_classifier.WatchDenseClassifier(parameters: Optional[Dict] = None)¶
Bases:
WatchNNBaseClassifier
Classifier consisting of Dense layers only.
- initialize_model(parameters: Dict) None ¶
Initializes a new and pretrained version of the Watch-Dense model
- Parameters:
parameters – Parameters for initializing the model.
src.classification.watch.lstm_classifier module¶
This file implements an LSTM based classifier for the watch data.
- class src.classification.watch.lstm_classifier.WatchLSTMClassifier(parameters: Optional[Dict] = None)¶
Bases:
WatchNNBaseClassifier
Classifier that uses LSTM layers and a Dense head for classification.
- initialize_model(parameters: Dict) None ¶
Initializes a new and pretrained version of the Watch-LSTM model
- Parameters:
parameters – Parameters for initializing the model.
src.classification.watch.nn_classifier module¶
This file defines an interface for classifiers for the watch data.
- class src.classification.watch.nn_classifier.WatchNNBaseClassifier(name: str, parameters: Optional[Dict] = None)¶
Bases:
WatchEmotionClassifier
Base class for all NN classifiers in tensorflow for watch data.
- classify(parameters: Optional[Dict] = None, **kwargs) array ¶
Classification method used to classify emotions from watch data
- Parameters:
parameters – Parameter dictionary used for classification
kwargs – Additional kwargs parameters
- Returns:
An array with predicted emotion indices
- abstract initialize_model(parameters: Dict) None ¶
Abstract method that creates self.model, a tf Model instance
- Parameters:
parameters – Parameters for initializing the model
- 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
- 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
- train(parameters: Optional[Dict] = None, **kwargs) None ¶
Training method for tensorflow watch models
- Parameters:
parameters – Parameter dictionary used for training
kwargs – Additional kwargs parameters
src.classification.watch.random_forest_classifier module¶
This file defines a Random Forest classifier for the watch data.
- class src.classification.watch.random_forest_classifier.WatchRandomForestClassifier(parameters: Optional[Dict] = None)¶
Bases:
WatchEmotionClassifier
Random Forest classifier for watch data.
- classify(parameters: Optional[Dict] = None, **kwargs) array ¶
Classification method used to classify emotions from watch data
- Parameters:
parameters – Parameter dictionary used for classification
kwargs – Additional kwargs parameters
- Returns:
An array with predicted emotion indices
- 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
- 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
- train(parameters: Optional[Dict] = None, **kwargs) None ¶
Training method for Random Forest classifier
- Parameters:
parameters – Parameter dictionary used for training
kwargs – Additional kwargs parameters
src.classification.watch.transformer_classifier module¶
This file implements an LSTM based classifier for the watch data.
- class src.classification.watch.transformer_classifier.WatchTransformerClassifier(parameters: Optional[Dict] = None)¶
Bases:
WatchNNBaseClassifier
Classifier that uses Transformer layers and a Dense head for classification.
- initialize_model(parameters: Dict) None ¶
Initializes a new and pretrained version of the Watch-Transformer model
- Parameters:
parameters – Parameters for initializing the model.
src.classification.watch.watch_emotion_classifier module¶
Base class for all watch emotion classifiers
- class src.classification.watch.watch_emotion_classifier.WatchEmotionClassifier(name: str = 'watch', parameters: Optional[Dict] = None)¶
Bases:
EmotionClassifier
Base class for all watch emotion classifiers. Contains common functions that concerns all smartwatch classifiers.
- abstract classify(parameters: Optional[Dict] = None, **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
- 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
- prepare_data(parameters: Dict) None ¶
Function that prepares speech datasets for training and stores them inside the class.
- Parameters:
parameters – Parameter dictionary that contains important params. including: which_set, batch_size, weighted
- prepare_training(parameters: Dict) None ¶
Function that prepares the training by initializing optimizer, loss, metrics and callbacks for training.
- Parameters:
parameters – Training 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: Optional[Dict] = None, **kwargs) None ¶
Virtual training method for interfacing
- Parameters:
parameters – Parameter dictionary used for training
kwargs – Additional kwargs parameters
src.classification.watch.xgboost_classifier module¶
This file defines a XGBOOST classifier for the watch data.
- class src.classification.watch.xgboost_classifier.WatchXGBoostClassifier(parameters: Optional[Dict] = None)¶
Bases:
WatchEmotionClassifier
XGBoost classifier for watch data.
- classify(parameters: Optional[Dict] = None, **kwargs) array ¶
Classification method used to classify emotions from watch data
- Parameters:
parameters – Parameter dictionary used for classification
kwargs – Additional kwargs parameters
- Returns:
An array with predicted emotion indices
- 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
- 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
- train(parameters: Optional[Dict] = None, **kwargs) None ¶
Training method for XGBoost classifier
- Parameters:
parameters – Parameter dictionary used for training
kwargs – Additional kwargs parameters
Module contents¶
Package for smartwatch based emotion classifiers