Commit 41127fd2 authored by Michael Zbyszyński's avatar Michael Zbyszyński
Browse files

added overload for recordSingleElement to generate a label. using in HelloRapidMix

parent 7dca907e
......@@ -23,6 +23,25 @@
BE2D955E1EFD4FB300014209 /* seriesClassification.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE2D955C1EFD4FB300014209 /* seriesClassification.cpp */; };
BE2D95651EFD504C00014209 /* rapidGVF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE2D95631EFD504C00014209 /* rapidGVF.cpp */; };
BE2D9BE11EFD507700014209 /* GVF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE2D9BDC1EFD507700014209 /* GVF.cpp */; };
BEF47B281F7BD119005B0C35 /* rapidXMM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEF47B261F7BD118005B0C35 /* rapidXMM.cpp */; };
BEF47B291F7BD1A2005B0C35 /* xmmKMeans.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE021F5D1EE0294F0025DE57 /* xmmKMeans.cpp */; };
BEF47B2A1F7BD1A7005B0C35 /* xmmKMeansParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE021F5F1EE0294F0025DE57 /* xmmKMeansParameters.cpp */; };
BEF47B2B1F7BD1B1005B0C35 /* xmmHierarchicalHmm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE021F551EE0294F0025DE57 /* xmmHierarchicalHmm.cpp */; };
BEF47B2C1F7BD1B3005B0C35 /* xmmHmmParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE021F571EE0294F0025DE57 /* xmmHmmParameters.cpp */; };
BEF47B2D1F7BD1B6005B0C35 /* xmmHmmSingleClass.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE021F5A1EE0294F0025DE57 /* xmmHmmSingleClass.cpp */; };
BEF47B2E1F7BD1C0005B0C35 /* xmmGmm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE021F4E1EE0294F0025DE57 /* xmmGmm.cpp */; };
BEF47B2F1F7BD1C2005B0C35 /* xmmGmmParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE021F501EE0294F0025DE57 /* xmmGmmParameters.cpp */; };
BEF47B301F7BD1C4005B0C35 /* xmmGmmSingleClass.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE021F521EE0294F0025DE57 /* xmmGmmSingleClass.cpp */; };
BEF47B311F7BD1D0005B0C35 /* xmmAttribute.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE021F341EE0294F0025DE57 /* xmmAttribute.cpp */; };
BEF47B321F7BD1D3005B0C35 /* xmmJson.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE021F381EE0294F0025DE57 /* xmmJson.cpp */; };
BEF47B331F7BD1DB005B0C35 /* xmmGaussianDistribution.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE021F3C1EE0294F0025DE57 /* xmmGaussianDistribution.cpp */; };
BEF47B341F7BD1E1005B0C35 /* xmmPhrase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE021F481EE0294F0025DE57 /* xmmPhrase.cpp */; };
BEF47B351F7BD1E2005B0C35 /* xmmTrainingSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE021F4A1EE0294F0025DE57 /* xmmTrainingSet.cpp */; };
BEF47B361F7BD226005B0C35 /* xmmModelSharedParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE021F431EE0294F0025DE57 /* xmmModelSharedParameters.cpp */; };
BEF47B371F7BD237005B0C35 /* xmmModelSingleClass.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE021F451EE0294F0025DE57 /* xmmModelSingleClass.cpp */; };
BEF47B3A1F7BD271005B0C35 /* searchWindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEF47B381F7BD271005B0C35 /* searchWindow.cpp */; };
BEF47B3D1F7BD27D005B0C35 /* fastDTW.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEF47B3B1F7BD27D005B0C35 /* fastDTW.cpp */; };
BEF47B401F7BD287005B0C35 /* warpPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEF47B3E1F7BD287005B0C35 /* warpPath.cpp */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
......@@ -40,8 +59,6 @@
/* Begin PBXFileReference section */
BE021EEA1EE028610025DE57 /* machineLearning.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = machineLearning.cpp; sourceTree = "<group>"; };
BE021EEB1EE028610025DE57 /* machineLearning.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = machineLearning.h; sourceTree = "<group>"; };
BE021EED1EE028610025DE57 /* rapidXmmTools.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = rapidXmmTools.cpp; sourceTree = "<group>"; };
BE021EEE1EE028610025DE57 /* rapidXmmTools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rapidXmmTools.h; sourceTree = "<group>"; };
BE021EEF1EE028610025DE57 /* trainingData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = trainingData.cpp; sourceTree = "<group>"; };
BE021EF01EE028610025DE57 /* trainingData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = trainingData.h; sourceTree = "<group>"; };
BE021EF11EE028610025DE57 /* rapidmix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rapidmix.h; sourceTree = "<group>"; };
......@@ -229,6 +246,14 @@
BE2D9BDE1EFD507700014209 /* GVFGesture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GVFGesture.h; sourceTree = "<group>"; };
BE2D9BDF1EFD507700014209 /* GVFUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GVFUtils.h; sourceTree = "<group>"; };
BE2D9BE01EFD507700014209 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
BEF47B261F7BD118005B0C35 /* rapidXMM.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = rapidXMM.cpp; sourceTree = "<group>"; };
BEF47B271F7BD118005B0C35 /* rapidXMM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rapidXMM.h; sourceTree = "<group>"; };
BEF47B381F7BD271005B0C35 /* searchWindow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = searchWindow.cpp; sourceTree = "<group>"; };
BEF47B391F7BD271005B0C35 /* searchWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = searchWindow.h; sourceTree = "<group>"; };
BEF47B3B1F7BD27D005B0C35 /* fastDTW.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = fastDTW.cpp; sourceTree = "<group>"; };
BEF47B3C1F7BD27D005B0C35 /* fastDTW.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fastDTW.h; sourceTree = "<group>"; };
BEF47B3E1F7BD287005B0C35 /* warpPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = warpPath.cpp; sourceTree = "<group>"; };
BEF47B3F1F7BD287005B0C35 /* warpPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = warpPath.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -256,25 +281,16 @@
BE021EE91EE028610025DE57 /* machineLearning */ = {
isa = PBXGroup;
children = (
BEF47B251F7BD118005B0C35 /* rapidXMM */,
BE2D95621EFD504C00014209 /* rapidGVF */,
BE021EEA1EE028610025DE57 /* machineLearning.cpp */,
BE021EEB1EE028610025DE57 /* machineLearning.h */,
BE021EEC1EE028610025DE57 /* rapidXmmTools */,
BE021EEF1EE028610025DE57 /* trainingData.cpp */,
BE021EF01EE028610025DE57 /* trainingData.h */,
);
path = machineLearning;
sourceTree = "<group>";
};
BE021EEC1EE028610025DE57 /* rapidXmmTools */ = {
isa = PBXGroup;
children = (
BE021EED1EE028610025DE57 /* rapidXmmTools.cpp */,
BE021EEE1EE028610025DE57 /* rapidXmmTools.h */,
);
path = rapidXmmTools;
sourceTree = "<group>";
};
BE021EF21EE028610025DE57 /* signalProcessing */ = {
isa = PBXGroup;
children = (
......@@ -297,6 +313,12 @@
BE021F001EE028950025DE57 /* src */ = {
isa = PBXGroup;
children = (
BEF47B3E1F7BD287005B0C35 /* warpPath.cpp */,
BEF47B3F1F7BD287005B0C35 /* warpPath.h */,
BEF47B3B1F7BD27D005B0C35 /* fastDTW.cpp */,
BEF47B3C1F7BD27D005B0C35 /* fastDTW.h */,
BEF47B381F7BD271005B0C35 /* searchWindow.cpp */,
BEF47B391F7BD271005B0C35 /* searchWindow.h */,
BE286DF51EFD54DD00E49A85 /* dtw.cpp */,
BE286DF61EFD54DD00E49A85 /* dtw.h */,
BE286DF21EFD516600E49A85 /* rapidStream.cpp */,
......@@ -768,6 +790,15 @@
path = ../../dependencies/GVF;
sourceTree = "<group>";
};
BEF47B251F7BD118005B0C35 /* rapidXMM */ = {
isa = PBXGroup;
children = (
BEF47B261F7BD118005B0C35 /* rapidXMM.cpp */,
BEF47B271F7BD118005B0C35 /* rapidXMM.h */,
);
path = rapidXMM;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
......@@ -830,13 +861,32 @@
BE0220001EE02ABE0025DE57 /* classification.cpp in Sources */,
BE0220011EE02AC00025DE57 /* knnClassification.cpp in Sources */,
BE0220041EE02ACA0025DE57 /* regression.cpp in Sources */,
BEF47B281F7BD119005B0C35 /* rapidXMM.cpp in Sources */,
BE2D9BE11EFD507700014209 /* GVF.cpp in Sources */,
BE2D955B1EFD4F8300014209 /* svmClassification.cpp in Sources */,
BEF47B3D1F7BD27D005B0C35 /* fastDTW.cpp in Sources */,
BE2D955E1EFD4FB300014209 /* seriesClassification.cpp in Sources */,
BE286DF71EFD54DD00E49A85 /* dtw.cpp in Sources */,
BEF47B2E1F7BD1C0005B0C35 /* xmmGmm.cpp in Sources */,
BE2D95651EFD504C00014209 /* rapidGVF.cpp in Sources */,
BE0220061EE02AE90025DE57 /* jsoncpp.cpp in Sources */,
BEF47B331F7BD1DB005B0C35 /* xmmGaussianDistribution.cpp in Sources */,
BEF47B2F1F7BD1C2005B0C35 /* xmmGmmParameters.cpp in Sources */,
BE286DF71EFD54DD00E49A85 /* dtw.cpp in Sources */,
BEF47B2A1F7BD1A7005B0C35 /* xmmKMeansParameters.cpp in Sources */,
BEF47B401F7BD287005B0C35 /* warpPath.cpp in Sources */,
BEF47B301F7BD1C4005B0C35 /* xmmGmmSingleClass.cpp in Sources */,
BEF47B351F7BD1E2005B0C35 /* xmmTrainingSet.cpp in Sources */,
BEF47B311F7BD1D0005B0C35 /* xmmAttribute.cpp in Sources */,
BEF47B371F7BD237005B0C35 /* xmmModelSingleClass.cpp in Sources */,
BEF47B361F7BD226005B0C35 /* xmmModelSharedParameters.cpp in Sources */,
BEF47B321F7BD1D3005B0C35 /* xmmJson.cpp in Sources */,
BEF47B341F7BD1E1005B0C35 /* xmmPhrase.cpp in Sources */,
BEF47B3A1F7BD271005B0C35 /* searchWindow.cpp in Sources */,
BEF47B2B1F7BD1B1005B0C35 /* xmmHierarchicalHmm.cpp in Sources */,
BEF47B2C1F7BD1B3005B0C35 /* xmmHmmParameters.cpp in Sources */,
BEF47B291F7BD1A2005B0C35 /* xmmKMeans.cpp in Sources */,
BE0220071EE02AFE0025DE57 /* trainingData.cpp in Sources */,
BEF47B2D1F7BD1B6005B0C35 /* xmmHmmSingleClass.cpp in Sources */,
BE286E051EFD553700E49A85 /* libsvm.cpp in Sources */,
BE286DF41EFD516600E49A85 /* rapidStream.cpp in Sources */,
BE0220081EE02B0F0025DE57 /* machineLearning.cpp in Sources */,
......
......@@ -16,26 +16,26 @@ int main(int argc, const char * argv[]) {
rapidmix::trainingData myData; //Create a place to hold training Data
//Setting up the first element of training data
std::vector<double> input = { 48 };
std::vector<double> output = { 130.81 };
myData.addElement(input, output);
std::vector<double> input { 48 };
std::vector<double> output { 130.81 };
myData.recordSingleElement(input, output);
//More elements
input = { 54 };
output = { 185.00 };
myData.addElement(input, output);
myData.recordSingleElement(input, output);
input = { 60 };
output = { 261.63 };
myData.addElement(input, output);
myData.recordSingleElement(input, output);
input = { 66 };
output = { 369.994 };
myData.addElement(input, output);
myData.recordSingleElement(input, output);
input = { 72 };
output = { 523.25 };
myData.addElement(input, output);
myData.recordSingleElement(input, output);
//Train the machine learning model with the data
mtofRegression.train(myData);
......
......@@ -67,6 +67,13 @@ namespace rapidmix {
return returnId;
};
uint32_t trainingData::recordSingleElement(const std::vector<double> &input, const std::vector<double> &output) {
startRecording();
int returnId = addElement(input, output);
stopRecording();
return returnId;
};
uint32_t trainingData::recordSingleElement(const std::string &label, const std::vector<double> &input, const std::vector<double> &output) {
startRecording(label);
int returnId = addElement(input, output);
......
......@@ -62,6 +62,9 @@ namespace rapidmix {
/** Create a phrase with a single element that has a label and input. Returns phrase id. */
uint32_t recordSingleElement(const std::string &label, const std::vector<double> &input);
/** Create a phrase with a single element that has input, and output. Returns phrase id. */
uint32_t recordSingleElement(const std::vector<double> &input, const std::vector<double> &output);
/** Create a phrase with a single element that has a label, input, and output. Returns phrase id. */
uint32_t recordSingleElement(const std::string &label, const std::vector<double> &input, const std::vector<double> &output);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment