diff --git a/LibSVMsharp/Core/svm_node.cs b/LibSVMsharp/Core/svm_node.cs index f237531..43e5e2d 100644 --- a/LibSVMsharp/Core/svm_node.cs +++ b/LibSVMsharp/Core/svm_node.cs @@ -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; } } diff --git a/LibSVMsharp/Extensions/SVMProblemExtensions.cs b/LibSVMsharp/Extensions/SVMProblemExtensions.cs index 2969e78..68ec6af 100644 --- a/LibSVMsharp/Extensions/SVMProblemExtensions.cs +++ b/LibSVMsharp/Extensions/SVMProblemExtensions.cs @@ -2,8 +2,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace LibSVMsharp.Extensions { @@ -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(); diff --git a/LibSVMsharp/SVMNode.cs b/LibSVMsharp/SVMNode.cs index b73f398..00b1ddb 100644 --- a/LibSVMsharp/SVMNode.cs +++ b/LibSVMsharp/SVMNode.cs @@ -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 { @@ -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)); }