diff --git a/build.proj b/build.proj index d64a6a3bf1..b99fd2e261 100644 --- a/build.proj +++ b/build.proj @@ -68,7 +68,7 @@ - + diff --git a/build/BranchInfo.props b/build/BranchInfo.props index f97015b836..0f0880500f 100644 --- a/build/BranchInfo.props +++ b/build/BranchInfo.props @@ -22,13 +22,13 @@ 1 - 1 + 3 0 preview 0 - 4 + 15 0 preview diff --git a/src/Microsoft.ML.AutoML/Microsoft.ML.AutoML.csproj b/src/Microsoft.ML.AutoML/Microsoft.ML.AutoML.csproj index 85a641601c..a224813e70 100644 --- a/src/Microsoft.ML.AutoML/Microsoft.ML.AutoML.csproj +++ b/src/Microsoft.ML.AutoML/Microsoft.ML.AutoML.csproj @@ -7,7 +7,7 @@ - 1.0.0 + 1.2.0 diff --git a/src/Microsoft.ML.AutoML/Utils/MLNetUtils/Conversions.cs b/src/Microsoft.ML.AutoML/Utils/MLNetUtils/Conversions.cs index b8cf657ad9..2c533535ce 100644 --- a/src/Microsoft.ML.AutoML/Utils/MLNetUtils/Conversions.cs +++ b/src/Microsoft.ML.AutoML/Utils/MLNetUtils/Conversions.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; +using System.Globalization; namespace Microsoft.ML.AutoML { @@ -25,7 +26,7 @@ public static bool TryParse(in TX src, out R4 dst) dst = R4.NaN; return true; } - if (float.TryParse(str, out dst)) + if (float.TryParse(str, NumberStyles.Float, CultureInfo.InvariantCulture, out dst)) { return true; } diff --git a/src/Microsoft.ML.AutoML/Utils/SweepableParamAttributes.cs b/src/Microsoft.ML.AutoML/Utils/SweepableParamAttributes.cs index b575e8bc80..ae7945d21e 100644 --- a/src/Microsoft.ML.AutoML/Utils/SweepableParamAttributes.cs +++ b/src/Microsoft.ML.AutoML/Utils/SweepableParamAttributes.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; +using System.Globalization; using System.Linq; using System.Text; @@ -144,7 +145,7 @@ public SweepableFloatParam(float min, float max, float stepSize = -1, int numSte public override void SetUsingValueText(string valueText) { - RawValue = float.Parse(valueText); + RawValue = float.Parse(valueText, CultureInfo.InvariantCulture); } public override SweepableParam Clone() => diff --git a/src/mlnet/Templates/Console/ModelBuilder.cs b/src/mlnet/Templates/Console/ModelBuilder.cs index 6a7fee6d07..feb2a993f4 100644 --- a/src/mlnet/Templates/Console/ModelBuilder.cs +++ b/src/mlnet/Templates/Console/ModelBuilder.cs @@ -27,7 +27,7 @@ public partial class ModelBuilder : ModelBuilderBase /// public virtual string TransformText() { - Write(@"//***************************************************************************************** + this.Write(@"//***************************************************************************************** //* * //* This is an auto-generated file by Microsoft ML.NET CLI (Command-Line Interface) tool. * //* * @@ -40,23 +40,23 @@ public virtual string TransformText() using Microsoft.ML; using Microsoft.ML.Data; using "); - Write(ToStringHelper.ToStringWithCulture(Namespace)); - Write(".Model.DataModels;\r\n"); - Write(ToStringHelper.ToStringWithCulture(GeneratedUsings)); - Write("\r\nnamespace "); - Write(ToStringHelper.ToStringWithCulture(Namespace)); - Write(".ConsoleApp\r\n{\r\n public static class ModelBuilder\r\n {\r\n private stat" + + this.Write(this.ToStringHelper.ToStringWithCulture(Namespace)); + this.Write(".Model.DataModels;\r\n"); + this.Write(this.ToStringHelper.ToStringWithCulture(GeneratedUsings)); + this.Write("\r\nnamespace "); + this.Write(this.ToStringHelper.ToStringWithCulture(Namespace)); + this.Write(".ConsoleApp\r\n{\r\n public static class ModelBuilder\r\n {\r\n private stat" + "ic string TRAIN_DATA_FILEPATH = @\""); - Write(ToStringHelper.ToStringWithCulture(Path)); - Write("\";\r\n"); + this.Write(this.ToStringHelper.ToStringWithCulture(Path)); + this.Write("\";\r\n"); if(!string.IsNullOrEmpty(TestPath)){ - Write(" private static string TEST_DATA_FILEPATH = @\""); - Write(ToStringHelper.ToStringWithCulture(TestPath)); - Write("\";\r\n"); + this.Write(" private static string TEST_DATA_FILEPATH = @\""); + this.Write(this.ToStringHelper.ToStringWithCulture(TestPath)); + this.Write("\";\r\n"); } - Write(" private static string MODEL_FILEPATH = @\"../../../../"); - Write(ToStringHelper.ToStringWithCulture(Namespace)); - Write(@".Model/MLModel.zip""; + this.Write(" private static string MODEL_FILEPATH = @\"../../../../"); + this.Write(this.ToStringHelper.ToStringWithCulture(Namespace)); + this.Write(@".Model/MLModel.zip""; // Create MLContext to be shared across the model creation workflow objects // Set a random seed for repeatable/deterministic results across multiple trainings. @@ -68,44 +68,44 @@ public static void CreateModel() IDataView trainingDataView = mlContext.Data.LoadFromTextFile( path: TRAIN_DATA_FILEPATH, hasHeader : "); - Write(ToStringHelper.ToStringWithCulture(HasHeader.ToString().ToLowerInvariant())); - Write(",\r\n separatorChar : \'"); - Write(ToStringHelper.ToStringWithCulture(Regex.Escape(Separator.ToString()))); - Write("\',\r\n allowQuoting : "); - Write(ToStringHelper.ToStringWithCulture(AllowQuoting.ToString().ToLowerInvariant())); - Write(",\r\n allowSparse: "); - Write(ToStringHelper.ToStringWithCulture(AllowSparse.ToString().ToLowerInvariant())); - Write(");\r\n\r\n"); + this.Write(this.ToStringHelper.ToStringWithCulture(HasHeader.ToString().ToLowerInvariant())); + this.Write(",\r\n separatorChar : \'"); + this.Write(this.ToStringHelper.ToStringWithCulture(Regex.Escape(Separator.ToString()))); + this.Write("\',\r\n allowQuoting : "); + this.Write(this.ToStringHelper.ToStringWithCulture(AllowQuoting.ToString().ToLowerInvariant())); + this.Write(",\r\n allowSparse: "); + this.Write(this.ToStringHelper.ToStringWithCulture(AllowSparse.ToString().ToLowerInvariant())); + this.Write(");\r\n\r\n"); if(!string.IsNullOrEmpty(TestPath)){ - Write(" IDataView testDataView = mlContext.Data.LoadFromTextFile(" + + this.Write(" IDataView testDataView = mlContext.Data.LoadFromTextFile(" + "\r\n path: TEST_DATA_FILEPATH,\r\n " + " hasHeader : "); - Write(ToStringHelper.ToStringWithCulture(HasHeader.ToString().ToLowerInvariant())); - Write(",\r\n separatorChar : \'"); - Write(ToStringHelper.ToStringWithCulture(Regex.Escape(Separator.ToString()))); - Write("\',\r\n allowQuoting : "); - Write(ToStringHelper.ToStringWithCulture(AllowQuoting.ToString().ToLowerInvariant())); - Write(",\r\n allowSparse: "); - Write(ToStringHelper.ToStringWithCulture(AllowSparse.ToString().ToLowerInvariant())); - Write(");\r\n"); + this.Write(this.ToStringHelper.ToStringWithCulture(HasHeader.ToString().ToLowerInvariant())); + this.Write(",\r\n separatorChar : \'"); + this.Write(this.ToStringHelper.ToStringWithCulture(Regex.Escape(Separator.ToString()))); + this.Write("\',\r\n allowQuoting : "); + this.Write(this.ToStringHelper.ToStringWithCulture(AllowQuoting.ToString().ToLowerInvariant())); + this.Write(",\r\n allowSparse: "); + this.Write(this.ToStringHelper.ToStringWithCulture(AllowSparse.ToString().ToLowerInvariant())); + this.Write(");\r\n"); } - Write(" // Build training pipeline\r\n IEstimator trai" + + this.Write(" // Build training pipeline\r\n IEstimator trai" + "ningPipeline = BuildTrainingPipeline(mlContext);\r\n\r\n"); if(string.IsNullOrEmpty(TestPath)){ - Write(" // Evaluate quality of Model\r\n Evaluate(mlContext, trainin" + + this.Write(" // Evaluate quality of Model\r\n Evaluate(mlContext, trainin" + "gDataView, trainingPipeline);\r\n\r\n"); } - Write(" // Train Model\r\n ITransformer mlModel = TrainModel(mlConte" + + this.Write(" // Train Model\r\n ITransformer mlModel = TrainModel(mlConte" + "xt, trainingDataView, trainingPipeline);\r\n"); if(!string.IsNullOrEmpty(TestPath)){ - Write("\r\n // Evaluate quality of Model\r\n EvaluateModel(mlContext, " + + this.Write("\r\n // Evaluate quality of Model\r\n EvaluateModel(mlContext, " + "mlModel, testDataView);\r\n"); } - Write("\r\n // Save model\r\n SaveModel(mlContext, mlModel, MODEL_FILE" + + this.Write("\r\n // Save model\r\n SaveModel(mlContext, mlModel, MODEL_FILE" + "PATH, trainingDataView.Schema);\r\n }\r\n\r\n public static IEstimator BuildTrainingPipeline(MLContext mlContext)\r\n {\r\n"); if(PreTrainerTransforms.Count >0 ) { - Write(" // Data process configuration with pipeline data transformations \r\n " + + this.Write(" // Data process configuration with pipeline data transformations \r\n " + " var dataProcessPipeline = "); for(int i=0;i0 ) { - Write(" var trainingPipeline = dataProcessPipeline.Append(trainer);\r\n"); + this.Write(" var trainingPipeline = dataProcessPipeline.Append(trainer);\r\n"); } else{ - Write(" var trainingPipeline = trainer;\r\n"); + this.Write(" var trainingPipeline = trainer;\r\n"); } - Write(@" + this.Write(@" return trainingPipeline; } @@ -156,71 +156,71 @@ public static ITransformer TrainModel(MLContext mlContext, IDataView trainingDat "); if(!string.IsNullOrEmpty(TestPath)){ - Write(@" private static void EvaluateModel(MLContext mlContext, ITransformer mlModel, IDataView testDataView) + this.Write(@" private static void EvaluateModel(MLContext mlContext, ITransformer mlModel, IDataView testDataView) { // Evaluate the model and show accuracy stats Console.WriteLine(""===== Evaluating Model's accuracy with Test data =====""); IDataView predictions = mlModel.Transform(testDataView); "); if("BinaryClassification".Equals(TaskType)){ - Write(" var metrics = mlContext."); - Write(ToStringHelper.ToStringWithCulture(TaskType)); - Write(".EvaluateNonCalibrated(predictions, \""); - Write(ToStringHelper.ToStringWithCulture(LabelName)); - Write("\", \"Score\");\r\n PrintBinaryClassificationMetrics(metrics);\r\n"); + this.Write(" var metrics = mlContext."); + this.Write(this.ToStringHelper.ToStringWithCulture(TaskType)); + this.Write(".EvaluateNonCalibrated(predictions, \""); + this.Write(this.ToStringHelper.ToStringWithCulture(LabelName)); + this.Write("\", \"Score\");\r\n PrintBinaryClassificationMetrics(metrics);\r\n"); } if("MulticlassClassification".Equals(TaskType)){ - Write(" var metrics = mlContext."); - Write(ToStringHelper.ToStringWithCulture(TaskType)); - Write(".Evaluate(predictions, \""); - Write(ToStringHelper.ToStringWithCulture(LabelName)); - Write("\", \"Score\");\r\n PrintMulticlassClassificationMetrics(metrics);\r\n"); + this.Write(" var metrics = mlContext."); + this.Write(this.ToStringHelper.ToStringWithCulture(TaskType)); + this.Write(".Evaluate(predictions, \""); + this.Write(this.ToStringHelper.ToStringWithCulture(LabelName)); + this.Write("\", \"Score\");\r\n PrintMulticlassClassificationMetrics(metrics);\r\n"); }if("Regression".Equals(TaskType)){ - Write(" var metrics = mlContext."); - Write(ToStringHelper.ToStringWithCulture(TaskType)); - Write(".Evaluate(predictions, \""); - Write(ToStringHelper.ToStringWithCulture(LabelName)); - Write("\", \"Score\");\r\n PrintRegressionMetrics(metrics);\r\n"); + this.Write(" var metrics = mlContext."); + this.Write(this.ToStringHelper.ToStringWithCulture(TaskType)); + this.Write(".Evaluate(predictions, \""); + this.Write(this.ToStringHelper.ToStringWithCulture(LabelName)); + this.Write("\", \"Score\");\r\n PrintRegressionMetrics(metrics);\r\n"); } - Write(" }\r\n"); + this.Write(" }\r\n"); }else{ - Write(@" private static void Evaluate(MLContext mlContext, IDataView trainingDataView, IEstimator trainingPipeline) + this.Write(@" private static void Evaluate(MLContext mlContext, IDataView trainingDataView, IEstimator trainingPipeline) { // Cross-Validate with single dataset (since we don't have two datasets, one for training and for evaluate) // in order to evaluate and get the model's accuracy metrics Console.WriteLine(""=============== Cross-validating to get model's accuracy metrics ===============""); "); if("BinaryClassification".Equals(TaskType)){ - Write(" var crossValidationResults = mlContext."); - Write(ToStringHelper.ToStringWithCulture(TaskType)); - Write(".CrossValidateNonCalibrated(trainingDataView, trainingPipeline, numberOfFolds: "); - Write(ToStringHelper.ToStringWithCulture(Kfolds)); - Write(", labelColumnName:\""); - Write(ToStringHelper.ToStringWithCulture(LabelName)); - Write("\");\r\n PrintBinaryClassificationFoldsAverageMetrics(crossValidationResu" + + this.Write(" var crossValidationResults = mlContext."); + this.Write(this.ToStringHelper.ToStringWithCulture(TaskType)); + this.Write(".CrossValidateNonCalibrated(trainingDataView, trainingPipeline, numberOfFolds: "); + this.Write(this.ToStringHelper.ToStringWithCulture(Kfolds)); + this.Write(", labelColumnName:\""); + this.Write(this.ToStringHelper.ToStringWithCulture(LabelName)); + this.Write("\");\r\n PrintBinaryClassificationFoldsAverageMetrics(crossValidationResu" + "lts);\r\n"); } if("MulticlassClassification".Equals(TaskType)){ - Write(" var crossValidationResults = mlContext."); - Write(ToStringHelper.ToStringWithCulture(TaskType)); - Write(".CrossValidate(trainingDataView, trainingPipeline, numberOfFolds: "); - Write(ToStringHelper.ToStringWithCulture(Kfolds)); - Write(", labelColumnName:\""); - Write(ToStringHelper.ToStringWithCulture(LabelName)); - Write("\");\r\n PrintMulticlassClassificationFoldsAverageMetrics(crossValidation" + + this.Write(" var crossValidationResults = mlContext."); + this.Write(this.ToStringHelper.ToStringWithCulture(TaskType)); + this.Write(".CrossValidate(trainingDataView, trainingPipeline, numberOfFolds: "); + this.Write(this.ToStringHelper.ToStringWithCulture(Kfolds)); + this.Write(", labelColumnName:\""); + this.Write(this.ToStringHelper.ToStringWithCulture(LabelName)); + this.Write("\");\r\n PrintMulticlassClassificationFoldsAverageMetrics(crossValidation" + "Results);\r\n"); } if("Regression".Equals(TaskType)){ - Write(" var crossValidationResults = mlContext."); - Write(ToStringHelper.ToStringWithCulture(TaskType)); - Write(".CrossValidate(trainingDataView, trainingPipeline, numberOfFolds: "); - Write(ToStringHelper.ToStringWithCulture(Kfolds)); - Write(", labelColumnName:\""); - Write(ToStringHelper.ToStringWithCulture(LabelName)); - Write("\");\r\n PrintRegressionFoldsAverageMetrics(crossValidationResults);\r\n"); + this.Write(" var crossValidationResults = mlContext."); + this.Write(this.ToStringHelper.ToStringWithCulture(TaskType)); + this.Write(".CrossValidate(trainingDataView, trainingPipeline, numberOfFolds: "); + this.Write(this.ToStringHelper.ToStringWithCulture(Kfolds)); + this.Write(", labelColumnName:\""); + this.Write(this.ToStringHelper.ToStringWithCulture(LabelName)); + this.Write("\");\r\n PrintRegressionFoldsAverageMetrics(crossValidationResults);\r\n"); } - Write(" }\r\n"); + this.Write(" }\r\n"); } - Write(@" private static void SaveModel(MLContext mlContext, ITransformer mlModel, string modelRelativePath, DataViewSchema modelInputSchema) + this.Write(@" private static void SaveModel(MLContext mlContext, ITransformer mlModel, string modelRelativePath, DataViewSchema modelInputSchema) { // Save/persist the trained model to a .ZIP file Console.WriteLine($""=============== Saving the model ===============""); @@ -240,7 +240,7 @@ public static string GetAbsolutePath(string relativePath) "); if("Regression".Equals(TaskType)){ - Write(" public static void PrintRegressionMetrics(RegressionMetrics metrics)\r\n " + + this.Write(" public static void PrintRegressionMetrics(RegressionMetrics metrics)\r\n " + " {\r\n Console.WriteLine($\"****************************************" + "*********\");\r\n Console.WriteLine($\"* Metrics for regression mod" + "el \");\r\n Console.WriteLine($\"*----------------------------------" + @@ -272,7 +272,7 @@ public static string GetAbsolutePath(string relativePath) "\r\n Console.WriteLine($\"**********************************************" + "***************************************************************\");\r\n }\r\n"); } if("BinaryClassification".Equals(TaskType)){ - Write(" public static void PrintBinaryClassificationMetrics(BinaryClassificationM" + + this.Write(" public static void PrintBinaryClassificationMetrics(BinaryClassificationM" + "etrics metrics)\r\n {\r\n Console.WriteLine($\"********************" + "****************************************\");\r\n Console.WriteLine($\"* " + " Metrics for binary classification model \");\r\n Console.Write" + @@ -307,7 +307,7 @@ public static string GetAbsolutePath(string relativePath) "95 = 1.96 * CalculateStandardDeviation(values) / Math.Sqrt((values.Count() - 1))" + ";\r\n return confidenceInterval95;\r\n }\r\n"); } if("MulticlassClassification".Equals(TaskType)){ - Write(" public static void PrintMulticlassClassificationMetrics(MulticlassClassif" + + this.Write(" public static void PrintMulticlassClassificationMetrics(MulticlassClassif" + "icationMetrics metrics)\r\n {\r\n Console.WriteLine($\"************" + "************************************************\");\r\n Console.WriteLi" + "ne($\"* Metrics for multi-class classification model \");\r\n Consol" + @@ -371,8 +371,8 @@ public static string GetAbsolutePath(string relativePath) "ndardDeviation(values) / Math.Sqrt((values.Count() - 1));\r\n return co" + "nfidenceInterval95;\r\n }\r\n"); } - Write(" }\r\n}\r\n"); - return GenerationEnvironment.ToString(); + this.Write(" }\r\n}\r\n"); + return this.GenerationEnvironment.ToString(); } public string Path {get;set;} @@ -415,15 +415,15 @@ protected System.Text.StringBuilder GenerationEnvironment { get { - if ((generationEnvironmentField == null)) + if ((this.generationEnvironmentField == null)) { - generationEnvironmentField = new global::System.Text.StringBuilder(); + this.generationEnvironmentField = new global::System.Text.StringBuilder(); } - return generationEnvironmentField; + return this.generationEnvironmentField; } set { - generationEnvironmentField = value; + this.generationEnvironmentField = value; } } /// @@ -433,11 +433,11 @@ public System.CodeDom.Compiler.CompilerErrorCollection Errors { get { - if ((errorsField == null)) + if ((this.errorsField == null)) { - errorsField = new global::System.CodeDom.Compiler.CompilerErrorCollection(); + this.errorsField = new global::System.CodeDom.Compiler.CompilerErrorCollection(); } - return errorsField; + return this.errorsField; } } /// @@ -447,11 +447,11 @@ private System.Collections.Generic.List indentLengths { get { - if ((indentLengthsField == null)) + if ((this.indentLengthsField == null)) { - indentLengthsField = new global::System.Collections.Generic.List(); + this.indentLengthsField = new global::System.Collections.Generic.List(); } - return indentLengthsField; + return this.indentLengthsField; } } /// @@ -461,7 +461,7 @@ public string CurrentIndent { get { - return currentIndentField; + return this.currentIndentField; } } /// @@ -471,11 +471,11 @@ public string CurrentIndent { get { - return sessionField; + return this.sessionField; } set { - sessionField = value; + this.sessionField = value; } } #endregion @@ -491,35 +491,35 @@ public void Write(string textToAppend) } // If we're starting off, or if the previous text ended with a newline, // we have to append the current indent first. - if (((GenerationEnvironment.Length == 0) - || endsWithNewline)) + if (((this.GenerationEnvironment.Length == 0) + || this.endsWithNewline)) { - GenerationEnvironment.Append(currentIndentField); - endsWithNewline = false; + this.GenerationEnvironment.Append(this.currentIndentField); + this.endsWithNewline = false; } // Check if the current text ends with a newline if (textToAppend.EndsWith(global::System.Environment.NewLine, global::System.StringComparison.CurrentCulture)) { - endsWithNewline = true; + this.endsWithNewline = true; } // This is an optimization. If the current indent is "", then we don't have to do any // of the more complex stuff further down. - if ((currentIndentField.Length == 0)) + if ((this.currentIndentField.Length == 0)) { - GenerationEnvironment.Append(textToAppend); + this.GenerationEnvironment.Append(textToAppend); return; } // Everywhere there is a newline in the text, add an indent after it - textToAppend = textToAppend.Replace(global::System.Environment.NewLine, (global::System.Environment.NewLine + currentIndentField)); + textToAppend = textToAppend.Replace(global::System.Environment.NewLine, (global::System.Environment.NewLine + this.currentIndentField)); // If the text ends with a newline, then we should strip off the indent added at the very end // because the appropriate indent will be added when the next time Write() is called - if (endsWithNewline) + if (this.endsWithNewline) { - GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - currentIndentField.Length)); + this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length)); } else { - GenerationEnvironment.Append(textToAppend); + this.GenerationEnvironment.Append(textToAppend); } } /// @@ -527,23 +527,23 @@ public void Write(string textToAppend) /// public void WriteLine(string textToAppend) { - Write(textToAppend); - GenerationEnvironment.AppendLine(); - endsWithNewline = true; + this.Write(textToAppend); + this.GenerationEnvironment.AppendLine(); + this.endsWithNewline = true; } /// /// Write formatted text directly into the generated output /// public void Write(string format, params object[] args) { - Write(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); + this.Write(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); } /// /// Write formatted text directly into the generated output /// public void WriteLine(string format, params object[] args) { - WriteLine(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); + this.WriteLine(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); } /// /// Raise an error @@ -552,7 +552,7 @@ public void Error(string message) { System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError(); error.ErrorText = message; - Errors.Add(error); + this.Errors.Add(error); } /// /// Raise a warning @@ -562,7 +562,7 @@ public void Warning(string message) System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError(); error.ErrorText = message; error.IsWarning = true; - Errors.Add(error); + this.Errors.Add(error); } /// /// Increase the indent @@ -573,8 +573,8 @@ public void PushIndent(string indent) { throw new global::System.ArgumentNullException("indent"); } - currentIndentField = (currentIndentField + indent); - indentLengths.Add(indent.Length); + this.currentIndentField = (this.currentIndentField + indent); + this.indentLengths.Add(indent.Length); } /// /// Remove the last indent that was added with PushIndent @@ -582,14 +582,14 @@ public void PushIndent(string indent) public string PopIndent() { string returnValue = ""; - if ((indentLengths.Count > 0)) + if ((this.indentLengths.Count > 0)) { - int indentLength = indentLengths[(indentLengths.Count - 1)]; - indentLengths.RemoveAt((indentLengths.Count - 1)); + int indentLength = this.indentLengths[(this.indentLengths.Count - 1)]; + this.indentLengths.RemoveAt((this.indentLengths.Count - 1)); if ((indentLength > 0)) { - returnValue = currentIndentField.Substring((currentIndentField.Length - indentLength)); - currentIndentField = currentIndentField.Remove((currentIndentField.Length - indentLength)); + returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength)); + this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength)); } } return returnValue; @@ -599,8 +599,8 @@ public string PopIndent() /// public void ClearIndent() { - indentLengths.Clear(); - currentIndentField = ""; + this.indentLengths.Clear(); + this.currentIndentField = ""; } #endregion #region ToString Helpers @@ -617,13 +617,13 @@ public System.IFormatProvider FormatProvider { get { - return formatProviderField ; + return this.formatProviderField ; } set { if ((value != null)) { - formatProviderField = value; + this.formatProviderField = value; } } } @@ -646,7 +646,7 @@ public string ToStringWithCulture(object objectToConvert) else { return ((string)(method.Invoke(objectToConvert, new object[] { - formatProviderField }))); + this.formatProviderField }))); } } } @@ -658,7 +658,7 @@ public ToStringInstanceHelper ToStringHelper { get { - return toStringHelperField; + return this.toStringHelperField; } } #endregion diff --git a/src/mlnet/Templates/Console/ModelInputClass.cs b/src/mlnet/Templates/Console/ModelInputClass.cs index b136882a82..6205ffc683 100644 --- a/src/mlnet/Templates/Console/ModelInputClass.cs +++ b/src/mlnet/Templates/Console/ModelInputClass.cs @@ -25,7 +25,7 @@ public partial class ModelInputClass : ModelInputClassBase /// public virtual string TransformText() { - Write(@"//***************************************************************************************** + this.Write(@"//***************************************************************************************** //* * //* This is an auto-generated file by Microsoft ML.NET CLI (Command-Line Interface) tool. * //* * @@ -34,15 +34,15 @@ public virtual string TransformText() using Microsoft.ML.Data; namespace "); - Write(ToStringHelper.ToStringWithCulture(Namespace)); - Write(".Model.DataModels\r\n{\r\n public class ModelInput\r\n {\r\n"); + this.Write(this.ToStringHelper.ToStringWithCulture(Namespace)); + this.Write(".Model.DataModels\r\n{\r\n public class ModelInput\r\n {\r\n"); foreach(var label in ClassLabels){ - Write(" "); - Write(ToStringHelper.ToStringWithCulture(label)); - Write("\r\n"); + this.Write(" "); + this.Write(this.ToStringHelper.ToStringWithCulture(label)); + this.Write("\r\n"); } - Write("}\r\n}\r\n"); - return GenerationEnvironment.ToString(); + this.Write("}\r\n}\r\n"); + return this.GenerationEnvironment.ToString(); } public IList ClassLabels {get;set;} @@ -72,15 +72,15 @@ protected System.Text.StringBuilder GenerationEnvironment { get { - if ((generationEnvironmentField == null)) + if ((this.generationEnvironmentField == null)) { - generationEnvironmentField = new global::System.Text.StringBuilder(); + this.generationEnvironmentField = new global::System.Text.StringBuilder(); } - return generationEnvironmentField; + return this.generationEnvironmentField; } set { - generationEnvironmentField = value; + this.generationEnvironmentField = value; } } /// @@ -90,11 +90,11 @@ public System.CodeDom.Compiler.CompilerErrorCollection Errors { get { - if ((errorsField == null)) + if ((this.errorsField == null)) { - errorsField = new global::System.CodeDom.Compiler.CompilerErrorCollection(); + this.errorsField = new global::System.CodeDom.Compiler.CompilerErrorCollection(); } - return errorsField; + return this.errorsField; } } /// @@ -104,11 +104,11 @@ private System.Collections.Generic.List indentLengths { get { - if ((indentLengthsField == null)) + if ((this.indentLengthsField == null)) { - indentLengthsField = new global::System.Collections.Generic.List(); + this.indentLengthsField = new global::System.Collections.Generic.List(); } - return indentLengthsField; + return this.indentLengthsField; } } /// @@ -118,7 +118,7 @@ public string CurrentIndent { get { - return currentIndentField; + return this.currentIndentField; } } /// @@ -128,11 +128,11 @@ public string CurrentIndent { get { - return sessionField; + return this.sessionField; } set { - sessionField = value; + this.sessionField = value; } } #endregion @@ -148,35 +148,35 @@ public void Write(string textToAppend) } // If we're starting off, or if the previous text ended with a newline, // we have to append the current indent first. - if (((GenerationEnvironment.Length == 0) - || endsWithNewline)) + if (((this.GenerationEnvironment.Length == 0) + || this.endsWithNewline)) { - GenerationEnvironment.Append(currentIndentField); - endsWithNewline = false; + this.GenerationEnvironment.Append(this.currentIndentField); + this.endsWithNewline = false; } // Check if the current text ends with a newline if (textToAppend.EndsWith(global::System.Environment.NewLine, global::System.StringComparison.CurrentCulture)) { - endsWithNewline = true; + this.endsWithNewline = true; } // This is an optimization. If the current indent is "", then we don't have to do any // of the more complex stuff further down. - if ((currentIndentField.Length == 0)) + if ((this.currentIndentField.Length == 0)) { - GenerationEnvironment.Append(textToAppend); + this.GenerationEnvironment.Append(textToAppend); return; } // Everywhere there is a newline in the text, add an indent after it - textToAppend = textToAppend.Replace(global::System.Environment.NewLine, (global::System.Environment.NewLine + currentIndentField)); + textToAppend = textToAppend.Replace(global::System.Environment.NewLine, (global::System.Environment.NewLine + this.currentIndentField)); // If the text ends with a newline, then we should strip off the indent added at the very end // because the appropriate indent will be added when the next time Write() is called - if (endsWithNewline) + if (this.endsWithNewline) { - GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - currentIndentField.Length)); + this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length)); } else { - GenerationEnvironment.Append(textToAppend); + this.GenerationEnvironment.Append(textToAppend); } } /// @@ -184,23 +184,23 @@ public void Write(string textToAppend) /// public void WriteLine(string textToAppend) { - Write(textToAppend); - GenerationEnvironment.AppendLine(); - endsWithNewline = true; + this.Write(textToAppend); + this.GenerationEnvironment.AppendLine(); + this.endsWithNewline = true; } /// /// Write formatted text directly into the generated output /// public void Write(string format, params object[] args) { - Write(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); + this.Write(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); } /// /// Write formatted text directly into the generated output /// public void WriteLine(string format, params object[] args) { - WriteLine(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); + this.WriteLine(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); } /// /// Raise an error @@ -209,7 +209,7 @@ public void Error(string message) { System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError(); error.ErrorText = message; - Errors.Add(error); + this.Errors.Add(error); } /// /// Raise a warning @@ -219,7 +219,7 @@ public void Warning(string message) System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError(); error.ErrorText = message; error.IsWarning = true; - Errors.Add(error); + this.Errors.Add(error); } /// /// Increase the indent @@ -230,8 +230,8 @@ public void PushIndent(string indent) { throw new global::System.ArgumentNullException("indent"); } - currentIndentField = (currentIndentField + indent); - indentLengths.Add(indent.Length); + this.currentIndentField = (this.currentIndentField + indent); + this.indentLengths.Add(indent.Length); } /// /// Remove the last indent that was added with PushIndent @@ -239,14 +239,14 @@ public void PushIndent(string indent) public string PopIndent() { string returnValue = ""; - if ((indentLengths.Count > 0)) + if ((this.indentLengths.Count > 0)) { - int indentLength = indentLengths[(indentLengths.Count - 1)]; - indentLengths.RemoveAt((indentLengths.Count - 1)); + int indentLength = this.indentLengths[(this.indentLengths.Count - 1)]; + this.indentLengths.RemoveAt((this.indentLengths.Count - 1)); if ((indentLength > 0)) { - returnValue = currentIndentField.Substring((currentIndentField.Length - indentLength)); - currentIndentField = currentIndentField.Remove((currentIndentField.Length - indentLength)); + returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength)); + this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength)); } } return returnValue; @@ -256,8 +256,8 @@ public string PopIndent() /// public void ClearIndent() { - indentLengths.Clear(); - currentIndentField = ""; + this.indentLengths.Clear(); + this.currentIndentField = ""; } #endregion #region ToString Helpers @@ -274,13 +274,13 @@ public System.IFormatProvider FormatProvider { get { - return formatProviderField ; + return this.formatProviderField ; } set { if ((value != null)) { - formatProviderField = value; + this.formatProviderField = value; } } } @@ -303,7 +303,7 @@ public string ToStringWithCulture(object objectToConvert) else { return ((string)(method.Invoke(objectToConvert, new object[] { - formatProviderField }))); + this.formatProviderField }))); } } } @@ -315,7 +315,7 @@ public ToStringInstanceHelper ToStringHelper { get { - return toStringHelperField; + return this.toStringHelperField; } } #endregion diff --git a/src/mlnet/Templates/Console/ModelOutputClass.cs b/src/mlnet/Templates/Console/ModelOutputClass.cs index 01c5b5b1c1..767ae5d0da 100644 --- a/src/mlnet/Templates/Console/ModelOutputClass.cs +++ b/src/mlnet/Templates/Console/ModelOutputClass.cs @@ -25,7 +25,7 @@ public partial class ModelOutputClass : ModelOutputClassBase /// public virtual string TransformText() { - Write(@"//***************************************************************************************** + this.Write(@"//***************************************************************************************** //* * //* This is an auto-generated file by Microsoft ML.NET CLI (Command-Line Interface) tool. * //* * @@ -35,26 +35,26 @@ public virtual string TransformText() using Microsoft.ML.Data; namespace "); - Write(ToStringHelper.ToStringWithCulture(Namespace)); - Write(".Model.DataModels\r\n{\r\n public class ModelOutput\r\n {\r\n"); + this.Write(this.ToStringHelper.ToStringWithCulture(Namespace)); + this.Write(".Model.DataModels\r\n{\r\n public class ModelOutput\r\n {\r\n"); if("BinaryClassification".Equals(TaskType)){ - Write(" // ColumnName attribute is used to change the column name from\r\n /" + + this.Write(" // ColumnName attribute is used to change the column name from\r\n /" + "/ its default value, which is the name of the field.\r\n [ColumnName(\"Predi" + "ctedLabel\")]\r\n public bool Prediction { get; set; }\r\n\r\n"); } if("MulticlassClassification".Equals(TaskType)){ - Write(" // ColumnName attribute is used to change the column name from\r\n /" + + this.Write(" // ColumnName attribute is used to change the column name from\r\n /" + "/ its default value, which is the name of the field.\r\n [ColumnName(\"Predi" + "ctedLabel\")]\r\n public "); - Write(ToStringHelper.ToStringWithCulture(PredictionLabelType)); - Write(" Prediction { get; set; }\r\n"); + this.Write(this.ToStringHelper.ToStringWithCulture(PredictionLabelType)); + this.Write(" Prediction { get; set; }\r\n"); } if("MulticlassClassification".Equals(TaskType)){ - Write(" public float[] Score { get; set; }\r\n"); + this.Write(" public float[] Score { get; set; }\r\n"); }else{ - Write(" public float Score { get; set; }\r\n"); + this.Write(" public float Score { get; set; }\r\n"); } - Write(" }\r\n}\r\n"); - return GenerationEnvironment.ToString(); + this.Write(" }\r\n}\r\n"); + return this.GenerationEnvironment.ToString(); } public string TaskType {get;set;} @@ -85,15 +85,15 @@ protected System.Text.StringBuilder GenerationEnvironment { get { - if ((generationEnvironmentField == null)) + if ((this.generationEnvironmentField == null)) { - generationEnvironmentField = new global::System.Text.StringBuilder(); + this.generationEnvironmentField = new global::System.Text.StringBuilder(); } - return generationEnvironmentField; + return this.generationEnvironmentField; } set { - generationEnvironmentField = value; + this.generationEnvironmentField = value; } } /// @@ -103,11 +103,11 @@ public System.CodeDom.Compiler.CompilerErrorCollection Errors { get { - if ((errorsField == null)) + if ((this.errorsField == null)) { - errorsField = new global::System.CodeDom.Compiler.CompilerErrorCollection(); + this.errorsField = new global::System.CodeDom.Compiler.CompilerErrorCollection(); } - return errorsField; + return this.errorsField; } } /// @@ -117,11 +117,11 @@ private System.Collections.Generic.List indentLengths { get { - if ((indentLengthsField == null)) + if ((this.indentLengthsField == null)) { - indentLengthsField = new global::System.Collections.Generic.List(); + this.indentLengthsField = new global::System.Collections.Generic.List(); } - return indentLengthsField; + return this.indentLengthsField; } } /// @@ -131,7 +131,7 @@ public string CurrentIndent { get { - return currentIndentField; + return this.currentIndentField; } } /// @@ -141,11 +141,11 @@ public string CurrentIndent { get { - return sessionField; + return this.sessionField; } set { - sessionField = value; + this.sessionField = value; } } #endregion @@ -161,35 +161,35 @@ public void Write(string textToAppend) } // If we're starting off, or if the previous text ended with a newline, // we have to append the current indent first. - if (((GenerationEnvironment.Length == 0) - || endsWithNewline)) + if (((this.GenerationEnvironment.Length == 0) + || this.endsWithNewline)) { - GenerationEnvironment.Append(currentIndentField); - endsWithNewline = false; + this.GenerationEnvironment.Append(this.currentIndentField); + this.endsWithNewline = false; } // Check if the current text ends with a newline if (textToAppend.EndsWith(global::System.Environment.NewLine, global::System.StringComparison.CurrentCulture)) { - endsWithNewline = true; + this.endsWithNewline = true; } // This is an optimization. If the current indent is "", then we don't have to do any // of the more complex stuff further down. - if ((currentIndentField.Length == 0)) + if ((this.currentIndentField.Length == 0)) { - GenerationEnvironment.Append(textToAppend); + this.GenerationEnvironment.Append(textToAppend); return; } // Everywhere there is a newline in the text, add an indent after it - textToAppend = textToAppend.Replace(global::System.Environment.NewLine, (global::System.Environment.NewLine + currentIndentField)); + textToAppend = textToAppend.Replace(global::System.Environment.NewLine, (global::System.Environment.NewLine + this.currentIndentField)); // If the text ends with a newline, then we should strip off the indent added at the very end // because the appropriate indent will be added when the next time Write() is called - if (endsWithNewline) + if (this.endsWithNewline) { - GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - currentIndentField.Length)); + this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length)); } else { - GenerationEnvironment.Append(textToAppend); + this.GenerationEnvironment.Append(textToAppend); } } /// @@ -197,23 +197,23 @@ public void Write(string textToAppend) /// public void WriteLine(string textToAppend) { - Write(textToAppend); - GenerationEnvironment.AppendLine(); - endsWithNewline = true; + this.Write(textToAppend); + this.GenerationEnvironment.AppendLine(); + this.endsWithNewline = true; } /// /// Write formatted text directly into the generated output /// public void Write(string format, params object[] args) { - Write(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); + this.Write(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); } /// /// Write formatted text directly into the generated output /// public void WriteLine(string format, params object[] args) { - WriteLine(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); + this.WriteLine(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); } /// /// Raise an error @@ -222,7 +222,7 @@ public void Error(string message) { System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError(); error.ErrorText = message; - Errors.Add(error); + this.Errors.Add(error); } /// /// Raise a warning @@ -232,7 +232,7 @@ public void Warning(string message) System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError(); error.ErrorText = message; error.IsWarning = true; - Errors.Add(error); + this.Errors.Add(error); } /// /// Increase the indent @@ -243,8 +243,8 @@ public void PushIndent(string indent) { throw new global::System.ArgumentNullException("indent"); } - currentIndentField = (currentIndentField + indent); - indentLengths.Add(indent.Length); + this.currentIndentField = (this.currentIndentField + indent); + this.indentLengths.Add(indent.Length); } /// /// Remove the last indent that was added with PushIndent @@ -252,14 +252,14 @@ public void PushIndent(string indent) public string PopIndent() { string returnValue = ""; - if ((indentLengths.Count > 0)) + if ((this.indentLengths.Count > 0)) { - int indentLength = indentLengths[(indentLengths.Count - 1)]; - indentLengths.RemoveAt((indentLengths.Count - 1)); + int indentLength = this.indentLengths[(this.indentLengths.Count - 1)]; + this.indentLengths.RemoveAt((this.indentLengths.Count - 1)); if ((indentLength > 0)) { - returnValue = currentIndentField.Substring((currentIndentField.Length - indentLength)); - currentIndentField = currentIndentField.Remove((currentIndentField.Length - indentLength)); + returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength)); + this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength)); } } return returnValue; @@ -269,8 +269,8 @@ public string PopIndent() /// public void ClearIndent() { - indentLengths.Clear(); - currentIndentField = ""; + this.indentLengths.Clear(); + this.currentIndentField = ""; } #endregion #region ToString Helpers @@ -287,13 +287,13 @@ public System.IFormatProvider FormatProvider { get { - return formatProviderField ; + return this.formatProviderField ; } set { if ((value != null)) { - formatProviderField = value; + this.formatProviderField = value; } } } @@ -316,7 +316,7 @@ public string ToStringWithCulture(object objectToConvert) else { return ((string)(method.Invoke(objectToConvert, new object[] { - formatProviderField }))); + this.formatProviderField }))); } } } @@ -328,7 +328,7 @@ public ToStringInstanceHelper ToStringHelper { get { - return toStringHelperField; + return this.toStringHelperField; } } #endregion diff --git a/src/mlnet/Templates/Console/ModelProject.cs b/src/mlnet/Templates/Console/ModelProject.cs index 7c26ec3d76..be2afa2ead 100644 --- a/src/mlnet/Templates/Console/ModelProject.cs +++ b/src/mlnet/Templates/Console/ModelProject.cs @@ -25,22 +25,22 @@ public partial class ModelProject : ModelProjectBase /// public virtual string TransformText() { - Write("\r\n\r\n \r\n netc" + + this.Write("\r\n\r\n \r\n netc" + "oreapp2.1\r\n \r\n \r\n \r\n"); + "rence Include=\"Microsoft.ML\" Version=\"1.2.0\" />\r\n"); if (IncludeLightGBMPackage) { - Write(" \r\n"); + this.Write(" \r\n"); } if (IncludeMklComponentsPackage){ - Write(" \r\n"); + this.Write(" \r\n"); } if (IncludeFastTreePackage){ - Write(" \r\n"); + this.Write(" \r\n"); } - Write(" \r\n\r\n \r\n \r\n \r\n\r\n \r\n \r\n PreserveNewest\r\n \r\n \r\n \r\n\r\n"); - return GenerationEnvironment.ToString(); + return this.GenerationEnvironment.ToString(); } public bool IncludeLightGBMPackage {get;set;} @@ -71,15 +71,15 @@ protected System.Text.StringBuilder GenerationEnvironment { get { - if ((generationEnvironmentField == null)) + if ((this.generationEnvironmentField == null)) { - generationEnvironmentField = new global::System.Text.StringBuilder(); + this.generationEnvironmentField = new global::System.Text.StringBuilder(); } - return generationEnvironmentField; + return this.generationEnvironmentField; } set { - generationEnvironmentField = value; + this.generationEnvironmentField = value; } } /// @@ -89,11 +89,11 @@ public System.CodeDom.Compiler.CompilerErrorCollection Errors { get { - if ((errorsField == null)) + if ((this.errorsField == null)) { - errorsField = new global::System.CodeDom.Compiler.CompilerErrorCollection(); + this.errorsField = new global::System.CodeDom.Compiler.CompilerErrorCollection(); } - return errorsField; + return this.errorsField; } } /// @@ -103,11 +103,11 @@ private System.Collections.Generic.List indentLengths { get { - if ((indentLengthsField == null)) + if ((this.indentLengthsField == null)) { - indentLengthsField = new global::System.Collections.Generic.List(); + this.indentLengthsField = new global::System.Collections.Generic.List(); } - return indentLengthsField; + return this.indentLengthsField; } } /// @@ -117,7 +117,7 @@ public string CurrentIndent { get { - return currentIndentField; + return this.currentIndentField; } } /// @@ -127,11 +127,11 @@ public string CurrentIndent { get { - return sessionField; + return this.sessionField; } set { - sessionField = value; + this.sessionField = value; } } #endregion @@ -147,35 +147,35 @@ public void Write(string textToAppend) } // If we're starting off, or if the previous text ended with a newline, // we have to append the current indent first. - if (((GenerationEnvironment.Length == 0) - || endsWithNewline)) + if (((this.GenerationEnvironment.Length == 0) + || this.endsWithNewline)) { - GenerationEnvironment.Append(currentIndentField); - endsWithNewline = false; + this.GenerationEnvironment.Append(this.currentIndentField); + this.endsWithNewline = false; } // Check if the current text ends with a newline if (textToAppend.EndsWith(global::System.Environment.NewLine, global::System.StringComparison.CurrentCulture)) { - endsWithNewline = true; + this.endsWithNewline = true; } // This is an optimization. If the current indent is "", then we don't have to do any // of the more complex stuff further down. - if ((currentIndentField.Length == 0)) + if ((this.currentIndentField.Length == 0)) { - GenerationEnvironment.Append(textToAppend); + this.GenerationEnvironment.Append(textToAppend); return; } // Everywhere there is a newline in the text, add an indent after it - textToAppend = textToAppend.Replace(global::System.Environment.NewLine, (global::System.Environment.NewLine + currentIndentField)); + textToAppend = textToAppend.Replace(global::System.Environment.NewLine, (global::System.Environment.NewLine + this.currentIndentField)); // If the text ends with a newline, then we should strip off the indent added at the very end // because the appropriate indent will be added when the next time Write() is called - if (endsWithNewline) + if (this.endsWithNewline) { - GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - currentIndentField.Length)); + this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length)); } else { - GenerationEnvironment.Append(textToAppend); + this.GenerationEnvironment.Append(textToAppend); } } /// @@ -183,23 +183,23 @@ public void Write(string textToAppend) /// public void WriteLine(string textToAppend) { - Write(textToAppend); - GenerationEnvironment.AppendLine(); - endsWithNewline = true; + this.Write(textToAppend); + this.GenerationEnvironment.AppendLine(); + this.endsWithNewline = true; } /// /// Write formatted text directly into the generated output /// public void Write(string format, params object[] args) { - Write(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); + this.Write(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); } /// /// Write formatted text directly into the generated output /// public void WriteLine(string format, params object[] args) { - WriteLine(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); + this.WriteLine(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); } /// /// Raise an error @@ -208,7 +208,7 @@ public void Error(string message) { System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError(); error.ErrorText = message; - Errors.Add(error); + this.Errors.Add(error); } /// /// Raise a warning @@ -218,7 +218,7 @@ public void Warning(string message) System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError(); error.ErrorText = message; error.IsWarning = true; - Errors.Add(error); + this.Errors.Add(error); } /// /// Increase the indent @@ -229,8 +229,8 @@ public void PushIndent(string indent) { throw new global::System.ArgumentNullException("indent"); } - currentIndentField = (currentIndentField + indent); - indentLengths.Add(indent.Length); + this.currentIndentField = (this.currentIndentField + indent); + this.indentLengths.Add(indent.Length); } /// /// Remove the last indent that was added with PushIndent @@ -238,14 +238,14 @@ public void PushIndent(string indent) public string PopIndent() { string returnValue = ""; - if ((indentLengths.Count > 0)) + if ((this.indentLengths.Count > 0)) { - int indentLength = indentLengths[(indentLengths.Count - 1)]; - indentLengths.RemoveAt((indentLengths.Count - 1)); + int indentLength = this.indentLengths[(this.indentLengths.Count - 1)]; + this.indentLengths.RemoveAt((this.indentLengths.Count - 1)); if ((indentLength > 0)) { - returnValue = currentIndentField.Substring((currentIndentField.Length - indentLength)); - currentIndentField = currentIndentField.Remove((currentIndentField.Length - indentLength)); + returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength)); + this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength)); } } return returnValue; @@ -255,8 +255,8 @@ public string PopIndent() /// public void ClearIndent() { - indentLengths.Clear(); - currentIndentField = ""; + this.indentLengths.Clear(); + this.currentIndentField = ""; } #endregion #region ToString Helpers @@ -273,13 +273,13 @@ public System.IFormatProvider FormatProvider { get { - return formatProviderField ; + return this.formatProviderField ; } set { if ((value != null)) { - formatProviderField = value; + this.formatProviderField = value; } } } @@ -302,7 +302,7 @@ public string ToStringWithCulture(object objectToConvert) else { return ((string)(method.Invoke(objectToConvert, new object[] { - formatProviderField }))); + this.formatProviderField }))); } } } @@ -314,7 +314,7 @@ public ToStringInstanceHelper ToStringHelper { get { - return toStringHelperField; + return this.toStringHelperField; } } #endregion diff --git a/src/mlnet/Templates/Console/ModelProject.tt b/src/mlnet/Templates/Console/ModelProject.tt index 65efa4d0d5..2030d61f27 100644 --- a/src/mlnet/Templates/Console/ModelProject.tt +++ b/src/mlnet/Templates/Console/ModelProject.tt @@ -9,15 +9,15 @@ netcoreapp2.1 - + <# if (IncludeLightGBMPackage) { #> - + <#}#> <# if (IncludeMklComponentsPackage){ #> - + <#}#> <# if (IncludeFastTreePackage){ #> - + <#}#> diff --git a/src/mlnet/Templates/Console/PredictProgram.cs b/src/mlnet/Templates/Console/PredictProgram.cs index 8af0aaef22..22d7d0ebee 100644 --- a/src/mlnet/Templates/Console/PredictProgram.cs +++ b/src/mlnet/Templates/Console/PredictProgram.cs @@ -27,7 +27,7 @@ public partial class PredictProgram : PredictProgramBase /// public virtual string TransformText() { - Write(@"//***************************************************************************************** + this.Write(@"//***************************************************************************************** //* * //* This is an auto-generated file by Microsoft ML.NET CLI (Command-Line Interface) tool. * //* * @@ -38,22 +38,22 @@ public virtual string TransformText() using System.Linq; using Microsoft.ML; using "); - Write(ToStringHelper.ToStringWithCulture(Namespace)); - Write(".Model.DataModels;\r\n\r\n\r\nnamespace "); - Write(ToStringHelper.ToStringWithCulture(Namespace)); - Write(".ConsoleApp\r\n{\r\n class Program\r\n {\r\n //Machine Learning model to loa" + + this.Write(this.ToStringHelper.ToStringWithCulture(Namespace)); + this.Write(".Model.DataModels;\r\n\r\n\r\nnamespace "); + this.Write(this.ToStringHelper.ToStringWithCulture(Namespace)); + this.Write(".ConsoleApp\r\n{\r\n class Program\r\n {\r\n //Machine Learning model to loa" + "d and use for predictions\r\n private const string MODEL_FILEPATH = @\"MLMod" + "el.zip\";\r\n\r\n //Dataset to use for predictions \r\n"); if(string.IsNullOrEmpty(TestDataPath)){ - Write(" private const string DATA_FILEPATH = @\""); - Write(ToStringHelper.ToStringWithCulture(TrainDataPath)); - Write("\";\r\n"); + this.Write(" private const string DATA_FILEPATH = @\""); + this.Write(this.ToStringHelper.ToStringWithCulture(TrainDataPath)); + this.Write("\";\r\n"); } else{ - Write(" private const string DATA_FILEPATH = @\""); - Write(ToStringHelper.ToStringWithCulture(TestDataPath)); - Write("\";\r\n"); + this.Write(" private const string DATA_FILEPATH = @\""); + this.Write(this.ToStringHelper.ToStringWithCulture(TestDataPath)); + this.Write("\";\r\n"); } - Write(@" + this.Write(@" static void Main(string[] args) { MLContext mlContext = new MLContext(); @@ -72,20 +72,20 @@ static void Main(string[] args) "); if("BinaryClassification".Equals(TaskType)){ - Write(" Console.WriteLine($\"Single Prediction --> Actual value: {sampleData."); - Write(ToStringHelper.ToStringWithCulture(Utils.Normalize(LabelName))); - Write("} | Predicted value: {predictionResult.Prediction}\");\r\n"); + this.Write(" Console.WriteLine($\"Single Prediction --> Actual value: {sampleData."); + this.Write(this.ToStringHelper.ToStringWithCulture(Utils.Normalize(LabelName))); + this.Write("} | Predicted value: {predictionResult.Prediction}\");\r\n"); }else if("Regression".Equals(TaskType)){ - Write(" Console.WriteLine($\"Single Prediction --> Actual value: {sampleData."); - Write(ToStringHelper.ToStringWithCulture(Utils.Normalize(LabelName))); - Write("} | Predicted value: {predictionResult.Score}\");\r\n"); + this.Write(" Console.WriteLine($\"Single Prediction --> Actual value: {sampleData."); + this.Write(this.ToStringHelper.ToStringWithCulture(Utils.Normalize(LabelName))); + this.Write("} | Predicted value: {predictionResult.Score}\");\r\n"); } else if("MulticlassClassification".Equals(TaskType)){ - Write(" Console.WriteLine($\"Single Prediction --> Actual value: {sampleData."); - Write(ToStringHelper.ToStringWithCulture(Utils.Normalize(LabelName))); - Write("} | Predicted value: {predictionResult.Prediction} | Predicted scores: [{String.J" + + this.Write(" Console.WriteLine($\"Single Prediction --> Actual value: {sampleData."); + this.Write(this.ToStringHelper.ToStringWithCulture(Utils.Normalize(LabelName))); + this.Write("} | Predicted value: {predictionResult.Prediction} | Predicted scores: [{String.J" + "oin(\",\", predictionResult.Score)}]\");\r\n"); } - Write(@" + this.Write(@" Console.WriteLine(""=============== End of process, hit any key to finish ===============""); Console.ReadKey(); } @@ -98,14 +98,14 @@ private static ModelInput CreateSingleDataSample(MLContext mlContext, string dat IDataView dataView = mlContext.Data.LoadFromTextFile( path: dataFilePath, hasHeader : "); - Write(ToStringHelper.ToStringWithCulture(HasHeader.ToString().ToLowerInvariant())); - Write(",\r\n separatorChar : \'"); - Write(ToStringHelper.ToStringWithCulture(Regex.Escape(Separator.ToString()))); - Write("\',\r\n allowQuoting : "); - Write(ToStringHelper.ToStringWithCulture(AllowQuoting.ToString().ToLowerInvariant())); - Write(",\r\n allowSparse: "); - Write(ToStringHelper.ToStringWithCulture(AllowSparse.ToString().ToLowerInvariant())); - Write(@"); + this.Write(this.ToStringHelper.ToStringWithCulture(HasHeader.ToString().ToLowerInvariant())); + this.Write(",\r\n separatorChar : \'"); + this.Write(this.ToStringHelper.ToStringWithCulture(Regex.Escape(Separator.ToString()))); + this.Write("\',\r\n allowQuoting : "); + this.Write(this.ToStringHelper.ToStringWithCulture(AllowQuoting.ToString().ToLowerInvariant())); + this.Write(",\r\n allowSparse: "); + this.Write(this.ToStringHelper.ToStringWithCulture(AllowSparse.ToString().ToLowerInvariant())); + this.Write(@"); // Here (ModelInput object) you could provide new test data, hardcoded or from the end-user application, instead of the row from the file. ModelInput sampleForPrediction = mlContext.Data.CreateEnumerable(dataView, false) @@ -125,7 +125,7 @@ public static string GetAbsolutePath(string relativePath) } } "); - return GenerationEnvironment.ToString(); + return this.GenerationEnvironment.ToString(); } public string TaskType {get;set;} @@ -162,15 +162,15 @@ protected System.Text.StringBuilder GenerationEnvironment { get { - if ((generationEnvironmentField == null)) + if ((this.generationEnvironmentField == null)) { - generationEnvironmentField = new global::System.Text.StringBuilder(); + this.generationEnvironmentField = new global::System.Text.StringBuilder(); } - return generationEnvironmentField; + return this.generationEnvironmentField; } set { - generationEnvironmentField = value; + this.generationEnvironmentField = value; } } /// @@ -180,11 +180,11 @@ public System.CodeDom.Compiler.CompilerErrorCollection Errors { get { - if ((errorsField == null)) + if ((this.errorsField == null)) { - errorsField = new global::System.CodeDom.Compiler.CompilerErrorCollection(); + this.errorsField = new global::System.CodeDom.Compiler.CompilerErrorCollection(); } - return errorsField; + return this.errorsField; } } /// @@ -194,11 +194,11 @@ private System.Collections.Generic.List indentLengths { get { - if ((indentLengthsField == null)) + if ((this.indentLengthsField == null)) { - indentLengthsField = new global::System.Collections.Generic.List(); + this.indentLengthsField = new global::System.Collections.Generic.List(); } - return indentLengthsField; + return this.indentLengthsField; } } /// @@ -208,7 +208,7 @@ public string CurrentIndent { get { - return currentIndentField; + return this.currentIndentField; } } /// @@ -218,11 +218,11 @@ public string CurrentIndent { get { - return sessionField; + return this.sessionField; } set { - sessionField = value; + this.sessionField = value; } } #endregion @@ -238,35 +238,35 @@ public void Write(string textToAppend) } // If we're starting off, or if the previous text ended with a newline, // we have to append the current indent first. - if (((GenerationEnvironment.Length == 0) - || endsWithNewline)) + if (((this.GenerationEnvironment.Length == 0) + || this.endsWithNewline)) { - GenerationEnvironment.Append(currentIndentField); - endsWithNewline = false; + this.GenerationEnvironment.Append(this.currentIndentField); + this.endsWithNewline = false; } // Check if the current text ends with a newline if (textToAppend.EndsWith(global::System.Environment.NewLine, global::System.StringComparison.CurrentCulture)) { - endsWithNewline = true; + this.endsWithNewline = true; } // This is an optimization. If the current indent is "", then we don't have to do any // of the more complex stuff further down. - if ((currentIndentField.Length == 0)) + if ((this.currentIndentField.Length == 0)) { - GenerationEnvironment.Append(textToAppend); + this.GenerationEnvironment.Append(textToAppend); return; } // Everywhere there is a newline in the text, add an indent after it - textToAppend = textToAppend.Replace(global::System.Environment.NewLine, (global::System.Environment.NewLine + currentIndentField)); + textToAppend = textToAppend.Replace(global::System.Environment.NewLine, (global::System.Environment.NewLine + this.currentIndentField)); // If the text ends with a newline, then we should strip off the indent added at the very end // because the appropriate indent will be added when the next time Write() is called - if (endsWithNewline) + if (this.endsWithNewline) { - GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - currentIndentField.Length)); + this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length)); } else { - GenerationEnvironment.Append(textToAppend); + this.GenerationEnvironment.Append(textToAppend); } } /// @@ -274,23 +274,23 @@ public void Write(string textToAppend) /// public void WriteLine(string textToAppend) { - Write(textToAppend); - GenerationEnvironment.AppendLine(); - endsWithNewline = true; + this.Write(textToAppend); + this.GenerationEnvironment.AppendLine(); + this.endsWithNewline = true; } /// /// Write formatted text directly into the generated output /// public void Write(string format, params object[] args) { - Write(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); + this.Write(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); } /// /// Write formatted text directly into the generated output /// public void WriteLine(string format, params object[] args) { - WriteLine(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); + this.WriteLine(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); } /// /// Raise an error @@ -299,7 +299,7 @@ public void Error(string message) { System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError(); error.ErrorText = message; - Errors.Add(error); + this.Errors.Add(error); } /// /// Raise a warning @@ -309,7 +309,7 @@ public void Warning(string message) System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError(); error.ErrorText = message; error.IsWarning = true; - Errors.Add(error); + this.Errors.Add(error); } /// /// Increase the indent @@ -320,8 +320,8 @@ public void PushIndent(string indent) { throw new global::System.ArgumentNullException("indent"); } - currentIndentField = (currentIndentField + indent); - indentLengths.Add(indent.Length); + this.currentIndentField = (this.currentIndentField + indent); + this.indentLengths.Add(indent.Length); } /// /// Remove the last indent that was added with PushIndent @@ -329,14 +329,14 @@ public void PushIndent(string indent) public string PopIndent() { string returnValue = ""; - if ((indentLengths.Count > 0)) + if ((this.indentLengths.Count > 0)) { - int indentLength = indentLengths[(indentLengths.Count - 1)]; - indentLengths.RemoveAt((indentLengths.Count - 1)); + int indentLength = this.indentLengths[(this.indentLengths.Count - 1)]; + this.indentLengths.RemoveAt((this.indentLengths.Count - 1)); if ((indentLength > 0)) { - returnValue = currentIndentField.Substring((currentIndentField.Length - indentLength)); - currentIndentField = currentIndentField.Remove((currentIndentField.Length - indentLength)); + returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength)); + this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength)); } } return returnValue; @@ -346,8 +346,8 @@ public string PopIndent() /// public void ClearIndent() { - indentLengths.Clear(); - currentIndentField = ""; + this.indentLengths.Clear(); + this.currentIndentField = ""; } #endregion #region ToString Helpers @@ -364,13 +364,13 @@ public System.IFormatProvider FormatProvider { get { - return formatProviderField ; + return this.formatProviderField ; } set { if ((value != null)) { - formatProviderField = value; + this.formatProviderField = value; } } } @@ -393,7 +393,7 @@ public string ToStringWithCulture(object objectToConvert) else { return ((string)(method.Invoke(objectToConvert, new object[] { - formatProviderField }))); + this.formatProviderField }))); } } } @@ -405,7 +405,7 @@ public ToStringInstanceHelper ToStringHelper { get { - return toStringHelperField; + return this.toStringHelperField; } } #endregion diff --git a/src/mlnet/Templates/Console/PredictProject.cs b/src/mlnet/Templates/Console/PredictProject.cs index 9bc5edb2a7..527b1ae22d 100644 --- a/src/mlnet/Templates/Console/PredictProject.cs +++ b/src/mlnet/Templates/Console/PredictProject.cs @@ -26,25 +26,25 @@ public partial class PredictProject : PredictProjectBase /// public virtual string TransformText() { - Write("\r\n\r\n \r\n Exe\r\n\r\n \r\n Exe\r\n netcoreapp2.1\r\n \r\n \r\n \r\n \r\n \r\n"); if (IncludeLightGBMPackage){ - Write(" \r\n"); + this.Write(" \r\n"); } if (IncludeMklComponentsPackage){ - Write(" \r\n"); + this.Write(" \r\n"); } if (IncludeFastTreePackage){ - Write(" \r\n"); + this.Write(" \r\n"); } - Write(" \r\n \r\n \r\n \r\n\r\n"); - return GenerationEnvironment.ToString(); + this.Write(" \r\n \r\n \r\n \r\n\r\n"); + return this.GenerationEnvironment.ToString(); } public string Namespace {get;set;} @@ -76,15 +76,15 @@ protected System.Text.StringBuilder GenerationEnvironment { get { - if ((generationEnvironmentField == null)) + if ((this.generationEnvironmentField == null)) { - generationEnvironmentField = new global::System.Text.StringBuilder(); + this.generationEnvironmentField = new global::System.Text.StringBuilder(); } - return generationEnvironmentField; + return this.generationEnvironmentField; } set { - generationEnvironmentField = value; + this.generationEnvironmentField = value; } } /// @@ -94,11 +94,11 @@ public System.CodeDom.Compiler.CompilerErrorCollection Errors { get { - if ((errorsField == null)) + if ((this.errorsField == null)) { - errorsField = new global::System.CodeDom.Compiler.CompilerErrorCollection(); + this.errorsField = new global::System.CodeDom.Compiler.CompilerErrorCollection(); } - return errorsField; + return this.errorsField; } } /// @@ -108,11 +108,11 @@ private System.Collections.Generic.List indentLengths { get { - if ((indentLengthsField == null)) + if ((this.indentLengthsField == null)) { - indentLengthsField = new global::System.Collections.Generic.List(); + this.indentLengthsField = new global::System.Collections.Generic.List(); } - return indentLengthsField; + return this.indentLengthsField; } } /// @@ -122,7 +122,7 @@ public string CurrentIndent { get { - return currentIndentField; + return this.currentIndentField; } } /// @@ -132,11 +132,11 @@ public string CurrentIndent { get { - return sessionField; + return this.sessionField; } set { - sessionField = value; + this.sessionField = value; } } #endregion @@ -152,35 +152,35 @@ public void Write(string textToAppend) } // If we're starting off, or if the previous text ended with a newline, // we have to append the current indent first. - if (((GenerationEnvironment.Length == 0) - || endsWithNewline)) + if (((this.GenerationEnvironment.Length == 0) + || this.endsWithNewline)) { - GenerationEnvironment.Append(currentIndentField); - endsWithNewline = false; + this.GenerationEnvironment.Append(this.currentIndentField); + this.endsWithNewline = false; } // Check if the current text ends with a newline if (textToAppend.EndsWith(global::System.Environment.NewLine, global::System.StringComparison.CurrentCulture)) { - endsWithNewline = true; + this.endsWithNewline = true; } // This is an optimization. If the current indent is "", then we don't have to do any // of the more complex stuff further down. - if ((currentIndentField.Length == 0)) + if ((this.currentIndentField.Length == 0)) { - GenerationEnvironment.Append(textToAppend); + this.GenerationEnvironment.Append(textToAppend); return; } // Everywhere there is a newline in the text, add an indent after it - textToAppend = textToAppend.Replace(global::System.Environment.NewLine, (global::System.Environment.NewLine + currentIndentField)); + textToAppend = textToAppend.Replace(global::System.Environment.NewLine, (global::System.Environment.NewLine + this.currentIndentField)); // If the text ends with a newline, then we should strip off the indent added at the very end // because the appropriate indent will be added when the next time Write() is called - if (endsWithNewline) + if (this.endsWithNewline) { - GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - currentIndentField.Length)); + this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length)); } else { - GenerationEnvironment.Append(textToAppend); + this.GenerationEnvironment.Append(textToAppend); } } /// @@ -188,23 +188,23 @@ public void Write(string textToAppend) /// public void WriteLine(string textToAppend) { - Write(textToAppend); - GenerationEnvironment.AppendLine(); - endsWithNewline = true; + this.Write(textToAppend); + this.GenerationEnvironment.AppendLine(); + this.endsWithNewline = true; } /// /// Write formatted text directly into the generated output /// public void Write(string format, params object[] args) { - Write(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); + this.Write(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); } /// /// Write formatted text directly into the generated output /// public void WriteLine(string format, params object[] args) { - WriteLine(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); + this.WriteLine(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); } /// /// Raise an error @@ -213,7 +213,7 @@ public void Error(string message) { System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError(); error.ErrorText = message; - Errors.Add(error); + this.Errors.Add(error); } /// /// Raise a warning @@ -223,7 +223,7 @@ public void Warning(string message) System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError(); error.ErrorText = message; error.IsWarning = true; - Errors.Add(error); + this.Errors.Add(error); } /// /// Increase the indent @@ -234,8 +234,8 @@ public void PushIndent(string indent) { throw new global::System.ArgumentNullException("indent"); } - currentIndentField = (currentIndentField + indent); - indentLengths.Add(indent.Length); + this.currentIndentField = (this.currentIndentField + indent); + this.indentLengths.Add(indent.Length); } /// /// Remove the last indent that was added with PushIndent @@ -243,14 +243,14 @@ public void PushIndent(string indent) public string PopIndent() { string returnValue = ""; - if ((indentLengths.Count > 0)) + if ((this.indentLengths.Count > 0)) { - int indentLength = indentLengths[(indentLengths.Count - 1)]; - indentLengths.RemoveAt((indentLengths.Count - 1)); + int indentLength = this.indentLengths[(this.indentLengths.Count - 1)]; + this.indentLengths.RemoveAt((this.indentLengths.Count - 1)); if ((indentLength > 0)) { - returnValue = currentIndentField.Substring((currentIndentField.Length - indentLength)); - currentIndentField = currentIndentField.Remove((currentIndentField.Length - indentLength)); + returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength)); + this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength)); } } return returnValue; @@ -260,8 +260,8 @@ public string PopIndent() /// public void ClearIndent() { - indentLengths.Clear(); - currentIndentField = ""; + this.indentLengths.Clear(); + this.currentIndentField = ""; } #endregion #region ToString Helpers @@ -278,13 +278,13 @@ public System.IFormatProvider FormatProvider { get { - return formatProviderField ; + return this.formatProviderField ; } set { if ((value != null)) { - formatProviderField = value; + this.formatProviderField = value; } } } @@ -307,7 +307,7 @@ public string ToStringWithCulture(object objectToConvert) else { return ((string)(method.Invoke(objectToConvert, new object[] { - formatProviderField }))); + this.formatProviderField }))); } } } @@ -319,7 +319,7 @@ public ToStringInstanceHelper ToStringHelper { get { - return toStringHelperField; + return this.toStringHelperField; } } #endregion diff --git a/src/mlnet/Templates/Console/PredictProject.tt b/src/mlnet/Templates/Console/PredictProject.tt index 6895a717b2..a052408d84 100644 --- a/src/mlnet/Templates/Console/PredictProject.tt +++ b/src/mlnet/Templates/Console/PredictProject.tt @@ -11,15 +11,15 @@ netcoreapp2.1 - + <# if (IncludeLightGBMPackage){ #> - + <#}#> <# if (IncludeMklComponentsPackage){ #> - + <#}#> <# if (IncludeFastTreePackage){ #> - + <#}#> diff --git a/test/mlnet.Tests/ApprovalTests/ConsoleCodeGeneratorTests.ConsoleAppProjectFileContentTest.approved.txt b/test/mlnet.Tests/ApprovalTests/ConsoleCodeGeneratorTests.ConsoleAppProjectFileContentTest.approved.txt index 12908b1088..d256f0bd62 100644 --- a/test/mlnet.Tests/ApprovalTests/ConsoleCodeGeneratorTests.ConsoleAppProjectFileContentTest.approved.txt +++ b/test/mlnet.Tests/ApprovalTests/ConsoleCodeGeneratorTests.ConsoleAppProjectFileContentTest.approved.txt @@ -5,9 +5,9 @@ netcoreapp2.1 - - - + + + diff --git a/test/mlnet.Tests/ApprovalTests/ConsoleCodeGeneratorTests.ModelProjectFileContentTest.approved.txt b/test/mlnet.Tests/ApprovalTests/ConsoleCodeGeneratorTests.ModelProjectFileContentTest.approved.txt index e97ae2fa8b..e321e2daf5 100644 --- a/test/mlnet.Tests/ApprovalTests/ConsoleCodeGeneratorTests.ModelProjectFileContentTest.approved.txt +++ b/test/mlnet.Tests/ApprovalTests/ConsoleCodeGeneratorTests.ModelProjectFileContentTest.approved.txt @@ -4,10 +4,10 @@ netcoreapp2.1 - - - - + + + +