accord-net / framework

Machine learning, computer vision, statistics and general scientific computing for .NET
http://accord-framework.net
GNU Lesser General Public License v2.1
4.5k stars 1.99k forks source link

dotnetcore de-selialization not supported #1495

Open pavlexander opened 6 years ago

pavlexander commented 6 years ago

What would you like to submit? (put an 'x' inside the bracket that applies)

Issue description

It is impossible currently to de-serialize k-mean clusters in dotnetcore 2.0 project.

For example - following code works fine in .Net Framework 4.7 project but not in dotnetcore 2.0 project.

class Program
{
    public static KMeansClusterCollection LoadClustersFromFile()
    {
        return Serializer.Load<KMeansClusterCollection>("clusters.dat");
    }

    static void Main(string[] args)
    {
        Console.WriteLine("Hello World!");

        var Clusters = LoadClustersFromFile(); 
        Clusters.Decide(new double[7] { 1, 2, 3, 4, 5, 6, 7 });
    }
}

You will see a null-pointer exception at last line.

pavlexander commented 6 years ago

Worth noticing, that clusters were serialized in .Net Framework. Seems like as long as it's the same family - de-serialization works OK. Is there a way I can transfer my k-clusters from .net framework to .net core?

I have tried all kind of things without success.