Skip to content

Changed all MLContext creation to include a fixed seed #4736

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 31, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Reverted fixed seed related changes from the code generator tests
  • Loading branch information
harishsk committed Jan 29, 2020
commit 44925863ed727b66f344ac7c4cd90bd07528d0ee
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace TestNamespace.ConsoleApp
private static ModelInput CreateSingleDataSample(string dataFilePath)
{
// Create MLContext
MLContext mlContext = new MLContext(1);
MLContext mlContext = new MLContext();

// Load dataset
IDataView dataView = mlContext.Data.LoadFromTextFile<ModelInput>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace TestNamespace.Model
{

// Create new MLContext
MLContext mlContext = new MLContext(1);
MLContext mlContext = new MLContext();

// Load model & create prediction engine
string modelPath = AppDomain.CurrentDomain.BaseDirectory + "MLModel.zip";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace TestNamespace.ConsoleApp
private static ModelInput CreateSingleDataSample(string dataFilePath)
{
// Create MLContext
MLContext mlContext = new MLContext(1);
MLContext mlContext = new MLContext();

// Load dataset
IDataView dataView = mlContext.Data.LoadFromTextFile<ModelInput>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace TestNamespace.ConsoleApp
private static ModelInput CreateSingleDataSample(string dataFilePath)
{
// Create MLContext
MLContext mlContext = new MLContext(1);
MLContext mlContext = new MLContext();

// Load dataset
IDataView dataView = mlContext.Data.LoadFromTextFile<ModelInput>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace TestNamespace.Model
{

// Create new MLContext
MLContext mlContext = new MLContext(1);
MLContext mlContext = new MLContext();

// Load model & create prediction engine
string modelPath = AppDomain.CurrentDomain.BaseDirectory + "MLModel.zip";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ private CodeGenerator PrepareForRecommendationTask()
{
if (mockedPipeline == null)
{
MLContext context = new MLContext(1);
MLContext context = new MLContext();

var trainer1 = new SuggestedTrainer(context, new MatrixFactorizationExtension(), new ColumnInformation() {
LabelColumnName = "Label",
Expand Down Expand Up @@ -335,7 +335,7 @@ private CodeGenerator PrepareForRecommendationTask()
{
if (mockedPipeline == null)
{
MLContext context = new MLContext(1);
MLContext context = new MLContext();
// same learners with different hyperparams
var hyperparams1 = new Microsoft.ML.AutoML.ParameterSet(new List<Microsoft.ML.AutoML.IParameterValue>() { new LongParameterValue("NumLeaves", 2) });
var trainer1 = new SuggestedTrainer(context, new LightGbmBinaryExtension(), new ColumnInformation(), hyperparams1);
Expand Down Expand Up @@ -372,7 +372,7 @@ private CodeGenerator PrepareForRecommendationTask()
{
if (mockedPipeline == null)
{
MLContext context = new MLContext(1);
MLContext context = new MLContext();
// same learners with different hyperparams
var hyperparams1 = new Microsoft.ML.AutoML.ParameterSet(new List<Microsoft.ML.AutoML.IParameterValue>() { new LongParameterValue("NumLeaves", 2) });
var trainer1 = new SuggestedTrainer(context, new LightGbmRegressionExtension(), new ColumnInformation(), hyperparams1);
Expand Down Expand Up @@ -409,7 +409,7 @@ private CodeGenerator PrepareForRecommendationTask()
{
if (mockedOvaPipeline == null)
{
MLContext context = new MLContext(1);
MLContext context = new MLContext();
// same learners with different hyperparams
var hyperparams1 = new Microsoft.ML.AutoML.ParameterSet(new List<Microsoft.ML.AutoML.IParameterValue>() { new LongParameterValue("NumLeaves", 2) });
var trainer1 = new SuggestedTrainer(context, new FastForestOvaExtension(), new ColumnInformation(), hyperparams1);
Expand Down
10 changes: 5 additions & 5 deletions test/Microsoft.ML.CodeGenerator.Tests/CodeGenTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class CodeGeneratorTests
[Fact]
public void TrainerGeneratorBasicNamedParameterTest()
{
var context = new MLContext(1);
var context = new MLContext();

var elementProperties = new Dictionary<string, object>()
{
Expand All @@ -37,7 +37,7 @@ public void TrainerGeneratorBasicNamedParameterTest()
[Fact]
public void TrainerGeneratorBasicAdvancedParameterTest()
{
var context = new MLContext(1);
var context = new MLContext();

var elementProperties = new Dictionary<string, object>()
{
Expand All @@ -58,7 +58,7 @@ public void TrainerGeneratorBasicAdvancedParameterTest()
[Fact]
public void TransformGeneratorBasicTest()
{
var context = new MLContext(1);
var context = new MLContext();
var elementProperties = new Dictionary<string, object>();
PipelineNode node = new PipelineNode("Normalizing", PipelineNodeType.Transform, new string[] { "Label" }, new string[] { "Label" }, elementProperties);
Pipeline pipeline = new Pipeline(new PipelineNode[] { node });
Expand All @@ -72,7 +72,7 @@ public void TransformGeneratorBasicTest()
[Fact]
public void TransformGeneratorUsingTest()
{
var context = new MLContext(1);
var context = new MLContext();
var elementProperties = new Dictionary<string, object>();
PipelineNode node = new PipelineNode("OneHotEncoding", PipelineNodeType.Transform, new string[] { "Label" }, new string[] { "Label" }, elementProperties);
Pipeline pipeline = new Pipeline(new PipelineNode[] { node });
Expand Down Expand Up @@ -117,7 +117,7 @@ public void ClassLabelGenerationBasicTest()
[Fact]
public void TrainerComplexParameterTest()
{
var context = new MLContext(1);
var context = new MLContext();

var elementProperties = new Dictionary<string, object>()
{
Expand Down
Loading