Commit 2355559c authored by Serrière Guillaume's avatar Serrière Guillaume

Add complete base architecture.

Signed-off-by: default avatarSerrière Guillaume <guillaume.serriere@inria.fr>
parent cfeced5d
......@@ -186,7 +186,7 @@ char* IXMLNodeImpl::getXML(const XML::uint32 depth) const
//If we have nothing else to print let's close the node and return
if(!m_bHasPCData && m_oNodeVector.empty())
{
l_sRes = l_sRes + string("/>\n");
l_sRes = l_sRes + string("/>");
char* l_pRes = ::strdup(l_sRes.c_str());
return l_pRes;
}
......
#include "ovpCAlgorithmClassifierOneVsOne.h"
#include "ovpCAlgorithmPairwiseDecision.h"
#include <map>
#include <cmath>
......@@ -14,6 +15,7 @@
static const char* const c_sTypeNodeName = "OneVsOne";
static const char* const c_sSubClassifierIdentifierNodeName = "SubClassifierIdentifier";
static const char* const c_sPairwiseDecisionName = "PairwiseDecision";
static const char* const c_sAlgorithmIdAttribute = "algorithm-id";
static const char* const c_sSubClassifierCountNodeName = "SubClassifierCount";
static const char* const c_sSubClassifiersNodeName = "SubClassifiers";
......@@ -165,7 +167,7 @@ boolean CAlgorithmClassifierOneVsOne::classify(const IFeatureVector& rFeatureVec
l_pFeatureVectorBuffer,
rFeatureVector.getBuffer(),
l_ui32FeatureVectorSize*sizeof(float64));
l_pTempProxy->process(OVP_Algorithm_Classifier_Pairwise_InputTriggerId_Classifiy);
l_pTempProxy->process(OVTK_Algorithm_Classifier_InputTriggerId_Classify);
//We have only probability here
float64 l_f64Prob = op_pClassificationValues->getBuffer()[0];
......@@ -260,6 +262,12 @@ void CAlgorithmClassifierOneVsOne::generateConfigurationNode(void)
l_pTempNode->setPCData(l_sAmountClasses.str().c_str());
l_pOneVsOneNode->addChild(l_pTempNode);
l_pTempNode = XML::createNode(c_sPairwiseDecisionName);
TParameterHandler < XML::IXMLNode* > op_pConfiguration(m_pDecisionStrategyAlgorithm->getOutputParameter(OVP_Algorithm_Classifier_Pairwise_OutputParameterId_Configuration));
m_pDecisionStrategyAlgorithm->process(OVP_Algorithm_Classifier_Pairwise_InputTriggerId_SaveConfiguration);
l_pTempNode->addChild((XML::IXMLNode*)op_pConfiguration);
l_pOneVsOneNode->addChild(l_pTempNode);
XML::IXMLNode *l_pSubClassifersNode = XML::createNode(c_sSubClassifiersNodeName);
for(size_t i = 0; i<m_oSubClassifierDescriptorList.size(); ++i)
{
......
......@@ -15,5 +15,9 @@ boolean CAlgorithmPairwiseDecision::process()
{
return this->classify();
}
else if(this->isInputTriggerActive(OVP_Algorithm_Classifier_Pairwise_InputTriggerId_SaveConfiguration))
{
return this->saveConfiguration();
}
return true;
}
......@@ -8,6 +8,17 @@
#define OVP_ClassId_Algorithm_PairwiseDecision OpenViBE::CIdentifier(0x26EF6DDA, 0xF137053C)
#define OVP_ClassId_Algorithm_PairwiseDecisionDesc OpenViBE::CIdentifier(0x191EB02A, 0x6866214A)
#define OVP_Algorithm_Classifier_InputParameter_ProbabilityMatrix OpenViBE::CIdentifier(0xF48D35AD, 0xB8EFF834)
#define OVP_Algorithm_Classifier_Pairwise_InputParameterId_Configuration OpenViBE::CIdentifier(0x10EBAC09, 0x80926A63)
#define OVP_Algorithm_Classifier_OutputParameter_ProbabilityVector OpenViBE::CIdentifier(0x883599FE, 0x2FDB32FF)
#define OVP_Algorithm_Classifier_Pairwise_OutputParameterId_Configuration OpenViBE::CIdentifier(0x69F05A61, 0x25C94515)
#define OVP_Algorithm_Classifier_Pairwise_InputTriggerId_Train OpenViBE::CIdentifier(0x32219D21, 0xD3BE6105)
#define OVP_Algorithm_Classifier_Pairwise_InputTriggerId_Classifiy OpenViBE::CIdentifier(0x3637344B, 0x05D03D7E)
#define OVP_Algorithm_Classifier_Pairwise_InputTriggerId_SaveConfiguration OpenViBE::CIdentifier(0xF19574AD, 0x024045A7)
#define OVP_Algorithm_Classifier_Pairwise_InputTriggerId_LoadConfiguration OpenViBE::CIdentifier(0x97AF6C6C, 0x670A12E6)
namespace OpenViBEPlugins
{
namespace Classification
......@@ -23,6 +34,7 @@ namespace OpenViBEPlugins
virtual OpenViBE::boolean uninitialize(void)=0;
virtual OpenViBE::boolean classify(void) =0;
virtual OpenViBE::boolean saveConfiguration(void) = 0;
virtual OpenViBE::boolean process(void);
......@@ -36,11 +48,15 @@ namespace OpenViBEPlugins
OpenViBE::Kernel::IAlgorithmProto& rAlgorithmPrototype) const
{
rAlgorithmPrototype.addInputParameter(OVP_Algorithm_Classifier_InputParameter_ProbabilityMatrix, "Probability Matrix", OpenViBE::Kernel::ParameterType_Matrix);
rAlgorithmPrototype.addInputParameter(OVP_Algorithm_Classifier_Pairwise_InputParameterId_Configuration, "Configuration node", OpenViBE::Kernel::ParameterType_Pointer);
rAlgorithmPrototype.addOutputParameter(OVP_Algorithm_Classifier_OutputParameter_ProbabilityVector, "Output Probability Matrix", OpenViBE::Kernel::ParameterType_Matrix);
rAlgorithmPrototype.addOutputParameter(OVP_Algorithm_Classifier_Pairwise_OutputParameterId_Configuration, "Configuration node", OpenViBE::Kernel::ParameterType_Pointer);
rAlgorithmPrototype.addInputTrigger(OVP_Algorithm_Classifier_Pairwise_InputTriggerId_Classifiy, "Classify");
rAlgorithmPrototype.addInputTrigger(OVP_Algorithm_Classifier_Pairwise_InputTriggerId_SaveConfiguration, "Save configuration");
rAlgorithmPrototype.addInputTrigger(OVP_Algorithm_Classifier_Pairwise_InputTriggerId_LoadConfiguration, "Load configuration");
return true;
}
......
#define PKPD_DEBUG 0
#include "ovpCAlgorithmPairwiseStrategyPKPD.h"
#include <iostream>
#define PKPD_DEBUG 0
#include <xml/IXMLNode.h>
#include <xml/IXMLHandler.h>
static const char* const c_sTypeNodeName = "PairwiseDecision_PKDP";
using namespace OpenViBE;
using namespace OpenViBE::Kernel;
......@@ -23,6 +29,8 @@ boolean CAlgorithmPairwiseStrategyPKPD::uninitialize()
return true;
}
boolean CAlgorithmPairwiseStrategyPKPD::classify()
{
TParameterHandler<IMatrix *> ip_pProbabilityMatrix = this->getInputParameter(OVP_Algorithm_Classifier_InputParameter_ProbabilityMatrix);
......@@ -84,3 +92,16 @@ boolean CAlgorithmPairwiseStrategyPKPD::classify()
delete[] l_pProbVector;
return true;
}
boolean CAlgorithmPairwiseStrategyPKPD::saveConfiguration()
{
TParameterHandler < XML::IXMLNode* > op_pConfiguration(this->getOutputParameter(OVP_Algorithm_Classifier_Pairwise_OutputParameterId_Configuration));
XML::IXMLNode* l_pRootNode = XML::createNode(c_sTypeNodeName);
op_pConfiguration = l_pRootNode;
return true;
}
boolean CAlgorithmPairwiseStrategyPKPD::loadConfiguration()
{
return true;
}
......@@ -25,6 +25,8 @@ namespace OpenViBEPlugins
virtual OpenViBE::boolean uninitialize(void);
virtual OpenViBE::boolean classify(void);
virtual OpenViBE::boolean saveConfiguration(void);
virtual OpenViBE::boolean loadConfiguration(void);
_IsDerivedFromClass_Final_(OpenViBEToolkit::TAlgorithm < OpenViBE::Plugins::IAlgorithm >, OVP_ClassId_Algorithm_PairwiseStrategy_PKPD)
};
......
......@@ -3,14 +3,6 @@
#define OVP_Classification_BoxTrainerXMLVersion 2
#define OVP_Algorithm_Classifier_InputParameter_ProbabilityMatrix OpenViBE::CIdentifier(0xF48D35AD, 0xB8EFF834)
#define OVP_Algorithm_Classifier_OutputParameter_ProbabilityVector OpenViBE::CIdentifier(0x883599FE, 0x2FDB32FF)
#define OVP_Algorithm_Classifier_Pairwise_InputTriggerId_Train OpenViBE::CIdentifier(0x32219D21, 0xD3BE6105)
#define OVP_Algorithm_Classifier_Pairwise_InputTriggerId_Classifiy OpenViBE::CIdentifier(0x3637344B, 0x05D03D7E)
#define OVP_Algorithm_Classifier_Pairwise_InputTriggerId_SaveConfiguration OpenViBE::CIdentifier(0xF19574AD, 0x024045A7)
#define OVP_Algorithm_Classifier_Pairwise_InputTriggerId_LoadConfiguration OpenViBE::CIdentifier(0x97AF6C6C, 0x670A12E6)
//___________________________________________________________________//
// //
// Plugin Object Descriptor Class Identifiers //
......
......@@ -10,6 +10,7 @@
#include "algorithms/ovpCAlgorithmClassifierOneVsOne.h"
#include "algorithms/ovpCAlgorithmConfusionMatrix.h"
#include "algorithms/ovpCAlgorithmPairwiseDecision.h"
#include "algorithms/ovpCAlgorithmPairwiseStrategyPKPD.h"
#include "box-algorithms/ovpCBoxAlgorithmVotingClassifier.h"
......
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