C# 基于Distribution Accord.net对数字数组进行分类

C# 基于Distribution Accord.net对数字数组进行分类,c#,accord.net,C#,Accord.net,我在c#中使用Accord.net,这个库中有很多分类器算法,我想知道什么最适合我的情况, 我试图用监督学习法根据双类型数组的分布对其进行分类,例如: 学习集: a1 = new int[]{1,2,3,4} label a a2 = new int[]{1,2,5,6} label a a3= new int[]{1,1,0,0} label b a4=new int[]{1,0,0,0} label b a5 =new int[]{-10,0,-10,0} label c a6=new in

我在c#中使用Accord.net,这个库中有很多分类器算法,我想知道什么最适合我的情况, 我试图用监督学习法根据双类型数组的分布对其进行分类,例如:

学习集:

a1 = new int[]{1,2,3,4} label a
a2 = new int[]{1,2,5,6} label a
a3= new int[]{1,1,0,0} label b
a4=new int[]{1,0,0,0} label b
a5 =new int[]{-10,0,-10,0} label c
a6=new int[]{-20,1,-20,1} label c
学习训练集后,分类器需要识别不在学习集中的数组: 例如:

classify(new int[]{1,1,1,0}) ---> returns label b

您的阵列有固定大小吗?例如,它们是否总是像您的示例中那样包含4个条目

如果是,请使用Accord.NET中的MulticlassSupportVectorMachine。现在有一个简单的示例,说明如何对大小为3的数组进行分类,但您可以根据需要进行更改:

// Sample input data
double[][] inputs =
{
    new double[] { -1, 3, 2 },
    new double[] { -1, 3, 2 },
    new double[] { -1, 3, 2 },
    new double[] { 10, 82, 4 },
    new double[] { 10, 15, 4 },
    new double[] { 0, 0, 1 },
    new double[] { 0, 0, 2 },
};

// Output for each of the inputs
int[] outputs = { 0, 3, 1, 2 };


// Create a new polynomial kernel
IKernel kernel = new Polynomial(2);

// Create a new Multi-class Support Vector Machine with one input,
//  using the linear kernel and for four disjoint classes.
var machine = new MulticlassSupportVectorMachine(inputs: 3, kernel: kernel, classes: 4);

// Create the Multi-class learning algorithm for the machine
var teacher = new MulticlassSupportVectorLearning(machine, inputs, outputs);

// Configure the learning algorithm to use SMO to train the
//  underlying SVMs in each of the binary class subproblems.
teacher.Algorithm = (svm, classInputs, classOutputs, i, j) =>
    new SequentialMinimalOptimization(svm, classInputs, classOutputs);

// Run the learning algorithm
double error = teacher.Run(); // output should be 0

// Compute the decision output for one of the input vectors
int decision = machine.Compute( new double[] { -1, 3, 2 });

你试过用其他的果仁吗?你有多少个样本,它们的维数是多少?是的,我尝试了所有类型的内核,我有两组,第一组的维数是16,另一组是32。难道你没有足够的训练数据吗?您发布的示例是否实际包含了您拥有的所有数据?