1 文本格式
using System;
namespace Legalsoft.Truffer
{
public class Svmpolykernel : Svmgenkernel
{
public int n { get; set; }
public double a { get; set; }
public double b { get; set; }
public double d { get; set; }
public Svmpolykernel(double[,] ddata, double[] yy, double aa, double bb, double dd) : base(yy, ddata)
{
this.n = data.GetLength(1);
this.a = aa;
this.b = bb;
this.d = dd;
fill();
}
public override double kernel(double xi, double xj)
{
return 0.0;
}
public override double kernel(double[] xi, double[] xj)
{
double dott = 0.0;
for (int k = 0; k < n; k++)
{
dott += xi[k] * xj[k];
}
return Math.Pow(a * dott + b, d);
}
}
}
2 代码格式
cs
using System;
namespace Legalsoft.Truffer
{
public class Svmpolykernel : Svmgenkernel
{
public int n { get; set; }
public double a { get; set; }
public double b { get; set; }
public double d { get; set; }
public Svmpolykernel(double[,] ddata, double[] yy, double aa, double bb, double dd) : base(yy, ddata)
{
this.n = data.GetLength(1);
this.a = aa;
this.b = bb;
this.d = dd;
fill();
}
public override double kernel(double xi, double xj)
{
return 0.0;
}
public override double kernel(double[] xi, double[] xj)
{
double dott = 0.0;
for (int k = 0; k < n; k++)
{
dott += xi[k] * xj[k];
}
return Math.Pow(a * dott + b, d);
}
}
}