public void Regression_logistic_gd_check_accuracy_model_jason_input() { initData_Jason(); BuildLogisticSGD lm = new BuildLogisticSGD(); Dasmic.MLLib.Algorithms.Regression.ModelBase mb = (Dasmic.MLLib.Algorithms.Regression.ModelBase) lm.BuildModel(_trainingData, _attributeHeaders, _indexTargetAttribute); double [] validateData = new double[2]; double crisp; for (int idx = 0; idx < _trainingData[0].Length; idx++) { validateData[0] = _trainingData[0][idx]; validateData[1] = _trainingData[1][idx]; double value = mb.RunModelForSingleData( validateData); if (value < .5) { crisp = 0; } else { crisp = 1; } Assert.AreEqual(crisp, _trainingData[_indexTargetAttribute][idx]); } }
public void Regression_logistic_gd_check_model_jason_input() { initData_Jason(); BuildLogisticSGD lm = new BuildLogisticSGD(); Dasmic.MLLib.Algorithms.Regression.ModelBase mb = (Dasmic.MLLib.Algorithms.Regression.ModelBase) lm.BuildModel(_trainingData, _attributeHeaders, _indexTargetAttribute); double[] validateData = { 1.465489372, 2.362125076 }; double value = mb.RunModelForSingleData( validateData); Assert.IsTrue(value > .13 && value < .15); validateData[0] = 7.673756466; validateData[1] = 3.508563011; value = mb.RunModelForSingleData( validateData); Assert.IsTrue(value > .8 && value < .99); }
public void Regression_linear_check_model_jason_input() { Init_dataset_jason_linear_regression(); BuildLinearSimple lm = new BuildLinearSimple(); Dasmic.MLLib.Algorithms.Regression.ModelBase mb = (Dasmic.MLLib.Algorithms.Regression.ModelBase)lm.BuildModel(_trainingData, _attributeHeaders, _indexTargetAttribute); double[] validateData = { 1 }; double value = mb.RunModelForSingleData( validateData); Assert.IsTrue(value > 1.1 && value < 1.3); }
public void Regression_linear_check_model_jason_input_row_2() { Init_dataset_jason_linear_regression(); BuildLinearSimple lm = new BuildLinearSimple(); Dasmic.MLLib.Algorithms.Regression.ModelBase mb = (Dasmic.MLLib.Algorithms.Regression.ModelBase)lm.BuildModel(_trainingData, _attributeHeaders, _indexTargetAttribute); double[] data = GetSingleTrainingRowDataForTest(2); double value = mb.RunModelForSingleData( data); Assert.IsTrue(SupportFunctions.DoubleCompare(value, 3.59)); }
public void Regression_linear_gd_check_model_power_input() { initData_Power(); BuildLinearSGD lm = new BuildLinearSGD(); Dasmic.MLLib.Algorithms.Regression.ModelBase mb = (Dasmic.MLLib.Algorithms.Regression.ModelBase) lm.BuildModel(_trainingData, _attributeHeaders, _indexTargetAttribute); double[] validateData = { 4 }; double value = mb.RunModelForSingleData( validateData); Assert.IsTrue(value > 17.10 && value < 17.13); }