public void LogisticsRegression_Test_iterations_10_learningrate_013() { var desc = loadMetaData(); LearningApi api = new LearningApi(desc); //Real dataset must be defined as object type, because data can be numeric, binary and classification api.UseActionModule <object[][], object[][]>((input, ctx) => { return(loadRealDataSample()); }); // Use mapper for data, which will extract (map) required columns api.UseDefaultDataMapper(); api.UseMinMaxNormalizer(); //run logistic regression for 10 iterations with learningRate=0.13 api.UseLogisticRegression(0.13, 10); api.Run(); LogisticRegressionScore score = api.GetScore() as LogisticRegressionScore; //Errors during each iteration. IF the learningRate is suitable errors is describing for every next iteration Assert.Equal(Math.Round(score.Errors[0], 5), 0.24278); Assert.Equal(Math.Round(score.Errors[1], 5), 0.23749); Assert.Equal(Math.Round(score.Errors[2], 5), 0.23359); Assert.Equal(Math.Round(score.Errors[3], 5), 0.23010); Assert.Equal(Math.Round(score.Errors[4], 5), 0.22740); Assert.Equal(Math.Round(score.Errors[5], 5), 0.22476); Assert.Equal(Math.Round(score.Errors[6], 5), 0.22271); Assert.Equal(Math.Round(score.Errors[7], 5), 0.22065); Assert.Equal(Math.Round(score.Errors[8], 5), 0.21902); Assert.Equal(Math.Round(score.Errors[9], 5), 0.21739); //LG Model Best Found model in 10 iteration Assert.Equal(Math.Round(score.Weights[0], 5), 0.06494); Assert.Equal(Math.Round(score.Weights[1], 5), 0.21584); Assert.Equal(Math.Round(score.Weights[2], 5), 0.89901); Assert.Equal(Math.Round(score.Weights[3], 5), 0.51497); Assert.Equal(Math.Round(score.Weights[4], 5), -0.30213); Assert.Equal(Math.Round(score.Weights[5], 5), -0.30213); Assert.Equal(Math.Round(score.Weights[6], 5), -0.85624); //define data for testing (prediction) LearningApi apiPrediction = new LearningApi(desc); //Real dataset must be defined as object type, because data can be numeric, binary and classification apiPrediction.UseActionModule <object[][], object[][]>((input, ctx) => { var data = new object[4][] { new object[] { 0.202, "blue", "male", 13, "yes" }, new object[] { 0.447, "green", "female", 37, "no" }, new object[] { 0.120, "red", "male", "21", "yes" }, new object[] { 0.313, "green", "male", 22, "yes" }, }; return(data); }); // Use mapper for data, which will extract (map) required columns apiPrediction.UseDefaultDataMapper(); var testData = apiPrediction.Run(); //use previous trained model var result = api.Algorithm.Predict(testData as double[][], api.Context) as LogisticRegressionResult; Assert.Equal(Math.Round(result.PredictedValues[0], 5), 1E-05); Assert.Equal(Math.Round(result.PredictedValues[1], 5), 0); Assert.Equal(Math.Round(result.PredictedValues[2], 5), 0); Assert.Equal(Math.Round(result.PredictedValues[3], 5), 0); }