forked from dotnet/machinelearning
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add trainer extension tests, & misc fixes (dotnet#23)
- Loading branch information
Showing
6 changed files
with
84 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System; | ||
using System.Linq; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace Microsoft.ML.Auto.Test | ||
{ | ||
[TestClass] | ||
public class TrainerExtensionsTests | ||
{ | ||
[TestMethod] | ||
public void TrainerExtensionInstanceTests() | ||
{ | ||
var context = new MLContext(); | ||
var trainerNames = Enum.GetValues(typeof(TrainerName)).Cast<TrainerName>(); | ||
foreach(var trainerName in trainerNames) | ||
{ | ||
var extension = TrainerExtensionCatalog.GetTrainerExtension(trainerName); | ||
var instance = extension.CreateInstance(context, null); | ||
Assert.IsNotNull(instance); | ||
var sweepParams = extension.GetHyperparamSweepRanges(); | ||
Assert.IsNotNull(sweepParams); | ||
} | ||
} | ||
|
||
[TestMethod] | ||
public void GetTrainersByMaxIterations() | ||
{ | ||
var tasks = new TaskKind[] { TaskKind.BinaryClassification, | ||
TaskKind.MulticlassClassification, TaskKind.Regression }; | ||
|
||
foreach(var task in tasks) | ||
{ | ||
var trainerSet10 = TrainerExtensionCatalog.GetTrainers(task, 10); | ||
var trainerSet50 = TrainerExtensionCatalog.GetTrainers(task, 50); | ||
var trainerSet100 = TrainerExtensionCatalog.GetTrainers(task, 100); | ||
|
||
Assert.IsNotNull(trainerSet10); | ||
Assert.IsNotNull(trainerSet50); | ||
Assert.IsNotNull(trainerSet100); | ||
|
||
Assert.IsTrue(trainerSet10.Count() < trainerSet50.Count()); | ||
Assert.IsTrue(trainerSet50.Count() < trainerSet100.Count()); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters