public void Test_Evaluate_Prediction_Model_Score_Amazon() { _output.WriteLine("Test_Evaluate_Prediction_Model_Score_Amazon()..."); var predictor = new Predictor(); predictor.LoadTrainData(Path.Combine(_dataFolderPath, "amazon_cells_labelled.txt")); predictor.BuildAndTrainModel(); var metrics = predictor.EvaluateModelMetrics(); _output.WriteLine($"Model Metrics - Accuracy:{metrics.Accuracy:P2}, AreaUnderRocCurve:{metrics.AreaUnderRocCurve:P2}, F1Score:{metrics.F1Score:P2}"); Assert.InRange(metrics.Accuracy, 0.5, 0.95); _output.WriteLine("...Test_Evaluate_Prediction_Model_Score_Amazon() DONE."); }
public void Test_Predict_Output_Positive_IMDB() { _output.WriteLine("Test_Predict_Output_Positive_IMDB()..."); const string INPUT_DATA = "amazing movie, very touching and deep"; var predictor = new Predictor(); predictor.LoadTrainData(Path.Combine(_dataFolderPath, "imdb_labelled.txt")); predictor.BuildAndTrainModel(); var predictionTuple = predictor.Predict(INPUT_DATA); _output.WriteLine($"Prediction for \"{INPUT_DATA}\" : {predictionTuple.prediction} (Probability: {predictionTuple.probability}, Score: {predictionTuple.score})"); Assert.True(predictionTuple.prediction); _output.WriteLine("...Test_Predict_Output_Positive_IMDB() DONE."); }
public void Test_Predict_Output_Negative_Yelp() { _output.WriteLine("Test_Predict_Output_Negative_Yelp()..."); const string INPUT_DATA = "This was quite a horrible meal"; var predictor = new Predictor(); predictor.LoadTrainData(Path.Combine(_dataFolderPath, "yelp_labelled.txt")); predictor.BuildAndTrainModel(); var predictionTuple = predictor.Predict(INPUT_DATA); _output.WriteLine($"Prediction for \"{INPUT_DATA}\" : {predictionTuple.prediction} (Probability: {predictionTuple.probability}, Score: {predictionTuple.score})"); Assert.False(predictionTuple.prediction); _output.WriteLine("...Test_Predict_Output_Negative_Yelp() DONE."); }
public void Test_Predict_Output_Negative_Amazon() { _output.WriteLine("Test_Predict_Output_Negative_Amazon()..."); const string INPUT_DATA = "this smartphone does not work at all, and is heavy too"; var predictor = new Predictor(); predictor.LoadTrainData(Path.Combine(_dataFolderPath, "amazon_cells_labelled.txt")); predictor.BuildAndTrainModel(); var predictionTuple = predictor.Predict(INPUT_DATA); _output.WriteLine($"Prediction for \"{INPUT_DATA}\" : {predictionTuple.prediction} (Probability: {predictionTuple.probability}, Score: {predictionTuple.score})"); Assert.False(predictionTuple.prediction); _output.WriteLine("...Test_Predict_Output_Negative_Amazon() DONE."); }