Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions LibSVMsharp/Core/svm_node.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;

namespace LibSVMsharp.Core
{
[StructLayout(LayoutKind.Sequential)]
public struct svm_node
{
internal int index;
internal double value;
public int index;
public double value;
}
}
4 changes: 1 addition & 3 deletions LibSVMsharp/Extensions/SVMProblemExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LibSVMsharp.Extensions
{
Expand Down Expand Up @@ -82,7 +80,7 @@ public static double[] PredictValues(this SVMProblem problem, SVMModel model, ou
double[] target = problem.X.Select(x =>
{
double[] estimations;
double y = x.PredictProbability(ptr_model, out estimations);
double y = x.PredictValues(ptr_model, out estimations);
temp.Add(estimations);
return y;
}).ToArray();
Expand Down
4 changes: 1 addition & 3 deletions LibSVMsharp/SVMNode.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using LibSVMsharp.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;

namespace LibSVMsharp
{
Expand Down Expand Up @@ -51,7 +49,7 @@ public static SVMNode[] Convert(IntPtr ptr)
{
svm_node node = (svm_node)Marshal.PtrToStructure(i_ptr_nodes, typeof(svm_node));
i_ptr_nodes = IntPtr.Add(i_ptr_nodes, Marshal.SizeOf(typeof(svm_node)));
if (node.index > 0)
if (node.index >= 0)
{
nodes.Add(new SVMNode(node.index, node.value));
}
Expand Down