From 500d7034025c08d41feb6a52bae6410a695b7b18 Mon Sep 17 00:00:00 2001 From: Zeeshan Ahmed <38438266+zeahmed@users.noreply.github.com> Date: Mon, 7 May 2018 23:12:04 -0700 Subject: [PATCH] Refactored scenario tests (issue #32) (#52) * Refectored scenario tests according to #Bug 240688: Scenarios has a class Top5Scenarios with 2 scenarios defined * Moved 'TrainAndPredictHousePriceModelTest' to separate file. This closes issue #32 --- ...usePricePrediction.cs => HousePricePredictionTests.cs} | 7 +++++-- ...ctionModel.cs => HousePriceTrainAndPredictionTests.cs} | 8 +++++--- ...ctIrisModelTest.cs => IrisPlantClassificationTests.cs} | 2 +- ...SentimentPrediction.cs => SentimentPredictionTests.cs} | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) rename test/Microsoft.ML.Tests/Scenarios/{Scenario_HousePricePrediction.cs => HousePricePredictionTests.cs} (94%) rename test/Microsoft.ML.Tests/Scenarios/{Scenario_TrainPredictionModel.cs => HousePriceTrainAndPredictionTests.cs} (93%) rename test/Microsoft.ML.Tests/Scenarios/{TrainAndPredictIrisModelTest.cs => IrisPlantClassificationTests.cs} (99%) rename test/Microsoft.ML.Tests/Scenarios/{Scenario3_SentimentPrediction.cs => SentimentPredictionTests.cs} (99%) diff --git a/test/Microsoft.ML.Tests/Scenarios/Scenario_HousePricePrediction.cs b/test/Microsoft.ML.Tests/Scenarios/HousePricePredictionTests.cs similarity index 94% rename from test/Microsoft.ML.Tests/Scenarios/Scenario_HousePricePrediction.cs rename to test/Microsoft.ML.Tests/Scenarios/HousePricePredictionTests.cs index 2b5fffa446..392462a0eb 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Scenario_HousePricePrediction.cs +++ b/test/Microsoft.ML.Tests/Scenarios/HousePricePredictionTests.cs @@ -2,14 +2,17 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using Microsoft.ML.Models; using Microsoft.ML.Runtime.Api; using Microsoft.ML.TestFramework; +using Microsoft.ML.Trainers; +using Microsoft.ML.Transforms; using Xunit; using Xunit.Abstractions; namespace Microsoft.ML.Scenarios { - public partial class Top5Scenarios : BaseTestClass + public partial class ScenariosTests : BaseTestClass { /* A real-estate firm Contoso wants to add a house price prediction to their ASP.NET/Xamarin application. @@ -121,7 +124,7 @@ public class HousePricePrediction public float Price; } - public Top5Scenarios(ITestOutputHelper output) : base(output) + public ScenariosTests(ITestOutputHelper output) : base(output) { } } diff --git a/test/Microsoft.ML.Tests/Scenarios/Scenario_TrainPredictionModel.cs b/test/Microsoft.ML.Tests/Scenarios/HousePriceTrainAndPredictionTests.cs similarity index 93% rename from test/Microsoft.ML.Tests/Scenarios/Scenario_TrainPredictionModel.cs rename to test/Microsoft.ML.Tests/Scenarios/HousePriceTrainAndPredictionTests.cs index de7d2f6a00..38ec6ce073 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Scenario_TrainPredictionModel.cs +++ b/test/Microsoft.ML.Tests/Scenarios/HousePriceTrainAndPredictionTests.cs @@ -1,15 +1,18 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using Microsoft.ML.Models; +using Microsoft.ML.Runtime.Api; +using Microsoft.ML.TestFramework; using Microsoft.ML.Trainers; using Microsoft.ML.Transforms; using Xunit; +using Xunit.Abstractions; namespace Microsoft.ML.Scenarios { - public partial class Top5Scenarios + public partial class ScenariosTests { [Fact(Skip = "Missing data set. See https://github.com/dotnet/machinelearning/issues/3")] public void TrainAndPredictHousePriceModelTest() @@ -70,4 +73,3 @@ public void TrainAndPredictHousePriceModelTest() } } } - diff --git a/test/Microsoft.ML.Tests/Scenarios/TrainAndPredictIrisModelTest.cs b/test/Microsoft.ML.Tests/Scenarios/IrisPlantClassificationTests.cs similarity index 99% rename from test/Microsoft.ML.Tests/Scenarios/TrainAndPredictIrisModelTest.cs rename to test/Microsoft.ML.Tests/Scenarios/IrisPlantClassificationTests.cs index d897303e30..30c497ccc5 100644 --- a/test/Microsoft.ML.Tests/Scenarios/TrainAndPredictIrisModelTest.cs +++ b/test/Microsoft.ML.Tests/Scenarios/IrisPlantClassificationTests.cs @@ -10,7 +10,7 @@ namespace Microsoft.ML.Scenarios { - public partial class Top5Scenarios + public partial class ScenariosTests { [Fact] public void TrainAndPredictIrisModelTest() diff --git a/test/Microsoft.ML.Tests/Scenarios/Scenario3_SentimentPrediction.cs b/test/Microsoft.ML.Tests/Scenarios/SentimentPredictionTests.cs similarity index 99% rename from test/Microsoft.ML.Tests/Scenarios/Scenario3_SentimentPrediction.cs rename to test/Microsoft.ML.Tests/Scenarios/SentimentPredictionTests.cs index a0591d34b9..131b8c02db 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Scenario3_SentimentPrediction.cs +++ b/test/Microsoft.ML.Tests/Scenarios/SentimentPredictionTests.cs @@ -13,7 +13,7 @@ namespace Microsoft.ML.Scenarios { - public partial class Top5Scenarios + public partial class ScenariosTests { public const string SentimentDataPath = "wikipedia-detox-250-line-data.tsv"; public const string SentimentTestPath = "wikipedia-detox-250-line-test.tsv";