Skip to content

Commit fe3e7b6

Browse files
committed
temporary fix for raspberry pi builds
1 parent d86affb commit fe3e7b6

6 files changed

Lines changed: 12 additions & 10 deletions

File tree

SVMClassifier/Common.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ public static uint C2I(Color color)
7575

7676
public static Color I2C(uint color)
7777
{
78-
byte a = (byte)(color >> 24);
7978
byte r = (byte)(color >> 16);
8079
byte g = (byte)(color >> 8);
8180
byte b = (byte)(color >> 0);

SVMClassifier/Conrec.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ public static void Contour(double[,] d, double[] x, double[] y, double[] z, Rend
121121
}
122122
else
123123
{
124-
h[0] = (double)1 / 4 * (h[1] + h[2] + h[3] + h[4]);
125-
xh[0] = (double)1 / 2 * (x[i] + x[i + 1]);
126-
yh[0] = (double)1 / 2 * (y[j] + y[j + 1]);
124+
h[0] = 0.25 * (h[1] + h[2] + h[3] + h[4]);
125+
xh[0] = 0.5 * (x[i] + x[i + 1]);
126+
yh[0] = 0.5 * (y[j] + y[j + 1]);
127127
}
128128

129129
if (h[m] > 0)

SVMClassifier/KernelFunction.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ public static double Fourier(ManagedArray x1, ManagedArray x2, ManagedArray k)
121121

122122
for (var i = 0; i < x1.Length(); i++)
123123
{
124-
z[i] = Math.Sin(m + (double)1 / 2) * 2;
124+
z[i] = Math.Sin(m + 0.5) * 2;
125125

126126
var d = x1[i] - x2[i];
127127

128-
z[i] = Math.Abs(d) > 0 ? Math.Sin(m + (double)1 / 2) * d / Math.Sin(d * (double)1 / 2) : z[i];
128+
z[i] = Math.Abs(d) > 0 ? Math.Sin(m + 0.5) * d / Math.Sin(d * 0.5) : z[i];
129129

130130
prod = (i == 0) ? z[i] : prod * z[i];
131131
}

SVMClassifier/MainWindow.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,8 @@ protected void InitializeUserInterface()
484484
ToggleUserControls(Paused);
485485

486486
Kernels.Add(new KernelClass("Polynomial", KernelType.POLYNOMIAL, new List<double> { 0, 2 }, new List<string> { "bias", "exponent" }));
487-
Kernels.Add(new KernelClass("Gaussian", KernelType.GAUSSIAN, new List<double> { (double)1 / 100 }, new List<string> { "sigma" }));
488-
Kernels.Add(new KernelClass("Radial", KernelType.RADIAL, new List<double> { (double)1 / 100 }, new List<string> { "sigma" }));
487+
Kernels.Add(new KernelClass("Gaussian", KernelType.GAUSSIAN, new List<double> { 0.01 }, new List<string> { "sigma" }));
488+
Kernels.Add(new KernelClass("Radial", KernelType.RADIAL, new List<double> { 0.01 }, new List<string> { "sigma" }));
489489
Kernels.Add(new KernelClass("Sigmoid", KernelType.SIGMOID, new List<double> { 1, 0 }, new List<string> { "slope", "intercept" }));
490490
Kernels.Add(new KernelClass("Linear", KernelType.LINEAR, new List<double> { 1, 0 }, new List<string> { "slope", "intercept" }));
491491
Kernels.Add(new KernelClass("Fourier", KernelType.FOURIER, new List<double> { 1 }, new List<string> { "scaling factor" }));

SVMClassifier/Model.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ int Cols(ManagedArray x)
7272
return x.x;
7373
}
7474

75-
public void Setup(ManagedArray x, ManagedArray y, double c, KernelType kernel, ManagedArray param, double tolerance = (double)1 / 1000, int maxpasses = 5, int category = 1)
75+
public void Setup(ManagedArray x, ManagedArray y, double c, KernelType kernel, ManagedArray param, double tolerance = 0.001, int maxpasses = 5, int category = 1)
7676
{
7777
ManagedOps.Free(dx, dy);
7878
dx = new ManagedArray(x);
@@ -399,7 +399,7 @@ public void Generate()
399399
// Converted to R by: SD Separa (2016/03/18)
400400
// Converted to C# by: SD Separa (2018/09/29)
401401
//
402-
public void Train(ManagedArray x, ManagedArray y, double c, KernelType kernel, ManagedArray param, double tolerance = (double)1 / 1000, int maxpasses = 5, int category = 1)
402+
public void Train(ManagedArray x, ManagedArray y, double c, KernelType kernel, ManagedArray param, double tolerance = 0.001, int maxpasses = 5, int category = 1)
403403
{
404404
Setup(x, y, c, kernel, param, tolerance, maxpasses, category);
405405

SVMClassifier/SVMClassifier.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,7 @@
9090
<None Include="packages.config" />
9191
</ItemGroup>
9292
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
93+
<PropertyGroup Condition = " '$(OS)' == 'Unix' ">
94+
<CscToolExe>mcs</CscToolExe>
95+
</PropertyGroup>
9396
</Project>

0 commit comments

Comments
 (0)