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

small adjustment to includes

parent 93ebd16a
...@@ -10,6 +10,15 @@ ...@@ -10,6 +10,15 @@
namespace rapidmix { namespace rapidmix {
//////////////////////////////////////////////////////////////////////// Generic train
template <class MachineLearningModule>
bool machineLearning<MachineLearningModule>::train(const trainingData &newTrainingData) {
return MachineLearningModule::train(newTrainingData);
}
/////////////////////////////////////////////////////////////////////// RapidLib specializations
void trainingData2rapidLib (const trainingData &newTrainingData, std::vector<trainingExample<double> > &trainingSet) { void trainingData2rapidLib (const trainingData &newTrainingData, std::vector<trainingExample<double> > &trainingSet) {
for (int h = 0; h < newTrainingData.trainingSet.size(); ++h) { //Go through every phrase for (int h = 0; h < newTrainingData.trainingSet.size(); ++h) { //Go through every phrase
...@@ -26,6 +35,7 @@ namespace rapidmix { ...@@ -26,6 +35,7 @@ namespace rapidmix {
} }
}; };
/////////////////////////////////////////////////////////////////////// RapidLib classification
template<> template<>
bool machineLearning<classification<double>>::train(const trainingData &newTrainingData) { bool machineLearning<classification<double>>::train(const trainingData &newTrainingData) {
std::vector<trainingExample<double> > trainingSet; std::vector<trainingExample<double> > trainingSet;
...@@ -37,6 +47,7 @@ namespace rapidmix { ...@@ -37,6 +47,7 @@ namespace rapidmix {
return classification::train(trainingSet); return classification::train(trainingSet);
} }
/////////////////////////////////////////////////////////////////////// RapidLib regression
template<> template<>
bool machineLearning<regression<double> >::train(const trainingData &newTrainingData) { bool machineLearning<regression<double> >::train(const trainingData &newTrainingData) {
std::vector<trainingExample<double> > trainingSet; std::vector<trainingExample<double> > trainingSet;
...@@ -44,6 +55,7 @@ namespace rapidmix { ...@@ -44,6 +55,7 @@ namespace rapidmix {
return regression::train(trainingSet); return regression::train(trainingSet);
} }
/////////////////////////////////////////////////////////////////////// RapidLib seriesClassification
template<> template<>
bool machineLearning<seriesClassification<double> >::train(const trainingData &newTrainingData) { bool machineLearning<seriesClassification<double> >::train(const trainingData &newTrainingData) {
std::vector<trainingSeries<double> > seriesSet; std::vector<trainingSeries<double> > seriesSet;
...@@ -58,18 +70,6 @@ namespace rapidmix { ...@@ -58,18 +70,6 @@ namespace rapidmix {
return seriesClassification::train(seriesSet); return seriesClassification::train(seriesSet);
} }
template<>
bool machineLearning<rapidGVF>::train(const trainingData &newTrainingData) {
return rapidGVF::train(newTrainingData);
}
///Generic train
template <class MachineLearningModule>
bool machineLearning<MachineLearningModule>::train(const trainingData &newTrainingData) {
return MachineLearningModule::train(newTrainingData);
}
template<> template<>
std::string machineLearning<classification<double> >::run(const std::vector<double> &inputVector, const std::string &label) { std::string machineLearning<classification<double> >::run(const std::vector<double> &inputVector, const std::string &label) {
int classIndex = classification::run(inputVector)[0]; int classIndex = classification::run(inputVector)[0];
...@@ -81,4 +81,11 @@ namespace rapidmix { ...@@ -81,4 +81,11 @@ namespace rapidmix {
return seriesClassification::run(inputSeries); return seriesClassification::run(inputSeries);
} }
/////////////////////////////////////////////////////////////////////// GVF
template<>
bool machineLearning<rapidGVF>::train(const trainingData &newTrainingData) {
return rapidGVF::train(newTrainingData);
}
} }
\ No newline at end of file
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#ifndef machineLearning_h #ifndef machineLearning_h
#define machineLearning_h #define machineLearning_h
#include "rapidMix.h" #include "../rapidMix.h"
////////// Include all of the machine learning algorithms here ////////// Include all of the machine learning algorithms here
#include "classification.h" #include "classification.h"
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include "rapidMix.h" #include "../rapidMix.h"
#include "json.h" #include "json.h"
namespace rapidmix { namespace rapidmix {
......
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