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
dff383de
Commit
dff383de
authored
Dec 01, 2017
by
mzed
Browse files
normalising format
parent
2989fd0e
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/machineLearning/rapidGVF/rapidGVF.cpp
View file @
dff383de
...
...
@@ -15,7 +15,8 @@ rapidGVF::~rapidGVF() {}
bool
rapidGVF
::
train
(
const
rapidmix
::
trainingData
&
newTrainingData
)
{
if
(
newTrainingData
.
trainingSet
.
size
()
<
1
)
{
if
(
newTrainingData
.
trainingSet
.
size
()
<
1
)
{
// no recorded phrase
return
false
;
}
...
...
@@ -31,12 +32,13 @@ bool rapidGVF::train(const rapidmix::trainingData &newTrainingData)
}
//Go through every phrase
for
(
int
h
=
0
;
h
<
newTrainingData
.
trainingSet
.
size
();
++
h
)
{
for
(
int
h
=
0
;
h
<
newTrainingData
.
trainingSet
.
size
();
++
h
)
{
gvf
.
startGesture
();
for
(
int
i
=
0
;
i
<
newTrainingData
.
trainingSet
[
h
].
elements
.
size
();
++
i
)
{
for
(
int
i
=
0
;
i
<
newTrainingData
.
trainingSet
[
h
].
elements
.
size
();
++
i
)
{
std
::
vector
<
double
>
vd
=
newTrainingData
.
trainingSet
[
h
].
elements
[
i
].
input
;
// Using template <class InputIterator> vector to change for vec<double> to vec<float>
std
::
vector
<
float
>
vf
(
vd
.
begin
(),
vd
.
end
());
this
->
currentGesture
.
addObservation
(
vf
);
...
...
@@ -49,7 +51,8 @@ bool rapidGVF::train(const rapidmix::trainingData &newTrainingData)
std
::
vector
<
double
>
rapidGVF
::
run
(
const
std
::
vector
<
double
>
&
inputVector
)
{
if
(
inputVector
.
size
()
==
0
)
{
if
(
inputVector
.
size
()
==
0
)
{
return
std
::
vector
<
double
>
();
}
...
...
tests/src/test_RapidLib.cpp
View file @
dff383de
...
...
@@ -69,7 +69,6 @@ SCENARIO("Test kNN classification", "[machineLearning]")
GIVEN
(
"kNN object and training dataset"
)
{
rapidmix
::
staticClassification
myKnn
;
rapidmix
::
trainingData
myData
;
REQUIRE
(
myData
.
recordSingleElement
(
"cat"
,
{
0.2
,
0.7
})
==
1
);
REQUIRE
(
myData
.
recordSingleElement
(
"dog"
,
{
2.0
,
44.2
})
==
3
);
// This is not 2, because phrases get numbers, too.
...
...
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