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
9ce5bd5d
Commit
9ce5bd5d
authored
Sep 18, 2017
by
mzed
Browse files
trying to get fastDTW working in JS
parent
5d75310f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
9ce5bd5d
...
...
@@ -12,7 +12,7 @@ RL_KNN=src/knnClassification.cpp src/classification.cpp
RL_SVM
=
src/svmClassification.cpp dependencies/libsvm/libsvm.cpp
RL_NN
=
src/neuralNetwork.cpp src/regression.cpp
RL_MS
=
src/modelSet.cpp
RL_DTW
=
src/
dtw
.cpp src/seriesClassification.cpp
RL_DTW
=
src/
warpPath.cpp src/dtw.cpp src/fastDTW
.cpp src/seriesClassification.cpp
RL_STREAM
=
src/rapidStream.cpp
SOURCE_RAPID
=
$(RL_MS)
$(RL_NN)
$(RL_KNN)
$(RL_SVM)
$(RL_DTW)
$(RL_STREAM)
...
...
RapidAPI/RapidAPI.xcodeproj/project.pbxproj
View file @
9ce5bd5d
...
...
@@ -19,6 +19,7 @@
BE59A4521F1698E500B26E85
/* jsoncpp.cpp in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
BE59A44E1F1698E500B26E85
/* jsoncpp.cpp */
;
};
BE59A4531F1698E500B26E85
/* libsvm.cpp in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
BE59A4501F1698E500B26E85
/* libsvm.cpp */
;
};
BE6783221F6A9B9A005E73D0
/* searchWindow.cpp in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
BE6783211F6A9B9A005E73D0
/* searchWindow.cpp */
;
};
BE6783241F6FFA5C005E73D0
/* warpPath.cpp in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
BE6783231F6FFA5C005E73D0
/* warpPath.cpp */
;
};
BE720AF11F615C0E00675FCA
/* fastDTW.cpp in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
BE720AEF1F615C0E00675FCA
/* fastDTW.cpp */
;
};
BE92865D1EF40BBD006847CF
/* rapidStream.cpp in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
BE92865C1EF40BBD006847CF
/* rapidStream.cpp */
;
};
/* End PBXBuildFile section */
...
...
@@ -64,6 +65,7 @@
BE67831F1F69672C005E73D0
/* warpPath.h */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
warpPath.h
;
sourceTree
=
"<group>"
;
};
BE6783201F6A95FE005E73D0
/* searchWindow.h */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
searchWindow.h
;
sourceTree
=
"<group>"
;
};
BE6783211F6A9B9A005E73D0
/* searchWindow.cpp */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.cpp.cpp
;
path
=
searchWindow.cpp
;
sourceTree
=
"<group>"
;
};
BE6783231F6FFA5C005E73D0
/* warpPath.cpp */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.cpp.cpp
;
path
=
warpPath.cpp
;
sourceTree
=
"<group>"
;
};
BE720AEF1F615C0E00675FCA
/* fastDTW.cpp */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.cpp.cpp
;
path
=
fastDTW.cpp
;
sourceTree
=
"<group>"
;
};
BE720AF01F615C0E00675FCA
/* fastDTW.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
fastDTW.h
;
sourceTree
=
"<group>"
;
};
BE92865B1EF40BB4006847CF
/* rapidStream.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
rapidStream.h
;
sourceTree
=
"<group>"
;
};
...
...
@@ -133,6 +135,7 @@
BE720AEF1F615C0E00675FCA
/* fastDTW.cpp */
,
BE720AF01F615C0E00675FCA
/* fastDTW.h */
,
BE67831F1F69672C005E73D0
/* warpPath.h */
,
BE6783231F6FFA5C005E73D0
/* warpPath.cpp */
,
BE6783201F6A95FE005E73D0
/* searchWindow.h */
,
BE6783211F6A9B9A005E73D0
/* searchWindow.cpp */
,
);
...
...
@@ -228,6 +231,7 @@
BE92865D1EF40BBD006847CF
/* rapidStream.cpp in Sources */
,
BE553E2F1EE05FE1004EB00F
/* svmClassification.cpp in Sources */
,
BE325F351DB50BE100F199A8
/* main.cpp in Sources */
,
BE6783241F6FFA5C005E73D0
/* warpPath.cpp in Sources */
,
BE325F4E1DB50BFE00F199A8
/* knnClassification.cpp in Sources */
,
BE59A4531F1698E500B26E85
/* libsvm.cpp in Sources */
,
BE325F4F1DB50BFE00F199A8
/* modelSet.cpp in Sources */
,
...
...
src/emscripten/seriesClassificationEmbindings.h
View file @
9ce5bd5d
...
...
@@ -13,7 +13,6 @@ EMSCRIPTEN_BINDINGS(seriesClassification_module) {
.
function
(
"run"
,
&
seriesClassification
::
run
)
.
function
(
"getCosts"
,
select_overload
<
std
::
vector
<
double
>
()
>
(
&
seriesClassification
::
getCosts
))
;
};
#endif
src/searchWindow.cpp
View file @
9ce5bd5d
...
...
@@ -7,10 +7,8 @@
//
#include <cassert>
#include "searchWindow.h"
searchWindow
::
searchWindow
(
const
std
::
vector
<
std
::
vector
<
double
>>
&
seriesX
,
const
std
::
vector
<
std
::
vector
<
double
>>
&
seriesY
,
const
std
::
vector
<
std
::
vector
<
double
>>
&
shrunkenX
,
const
std
::
vector
<
std
::
vector
<
double
>>
&
shrunkenY
,
warpPath
shrunkenWarpPath
,
int
searchRadius
)
:
minValues
(
seriesX
.
size
(),
-
1
),
maxValues
(
seriesX
.
size
(),
0
),
maxY
(
int
(
seriesY
.
size
()
-
1
)),
size
(
0
)
{
...
...
src/seriesClassification.cpp
View file @
9ce5bd5d
...
...
@@ -31,15 +31,15 @@ void seriesClassification::reset() {
}
std
::
string
seriesClassification
::
run
(
const
std
::
vector
<
std
::
vector
<
double
>>
&
inputSeries
)
{
fastDTW
d
tw
;
fastDTW
fastD
tw
;
int
searchRadius
=
1
;
//TODO: Define this properly, elsewhere?
int
closestSeries
=
0
;
allCosts
.
clear
();
double
lowestCost
=
d
tw
.
getCost
(
inputSeries
,
allTrainingSeries
[
0
].
input
,
searchRadius
);
double
lowestCost
=
fastD
tw
.
getCost
(
inputSeries
,
allTrainingSeries
[
0
].
input
,
searchRadius
);
allCosts
.
push_back
(
lowestCost
);
for
(
int
i
=
1
;
i
<
allTrainingSeries
.
size
();
++
i
)
{
double
currentCost
=
d
tw
.
getCost
(
inputSeries
,
allTrainingSeries
[
i
].
input
,
searchRadius
);
double
currentCost
=
fastD
tw
.
getCost
(
inputSeries
,
allTrainingSeries
[
i
].
input
,
searchRadius
);
allCosts
.
push_back
(
currentCost
);
if
(
currentCost
<
lowestCost
)
{
lowestCost
=
currentCost
;
...
...
src/warpPath.cpp
0 → 100644
View file @
9ce5bd5d
//
// warpPath.cpp
// RapidAPI
//
// Created by mzed on 13/09/2017.
// Copyright © 2017 Goldsmiths. All rights reserved.
//
#include "warpPath.h"
warpPath
::
warpPath
()
{};
warpPath
::~
warpPath
()
{};
void
warpPath
::
add
(
int
x
,
int
y
)
{
xIndices
.
insert
(
xIndices
.
begin
(),
x
);
yIndices
.
insert
(
yIndices
.
begin
(),
y
);
};
src/warpPath.h
View file @
9ce5bd5d
...
...
@@ -9,21 +9,23 @@
#ifndef warpPath_h
#define warpPath_h
#include <vector>
class
warpPath
{
public:
warpPath
();
~
warpPath
();
std
::
vector
<
int
>
xIndices
;
std
::
vector
<
int
>
yIndices
;
void
add
(
int
x
,
int
y
)
{
xIndices
.
insert
(
xIndices
.
begin
(),
x
);
yIndices
.
insert
(
yIndices
.
begin
(),
y
);
}
void
add
(
int
x
,
int
y
);
};
class
warpInfo
{
struct
warpInfo
{
public:
warpPath
path
;
double
cost
;
};
#endif
/* warpPath_h */
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