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
RapidLib
Commits
1e6df133
Commit
1e6df133
authored
Nov 24, 2017
by
mzed
Browse files
merging dev stuff
parent
c816014f
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/seriesClassification.cpp
View file @
1e6df133
...
...
@@ -17,7 +17,7 @@
#define SEARCH_RADIUS 1
template
<
typename
T
>
seriesClassificationTemplate
<
T
>::
seriesClassificationTemplate
()
{};
seriesClassificationTemplate
<
T
>::
seriesClassificationTemplate
()
:
hopSize
(
1
),
counter
(
0
)
{};
template
<
typename
T
>
seriesClassificationTemplate
<
T
>::~
seriesClassificationTemplate
()
{};
...
...
@@ -54,6 +54,10 @@ bool seriesClassificationTemplate<T>::train(const std::vector<trainingSeriesTemp
lengthsPerLabel
[
allTrainingSeries
[
i
].
label
]
=
tempLengths
;
}
}
//TODO: make this size smarter?
for
(
int
i
=
0
;
i
<
maxLength
;
++
i
)
{
seriesBuffer
.
push_back
({
0
});
//set size of continuous buffer
}
return
trained
;
};
...
...
@@ -104,6 +108,19 @@ T seriesClassificationTemplate<T>::run(const std::vector<std::vector<T>> &inputS
return
lowestCost
;
};
template
<
typename
T
>
std
::
string
seriesClassificationTemplate
<
T
>::
runContinuous
(
const
std
::
vector
<
T
>
&
inputVector
)
{
seriesBuffer
.
erase
(
seriesBuffer
.
begin
());
seriesBuffer
.
push_back
(
inputVector
);
std
::
string
returnString
=
"none"
;
if
((
counter
%
hopSize
)
==
0
)
{
returnString
=
counter
=
0
;
}
++
counter
;
return
returnString
;
}
template
<
typename
T
>
std
::
vector
<
T
>
seriesClassificationTemplate
<
T
>::
getCosts
()
const
{
return
allCosts
;
...
...
@@ -198,4 +215,4 @@ template class seriesClassificationTemplate<float>;
//std::vector<T> seriesClassification::getCosts(const std::vector<trainingExample> &trainingSet) {
// run(trainingSet);
// return allCosts;
//}
\ No newline at end of file
//}
src/seriesClassification.h
View file @
1e6df133
...
...
@@ -50,6 +50,12 @@ public:
*/
T
run
(
const
std
::
vector
<
std
::
vector
<
T
>
>
&
inputSeries
,
std
::
string
label
);
/** Compare an input series to all of the stored series with a specified label
* @param std::vector<T> one frame either float or double input data
* @return The lowest cost match, float or double
*/
std
::
string
runContinuous
(
const
std
::
vector
<
T
>
&
inputVector
);
/** Get the costs that were calculated by the run method
* @return A vector of floats or doubles, the cost of matching to each training series
*/
...
...
@@ -103,6 +109,10 @@ private:
int
maxLength
;
int
minLength
;
std
::
map
<
std
::
string
,
minMax
<
int
>
>
lengthsPerLabel
;
std
::
vector
<
std
::
vector
<
T
>
>
seriesBuffer
;
int
hopSize
;
int
counter
;
};
//This is here to keep the old API working
...
...
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