MyoGestic Model Configurations¶
- class myogestic.models.config.BoolParameter[source]¶
Bases:
TypedDict
TypedDict for boolean parameters.
- Parameters:
default_value (bool) – The default value for the parameter.
- class myogestic.models.config.CategoricalParameter[source]¶
Bases:
TypedDict
TypedDict for categorical parameters.
- class myogestic.models.config.FloatParameter[source]¶
Bases:
TypedDict
TypedDict for float parameters.
- class myogestic.models.config.IntParameter[source]¶
Bases:
TypedDict
TypedDict for integer parameters.
- class myogestic.models.config.StringParameter[source]¶
Bases:
TypedDict
TypedDict for string parameters.
- Parameters:
default_value (str) – The default value for the parameter.
- myogestic.models.config.ChangeableParameter¶
Union of the TypedDicts for the changeable parameters.
- myogestic.models.config.UnchangeableParameter¶
Union of the types for the unchangeable parameters.
- myogestic.models.config.MODELS_MAP¶
Dictionary to get the models class and whether it is a classifier or regressor.
The keys are the models names, the values are tuples with the models class and a boolean indicating whether the models is a classifier.
The model class must be a callable that receives the parameters as keyword arguments.
MODELS_MAP: dict[str, tuple[object, bool]] = {
"CatBoost Classifier": (CatBoostClassifier, True),
"CatBoost Regressor": (CatBoostRegressor, False),
"Linear Regressor": (LinearRegression, False),
"Logistic Classifier": (LogisticRegression, True),
"Gaussian Process Classifier": (GaussianProcessClassifier, True),
"AdaBoost Classifier": (AdaBoostClassifier, True),
"MLP Classifier": (MLPClassifier, True),
"Support Vector Classifier": (SVC, True),
}
- myogestic.models.config.FUNCTIONS_MAP¶
Dictionary to get the functions to save and load the models.
The keys are the models names, the values are dictionaries with the keys “save_function”, “load_function” and “train_function” and the values are the functions to save, load and train the models, respectively.
FUNCTIONS_MAP: dict[
str, dict[Literal["save_function", "load_function", "train_function"], callable]
] = {
"CatBoost Classifier": {
"save_function": catboost_models.save,
"load_function": catboost_models.load,
"train_function": catboost_models.train,
},
"CatBoost Regressor": {
"save_function": catboost_models.save,
"load_function": catboost_models.load,
"train_function": catboost_models.train,
},
"Linear Regressor": {
"save_function": sklearn_models.save,
"load_function": sklearn_models.load,
"train_function": sklearn_models.train,
},
"Linear Regressor Per Finger": {
"save_function": sklearn_models.save,
"load_function": sklearn_models.load,
"train_function": sklearn_models.train,
},
"Gaussian Process Classifier": {
"save_function": sklearn_models.save,
"load_function": sklearn_models.load,
"train_function": sklearn_models.train,
},
"AdaBoost Classifier": {
"save_function": sklearn_models.save,
"load_function": sklearn_models.load,
"train_function": sklearn_models.train,
},
"MLP Classifier": {
"save_function": sklearn_models.save,
"load_function": sklearn_models.load,
"train_function": sklearn_models.train,
},
"Support Vector Classifier": {
"save_function": sklearn_models.save,
"load_function": sklearn_models.load,
"train_function": sklearn_models.train,
},
}
- myogestic.models.config.PARAMETERS_MAP¶
Dictionary to get the parameters for the models.
The keys are the models names, the values are dictionaries with two keys: “changeable” and “unchangeable”. The values are dictionaries with the parameter names as keys and the parameter values as values.
The changeable parameters must be of type ChangeableParameter and the unchangeable parameters must be of type UnchangeableParameter.
PARAMETERS_MAP: dict[
str,
dict[
Literal["changeable", "unchangeable"],
dict[str, ChangeableParameter | UnchangeableParameter],
],
] = {
"CatBoost Classifier": {
"changeable": {
"iterations": {
"start_value": 10,
"end_value": 10000,
"step": 100,
"default_value": 1000,
},
"l2_leaf_reg": {
"start_value": 1,
"end_value": 10,
"step": 1,
"default_value": 5,
},
"border_count": {
"start_value": 1,
"end_value": 255,
"step": 1,
"default_value": 254,
},
},
"unchangeable": {
"task_type": "GPU" if get_gpu_device_count() > 0 else "CPU",
"train_dir": None,
},
},
"CatBoost Regressor": {
"changeable": {
"iterations": {
"start_value": 10,
"end_value": 1000,
"step": 10,
"default_value": 100,
},
"l2_leaf_reg": {
"start_value": 1,
"end_value": 10,
"step": 1,
"default_value": 5,
},
"border_count": {
"start_value": 1,
"end_value": 255,
"step": 1,
"default_value": 254,
},
},
"unchangeable": {
"task_type": "GPU" if get_gpu_device_count() > 0 else "CPU",
"train_dir": None,
"loss_function": "MultiRMSE",
"boosting_type": "Plain",
},
},
"Linear Regressor": {
"changeable": {},
"unchangeable": {},
},
"Logistic Classifier": {
"changeable": {},
"unchangeable": {},
},
"Gaussian Process Classifier": {
"changeable": {},
"unchangeable": {},
},
"AdaBoost Classifier": {
"changeable": {},
"unchangeable": {},
},
"MLP Classifier": {
"changeable": {},
"unchangeable": {},
},
"Support Vector Classifier": {
"changeable": {},
"unchangeable": {},
},
}
- myogestic.models.config.FEATURES_MAP¶
Dictionary to get the EMG features class.
The keys are the feature names, the values are the features class. The features must subclass the FilterBaseClass.
FEATURES_MAP: dict[str, FilterBaseClass] = { # noqa
"Root Mean Square": RMSFilter,
"Mean Absolute Value": MAVFilter,
"Integrated Absolute Value": IAVFilter,
"Variance": VARFilter,
"Waveform Length": WFLFilter,
"Zero Crossings": ZCFilter,
"Slope Sign Change": SSCFilter,
# TODO: Add these back
# "Difference Absolute Standard Deviation": DASDVFilter,
# "V-Order": VOrderFilter,
# "Average Amplitude Change": AACFilter,
# "Maximum Fractal Length": MFLFilter,
}