Appendix H — chapter3.analysis.model
chapter3.analysis.model
Defines a model to manage the reports generated by the machine and deep learning models.
Classes
Name | Description |
---|---|
ActivityMetric | Enumeration for each metric of interest from the model reports for individual activities. Values: PRECISION, RECALL, F1, SUPPORT. |
Filter | Class to represent a filter that can be applied to a dataframe of reports |
Model | Enumeration to represent the ML and DL models. Values: MLP, CNN, LSTM, CNN_LSTM. |
ModelMetric | Enumeration for each metric of interest from the model reports. Values: ACCURACY, TRAINING_TIME. |
Source | Enumeration to represent the data sources. Values: SP, SW, FUSED. |
TargetFilter | Enumeration for each attribute of interest from the model reports. Values: MODEL, SEATED, STANDING_UP, WALKING, TURNING, SITTING_DOWN. |
ActivityMetric
chapter3.analysis.model.ActivityMetric()
Enumeration for each metric of interest from the model reports for individual activities. Values: PRECISION, RECALL, F1, SUPPORT.
Filter
chapter3.analysis.model.Filter(self, model, source, target, metric)
Class to represent a filter that can be applied to a dataframe of reports
Attributes
Name | Type | Description |
---|---|---|
model | str | Model to look for. One of libs.chapter3.model.Model |
source | str | Source to look for. One of libs.chapter3.model.Source |
target | str | Target to look for. One of libs.chapter3.model.TargetFilter . |
metric | str | Metric to look for. One of libs.chapter3.model.ModelMetric or libs.chapter3.model.ActivityMetric |
Methods
Name | Description |
---|---|
apply | Function to apply the filter to a specified dataframe. |
apply
chapter3.analysis.model.Filter.apply(df)
Function to apply the filter to a specified dataframe.
Parameters
Name | Type | Description | Default |
---|---|---|---|
df |
pandas.DataFrame |
Model reports. | required |
Returns
Type | Description |
---|---|
pandas.DataFrame |
Filtered model reports. |
Model
chapter3.analysis.model.Model()
Enumeration to represent the ML and DL models. Values: MLP, CNN, LSTM, CNN_LSTM.
ModelMetric
chapter3.analysis.model.ModelMetric()
Enumeration for each metric of interest from the model reports. Values: ACCURACY, TRAINING_TIME.
Source
chapter3.analysis.model.Source()
Enumeration to represent the data sources. Values: SP, SW, FUSED.
TargetFilter
chapter3.analysis.model.TargetFilter()
Enumeration for each attribute of interest from the model reports. Values: MODEL, SEATED, STANDING_UP, WALKING, TURNING, SITTING_DOWN.
Functions
Name | Description |
---|---|
obtain_best_items | Determines the best performant item (model or data source) from a DataFrame of statistical tests comparing groups. |
obtain_best_items
chapter3.analysis.model.obtain_best_items(test_results, focus_on, groups)
Determines the best performant item (model or data source) from a DataFrame of statistical tests comparing groups.
Parameters
Name | Type | Description | Default |
---|---|---|---|
test_results |
pandas.DataFrame |
DataFrame with statistical tests. Generated with libs.chapter3.statistical_tests.statistical_comparison . |
required |
focus_on |
list[str] | Items being compared. List items are one of libs.chapter3.model.Source or libs.chapter3.model.Model . |
required |
groups |
list[str] | Each group where focus_on items are compared. List items are one of libs.chapter3.model.Source or libs.chapter3.model.Model . |
required |
Returns
Type | Description |
---|---|
dict | Dict containing the best performant item. |