Commit c6ba9b68 authored by Serrière Guillaume's avatar Serrière Guillaume

Add automatic test for classification.

Signed-off-by: default avatarSerrière Guillaume <guillaume.serriere@inria.fr>
parent daca7d42
PROJECT(test_accurancy)
IF(WIN32)
ADD_DEFINITIONS(-DTARGET_OS_Windows)
ENDIF(WIN32)
IF(UNIX)
ADD_DEFINITIONS(-DTARGET_OS_Linux)
ENDIF(UNIX)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
ADD_DEFINITIONS(-DTARGET_ARCHITECTURE_i386)
INCLUDE_DIRECTORIES(../src)
ADD_EXECUTABLE(${PROJECT_NAME} test_accurancy.cpp)
#INCLUDE("FindOpenViBE")
# Unfortunately we need to install the tests as any application to find .dll/.so files
# on both Windows and Linux.
OV_INSTALL_LAUNCH_SCRIPT(${PROJECT_NAME})
INSTALL(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR})
\ No newline at end of file
#blabla
IF(WIN32)
SET(EXT cmd)
SET(OS_FLAGS "--no-pause")
ELSE(WIN32)
SET(EXT sh)
SET(OS_FLAGS "")
ENDIF(WIN32)
#######################################
######### PLDA section
SET(TEST_NAME PLDA-OneVsOne-HT-Test)
SET(SCENARIO_TO_TEST "${TEST_NAME}.xml")
ADD_TEST(run_${TEST_NAME} "$ENV{OV_BINARY_PATH}/openvibe-designer.${EXT}" ${OS_FLAGS} "--no-gui" "--play-fast" ${SCENARIO_TO_TEST})
ADD_TEST(comparator_${TEST_NAME} "$ENV{OV_BINARY_PATH}/test_accurancy.${EXT}" "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log")
SET_TESTS_PROPERTIES(run_${TEST_NAME} PROPERTIES ATTACHED_FILES_ON_FAIL "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log"})
SET_TESTS_PROPERTIES(comparator_${TEST_NAME} PROPERTIES DEPENDS run_${TEST_NAME}})
SET(TEST_NAME PLDA-OneVsOne-PKPD-Test)
SET(SCENARIO_TO_TEST "${TEST_NAME}.xml")
ADD_TEST(run_${TEST_NAME} "$ENV{OV_BINARY_PATH}/openvibe-designer.${EXT}" ${OS_FLAGS} "--no-gui" "--play-fast" ${SCENARIO_TO_TEST})
ADD_TEST(comparator_${TEST_NAME} "$ENV{OV_BINARY_PATH}/test_accurancy.${EXT}" "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log")
SET_TESTS_PROPERTIES(run_${TEST_NAME} PROPERTIES ATTACHED_FILES_ON_FAIL "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log"})
SET_TESTS_PROPERTIES(comparator_${TEST_NAME} PROPERTIES DEPENDS run_${TEST_NAME}})
SET(TEST_NAME PLDA-OneVsOne-Voting-Test)
SET(SCENARIO_TO_TEST "${TEST_NAME}.xml")
ADD_TEST(run_${TEST_NAME} "$ENV{OV_BINARY_PATH}/openvibe-designer.${EXT}" ${OS_FLAGS} "--no-gui" "--play-fast" ${SCENARIO_TO_TEST})
ADD_TEST(comparator_${TEST_NAME} "$ENV{OV_BINARY_PATH}/test_accurancy.${EXT}" "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log")
SET_TESTS_PROPERTIES(run_${TEST_NAME} PROPERTIES ATTACHED_FILES_ON_FAIL "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log"})
SET_TESTS_PROPERTIES(comparator_${TEST_NAME} PROPERTIES DEPENDS run_${TEST_NAME}})
SET(TEST_NAME PLDA-OneVsAll-Test)
SET(SCENARIO_TO_TEST "${TEST_NAME}.xml")
ADD_TEST(run_${TEST_NAME} "$ENV{OV_BINARY_PATH}/openvibe-designer.${EXT}" ${OS_FLAGS} "--no-gui" "--play-fast" ${SCENARIO_TO_TEST})
ADD_TEST(comparator_${TEST_NAME} "$ENV{OV_BINARY_PATH}/test_accurancy.${EXT}" "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log")
SET_TESTS_PROPERTIES(run_${TEST_NAME} PROPERTIES ATTACHED_FILES_ON_FAIL "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log"})
SET_TESTS_PROPERTIES(comparator_${TEST_NAME} PROPERTIES DEPENDS run_${TEST_NAME}})
#######################################
######### LDA section
SET(TEST_NAME LDA-OneVsOne-Voting-Test)
SET(SCENARIO_TO_TEST "${TEST_NAME}.xml")
ADD_TEST(run_${TEST_NAME} "$ENV{OV_BINARY_PATH}/openvibe-designer.${EXT}" ${OS_FLAGS} "--no-gui" "--play-fast" ${SCENARIO_TO_TEST})
ADD_TEST(comparator_${TEST_NAME} "$ENV{OV_BINARY_PATH}/test_accurancy.${EXT}" "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log")
SET_TESTS_PROPERTIES(run_${TEST_NAME} PROPERTIES ATTACHED_FILES_ON_FAIL "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log"})
SET_TESTS_PROPERTIES(comparator_${TEST_NAME} PROPERTIES DEPENDS run_${TEST_NAME}})
SET(TEST_NAME LDA-OneVsAll-Test)
SET(SCENARIO_TO_TEST "${TEST_NAME}.xml")
ADD_TEST(run_${TEST_NAME} "$ENV{OV_BINARY_PATH}/openvibe-designer.${EXT}" ${OS_FLAGS} "--no-gui" "--play-fast" ${SCENARIO_TO_TEST})
ADD_TEST(comparator_${TEST_NAME} "$ENV{OV_BINARY_PATH}/test_accurancy.${EXT}" "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log")
SET_TESTS_PROPERTIES(run_${TEST_NAME} PROPERTIES ATTACHED_FILES_ON_FAIL "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log"})
SET_TESTS_PROPERTIES(comparator_${TEST_NAME} PROPERTIES DEPENDS run_${TEST_NAME}})
#######################################
######### sLDA section
SET(TEST_NAME sLDA-OneVsOne-Voting-Test)
SET(SCENARIO_TO_TEST "${TEST_NAME}.xml")
ADD_TEST(run_${TEST_NAME} "$ENV{OV_BINARY_PATH}/openvibe-designer.${EXT}" ${OS_FLAGS} "--no-gui" "--play-fast" ${SCENARIO_TO_TEST})
ADD_TEST(comparator_${TEST_NAME} "$ENV{OV_BINARY_PATH}/test_accurancy.${EXT}" "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log")
SET_TESTS_PROPERTIES(run_${TEST_NAME} PROPERTIES ATTACHED_FILES_ON_FAIL "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log"})
SET_TESTS_PROPERTIES(comparator_${TEST_NAME} PROPERTIES DEPENDS run_${TEST_NAME}})
SET(TEST_NAME sLDA-OneVsAll-Test)
SET(SCENARIO_TO_TEST "${TEST_NAME}.xml")
ADD_TEST(run_${TEST_NAME} "$ENV{OV_BINARY_PATH}/openvibe-designer.${EXT}" ${OS_FLAGS} "--no-gui" "--play-fast" ${SCENARIO_TO_TEST})
ADD_TEST(comparator_${TEST_NAME} "$ENV{OV_BINARY_PATH}/test_accurancy.${EXT}" "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log")
SET_TESTS_PROPERTIES(run_${TEST_NAME} PROPERTIES ATTACHED_FILES_ON_FAIL "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log"})
SET_TESTS_PROPERTIES(comparator_${TEST_NAME} PROPERTIES DEPENDS run_${TEST_NAME}})
#######################################
######### PsLDA section
SET(TEST_NAME PsLDA-OneVsOne-HT-Test)
SET(SCENARIO_TO_TEST "${TEST_NAME}.xml")
ADD_TEST(run_${TEST_NAME} "$ENV{OV_BINARY_PATH}/openvibe-designer.${EXT}" ${OS_FLAGS} "--no-gui" "--play-fast" ${SCENARIO_TO_TEST})
ADD_TEST(comparator_${TEST_NAME} "$ENV{OV_BINARY_PATH}/test_accurancy.${EXT}" "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log")
SET_TESTS_PROPERTIES(run_${TEST_NAME} PROPERTIES ATTACHED_FILES_ON_FAIL "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log"})
SET_TESTS_PROPERTIES(comparator_${TEST_NAME} PROPERTIES DEPENDS run_${TEST_NAME}})
SET(TEST_NAME PsLDA-OneVsOne-PKPD-Test)
SET(SCENARIO_TO_TEST "${TEST_NAME}.xml")
ADD_TEST(run_${TEST_NAME} "$ENV{OV_BINARY_PATH}/openvibe-designer.${EXT}" ${OS_FLAGS} "--no-gui" "--play-fast" ${SCENARIO_TO_TEST})
ADD_TEST(comparator_${TEST_NAME} "$ENV{OV_BINARY_PATH}/test_accurancy.${EXT}" "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log")
SET_TESTS_PROPERTIES(run_${TEST_NAME} PROPERTIES ATTACHED_FILES_ON_FAIL "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log"})
SET_TESTS_PROPERTIES(comparator_${TEST_NAME} PROPERTIES DEPENDS run_${TEST_NAME}})
SET(TEST_NAME PsLDA-OneVsOne-Voting-Test)
SET(SCENARIO_TO_TEST "${TEST_NAME}.xml")
ADD_TEST(run_${TEST_NAME} "$ENV{OV_BINARY_PATH}/openvibe-designer.${EXT}" ${OS_FLAGS} "--no-gui" "--play-fast" ${SCENARIO_TO_TEST})
ADD_TEST(comparator_${TEST_NAME} "$ENV{OV_BINARY_PATH}/test_accurancy.${EXT}" "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log")
SET_TESTS_PROPERTIES(run_${TEST_NAME} PROPERTIES ATTACHED_FILES_ON_FAIL "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log"})
SET_TESTS_PROPERTIES(comparator_${TEST_NAME} PROPERTIES DEPENDS run_${TEST_NAME}})
SET(TEST_NAME PsLDA-OneVsAll-Test)
SET(SCENARIO_TO_TEST "${TEST_NAME}.xml")
ADD_TEST(run_${TEST_NAME} "$ENV{OV_BINARY_PATH}/openvibe-designer.${EXT}" ${OS_FLAGS} "--no-gui" "--play-fast" ${SCENARIO_TO_TEST})
ADD_TEST(comparator_${TEST_NAME} "$ENV{OV_BINARY_PATH}/test_accurancy.${EXT}" "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log")
SET_TESTS_PROPERTIES(run_${TEST_NAME} PROPERTIES ATTACHED_FILES_ON_FAIL "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log"})
SET_TESTS_PROPERTIES(comparator_${TEST_NAME} PROPERTIES DEPENDS run_${TEST_NAME}})
#######################################
######### SVM section
SET(TEST_NAME SVM-Native-Test)
SET(SCENARIO_TO_TEST "${TEST_NAME}.xml")
ADD_TEST(run_${TEST_NAME} "$ENV{OV_BINARY_PATH}/openvibe-designer.${EXT}" ${OS_FLAGS} "--no-gui" "--play-fast" ${SCENARIO_TO_TEST})
ADD_TEST(comparator_${TEST_NAME} "$ENV{OV_BINARY_PATH}/test_accurancy.${EXT}" "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log")
SET_TESTS_PROPERTIES(run_${TEST_NAME} PROPERTIES ATTACHED_FILES_ON_FAIL "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log"})
SET_TESTS_PROPERTIES(comparator_${TEST_NAME} PROPERTIES DEPENDS run_${TEST_NAME}})
SET(TEST_NAME SVM-OneVsOne-Voting-Test)
SET(SCENARIO_TO_TEST "${TEST_NAME}.xml")
ADD_TEST(run_${TEST_NAME} "$ENV{OV_BINARY_PATH}/openvibe-designer.${EXT}" ${OS_FLAGS} "--no-gui" "--play-fast" ${SCENARIO_TO_TEST})
ADD_TEST(comparator_${TEST_NAME} "$ENV{OV_BINARY_PATH}/test_accurancy.${EXT}" "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log")
SET_TESTS_PROPERTIES(run_${TEST_NAME} PROPERTIES ATTACHED_FILES_ON_FAIL "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log"})
SET_TESTS_PROPERTIES(comparator_${TEST_NAME} PROPERTIES DEPENDS run_${TEST_NAME}})
SET(TEST_NAME SVM-OneVsAll-Test)
SET(SCENARIO_TO_TEST "${TEST_NAME}.xml")
ADD_TEST(run_${TEST_NAME} "$ENV{OV_BINARY_PATH}/openvibe-designer.${EXT}" ${OS_FLAGS} "--no-gui" "--play-fast" ${SCENARIO_TO_TEST})
ADD_TEST(comparator_${TEST_NAME} "$ENV{OV_BINARY_PATH}/test_accurancy.${EXT}" "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log")
SET_TESTS_PROPERTIES(run_${TEST_NAME} PROPERTIES ATTACHED_FILES_ON_FAIL "$ENV{HOME}/.config/openvibe/log/openvibe-designer.log"})
SET_TESTS_PROPERTIES(comparator_${TEST_NAME} PROPERTIES DEPENDS run_${TEST_NAME}})
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<OpenViBE-SettingsOverride>
<SettingValue>3.710409e-01 6.657479e-01 -1.042486e-01 7.402487e-02 -4.998371e-01 -3.910547e-01 -4.640642e-01 3.905098e-01 -3.351870e-01 -1.548908e-01 6.889251e-01 -1.455582e-01 </SettingValue>
<SettingValue>2</SettingValue>
<SettingValue>6</SettingValue>
</OpenViBE-SettingsOverride>
<OpenViBE-SettingsOverride>
<SettingValue>3.650117e-01 2.806841e-01 4.808358e-01 1.014923e-02 -7.237455e-01 -1.812988e-01 -3.742728e-01 5.225129e-01 -2.793061e-01 3.121540e-01 5.283969e-01 -3.636546e-01 </SettingValue>
<SettingValue>2</SettingValue>
<SettingValue>6</SettingValue>
</OpenViBE-SettingsOverride>
<OpenViBE-SettingsOverride>
<SettingValue>-5.343845e-01 1.369963e-02 3.678158e-01 -6.578927e-01 3.275904e-01 1.970249e-01 4.196543e-01 -5.389358e-01 3.383975e-01 5.559860e-02 -5.922296e-01 2.551440e-01 </SettingValue>
<SettingValue>2</SettingValue>
<SettingValue>6</SettingValue>
</OpenViBE-SettingsOverride>
<OpenViBE-SettingsOverride>
<SettingValue>7</SettingValue>
<SettingValue>1</SettingValue>
<SettingValue>OVTK_StimulationId_Target</SettingValue>
</OpenViBE-SettingsOverride>
<OpenViBE-SettingsOverride>
<SettingValue>Butterworth</SettingValue>
<SettingValue>Band pass</SettingValue>
<SettingValue>4</SettingValue>
<SettingValue>19.75</SettingValue>
<SettingValue>20.25</SettingValue>
<SettingValue>0.500000</SettingValue>
</OpenViBE-SettingsOverride>
<OpenViBE-SettingsOverride>
<SettingValue>Butterworth</SettingValue>
<SettingValue>Band pass</SettingValue>
<SettingValue>4</SettingValue>
<SettingValue>14.75</SettingValue>
<SettingValue>15.25</SettingValue>
<SettingValue>0.500000</SettingValue>
</OpenViBE-SettingsOverride>
<OpenViBE-SettingsOverride>
<SettingValue>Butterworth</SettingValue>
<SettingValue>Band pass</SettingValue>
<SettingValue>4</SettingValue>
<SettingValue>11.75</SettingValue>
<SettingValue>12.25</SettingValue>
<SettingValue>0.500000</SettingValue>
</OpenViBE-SettingsOverride>
<OpenViBE-SettingsOverride>
<SettingValue>0.5</SettingValue>
<SettingValue>0.1</SettingValue>
</OpenViBE-SettingsOverride>
This diff is collapsed.
targets = {}
non_targets = {}
sent_stimulation = 0
function initialize(box)
dofile(box:get_config("${Path_Data}") .. "/plugins/stimulation/lua-stimulator-stim-codes.lua")
-- read the parameters of the box
s_targets = box:get_setting(2)
for t in s_targets:gmatch("%d+") do
targets[t + 0] = true
end
s_non_targets = box:get_setting(3)
for t in s_non_targets:gmatch("%d+") do
non_targets[t + 0] = true
end
sent_stimulation = _G[box:get_setting(4)]
end
function uninitialize(box)
end
function process(box)
finished = false
while box:keep_processing() and not finished do
time = box:get_current_time()
while box:get_stimulation_count(1) > 0 do
s_code, s_date, s_duration = box:get_stimulation(1, 1)
box:remove_stimulation(1, 1)
if s_code >= OVTK_StimulationId_Label_00 and s_code <= OVTK_StimulationId_Label_1F then
received_stimulation = s_code - OVTK_StimulationId_Label_00
if targets[received_stimulation] ~= nil then
box:send_stimulation(1, sent_stimulation, time)
elseif non_targets[received_stimulation] ~= nil then
box:send_stimulation(2, sent_stimulation, time)
end
elseif s_code == OVTK_StimulationId_ExperimentStop then
finished = true
end
end
box:sleep()
end
end
#include <fstream>
#include <sstream>
#include <string>
#include <iostream>
#include <cstring>
#include <cstdlib>
using namespace std;
const double threshold = 72;
int main (int argc, char** argv)
{
ifstream file(argv[1], ios::in);
if(file)
{
string line;
while(getline(file, line))
{
size_t pos;
if((pos = line.find("Cross-validation")) != string::npos)
{
string cutline = line.substr(pos);
pos = cutline.find("is")+ 3;//We need to cut the coloration
cutline = cutline.substr(pos);
pos = cutline.find("%");
cutline = cutline.substr(0, pos);
stringstream l_sPercentage(cutline);
double l_fPercentage;
l_sPercentage >> l_fPercentage;
if(l_fPercentage < threshold)
{
cout << "Accurancy too low" << l_fPercentage << "%)" << endl;
return 1;
}
else{
cout << "Test ok (" << l_fPercentage << "%)" << endl;
return 0;
}
}
}
}
return 2;
}
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