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

gvf and rapidlib building with cmake

parent 5dec9060
......@@ -23,13 +23,24 @@ include_directories(dependencies/pipo/src/host)
# Third party dependencies
include_directories(dependencies/third_party/json)
file(GLOB_RECURSE RM_SOURCES "${PROJECT_SOURCE_DIR}/src/*.cpp")
file(GLOB_RECURSE RAPIDMIX_SRC "${PROJECT_SOURCE_DIR}/src/*.cpp")
file(GLOB GVF_SRC "${PROJECT_SOURCE_DIR}/dependencies/GVF/GVF.cpp")
file(GLOB MAXI_SRC "${PROJECT_SOURCE_DIR}/dependencies/Maximilian/maximilian.cpp")
file(GLOB RAPIDLIB_SRC "${PROJECT_SOURCE_DIR}/dependencies/RapidLib/src/*.cpp")
file(GLOB RAPIDLIB_DEP "${PROJECT_SOURCE_DIR}/dependencies/RapidLib/dependencies/libsvm/libsvm.cpp")
file(GLOB JSON_SRC "${PROJECT_SOURCE_DIR}/dependencies/third_party/jsoncpp.cpp")
#Set the source for the main library, using the groups defined above
set(RAPIDMIX_SRC ${RM_SOURCES} ${JSON_SRC})
set(RAPIDMIX_FULL_SRC ${RAPIDMIX_SRC}
${GVF_SRC}
${MAXI_SRC}
${RAPIDLIB_SRC}
${RAPIDLIB_DEP}
${JSON_SRC}
)
add_library(RMIX ${RAPIDMIX_SRC})
add_library(RMIX ${RAPIDMIX_FULL_SRC})
add_executable(rapidmix rapidmixCMake.cpp )
add_executable(rapidmix tests/rapidMixTest.cpp )
target_link_libraries(rapidmix RMIX)
#include <cassert>
#include <vector>
#include "rapidmix.h"
int main() {
//rapidmix::staticRegression myNN;
rapidmix::trainingData myData;
std::vector<double> input = { 0.2, 0.7 };
std::vector<double> output = { 3.0 };
myData.recordSingleElement("label", input, output);
input = { 2.0, 44.2 };
output = { 20.14 };
myData.recordSingleElement("label", input, output);
//myNN.train(myData);
std::vector<double> inputVec = { 1.618, 18.9 };
//assert(myNN.run(inputVec)[0] == 12.596715279688549);
return 0;
}
#include <cassert>
#include <vector>
#include <iostream>
#include "rapidmix.h"
int main() {
///////////////////////////////////Test GVF
rapidmix::gvfTemporalVariation gvf;
rapidmix::trainingData myGVFData;
// Record first gesture
myGVFData.startRecording();
myGVFData.addElement({ 4.0, 0.7 });
myGVFData.addElement({ 3.0, 0.8 });
myGVFData.addElement({ 2.0, 0.9 });
myGVFData.addElement({ 1.0, 1.0 });
myGVFData.addElement({ 0.4, 1.2 });
myGVFData.addElement({ 0.2, 1.4 });
myGVFData.stopRecording();
// Record reverse of first gesture
myGVFData.startRecording();
myGVFData.addElement({ 0.2, 1.4 });
myGVFData.addElement({ 0.4, 1.2 });
myGVFData.addElement({ 1.0, 1.0 });
myGVFData.addElement({ 2.0, 0.9 });
myGVFData.addElement({ 3.0, 0.8 });
myGVFData.addElement({ 4.0, 0.7 });
myGVFData.stopRecording();
// Train
std::cout << "gvf train = " << gvf.train(myGVFData) << std::endl;
std::cout << "gvf passed." << std::endl;
//////////////////////////////////////Test RapidLib
rapidmix::staticRegression myNN;
rapidmix::trainingData myRLData;
std::vector<double> input = { 0.2, 0.7 };
std::vector<double> output = { 3.0 };
myRLData.recordSingleElement("label", input, output);
input = { 2.0, 44.2 };
output = { 20.14 };
myRLData.recordSingleElement("label", input, output);
std::cout << "staticRegression train = " << myNN.train(myRLData) << std::endl;
std::vector<double> inputVec = { 1.618, 18.9 };
assert(myNN.run(inputVec)[0] == 12.596715279688549);
std::cout << "staticRegression passed." << std::endl;
return 0;
}
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