Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
rapid-mix
RAPID-MIX_API
Commits
db220457
Commit
db220457
authored
Sep 29, 2017
by
Michael Zbyszyński
Browse files
small adjustment to includes
parent
93ebd16a
Changes
3
Show whitespace changes
Inline
Side-by-side
src/machineLearning/machineLearning.cpp
View file @
db220457
...
@@ -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
src/machineLearning/machineLearning.h
View file @
db220457
...
@@ -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"
...
...
src/machineLearning/trainingData.h
View file @
db220457
...
@@ -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
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment