ML.NET Binary Classification Model Not Working










0














There doesn't seem to be much documentation on ML.Net as it appears to be relatively new. I've been running into problem after problem trying to learn how to use it, and I finally figured out it enough to get it to at least run without experiencing an error; however, there seems to be a problem with my model. It always returns 0 with a probability of 50%. I've included my code below. Does anyone know any good resources for the most recent version of ML.Net that I can explore? The code below is supposed to be making a binary classification model that can predict whether a team is going or not going to the playoff. The data is just the final results of last season with most of the data removed so the only columns that remain are the average age, wins, losses, and playoff status (1 = playoffs & 0 = no playoff).



Program.cs



using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.ML;
using Microsoft.ML.Core.Data;
using Microsoft.ML.Runtime.Api;
using Microsoft.ML.Runtime.Data;

namespace MachineLearning2

class Program

static readonly string _trainDataPath = Path.Combine(Environment.CurrentDirectory, "trainingNHL.txt");
static readonly string _testDataPath = Path.Combine(Environment.CurrentDirectory, "testingNHL.txt");
static readonly string _modelPath = Path.Combine(Environment.CurrentDirectory, "Model.zip");
static TextLoader _textLoader;

static void Main(string args)

MLContext mlContext = new MLContext(seed: 0);
_textLoader = mlContext.Data.TextReader(new TextLoader.Arguments()

Separator = ",",
HasHeader = false,
Column = new

new TextLoader.Column("Age", DataKind.R4, 0),
new TextLoader.Column("Wins", DataKind.R4, 1),
new TextLoader.Column("Losses", DataKind.R4, 2),
new TextLoader.Column("Label", DataKind.R4, 3)

);
var model = Train(mlContext, _trainDataPath);
Evaluate(mlContext, model);
Predict(mlContext, model);
PredictWithModelLoadedFromFile(mlContext);



public static ITransformer Train(MLContext mlContext, string dataPath)

IDataView dataView = _textLoader.Read(dataPath);
var pipeline = mlContext.Transforms.Concatenate("Features","Age", "Wins", "Losses")
.Append(mlContext.BinaryClassification.Trainers.FastTree(numLeaves: 50, numTrees: 50, minDatapointsInLeafs: 20));
Console.WriteLine("=============== Create and Train the Model ===============");
var model = pipeline.Fit(dataView);
Console.WriteLine("=============== End of training ===============");
Console.WriteLine();
return model;


public static void Evaluate(MLContext mlContext, ITransformer model)

IDataView dataView = _textLoader.Read(_testDataPath);
Console.WriteLine("=============== Evaluating Model accuracy with Test data===============");
var predictions = model.Transform(dataView);
var metrics = mlContext.BinaryClassification.Evaluate(predictions, "Label");
Console.WriteLine();
Console.WriteLine("Model quality metrics evaluation");
Console.WriteLine("--------------------------------");
Console.WriteLine($"Accuracy: metrics.Accuracy:P2");
Console.WriteLine($"Auc: metrics.Auc:P2");
Console.WriteLine($"F1Score: metrics.F1Score:P2");
Console.WriteLine("=============== End of model evaluation ===============");
SaveModelAsFile(mlContext, model);


private static void SaveModelAsFile(MLContext mlContext, ITransformer model)

using (var fs = new FileStream(_modelPath, FileMode.Create, FileAccess.Write, FileShare.Write))
mlContext.Model.Save(model, fs);
Console.WriteLine("The model is saved to 0", _modelPath);



public static void Predict(MLContext mlContext, ITransformer model)
Prediction: (Convert.ToBoolean(resultprediction.Prediction) ? "Yes" : "No")

public static void PredictWithModelLoadedFromFile(MLContext mlContext)

IEnumerable<NHLData> teams = new

new NHLData

Age = 29,
Wins = 30,
Losses = 52
,
new NHLData

Age = 35,
Wins = 80,
Losses = 2

;
ITransformer loadedModel;
using (var stream = new FileStream(_modelPath, FileMode.Open, FileAccess.Read, FileShare.Read))

loadedModel = mlContext.Model.Load(stream);

// Create prediction engine
var nhlStreamingDataView = mlContext.CreateStreamingDataView(teams);
var predictions = loadedModel.Transform(nhlStreamingDataView);

// Use the model to predict whether comment data is toxic (1) or nice (0).
var predictedResults = predictions.AsEnumerable<NHLPrediction>(mlContext, reuseRowObject: false);
Console.WriteLine();

Console.WriteLine("=============== Prediction Test of loaded model with a multiple samples ===============");
var teamsAndPredictions = teams.Zip(predictedResults, (team, prediction) => (team, prediction));
foreach (var item in teamsAndPredictions)
Prediction: (Convert.ToBoolean(item.prediction.Prediction) ? "Yes" : "No")
Console.WriteLine("=============== End of predictions ===============");





NHLData.cs



using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.ML.Runtime.Api;

namespace MachineLearning2

public class NHLData

[Column(ordinal: "0")]
public float Age;
[Column(ordinal: "1")]
public float Wins;
[Column(ordinal: "2")]
public float Losses;
[Column(ordinal: "3", name: "Label")]
public float Playoffs;


public class NHLPrediction

[ColumnName("PredictedLabel")]
public bool Prediction get; set;

[ColumnName("Probability")]
public float Probability get; set;

[ColumnName("Score")]
public float Score get; set;




trainingNHL.txt (columns: Age, Wins, Losses, Playoffs)



28.4,53,18,1
27.5,54,23,1
28,51,24,1
28.3,49,26,1
29.5,45,26,1
28.8,45,27,1
29.1,45,29,1
27.7,44,29,1
26.4,43,30,1
28.5,42,32,0
27,36,35,0
26.8,36,40,0
28,33,39,0
30.2,30,39,0
26.5,29,41,0
27.1,25,45,0


testingNHL.txt (columns: Age, Wins, Losses, Playoffs)



26.8,52,20,1
28.6,50,20,1
28.4,49,26,1
28.7,44,25,1
27.7,47,29,1
27.4,42,26,1
26.4,45,30,1
27.8,44,30,0
28.5,44,32,0
28.4,37,35,0
28.4,35,37,0
28.7,34,39,0
28.2,31,40,0
27.8,29,40,0
29.3,28,43,0









share|improve this question


























    0














    There doesn't seem to be much documentation on ML.Net as it appears to be relatively new. I've been running into problem after problem trying to learn how to use it, and I finally figured out it enough to get it to at least run without experiencing an error; however, there seems to be a problem with my model. It always returns 0 with a probability of 50%. I've included my code below. Does anyone know any good resources for the most recent version of ML.Net that I can explore? The code below is supposed to be making a binary classification model that can predict whether a team is going or not going to the playoff. The data is just the final results of last season with most of the data removed so the only columns that remain are the average age, wins, losses, and playoff status (1 = playoffs & 0 = no playoff).



    Program.cs



    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using Microsoft.ML;
    using Microsoft.ML.Core.Data;
    using Microsoft.ML.Runtime.Api;
    using Microsoft.ML.Runtime.Data;

    namespace MachineLearning2

    class Program

    static readonly string _trainDataPath = Path.Combine(Environment.CurrentDirectory, "trainingNHL.txt");
    static readonly string _testDataPath = Path.Combine(Environment.CurrentDirectory, "testingNHL.txt");
    static readonly string _modelPath = Path.Combine(Environment.CurrentDirectory, "Model.zip");
    static TextLoader _textLoader;

    static void Main(string args)

    MLContext mlContext = new MLContext(seed: 0);
    _textLoader = mlContext.Data.TextReader(new TextLoader.Arguments()

    Separator = ",",
    HasHeader = false,
    Column = new

    new TextLoader.Column("Age", DataKind.R4, 0),
    new TextLoader.Column("Wins", DataKind.R4, 1),
    new TextLoader.Column("Losses", DataKind.R4, 2),
    new TextLoader.Column("Label", DataKind.R4, 3)

    );
    var model = Train(mlContext, _trainDataPath);
    Evaluate(mlContext, model);
    Predict(mlContext, model);
    PredictWithModelLoadedFromFile(mlContext);



    public static ITransformer Train(MLContext mlContext, string dataPath)

    IDataView dataView = _textLoader.Read(dataPath);
    var pipeline = mlContext.Transforms.Concatenate("Features","Age", "Wins", "Losses")
    .Append(mlContext.BinaryClassification.Trainers.FastTree(numLeaves: 50, numTrees: 50, minDatapointsInLeafs: 20));
    Console.WriteLine("=============== Create and Train the Model ===============");
    var model = pipeline.Fit(dataView);
    Console.WriteLine("=============== End of training ===============");
    Console.WriteLine();
    return model;


    public static void Evaluate(MLContext mlContext, ITransformer model)

    IDataView dataView = _textLoader.Read(_testDataPath);
    Console.WriteLine("=============== Evaluating Model accuracy with Test data===============");
    var predictions = model.Transform(dataView);
    var metrics = mlContext.BinaryClassification.Evaluate(predictions, "Label");
    Console.WriteLine();
    Console.WriteLine("Model quality metrics evaluation");
    Console.WriteLine("--------------------------------");
    Console.WriteLine($"Accuracy: metrics.Accuracy:P2");
    Console.WriteLine($"Auc: metrics.Auc:P2");
    Console.WriteLine($"F1Score: metrics.F1Score:P2");
    Console.WriteLine("=============== End of model evaluation ===============");
    SaveModelAsFile(mlContext, model);


    private static void SaveModelAsFile(MLContext mlContext, ITransformer model)

    using (var fs = new FileStream(_modelPath, FileMode.Create, FileAccess.Write, FileShare.Write))
    mlContext.Model.Save(model, fs);
    Console.WriteLine("The model is saved to 0", _modelPath);



    public static void Predict(MLContext mlContext, ITransformer model)
    Prediction: (Convert.ToBoolean(resultprediction.Prediction) ? "Yes" : "No")

    public static void PredictWithModelLoadedFromFile(MLContext mlContext)

    IEnumerable<NHLData> teams = new

    new NHLData

    Age = 29,
    Wins = 30,
    Losses = 52
    ,
    new NHLData

    Age = 35,
    Wins = 80,
    Losses = 2

    ;
    ITransformer loadedModel;
    using (var stream = new FileStream(_modelPath, FileMode.Open, FileAccess.Read, FileShare.Read))

    loadedModel = mlContext.Model.Load(stream);

    // Create prediction engine
    var nhlStreamingDataView = mlContext.CreateStreamingDataView(teams);
    var predictions = loadedModel.Transform(nhlStreamingDataView);

    // Use the model to predict whether comment data is toxic (1) or nice (0).
    var predictedResults = predictions.AsEnumerable<NHLPrediction>(mlContext, reuseRowObject: false);
    Console.WriteLine();

    Console.WriteLine("=============== Prediction Test of loaded model with a multiple samples ===============");
    var teamsAndPredictions = teams.Zip(predictedResults, (team, prediction) => (team, prediction));
    foreach (var item in teamsAndPredictions)
    Prediction: (Convert.ToBoolean(item.prediction.Prediction) ? "Yes" : "No")
    Console.WriteLine("=============== End of predictions ===============");





    NHLData.cs



    using System;
    using System.Collections.Generic;
    using System.Text;
    using Microsoft.ML.Runtime.Api;

    namespace MachineLearning2

    public class NHLData

    [Column(ordinal: "0")]
    public float Age;
    [Column(ordinal: "1")]
    public float Wins;
    [Column(ordinal: "2")]
    public float Losses;
    [Column(ordinal: "3", name: "Label")]
    public float Playoffs;


    public class NHLPrediction

    [ColumnName("PredictedLabel")]
    public bool Prediction get; set;

    [ColumnName("Probability")]
    public float Probability get; set;

    [ColumnName("Score")]
    public float Score get; set;




    trainingNHL.txt (columns: Age, Wins, Losses, Playoffs)



    28.4,53,18,1
    27.5,54,23,1
    28,51,24,1
    28.3,49,26,1
    29.5,45,26,1
    28.8,45,27,1
    29.1,45,29,1
    27.7,44,29,1
    26.4,43,30,1
    28.5,42,32,0
    27,36,35,0
    26.8,36,40,0
    28,33,39,0
    30.2,30,39,0
    26.5,29,41,0
    27.1,25,45,0


    testingNHL.txt (columns: Age, Wins, Losses, Playoffs)



    26.8,52,20,1
    28.6,50,20,1
    28.4,49,26,1
    28.7,44,25,1
    27.7,47,29,1
    27.4,42,26,1
    26.4,45,30,1
    27.8,44,30,0
    28.5,44,32,0
    28.4,37,35,0
    28.4,35,37,0
    28.7,34,39,0
    28.2,31,40,0
    27.8,29,40,0
    29.3,28,43,0









    share|improve this question
























      0












      0








      0







      There doesn't seem to be much documentation on ML.Net as it appears to be relatively new. I've been running into problem after problem trying to learn how to use it, and I finally figured out it enough to get it to at least run without experiencing an error; however, there seems to be a problem with my model. It always returns 0 with a probability of 50%. I've included my code below. Does anyone know any good resources for the most recent version of ML.Net that I can explore? The code below is supposed to be making a binary classification model that can predict whether a team is going or not going to the playoff. The data is just the final results of last season with most of the data removed so the only columns that remain are the average age, wins, losses, and playoff status (1 = playoffs & 0 = no playoff).



      Program.cs



      using System;
      using System.Collections.Generic;
      using System.IO;
      using System.Linq;
      using Microsoft.ML;
      using Microsoft.ML.Core.Data;
      using Microsoft.ML.Runtime.Api;
      using Microsoft.ML.Runtime.Data;

      namespace MachineLearning2

      class Program

      static readonly string _trainDataPath = Path.Combine(Environment.CurrentDirectory, "trainingNHL.txt");
      static readonly string _testDataPath = Path.Combine(Environment.CurrentDirectory, "testingNHL.txt");
      static readonly string _modelPath = Path.Combine(Environment.CurrentDirectory, "Model.zip");
      static TextLoader _textLoader;

      static void Main(string args)

      MLContext mlContext = new MLContext(seed: 0);
      _textLoader = mlContext.Data.TextReader(new TextLoader.Arguments()

      Separator = ",",
      HasHeader = false,
      Column = new

      new TextLoader.Column("Age", DataKind.R4, 0),
      new TextLoader.Column("Wins", DataKind.R4, 1),
      new TextLoader.Column("Losses", DataKind.R4, 2),
      new TextLoader.Column("Label", DataKind.R4, 3)

      );
      var model = Train(mlContext, _trainDataPath);
      Evaluate(mlContext, model);
      Predict(mlContext, model);
      PredictWithModelLoadedFromFile(mlContext);



      public static ITransformer Train(MLContext mlContext, string dataPath)

      IDataView dataView = _textLoader.Read(dataPath);
      var pipeline = mlContext.Transforms.Concatenate("Features","Age", "Wins", "Losses")
      .Append(mlContext.BinaryClassification.Trainers.FastTree(numLeaves: 50, numTrees: 50, minDatapointsInLeafs: 20));
      Console.WriteLine("=============== Create and Train the Model ===============");
      var model = pipeline.Fit(dataView);
      Console.WriteLine("=============== End of training ===============");
      Console.WriteLine();
      return model;


      public static void Evaluate(MLContext mlContext, ITransformer model)

      IDataView dataView = _textLoader.Read(_testDataPath);
      Console.WriteLine("=============== Evaluating Model accuracy with Test data===============");
      var predictions = model.Transform(dataView);
      var metrics = mlContext.BinaryClassification.Evaluate(predictions, "Label");
      Console.WriteLine();
      Console.WriteLine("Model quality metrics evaluation");
      Console.WriteLine("--------------------------------");
      Console.WriteLine($"Accuracy: metrics.Accuracy:P2");
      Console.WriteLine($"Auc: metrics.Auc:P2");
      Console.WriteLine($"F1Score: metrics.F1Score:P2");
      Console.WriteLine("=============== End of model evaluation ===============");
      SaveModelAsFile(mlContext, model);


      private static void SaveModelAsFile(MLContext mlContext, ITransformer model)

      using (var fs = new FileStream(_modelPath, FileMode.Create, FileAccess.Write, FileShare.Write))
      mlContext.Model.Save(model, fs);
      Console.WriteLine("The model is saved to 0", _modelPath);



      public static void Predict(MLContext mlContext, ITransformer model)
      Prediction: (Convert.ToBoolean(resultprediction.Prediction) ? "Yes" : "No")

      public static void PredictWithModelLoadedFromFile(MLContext mlContext)

      IEnumerable<NHLData> teams = new

      new NHLData

      Age = 29,
      Wins = 30,
      Losses = 52
      ,
      new NHLData

      Age = 35,
      Wins = 80,
      Losses = 2

      ;
      ITransformer loadedModel;
      using (var stream = new FileStream(_modelPath, FileMode.Open, FileAccess.Read, FileShare.Read))

      loadedModel = mlContext.Model.Load(stream);

      // Create prediction engine
      var nhlStreamingDataView = mlContext.CreateStreamingDataView(teams);
      var predictions = loadedModel.Transform(nhlStreamingDataView);

      // Use the model to predict whether comment data is toxic (1) or nice (0).
      var predictedResults = predictions.AsEnumerable<NHLPrediction>(mlContext, reuseRowObject: false);
      Console.WriteLine();

      Console.WriteLine("=============== Prediction Test of loaded model with a multiple samples ===============");
      var teamsAndPredictions = teams.Zip(predictedResults, (team, prediction) => (team, prediction));
      foreach (var item in teamsAndPredictions)
      Prediction: (Convert.ToBoolean(item.prediction.Prediction) ? "Yes" : "No")
      Console.WriteLine("=============== End of predictions ===============");





      NHLData.cs



      using System;
      using System.Collections.Generic;
      using System.Text;
      using Microsoft.ML.Runtime.Api;

      namespace MachineLearning2

      public class NHLData

      [Column(ordinal: "0")]
      public float Age;
      [Column(ordinal: "1")]
      public float Wins;
      [Column(ordinal: "2")]
      public float Losses;
      [Column(ordinal: "3", name: "Label")]
      public float Playoffs;


      public class NHLPrediction

      [ColumnName("PredictedLabel")]
      public bool Prediction get; set;

      [ColumnName("Probability")]
      public float Probability get; set;

      [ColumnName("Score")]
      public float Score get; set;




      trainingNHL.txt (columns: Age, Wins, Losses, Playoffs)



      28.4,53,18,1
      27.5,54,23,1
      28,51,24,1
      28.3,49,26,1
      29.5,45,26,1
      28.8,45,27,1
      29.1,45,29,1
      27.7,44,29,1
      26.4,43,30,1
      28.5,42,32,0
      27,36,35,0
      26.8,36,40,0
      28,33,39,0
      30.2,30,39,0
      26.5,29,41,0
      27.1,25,45,0


      testingNHL.txt (columns: Age, Wins, Losses, Playoffs)



      26.8,52,20,1
      28.6,50,20,1
      28.4,49,26,1
      28.7,44,25,1
      27.7,47,29,1
      27.4,42,26,1
      26.4,45,30,1
      27.8,44,30,0
      28.5,44,32,0
      28.4,37,35,0
      28.4,35,37,0
      28.7,34,39,0
      28.2,31,40,0
      27.8,29,40,0
      29.3,28,43,0









      share|improve this question













      There doesn't seem to be much documentation on ML.Net as it appears to be relatively new. I've been running into problem after problem trying to learn how to use it, and I finally figured out it enough to get it to at least run without experiencing an error; however, there seems to be a problem with my model. It always returns 0 with a probability of 50%. I've included my code below. Does anyone know any good resources for the most recent version of ML.Net that I can explore? The code below is supposed to be making a binary classification model that can predict whether a team is going or not going to the playoff. The data is just the final results of last season with most of the data removed so the only columns that remain are the average age, wins, losses, and playoff status (1 = playoffs & 0 = no playoff).



      Program.cs



      using System;
      using System.Collections.Generic;
      using System.IO;
      using System.Linq;
      using Microsoft.ML;
      using Microsoft.ML.Core.Data;
      using Microsoft.ML.Runtime.Api;
      using Microsoft.ML.Runtime.Data;

      namespace MachineLearning2

      class Program

      static readonly string _trainDataPath = Path.Combine(Environment.CurrentDirectory, "trainingNHL.txt");
      static readonly string _testDataPath = Path.Combine(Environment.CurrentDirectory, "testingNHL.txt");
      static readonly string _modelPath = Path.Combine(Environment.CurrentDirectory, "Model.zip");
      static TextLoader _textLoader;

      static void Main(string args)

      MLContext mlContext = new MLContext(seed: 0);
      _textLoader = mlContext.Data.TextReader(new TextLoader.Arguments()

      Separator = ",",
      HasHeader = false,
      Column = new

      new TextLoader.Column("Age", DataKind.R4, 0),
      new TextLoader.Column("Wins", DataKind.R4, 1),
      new TextLoader.Column("Losses", DataKind.R4, 2),
      new TextLoader.Column("Label", DataKind.R4, 3)

      );
      var model = Train(mlContext, _trainDataPath);
      Evaluate(mlContext, model);
      Predict(mlContext, model);
      PredictWithModelLoadedFromFile(mlContext);



      public static ITransformer Train(MLContext mlContext, string dataPath)

      IDataView dataView = _textLoader.Read(dataPath);
      var pipeline = mlContext.Transforms.Concatenate("Features","Age", "Wins", "Losses")
      .Append(mlContext.BinaryClassification.Trainers.FastTree(numLeaves: 50, numTrees: 50, minDatapointsInLeafs: 20));
      Console.WriteLine("=============== Create and Train the Model ===============");
      var model = pipeline.Fit(dataView);
      Console.WriteLine("=============== End of training ===============");
      Console.WriteLine();
      return model;


      public static void Evaluate(MLContext mlContext, ITransformer model)

      IDataView dataView = _textLoader.Read(_testDataPath);
      Console.WriteLine("=============== Evaluating Model accuracy with Test data===============");
      var predictions = model.Transform(dataView);
      var metrics = mlContext.BinaryClassification.Evaluate(predictions, "Label");
      Console.WriteLine();
      Console.WriteLine("Model quality metrics evaluation");
      Console.WriteLine("--------------------------------");
      Console.WriteLine($"Accuracy: metrics.Accuracy:P2");
      Console.WriteLine($"Auc: metrics.Auc:P2");
      Console.WriteLine($"F1Score: metrics.F1Score:P2");
      Console.WriteLine("=============== End of model evaluation ===============");
      SaveModelAsFile(mlContext, model);


      private static void SaveModelAsFile(MLContext mlContext, ITransformer model)

      using (var fs = new FileStream(_modelPath, FileMode.Create, FileAccess.Write, FileShare.Write))
      mlContext.Model.Save(model, fs);
      Console.WriteLine("The model is saved to 0", _modelPath);



      public static void Predict(MLContext mlContext, ITransformer model)
      Prediction: (Convert.ToBoolean(resultprediction.Prediction) ? "Yes" : "No")

      public static void PredictWithModelLoadedFromFile(MLContext mlContext)

      IEnumerable<NHLData> teams = new

      new NHLData

      Age = 29,
      Wins = 30,
      Losses = 52
      ,
      new NHLData

      Age = 35,
      Wins = 80,
      Losses = 2

      ;
      ITransformer loadedModel;
      using (var stream = new FileStream(_modelPath, FileMode.Open, FileAccess.Read, FileShare.Read))

      loadedModel = mlContext.Model.Load(stream);

      // Create prediction engine
      var nhlStreamingDataView = mlContext.CreateStreamingDataView(teams);
      var predictions = loadedModel.Transform(nhlStreamingDataView);

      // Use the model to predict whether comment data is toxic (1) or nice (0).
      var predictedResults = predictions.AsEnumerable<NHLPrediction>(mlContext, reuseRowObject: false);
      Console.WriteLine();

      Console.WriteLine("=============== Prediction Test of loaded model with a multiple samples ===============");
      var teamsAndPredictions = teams.Zip(predictedResults, (team, prediction) => (team, prediction));
      foreach (var item in teamsAndPredictions)
      Prediction: (Convert.ToBoolean(item.prediction.Prediction) ? "Yes" : "No")
      Console.WriteLine("=============== End of predictions ===============");





      NHLData.cs



      using System;
      using System.Collections.Generic;
      using System.Text;
      using Microsoft.ML.Runtime.Api;

      namespace MachineLearning2

      public class NHLData

      [Column(ordinal: "0")]
      public float Age;
      [Column(ordinal: "1")]
      public float Wins;
      [Column(ordinal: "2")]
      public float Losses;
      [Column(ordinal: "3", name: "Label")]
      public float Playoffs;


      public class NHLPrediction

      [ColumnName("PredictedLabel")]
      public bool Prediction get; set;

      [ColumnName("Probability")]
      public float Probability get; set;

      [ColumnName("Score")]
      public float Score get; set;




      trainingNHL.txt (columns: Age, Wins, Losses, Playoffs)



      28.4,53,18,1
      27.5,54,23,1
      28,51,24,1
      28.3,49,26,1
      29.5,45,26,1
      28.8,45,27,1
      29.1,45,29,1
      27.7,44,29,1
      26.4,43,30,1
      28.5,42,32,0
      27,36,35,0
      26.8,36,40,0
      28,33,39,0
      30.2,30,39,0
      26.5,29,41,0
      27.1,25,45,0


      testingNHL.txt (columns: Age, Wins, Losses, Playoffs)



      26.8,52,20,1
      28.6,50,20,1
      28.4,49,26,1
      28.7,44,25,1
      27.7,47,29,1
      27.4,42,26,1
      26.4,45,30,1
      27.8,44,30,0
      28.5,44,32,0
      28.4,37,35,0
      28.4,35,37,0
      28.7,34,39,0
      28.2,31,40,0
      27.8,29,40,0
      29.3,28,43,0






      c# ml.net






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 10 at 22:48









      TheBinaryCPA

      307




      307






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Is trainingNHL.txt the full dataset you are using or only a sample of it? I just tried training on it with FastTree and I see "Warning: 50 of the boosting iterations failed to grow a tree. This is commonly because the minimum documents in leaf hyperparameter was set too high for this dataset."



          Given the parameters you set in FastTree, you will need more data to train a meaningful model. When I change minDatapointsInLeafs to 2, I am able to train a non-trivial model (although the results are still not extremely trustworthy due to the amount of data). You could also try using something like AveragedPerceptron or SDCA.






          share|improve this answer




















          • Thank you so much. That was the full training data. I could expand the amount of data by grabbing previous seasons. I was trying to keep everything small since I was trying to figure out how to build my own model (not really using this model for anything) based on the tutorials in the docs. Thanks again for the help. I'll continue to look into these parameters on how to properly tune future models.
            – TheBinaryCPA
            Nov 10 at 23:44










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53244185%2fml-net-binary-classification-model-not-working%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Is trainingNHL.txt the full dataset you are using or only a sample of it? I just tried training on it with FastTree and I see "Warning: 50 of the boosting iterations failed to grow a tree. This is commonly because the minimum documents in leaf hyperparameter was set too high for this dataset."



          Given the parameters you set in FastTree, you will need more data to train a meaningful model. When I change minDatapointsInLeafs to 2, I am able to train a non-trivial model (although the results are still not extremely trustworthy due to the amount of data). You could also try using something like AveragedPerceptron or SDCA.






          share|improve this answer




















          • Thank you so much. That was the full training data. I could expand the amount of data by grabbing previous seasons. I was trying to keep everything small since I was trying to figure out how to build my own model (not really using this model for anything) based on the tutorials in the docs. Thanks again for the help. I'll continue to look into these parameters on how to properly tune future models.
            – TheBinaryCPA
            Nov 10 at 23:44















          1














          Is trainingNHL.txt the full dataset you are using or only a sample of it? I just tried training on it with FastTree and I see "Warning: 50 of the boosting iterations failed to grow a tree. This is commonly because the minimum documents in leaf hyperparameter was set too high for this dataset."



          Given the parameters you set in FastTree, you will need more data to train a meaningful model. When I change minDatapointsInLeafs to 2, I am able to train a non-trivial model (although the results are still not extremely trustworthy due to the amount of data). You could also try using something like AveragedPerceptron or SDCA.






          share|improve this answer




















          • Thank you so much. That was the full training data. I could expand the amount of data by grabbing previous seasons. I was trying to keep everything small since I was trying to figure out how to build my own model (not really using this model for anything) based on the tutorials in the docs. Thanks again for the help. I'll continue to look into these parameters on how to properly tune future models.
            – TheBinaryCPA
            Nov 10 at 23:44













          1












          1








          1






          Is trainingNHL.txt the full dataset you are using or only a sample of it? I just tried training on it with FastTree and I see "Warning: 50 of the boosting iterations failed to grow a tree. This is commonly because the minimum documents in leaf hyperparameter was set too high for this dataset."



          Given the parameters you set in FastTree, you will need more data to train a meaningful model. When I change minDatapointsInLeafs to 2, I am able to train a non-trivial model (although the results are still not extremely trustworthy due to the amount of data). You could also try using something like AveragedPerceptron or SDCA.






          share|improve this answer












          Is trainingNHL.txt the full dataset you are using or only a sample of it? I just tried training on it with FastTree and I see "Warning: 50 of the boosting iterations failed to grow a tree. This is commonly because the minimum documents in leaf hyperparameter was set too high for this dataset."



          Given the parameters you set in FastTree, you will need more data to train a meaningful model. When I change minDatapointsInLeafs to 2, I am able to train a non-trivial model (although the results are still not extremely trustworthy due to the amount of data). You could also try using something like AveragedPerceptron or SDCA.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 10 at 23:32









          Gal Oshri

          3082




          3082











          • Thank you so much. That was the full training data. I could expand the amount of data by grabbing previous seasons. I was trying to keep everything small since I was trying to figure out how to build my own model (not really using this model for anything) based on the tutorials in the docs. Thanks again for the help. I'll continue to look into these parameters on how to properly tune future models.
            – TheBinaryCPA
            Nov 10 at 23:44
















          • Thank you so much. That was the full training data. I could expand the amount of data by grabbing previous seasons. I was trying to keep everything small since I was trying to figure out how to build my own model (not really using this model for anything) based on the tutorials in the docs. Thanks again for the help. I'll continue to look into these parameters on how to properly tune future models.
            – TheBinaryCPA
            Nov 10 at 23:44















          Thank you so much. That was the full training data. I could expand the amount of data by grabbing previous seasons. I was trying to keep everything small since I was trying to figure out how to build my own model (not really using this model for anything) based on the tutorials in the docs. Thanks again for the help. I'll continue to look into these parameters on how to properly tune future models.
          – TheBinaryCPA
          Nov 10 at 23:44




          Thank you so much. That was the full training data. I could expand the amount of data by grabbing previous seasons. I was trying to keep everything small since I was trying to figure out how to build my own model (not really using this model for anything) based on the tutorials in the docs. Thanks again for the help. I'll continue to look into these parameters on how to properly tune future models.
          – TheBinaryCPA
          Nov 10 at 23:44

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid …


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid …


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53244185%2fml-net-binary-classification-model-not-working%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Top Tejano songwriter Luis Silva dead of heart attack at 64

          政党

          天津地下鉄3号線