Skip to content

Commit 56ba652

Browse files
committed
Fix bugs
1 parent 089caab commit 56ba652

File tree

4 files changed

+54
-28
lines changed

4 files changed

+54
-28
lines changed

BiosensorFramework/BiosensorFrameworkDoc.md

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@
6060
- [Features](#F-MMIVR-BiosensorFramework-MachineLearningUtilities-ExtractedBinFeatures-Features 'MMIVR.BiosensorFramework.MachineLearningUtilities.ExtractedBinFeatures.Features')
6161
- [Label](#F-MMIVR-BiosensorFramework-MachineLearningUtilities-ExtractedBinFeatures-Label 'MMIVR.BiosensorFramework.MachineLearningUtilities.ExtractedBinFeatures.Label')
6262
- [ExtractedFeatures](#T-MMIVR-BiosensorFramework-MachineLearningUtilities-ExtractedFeatures 'MMIVR.BiosensorFramework.MachineLearningUtilities.ExtractedFeatures')
63-
- [StressFeatures](#F-MMIVR-BiosensorFramework-MachineLearningUtilities-ExtractedFeatures-StressFeatures 'MMIVR.BiosensorFramework.MachineLearningUtilities.ExtractedFeatures.StressFeatures')
63+
- [Features](#F-MMIVR-BiosensorFramework-MachineLearningUtilities-ExtractedFeatures-Features 'MMIVR.BiosensorFramework.MachineLearningUtilities.ExtractedFeatures.Features')
6464
- [ExtractedMultiFeatures](#T-MMIVR-BiosensorFramework-MachineLearningUtilities-ExtractedMultiFeatures 'MMIVR.BiosensorFramework.MachineLearningUtilities.ExtractedMultiFeatures')
65+
- [Features](#F-MMIVR-BiosensorFramework-MachineLearningUtilities-ExtractedMultiFeatures-Features 'MMIVR.BiosensorFramework.MachineLearningUtilities.ExtractedMultiFeatures.Features')
6566
- [Result](#F-MMIVR-BiosensorFramework-MachineLearningUtilities-ExtractedMultiFeatures-Result 'MMIVR.BiosensorFramework.MachineLearningUtilities.ExtractedMultiFeatures.Result')
66-
- [StressFeatures](#F-MMIVR-BiosensorFramework-MachineLearningUtilities-ExtractedMultiFeatures-StressFeatures 'MMIVR.BiosensorFramework.MachineLearningUtilities.ExtractedMultiFeatures.StressFeatures')
6767
- [ExtractedRegFeatures](#T-MMIVR-BiosensorFramework-MachineLearningUtilities-ExtractedRegFeatures 'MMIVR.BiosensorFramework.MachineLearningUtilities.ExtractedRegFeatures')
68+
- [Features](#F-MMIVR-BiosensorFramework-MachineLearningUtilities-ExtractedRegFeatures-Features 'MMIVR.BiosensorFramework.MachineLearningUtilities.ExtractedRegFeatures.Features')
6869
- [Result](#F-MMIVR-BiosensorFramework-MachineLearningUtilities-ExtractedRegFeatures-Result 'MMIVR.BiosensorFramework.MachineLearningUtilities.ExtractedRegFeatures.Result')
69-
- [StressFeatures](#F-MMIVR-BiosensorFramework-MachineLearningUtilities-ExtractedRegFeatures-StressFeatures 'MMIVR.BiosensorFramework.MachineLearningUtilities.ExtractedRegFeatures.StressFeatures')
7070
- [FFT](#T-MMIVR-BiosensorFramework-DataProcessing-ThirdParty-DSPLib-FFT 'MMIVR.BiosensorFramework.DataProcessing.ThirdParty.DSPLib.FFT')
7171
- [#ctor()](#M-MMIVR-BiosensorFramework-DataProcessing-ThirdParty-DSPLib-FFT-#ctor 'MMIVR.BiosensorFramework.DataProcessing.ThirdParty.DSPLib.FFT.#ctor')
7272
- [BitReverse()](#M-MMIVR-BiosensorFramework-DataProcessing-ThirdParty-DSPLib-FFT-BitReverse-System-UInt32,System-UInt32- 'MMIVR.BiosensorFramework.DataProcessing.ThirdParty.DSPLib.FFT.BitReverse(System.UInt32,System.UInt32)')
@@ -132,6 +132,7 @@
132132
- [MakeMultiPrediction(mlContext,LiveData,Model)](#M-MMIVR-BiosensorFramework-MachineLearningUtilities-Predict-MakeMultiPrediction-Microsoft-ML-MLContext,MMIVR-BiosensorFramework-MachineLearningUtilities-ExtractedMultiFeatures,Microsoft-ML-ITransformer- 'MMIVR.BiosensorFramework.MachineLearningUtilities.Predict.MakeMultiPrediction(Microsoft.ML.MLContext,MMIVR.BiosensorFramework.MachineLearningUtilities.ExtractedMultiFeatures,Microsoft.ML.ITransformer)')
133133
- [MakeRegPrediction(mlContext,LiveData,Model)](#M-MMIVR-BiosensorFramework-MachineLearningUtilities-Predict-MakeRegPrediction-Microsoft-ML-MLContext,Microsoft-ML-IDataView,Microsoft-ML-ITransformer- 'MMIVR.BiosensorFramework.MachineLearningUtilities.Predict.MakeRegPrediction(Microsoft.ML.MLContext,Microsoft.ML.IDataView,Microsoft.ML.ITransformer)')
134134
- [PredictWindow(mlContext,Model,WindowReadings)](#M-MMIVR-BiosensorFramework-MachineLearningUtilities-Predict-PredictWindow-Microsoft-ML-MLContext,Microsoft-ML-ITransformer,System-Collections-Generic-List{System-Collections-Generic-List{System-Double}}- 'MMIVR.BiosensorFramework.MachineLearningUtilities.Predict.PredictWindow(Microsoft.ML.MLContext,Microsoft.ML.ITransformer,System.Collections.Generic.List{System.Collections.Generic.List{System.Double}})')
135+
- [PredictWindowMulti(mlContext,Model,WindowReadings)](#M-MMIVR-BiosensorFramework-MachineLearningUtilities-Predict-PredictWindowMulti-Microsoft-ML-MLContext,Microsoft-ML-ITransformer,System-Collections-Generic-List{System-Collections-Generic-List{System-Double}}- 'MMIVR.BiosensorFramework.MachineLearningUtilities.Predict.PredictWindowMulti(Microsoft.ML.MLContext,Microsoft.ML.ITransformer,System.Collections.Generic.List{System.Collections.Generic.List{System.Double}})')
135136
- [PredictionBinResult](#T-MMIVR-BiosensorFramework-MachineLearningUtilities-PredictionBinResult 'MMIVR.BiosensorFramework.MachineLearningUtilities.PredictionBinResult')
136137
- [Prediction](#F-MMIVR-BiosensorFramework-MachineLearningUtilities-PredictionBinResult-Prediction 'MMIVR.BiosensorFramework.MachineLearningUtilities.PredictionBinResult.Prediction')
137138
- [Probability](#F-MMIVR-BiosensorFramework-MachineLearningUtilities-PredictionBinResult-Probability 'MMIVR.BiosensorFramework.MachineLearningUtilities.PredictionBinResult.Probability')
@@ -205,7 +206,7 @@
205206
- [PrintBinMetrics(metrics)](#M-MMIVR-BiosensorFramework-MachineLearningUtilities-Train-PrintBinMetrics-Microsoft-ML-Data-BinaryClassificationMetrics- 'MMIVR.BiosensorFramework.MachineLearningUtilities.Train.PrintBinMetrics(Microsoft.ML.Data.BinaryClassificationMetrics)')
206207
- [PrintMultiMetrics(metrics)](#M-MMIVR-BiosensorFramework-MachineLearningUtilities-Train-PrintMultiMetrics-Microsoft-ML-Data-MulticlassClassificationMetrics- 'MMIVR.BiosensorFramework.MachineLearningUtilities.Train.PrintMultiMetrics(Microsoft.ML.Data.MulticlassClassificationMetrics)')
207208
- [PrintRegMetrics(metrics)](#M-MMIVR-BiosensorFramework-MachineLearningUtilities-Train-PrintRegMetrics-Microsoft-ML-Data-RegressionMetrics- 'MMIVR.BiosensorFramework.MachineLearningUtilities.Train.PrintRegMetrics(Microsoft.ML.Data.RegressionMetrics)')
208-
- [RunBenchmarks(DirectoryPath,BestRegModel,BestMultiModel,BestBinModel)](#M-MMIVR-BiosensorFramework-MachineLearningUtilities-Train-RunBenchmarks-System-String,Microsoft-ML-ITransformer@,Microsoft-ML-ITransformer@,Microsoft-ML-ITransformer@- 'MMIVR.BiosensorFramework.MachineLearningUtilities.Train.RunBenchmarks(System.String,Microsoft.ML.ITransformer@,Microsoft.ML.ITransformer@,Microsoft.ML.ITransformer@)')
209+
- [RunBenchmarks(DirectoryPath,BestRegModel,BestMultiModel,BestBinModel,ModelDir)](#M-MMIVR-BiosensorFramework-MachineLearningUtilities-Train-RunBenchmarks-System-String,Microsoft-ML-ITransformer@,Microsoft-ML-ITransformer@,Microsoft-ML-ITransformer@,System-String- 'MMIVR.BiosensorFramework.MachineLearningUtilities.Train.RunBenchmarks(System.String,Microsoft.ML.ITransformer@,Microsoft.ML.ITransformer@,Microsoft.ML.ITransformer@,System.String)')
209210
- [TrimFeatureSet(FeatureSet,LabelsToRemove)](#M-MMIVR-BiosensorFramework-MachineLearningUtilities-Train-TrimFeatureSet-System-Collections-Generic-List{MMIVR-BiosensorFramework-MachineLearningUtilities-ExtractedMultiFeatures},System-Collections-Generic-List{System-Int32}- 'MMIVR.BiosensorFramework.MachineLearningUtilities.Train.TrimFeatureSet(System.Collections.Generic.List{MMIVR.BiosensorFramework.MachineLearningUtilities.ExtractedMultiFeatures},System.Collections.Generic.List{System.Int32})')
210211
- [Type](#T-MMIVR-BiosensorFramework-DataProcessing-ThirdParty-DSPLib-DSP-Window-Type 'MMIVR.BiosensorFramework.DataProcessing.ThirdParty.DSPLib.DSP.Window.Type')
211212
- [Utilities](#T-MMIVR-BiosensorFramework-Biosensors-EmpaticaE4-Utilities 'MMIVR.BiosensorFramework.Biosensors.EmpaticaE4.Utilities')
@@ -1038,8 +1039,8 @@ MMIVR.BiosensorFramework.MachineLearningUtilities
10381039

10391040
Class to hold extracted features for inferencing.
10401041

1041-
<a name='F-MMIVR-BiosensorFramework-MachineLearningUtilities-ExtractedFeatures-StressFeatures'></a>
1042-
### StressFeatures `constants`
1042+
<a name='F-MMIVR-BiosensorFramework-MachineLearningUtilities-ExtractedFeatures-Features'></a>
1043+
### Features `constants`
10431044

10441045
##### Summary
10451046

@@ -1056,19 +1057,19 @@ MMIVR.BiosensorFramework.MachineLearningUtilities
10561057

10571058
Class to hold extracted features for training a multi-class model.
10581059

1059-
<a name='F-MMIVR-BiosensorFramework-MachineLearningUtilities-ExtractedMultiFeatures-Result'></a>
1060-
### Result `constants`
1060+
<a name='F-MMIVR-BiosensorFramework-MachineLearningUtilities-ExtractedMultiFeatures-Features'></a>
1061+
### Features `constants`
10611062

10621063
##### Summary
10631064

1064-
The label for the stress features.
1065+
Array to store the hand crafted features.
10651066

1066-
<a name='F-MMIVR-BiosensorFramework-MachineLearningUtilities-ExtractedMultiFeatures-StressFeatures'></a>
1067-
### StressFeatures `constants`
1067+
<a name='F-MMIVR-BiosensorFramework-MachineLearningUtilities-ExtractedMultiFeatures-Result'></a>
1068+
### Result `constants`
10681069

10691070
##### Summary
10701071

1071-
Array to store the hand crafted features.
1072+
The label for the stress features.
10721073

10731074
<a name='T-MMIVR-BiosensorFramework-MachineLearningUtilities-ExtractedRegFeatures'></a>
10741075
## ExtractedRegFeatures `type`
@@ -1081,19 +1082,19 @@ MMIVR.BiosensorFramework.MachineLearningUtilities
10811082

10821083
Class to hold extracted features for training a regression model.
10831084

1084-
<a name='F-MMIVR-BiosensorFramework-MachineLearningUtilities-ExtractedRegFeatures-Result'></a>
1085-
### Result `constants`
1085+
<a name='F-MMIVR-BiosensorFramework-MachineLearningUtilities-ExtractedRegFeatures-Features'></a>
1086+
### Features `constants`
10861087

10871088
##### Summary
10881089

1089-
The label for the stress features.
1090+
Array to store the hand crafted features.
10901091

1091-
<a name='F-MMIVR-BiosensorFramework-MachineLearningUtilities-ExtractedRegFeatures-StressFeatures'></a>
1092-
### StressFeatures `constants`
1092+
<a name='F-MMIVR-BiosensorFramework-MachineLearningUtilities-ExtractedRegFeatures-Result'></a>
1093+
### Result `constants`
10931094

10941095
##### Summary
10951096

1096-
Array to store the hand crafted features.
1097+
The label for the stress features.
10971098

10981099
<a name='T-MMIVR-BiosensorFramework-DataProcessing-ThirdParty-DSPLib-FFT'></a>
10991100
## FFT `type`
@@ -2118,6 +2119,21 @@ Takes the readings from the windowed data, extracts the features, and runs it th
21182119
| Model | [Microsoft.ML.ITransformer](#T-Microsoft-ML-ITransformer 'Microsoft.ML.ITransformer') | The loaded model for operations to be performed on. |
21192120
| WindowReadings | [System.Collections.Generic.List{System.Collections.Generic.List{System.Double}}](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Collections.Generic.List 'System.Collections.Generic.List{System.Collections.Generic.List{System.Double}}') | Packaged List of List of sensor readings. |
21202121

2122+
<a name='M-MMIVR-BiosensorFramework-MachineLearningUtilities-Predict-PredictWindowMulti-Microsoft-ML-MLContext,Microsoft-ML-ITransformer,System-Collections-Generic-List{System-Collections-Generic-List{System-Double}}-'></a>
2123+
### PredictWindowMulti(mlContext,Model,WindowReadings) `method`
2124+
2125+
##### Summary
2126+
2127+
Takes the readings from the windowed data, extracts the features, and runs it through a prediction pipeline.
2128+
2129+
##### Parameters
2130+
2131+
| Name | Type | Description |
2132+
| ---- | ---- | ----------- |
2133+
| mlContext | [Microsoft.ML.MLContext](#T-Microsoft-ML-MLContext 'Microsoft.ML.MLContext') | Microsoft ML context for operations to be performed in. |
2134+
| Model | [Microsoft.ML.ITransformer](#T-Microsoft-ML-ITransformer 'Microsoft.ML.ITransformer') | The loaded model for operations to be performed on. |
2135+
| WindowReadings | [System.Collections.Generic.List{System.Collections.Generic.List{System.Double}}](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Collections.Generic.List 'System.Collections.Generic.List{System.Collections.Generic.List{System.Double}}') | Packaged List of List of sensor readings. |
2136+
21212137
<a name='T-MMIVR-BiosensorFramework-MachineLearningUtilities-PredictionBinResult'></a>
21222138
## PredictionBinResult `type`
21232139

@@ -2914,8 +2930,8 @@ Prints the performance metrics of the regression classification test to Console.
29142930
| ---- | ---- | ----------- |
29152931
| metrics | [Microsoft.ML.Data.RegressionMetrics](#T-Microsoft-ML-Data-RegressionMetrics 'Microsoft.ML.Data.RegressionMetrics') | The metrics from the test set. |
29162932

2917-
<a name='M-MMIVR-BiosensorFramework-MachineLearningUtilities-Train-RunBenchmarks-System-String,Microsoft-ML-ITransformer@,Microsoft-ML-ITransformer@,Microsoft-ML-ITransformer@-'></a>
2918-
### RunBenchmarks(DirectoryPath,BestRegModel,BestMultiModel,BestBinModel) `method`
2933+
<a name='M-MMIVR-BiosensorFramework-MachineLearningUtilities-Train-RunBenchmarks-System-String,Microsoft-ML-ITransformer@,Microsoft-ML-ITransformer@,Microsoft-ML-ITransformer@,System-String-'></a>
2934+
### RunBenchmarks(DirectoryPath,BestRegModel,BestMultiModel,BestBinModel,ModelDir) `method`
29192935

29202936
##### Summary
29212937

@@ -2929,6 +2945,7 @@ Runs regression, multi-class, and binary classification tasks on the WESAD datas
29292945
| BestRegModel | [Microsoft.ML.ITransformer@](#T-Microsoft-ML-ITransformer@ 'Microsoft.ML.ITransformer@') | The best regression ITransformer model. |
29302946
| BestMultiModel | [Microsoft.ML.ITransformer@](#T-Microsoft-ML-ITransformer@ 'Microsoft.ML.ITransformer@') | The best multi-class ITransformer model. |
29312947
| BestBinModel | [Microsoft.ML.ITransformer@](#T-Microsoft-ML-ITransformer@ 'Microsoft.ML.ITransformer@') | The best binary ITransformer model. |
2948+
| ModelDir | [System.String](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.String 'System.String') | The top directory to save the best models to. Default null. |
29322949

29332950
<a name='M-MMIVR-BiosensorFramework-MachineLearningUtilities-Train-TrimFeatureSet-System-Collections-Generic-List{MMIVR-BiosensorFramework-MachineLearningUtilities-ExtractedMultiFeatures},System-Collections-Generic-List{System-Int32}-'></a>
29342951
### TrimFeatureSet(FeatureSet,LabelsToRemove) `method`

BiosensorFramework/BiosensorFrameworkDoc.xml

Lines changed: 13 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

BiosensorFramework/Machine Learning Utilities/DataImport.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ public static void SchmidtDatasetPipeline(string DirectoryPath, MLContext mlCont
289289

290290
MultiFeatureSet.Add(new ExtractedMultiFeatures()
291291
{
292-
StressFeatures = SubjectFeatures.ToArray().ToFloat(),
292+
Features = SubjectFeatures.ToArray().ToFloat(),
293293
Result = (uint)Dataset.Item3.GetSubArray(i * 700, (i + WindowSize) * 700).Mean(),
294294
});
295295

BiosensorFramework/Machine Learning Utilities/Train.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,13 +331,13 @@ public static List<ExtractedBinFeatures> MultiToBin(List<ExtractedMultiFeatures>
331331
ConFeatures.Add(new ExtractedBinFeatures()
332332
{
333333
Label = false,
334-
Features = FeatureSet[i].StressFeatures
334+
Features = FeatureSet[i].Features
335335
});
336336
else
337337
ConFeatures.Add(new ExtractedBinFeatures()
338338
{
339339
Label = FeatureSet[i].Result == 1,
340-
Features = FeatureSet[i].StressFeatures,
340+
Features = FeatureSet[i].Features,
341341
});
342342
}
343343
return ConFeatures;
@@ -355,7 +355,7 @@ public static List<ExtractedRegFeatures> MultiToReg(List<ExtractedMultiFeatures>
355355
ConFeatures.Add(new ExtractedRegFeatures()
356356
{
357357
Result = FeatureSet[i].Result,
358-
StressFeatures = FeatureSet[i].StressFeatures,
358+
Features = FeatureSet[i].Features,
359359
});
360360
}
361361
return ConFeatures;

0 commit comments

Comments
 (0)