本文整理汇总了C#中Accord.MachineLearning.VectorMachines.KernelSupportVectorMachine.ToWeights方法的典型用法代码示例。如果您正苦于以下问题:C# KernelSupportVectorMachine.ToWeights方法的具体用法?C# KernelSupportVectorMachine.ToWeights怎么用?C# KernelSupportVectorMachine.ToWeights使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Accord.MachineLearning.VectorMachines.KernelSupportVectorMachine
的用法示例。
在下文中一共展示了KernelSupportVectorMachine.ToWeights方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: KernelTest1
public void KernelTest1()
{
var dataset = SequentialMinimalOptimizationTest.yinyang;
double[][] inputs = dataset.Submatrix(null, 0, 1).ToArray();
int[] labels = dataset.GetColumn(2).ToInt32();
double e1, e2;
double[] w1, w2;
{
Accord.Math.Tools.SetupGenerator(0);
var svm = new SupportVectorMachine(inputs: 2);
var teacher = new ProbabilisticCoordinateDescent(svm, inputs, labels);
teacher.Tolerance = 1e-10;
teacher.Complexity = 1e+10;
e1 = teacher.Run();
w1 = svm.ToWeights();
}
{
Accord.Math.Tools.SetupGenerator(0);
var svm = new KernelSupportVectorMachine(new Linear(0), inputs: 2);
var teacher = new ProbabilisticCoordinateDescent(svm, inputs, labels);
teacher.Tolerance = 1e-10;
teacher.Complexity = 1e+10;
e2 = teacher.Run();
w2 = svm.ToWeights();
}
Assert.AreEqual(e1, e2);
Assert.AreEqual(w1.Length, w2.Length);
Assert.AreEqual(w1[0], w2[0]);
Assert.AreEqual(w1[1], w2[1]);
Assert.AreEqual(w1[2], w2[2]);
}