I'm trying to use Accord.Net in c++/cli.
Did anyone try it ?
I have translated the simple example depicted in the getting started page into c++/cli code. (see the original program written in c# here: http://code.google.com/p/accord/wiki/GettingStarted)
It all seems okay, however I'm getting some annoying error message which saying: cannot convert parameter 2 from 'cli::array<Type,dimension> ^' to 'cli::array<Type,dimension> ^'
please see also the attached screen-shots.
I just don't get it since it's the same parameter...
Any idea ?
thanks in advanced!
[Please Excuse My English.:)]
// cpp_test.cpp : main project file.
#include "stdafx.h"
using namespace cli;
using namespace System;
using namespace Accord::MachineLearning::VectorMachines;
using namespace Accord::MachineLearning::VectorMachines::Learning;
using namespace Accord::Math;
using namespace Accord::Statistics::Kernels;
int main(array<System::String ^> ^args)
{
KernelSupportVectorMachine^ ksvm = gcnew KernelSupportVectorMachine(gcnew Gaussian(), 2);
// Example XOR problem
array<array<double>^>^ inputs =
{
gcnew array<double> { 0, 0 }, // 0 xor 0: 1 (label +1)
gcnew array<double> { 0, 1 }, // 0 xor 1: 0 (label -1)
gcnew array<double> { 1, 0 }, // 1 xor 0: 0 (label -1)
gcnew array<double> { 1, 1 } // 1 xor 1: 1 (label +1)
};
// Dichotomy SVM outputs should be given as [-1;+1]
array<int>^ outputs =
{
1, -1, -1, 1
};
SequentialMinimalOptimization^ smo = gcnew SequentialMinimalOptimization(ksvm, inputs, outputs);
double error = smo->Run();
return 0;
}