diff --git a/src/Microsoft.ML.Api/TypedCursor.cs b/src/Microsoft.ML.Api/TypedCursor.cs index eda5b6656b..67fc91439e 100644 --- a/src/Microsoft.ML.Api/TypedCursor.cs +++ b/src/Microsoft.ML.Api/TypedCursor.cs @@ -658,7 +658,7 @@ public static ICursorable AsCursorable(this IDataView data, bool ign where TRow : class, new() { // REVIEW: Take an env as a parameter. - var env = new TlcEnvironment(); + var env = new ConsoleEnvironment(); return data.AsCursorable(env, ignoreMissingColumns, schemaDefinition); } @@ -699,7 +699,7 @@ public static IEnumerable AsEnumerable(this IDataView data, bool reu where TRow : class, new() { // REVIEW: Take an env as a parameter. - var env = new TlcEnvironment(); + var env = new ConsoleEnvironment(); return data.AsEnumerable(env, reuseRowObject, ignoreMissingColumns, schemaDefinition); } } diff --git a/src/Microsoft.ML.Core/Data/ProgressReporter.cs b/src/Microsoft.ML.Core/Data/ProgressReporter.cs index 5f9575cca5..f8850c8ac5 100644 --- a/src/Microsoft.ML.Core/Data/ProgressReporter.cs +++ b/src/Microsoft.ML.Core/Data/ProgressReporter.cs @@ -17,7 +17,7 @@ namespace Microsoft.ML.Runtime.Data public static class ProgressReporting { /// - /// The progress channel for . + /// The progress channel for . /// This is coupled with a that aggregates all events and returns them on demand. /// public sealed class ProgressChannel : IProgressChannel diff --git a/src/Microsoft.ML.Core/Environment/TlcEnvironment.cs b/src/Microsoft.ML.Core/Environment/ConsoleEnvironment.cs similarity index 88% rename from src/Microsoft.ML.Core/Environment/TlcEnvironment.cs rename to src/Microsoft.ML.Core/Environment/ConsoleEnvironment.cs index 13781c5c11..df89592b13 100644 --- a/src/Microsoft.ML.Core/Environment/TlcEnvironment.cs +++ b/src/Microsoft.ML.Core/Environment/ConsoleEnvironment.cs @@ -15,14 +15,14 @@ namespace Microsoft.ML.Runtime.Data { using Stopwatch = System.Diagnostics.Stopwatch; - public sealed class TlcEnvironment : HostEnvironmentBase + public sealed class ConsoleEnvironment : HostEnvironmentBase { public const string ComponentHistoryKey = "ComponentHistory"; private sealed class ConsoleWriter { private readonly object _lock; - private readonly TlcEnvironment _parent; + private readonly ConsoleEnvironment _parent; private readonly TextWriter _out; private readonly TextWriter _err; @@ -34,7 +34,7 @@ private sealed class ConsoleWriter private const int _maxDots = 50; private int _dots; - public ConsoleWriter(TlcEnvironment parent, TextWriter outWriter, TextWriter errWriter) + public ConsoleWriter(ConsoleEnvironment parent, TextWriter outWriter, TextWriter errWriter) { Contracts.AssertValue(parent); Contracts.AssertValue(outWriter); @@ -331,7 +331,7 @@ private bool PrintDot() private sealed class Channel : ChannelBase { public readonly Stopwatch Watch; - public Channel(TlcEnvironment root, ChannelProviderBase parent, string shortName, + public Channel(ConsoleEnvironment root, ChannelProviderBase parent, string shortName, Action dispatch) : base(root, parent, shortName, dispatch) { @@ -358,20 +358,36 @@ protected override void DisposeCore() private volatile ConsoleWriter _consoleWriter; private readonly MessageSensitivity _sensitivityFlags; - public TlcEnvironment(int? seed = null, bool verbose = false, + /// + /// Create an ML.NET for local execution, with console feedback. + /// + /// Random seed. Set to null for a non-deterministic environment. + /// Set to true for fully verbose logging. + /// Allowed message sensitivity. + /// Concurrency level. Set to 1 to run single-threaded. Set to 0 to pick automatically. + /// Text writer to print normal messages to. + /// Text writer to print error messages to. + public ConsoleEnvironment(int? seed = null, bool verbose = false, MessageSensitivity sensitivity = MessageSensitivity.All, int conc = 0, TextWriter outWriter = null, TextWriter errWriter = null) : this(RandomUtils.Create(seed), verbose, sensitivity, conc, outWriter, errWriter) { } + // REVIEW: do we really care about custom random? If we do, let's make this ctor public. /// - /// This takes ownership of the random number generator. + /// Create an ML.NET environment for local execution, with console feedback. /// - public TlcEnvironment(IRandom rand, bool verbose = false, + /// An custom source of randomness to use in the environment. + /// Set to true for fully verbose logging. + /// Allowed message sensitivity. + /// Concurrency level. Set to 1 to run single-threaded. Set to 0 to pick automatically. + /// Text writer to print normal messages to. + /// Text writer to print error messages to. + private ConsoleEnvironment(IRandom rand, bool verbose = false, MessageSensitivity sensitivity = MessageSensitivity.All, int conc = 0, TextWriter outWriter = null, TextWriter errWriter = null) - : base(rand, verbose, conc, nameof(TlcEnvironment)) + : base(rand, verbose, conc, nameof(ConsoleEnvironment)) { Contracts.CheckValueOrNull(outWriter); Contracts.CheckValueOrNull(errWriter); @@ -401,7 +417,7 @@ protected override IFileHandle CreateTempFileCore(IHostEnvironment env, string s return base.CreateTempFileCore(env, suffix, "TLC_" + prefix); } - protected override IHost RegisterCore(HostEnvironmentBase source, string shortName, string parentFullName, IRandom rand, bool verbose, int? conc) + protected override IHost RegisterCore(HostEnvironmentBase source, string shortName, string parentFullName, IRandom rand, bool verbose, int? conc) { Contracts.AssertValue(rand); Contracts.AssertValueOrNull(parentFullName); @@ -413,7 +429,7 @@ protected override IHost RegisterCore(HostEnvironmentBase source protected override IChannel CreateCommChannel(ChannelProviderBase parent, string name) { Contracts.AssertValue(parent); - Contracts.Assert(parent is TlcEnvironment); + Contracts.Assert(parent is ConsoleEnvironment); Contracts.AssertNonEmpty(name); return new Channel(this, parent, name, GetDispatchDelegate()); } @@ -421,7 +437,7 @@ protected override IChannel CreateCommChannel(ChannelProviderBase parent, string protected override IPipe CreatePipe(ChannelProviderBase parent, string name) { Contracts.AssertValue(parent); - Contracts.Assert(parent is TlcEnvironment); + Contracts.Assert(parent is ConsoleEnvironment); Contracts.AssertNonEmpty(name); return new Pipe(parent, name, GetDispatchDelegate()); } @@ -439,11 +455,11 @@ internal IDisposable RedirectChannelOutput(TextWriter newOutWriter, TextWriter n private sealed class OutputRedirector : IDisposable { - private readonly TlcEnvironment _root; + private readonly ConsoleEnvironment _root; private ConsoleWriter _oldConsoleWriter; private readonly ConsoleWriter _newConsoleWriter; - public OutputRedirector(TlcEnvironment env, TextWriter newOutWriter, TextWriter newErrWriter) + public OutputRedirector(ConsoleEnvironment env, TextWriter newOutWriter, TextWriter newErrWriter) { Contracts.AssertValue(env); Contracts.AssertValue(newOutWriter); @@ -467,7 +483,7 @@ public void Dispose() private sealed class Host : HostBase { - public Host(HostEnvironmentBase source, string shortName, string parentFullName, IRandom rand, bool verbose, int? conc) + public Host(HostEnvironmentBase source, string shortName, string parentFullName, IRandom rand, bool verbose, int? conc) : base(source, shortName, parentFullName, rand, verbose, conc) { IsCancelled = source.IsCancelled; @@ -489,7 +505,7 @@ protected override IPipe CreatePipe(ChannelProviderBase pare return new Pipe(parent, name, GetDispatchDelegate()); } - protected override IHost RegisterCore(HostEnvironmentBase source, string shortName, string parentFullName, IRandom rand, bool verbose, int? conc) + protected override IHost RegisterCore(HostEnvironmentBase source, string shortName, string parentFullName, IRandom rand, bool verbose, int? conc) { return new Host(source, shortName, parentFullName, rand, verbose, conc); } diff --git a/src/Microsoft.ML.Data/Utilities/LocalEnvironment.cs b/src/Microsoft.ML.Data/Utilities/LocalEnvironment.cs new file mode 100644 index 0000000000..5a28a9b27c --- /dev/null +++ b/src/Microsoft.ML.Data/Utilities/LocalEnvironment.cs @@ -0,0 +1,131 @@ +// 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 System; + +namespace Microsoft.ML.Runtime.Data +{ + using Stopwatch = System.Diagnostics.Stopwatch; + + /// + /// An ML.NET environment for local execution. + /// + public sealed class LocalEnvironment : HostEnvironmentBase + { + private sealed class Channel : ChannelBase + { + public readonly Stopwatch Watch; + public Channel(LocalEnvironment root, ChannelProviderBase parent, string shortName, + Action dispatch) + : base(root, parent, shortName, dispatch) + { + Watch = Stopwatch.StartNew(); + Dispatch(this, new ChannelMessage(ChannelMessageKind.Trace, MessageSensitivity.None, "Channel started")); + } + + public override void Done() + { + Watch.Stop(); + ChannelFinished(); + base.Done(); + } + + private void ChannelFinished() + => Dispatch(this, new ChannelMessage(ChannelMessageKind.Trace, MessageSensitivity.None, "Channel finished. Elapsed { 0:c }.", Watch.Elapsed)); + + protected override void DisposeCore() + { + if (IsActive) + { + ChannelFinished(); + Watch.Stop(); + } + + Dispatch(this, new ChannelMessage(ChannelMessageKind.Trace, MessageSensitivity.None, "Channel disposed")); + base.DisposeCore(); + } + } + + /// + /// Create an ML.NET for local execution. + /// + /// Random seed. Set to null for a non-deterministic environment. + /// Concurrency level. Set to 1 to run single-threaded. Set to 0 to pick automatically. + public LocalEnvironment(int? seed = null, int conc = 0) + : base(RandomUtils.Create(seed), verbose: false, conc) + { + } + + /// + /// Add a custom listener to the messages of ML.NET components. + /// + public void AddListener(Action listener) + => AddListener(listener); + + /// + /// Remove a previously added a custom listener. + /// + public void RemoveListener(Action listener) + => RemoveListener(listener); + + protected override IFileHandle CreateTempFileCore(IHostEnvironment env, string suffix = null, string prefix = null) + => base.CreateTempFileCore(env, suffix, "Local_" + prefix); + + protected override IHost RegisterCore(HostEnvironmentBase source, string shortName, string parentFullName, IRandom rand, bool verbose, int? conc) + { + Contracts.AssertValue(rand); + Contracts.AssertValueOrNull(parentFullName); + Contracts.AssertNonEmpty(shortName); + Contracts.Assert(source == this || source is Host); + return new Host(source, shortName, parentFullName, rand, verbose, conc); + } + + protected override IChannel CreateCommChannel(ChannelProviderBase parent, string name) + { + Contracts.AssertValue(parent); + Contracts.Assert(parent is LocalEnvironment); + Contracts.AssertNonEmpty(name); + return new Channel(this, parent, name, GetDispatchDelegate()); + } + + protected override IPipe CreatePipe(ChannelProviderBase parent, string name) + { + Contracts.AssertValue(parent); + Contracts.Assert(parent is LocalEnvironment); + Contracts.AssertNonEmpty(name); + return new Pipe(parent, name, GetDispatchDelegate()); + } + + private sealed class Host : HostBase + { + public Host(HostEnvironmentBase source, string shortName, string parentFullName, IRandom rand, bool verbose, int? conc) + : base(source, shortName, parentFullName, rand, verbose, conc) + { + IsCancelled = source.IsCancelled; + } + + protected override IChannel CreateCommChannel(ChannelProviderBase parent, string name) + { + Contracts.AssertValue(parent); + Contracts.Assert(parent is Host); + Contracts.AssertNonEmpty(name); + return new Channel(Root, parent, name, GetDispatchDelegate()); + } + + protected override IPipe CreatePipe(ChannelProviderBase parent, string name) + { + Contracts.AssertValue(parent); + Contracts.Assert(parent is Host); + Contracts.AssertNonEmpty(name); + return new Pipe(parent, name, GetDispatchDelegate()); + } + + protected override IHost RegisterCore(HostEnvironmentBase source, string shortName, string parentFullName, IRandom rand, bool verbose, int? conc) + { + return new Host(source, shortName, parentFullName, rand, verbose, conc); + } + } + } + +} diff --git a/src/Microsoft.ML.FastTree/FastTree.cs b/src/Microsoft.ML.FastTree/FastTree.cs index 9f24b4bc09..8e5d48f260 100644 --- a/src/Microsoft.ML.FastTree/FastTree.cs +++ b/src/Microsoft.ML.FastTree/FastTree.cs @@ -110,8 +110,8 @@ private protected FastTreeTrainerBase(IHostEnvironment env, TArgs args) ParallelTraining = Args.ParallelTrainer != null ? Args.ParallelTrainer.CreateComponent(env) : new SingleTrainer(); ParallelTraining.InitEnvironment(); // REVIEW: CLR 4.6 has a bug that is only exposed in Scope, and if we trigger GC.Collect in scope environment - // with memory consumption more than 5GB, GC get stuck in infinite loop. So for now let's call GC only if we call things from TlcEnvironment. - AllowGC = (env is HostEnvironmentBase); + // with memory consumption more than 5GB, GC get stuck in infinite loop. So for now let's call GC only if we call things from ConsoleEnvironment. + AllowGC = (env is HostEnvironmentBase); Tests = new List(); InitializeThreads(numThreads); diff --git a/src/Microsoft.ML.Legacy/LearningPipeline.cs b/src/Microsoft.ML.Legacy/LearningPipeline.cs index 7711398c89..71ac97b80d 100644 --- a/src/Microsoft.ML.Legacy/LearningPipeline.cs +++ b/src/Microsoft.ML.Legacy/LearningPipeline.cs @@ -161,7 +161,7 @@ public PredictionModel Train() where TInput : class where TOutput : class, new() { - using (var environment = new TlcEnvironment(seed: _seed, conc: _conc)) + using (var environment = new ConsoleEnvironment(seed: _seed, conc: _conc)) { Experiment experiment = environment.CreateExperiment(); ILearningPipelineStep step = null; diff --git a/src/Microsoft.ML.Legacy/LearningPipelineDebugProxy.cs b/src/Microsoft.ML.Legacy/LearningPipelineDebugProxy.cs index 55934fb709..5df87ac098 100644 --- a/src/Microsoft.ML.Legacy/LearningPipelineDebugProxy.cs +++ b/src/Microsoft.ML.Legacy/LearningPipelineDebugProxy.cs @@ -25,7 +25,7 @@ internal sealed class LearningPipelineDebugProxy private const int MaxSlotNamesToDisplay = 100; private readonly LearningPipeline _pipeline; - private readonly TlcEnvironment _environment; + private readonly ConsoleEnvironment _environment; private IDataView _preview; private Exception _pipelineExecutionException; private PipelineItemDebugColumn[] _columns; @@ -39,7 +39,7 @@ public LearningPipelineDebugProxy(LearningPipeline pipeline) _pipeline = new LearningPipeline(); // use a ConcurrencyFactor of 1 so other threads don't need to run in the debugger - _environment = new TlcEnvironment(conc: 1); + _environment = new ConsoleEnvironment(conc: 1); foreach (ILearningPipelineItem item in pipeline) { diff --git a/src/Microsoft.ML.Legacy/Models/BinaryClassificationEvaluator.cs b/src/Microsoft.ML.Legacy/Models/BinaryClassificationEvaluator.cs index a986f7051e..71b32a323a 100644 --- a/src/Microsoft.ML.Legacy/Models/BinaryClassificationEvaluator.cs +++ b/src/Microsoft.ML.Legacy/Models/BinaryClassificationEvaluator.cs @@ -24,7 +24,7 @@ public sealed partial class BinaryClassificationEvaluator /// public BinaryClassificationMetrics Evaluate(PredictionModel model, ILearningPipelineLoader testData) { - using (var environment = new TlcEnvironment()) + using (var environment = new ConsoleEnvironment()) { environment.CheckValue(model, nameof(model)); environment.CheckValue(testData, nameof(testData)); diff --git a/src/Microsoft.ML.Legacy/Models/ClassificationEvaluator.cs b/src/Microsoft.ML.Legacy/Models/ClassificationEvaluator.cs index 56403e2782..63e7f8055e 100644 --- a/src/Microsoft.ML.Legacy/Models/ClassificationEvaluator.cs +++ b/src/Microsoft.ML.Legacy/Models/ClassificationEvaluator.cs @@ -25,7 +25,7 @@ public sealed partial class ClassificationEvaluator /// public ClassificationMetrics Evaluate(PredictionModel model, ILearningPipelineLoader testData) { - using (var environment = new TlcEnvironment()) + using (var environment = new ConsoleEnvironment()) { environment.CheckValue(model, nameof(model)); environment.CheckValue(testData, nameof(testData)); diff --git a/src/Microsoft.ML.Legacy/Models/ClusterEvaluator.cs b/src/Microsoft.ML.Legacy/Models/ClusterEvaluator.cs index b9fb0cb75e..411c85b176 100644 --- a/src/Microsoft.ML.Legacy/Models/ClusterEvaluator.cs +++ b/src/Microsoft.ML.Legacy/Models/ClusterEvaluator.cs @@ -24,7 +24,7 @@ public sealed partial class ClusterEvaluator /// public ClusterMetrics Evaluate(PredictionModel model, ILearningPipelineLoader testData) { - using (var environment = new TlcEnvironment()) + using (var environment = new ConsoleEnvironment()) { environment.CheckValue(model, nameof(model)); environment.CheckValue(testData, nameof(testData)); diff --git a/src/Microsoft.ML.Legacy/Models/CrossValidator.cs b/src/Microsoft.ML.Legacy/Models/CrossValidator.cs index 5d73096e7e..d9d133a779 100644 --- a/src/Microsoft.ML.Legacy/Models/CrossValidator.cs +++ b/src/Microsoft.ML.Legacy/Models/CrossValidator.cs @@ -27,7 +27,7 @@ public CrossValidationOutput CrossValidate(Lea where TInput : class where TOutput : class, new() { - using (var environment = new TlcEnvironment()) + using (var environment = new ConsoleEnvironment()) { Experiment subGraph = environment.CreateExperiment(); ILearningPipelineStep step = null; diff --git a/src/Microsoft.ML.Legacy/Models/OneVersusAll.cs b/src/Microsoft.ML.Legacy/Models/OneVersusAll.cs index 8e39eaca22..acd756556a 100644 --- a/src/Microsoft.ML.Legacy/Models/OneVersusAll.cs +++ b/src/Microsoft.ML.Legacy/Models/OneVersusAll.cs @@ -52,7 +52,7 @@ public OvaPipelineItem(ITrainerInputWithLabel trainer, bool useProbabilities) public ILearningPipelineStep ApplyStep(ILearningPipelineStep previousStep, Experiment experiment) { - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var subgraph = env.CreateExperiment(); subgraph.Add(_trainer); diff --git a/src/Microsoft.ML.Legacy/Models/OnnxConverter.cs b/src/Microsoft.ML.Legacy/Models/OnnxConverter.cs index e2bb10757d..7673ae90d6 100644 --- a/src/Microsoft.ML.Legacy/Models/OnnxConverter.cs +++ b/src/Microsoft.ML.Legacy/Models/OnnxConverter.cs @@ -61,7 +61,7 @@ public sealed partial class OnnxConverter /// Model that needs to be converted to ONNX format. public void Convert(PredictionModel model) { - using (var environment = new TlcEnvironment()) + using (var environment = new ConsoleEnvironment()) { environment.CheckValue(model, nameof(model)); diff --git a/src/Microsoft.ML.Legacy/Models/RegressionEvaluator.cs b/src/Microsoft.ML.Legacy/Models/RegressionEvaluator.cs index 5af025a01b..35a7fd7500 100644 --- a/src/Microsoft.ML.Legacy/Models/RegressionEvaluator.cs +++ b/src/Microsoft.ML.Legacy/Models/RegressionEvaluator.cs @@ -24,7 +24,7 @@ public sealed partial class RegressionEvaluator /// public RegressionMetrics Evaluate(PredictionModel model, ILearningPipelineLoader testData) { - using (var environment = new TlcEnvironment()) + using (var environment = new ConsoleEnvironment()) { environment.CheckValue(model, nameof(model)); environment.CheckValue(testData, nameof(testData)); diff --git a/src/Microsoft.ML.Legacy/Models/TrainTestEvaluator.cs b/src/Microsoft.ML.Legacy/Models/TrainTestEvaluator.cs index 6ae1b88129..6972b8cf3e 100644 --- a/src/Microsoft.ML.Legacy/Models/TrainTestEvaluator.cs +++ b/src/Microsoft.ML.Legacy/Models/TrainTestEvaluator.cs @@ -30,7 +30,7 @@ public TrainTestEvaluatorOutput TrainTestEvaluate> ReadAsync( if (stream == null) throw new ArgumentNullException(nameof(stream)); - using (var environment = new TlcEnvironment()) + using (var environment = new ConsoleEnvironment()) { BatchPredictionEngine predictor = environment.CreateBatchPredictionEngine(stream); diff --git a/src/Microsoft.ML.Maml/MAML.cs b/src/Microsoft.ML.Maml/MAML.cs index cb75151379..cac407c21a 100644 --- a/src/Microsoft.ML.Maml/MAML.cs +++ b/src/Microsoft.ML.Maml/MAML.cs @@ -76,7 +76,7 @@ private static int MainWithProgress(string args) private static bool ShouldAlwaysPrintStacktrace() => false; - private static TlcEnvironment CreateEnvironment() + private static ConsoleEnvironment CreateEnvironment() { string sensitivityString = null; MessageSensitivity sensitivity = MessageSensitivity.All; @@ -90,7 +90,7 @@ private static TlcEnvironment CreateEnvironment() sensitivity = MessageSensitivity.All; } } - return new TlcEnvironment(sensitivity: sensitivity); + return new ConsoleEnvironment(sensitivity: sensitivity); } /// @@ -104,7 +104,7 @@ private static TlcEnvironment CreateEnvironment() /// so we always write . If set to true though, this executable will also print stack traces from the /// marked exceptions as well. /// - internal static int MainCore(TlcEnvironment env, string args, bool alwaysPrintStacktrace) + internal static int MainCore(ConsoleEnvironment env, string args, bool alwaysPrintStacktrace) { // REVIEW: How should extra dlls, tracking, etc be handled? Should the args objects for // all commands derive from a common base? @@ -212,7 +212,7 @@ internal static int MainCore(TlcEnvironment env, string args, bool alwaysPrintSt } } - private static void TrackProgress(TlcEnvironment env, CancellationToken ct) + private static void TrackProgress(ConsoleEnvironment env, CancellationToken ct) { try { @@ -292,7 +292,7 @@ private static void PrintExceptionData(TextWriter writer, Exception ex, bool inc writer.WriteLine("Exception context:"); } - if (TlcEnvironment.ComponentHistoryKey.Equals(kvp.Key)) + if (ConsoleEnvironment.ComponentHistoryKey.Equals(kvp.Key)) { if (kvp.Value is string[] createdComponents) { diff --git a/src/Microsoft.ML.PipelineInference/InferenceUtils.cs b/src/Microsoft.ML.PipelineInference/InferenceUtils.cs index 94f9fd48e8..a9527b9504 100644 --- a/src/Microsoft.ML.PipelineInference/InferenceUtils.cs +++ b/src/Microsoft.ML.PipelineInference/InferenceUtils.cs @@ -19,7 +19,7 @@ public static IDataView Take(this IDataView data, int count) { Contracts.CheckValue(data, nameof(data)); // REVIEW: This should take an env as a parameter, not create one. - var env = new TlcEnvironment(0); + var env = new ConsoleEnvironment(0); var take = SkipTakeFilter.Create(env, new SkipTakeFilter.TakeArguments { Count = count }, data); return CacheCore(take, env); } @@ -28,7 +28,7 @@ public static IDataView Cache(this IDataView data) { Contracts.CheckValue(data, nameof(data)); // REVIEW: This should take an env as a parameter, not create one. - return CacheCore(data, new TlcEnvironment(0)); + return CacheCore(data, new ConsoleEnvironment(0)); } private static IDataView CacheCore(IDataView data, IHostEnvironment env) diff --git a/src/Microsoft.ML.PipelineInference/TextFileContents.cs b/src/Microsoft.ML.PipelineInference/TextFileContents.cs index bc370bc5ee..aeb72ee0c9 100644 --- a/src/Microsoft.ML.PipelineInference/TextFileContents.cs +++ b/src/Microsoft.ML.PipelineInference/TextFileContents.cs @@ -115,7 +115,7 @@ private static bool TryParseFile(IChannel ch, TextLoader.Arguments args, IMultiS try { // No need to provide information from unsuccessful loader, so we create temporary environment and get information from it in case of success - using (var loaderEnv = new TlcEnvironment(0, true)) + using (var loaderEnv = new ConsoleEnvironment(0, true)) { var messages = new ConcurrentBag(); loaderEnv.AddListener( diff --git a/src/Microsoft.ML.ResultProcessor/ResultProcessor.cs b/src/Microsoft.ML.ResultProcessor/ResultProcessor.cs index b07be5b2c0..eb42e452bd 100644 --- a/src/Microsoft.ML.ResultProcessor/ResultProcessor.cs +++ b/src/Microsoft.ML.ResultProcessor/ResultProcessor.cs @@ -1173,7 +1173,7 @@ public static int Main(string[] args) protected static void Run(string[] args) { ResultProcessorArguments cmd = new ResultProcessorArguments(); - TlcEnvironment env = new TlcEnvironment(42); + ConsoleEnvironment env = new ConsoleEnvironment(42); List predictorResultsList = new List(); PredictionUtil.ParseArguments(env, cmd, PredictionUtil.CombineSettings(args)); diff --git a/test/Microsoft.ML.Benchmarks/KMeansAndLogisticRegressionBench.cs b/test/Microsoft.ML.Benchmarks/KMeansAndLogisticRegressionBench.cs index 32ca8981b0..234995d1e5 100644 --- a/test/Microsoft.ML.Benchmarks/KMeansAndLogisticRegressionBench.cs +++ b/test/Microsoft.ML.Benchmarks/KMeansAndLogisticRegressionBench.cs @@ -18,7 +18,7 @@ public class KMeansAndLogisticRegressionBench [Benchmark] public ParameterMixingCalibratedPredictor TrainKMeansAndLR() { - using (var env = new TlcEnvironment(seed: 1)) + using (var env = new ConsoleEnvironment(seed: 1)) { // Pipeline var loader = TextLoader.ReadFile(env, diff --git a/test/Microsoft.ML.Benchmarks/StochasticDualCoordinateAscentClassifierBench.cs b/test/Microsoft.ML.Benchmarks/StochasticDualCoordinateAscentClassifierBench.cs index 13f99c7885..7be306ff87 100644 --- a/test/Microsoft.ML.Benchmarks/StochasticDualCoordinateAscentClassifierBench.cs +++ b/test/Microsoft.ML.Benchmarks/StochasticDualCoordinateAscentClassifierBench.cs @@ -61,7 +61,7 @@ private Legacy.PredictionModel Train(string dataPath) [Benchmark] public void TrainSentiment() { - using (var env = new TlcEnvironment(seed: 1)) + using (var env = new ConsoleEnvironment(seed: 1)) { // Pipeline var loader = TextLoader.ReadFile(env, diff --git a/test/Microsoft.ML.Benchmarks/Text/MultiClassClassification.cs b/test/Microsoft.ML.Benchmarks/Text/MultiClassClassification.cs index 85c1cb0091..0a93b28c32 100644 --- a/test/Microsoft.ML.Benchmarks/Text/MultiClassClassification.cs +++ b/test/Microsoft.ML.Benchmarks/Text/MultiClassClassification.cs @@ -46,7 +46,7 @@ public void SetupScoringSpeedTests() SetupTrainingSpeedTests(); _modelPath_Wiki = Path.Combine(Directory.GetCurrentDirectory(), @"WikiModel.zip"); string cmd = @"CV k=5 data=" + _dataPath_Wiki + " loader=TextLoader{quote=- sparse=- col=Label:R4:0 col=rev_id:TX:1 col=comment:TX:2 col=logged_in:BL:4 col=ns:TX:5 col=sample:TX:6 col=split:TX:7 col=year:R4:3 header=+} xf=Convert{col=logged_in type=R4} xf=CategoricalTransform{col=ns} xf=TextTransform{col=FeaturesText:comment wordExtractor=NGramExtractorTransform{ngram=2}} xf=Concat{col=Features:FeaturesText,logged_in,ns} tr=OVA{p=AveragedPerceptron{iter=10}} out={" + _modelPath_Wiki + "}"; - using (var tlc = new TlcEnvironment(verbose: false, sensitivity: MessageSensitivity.None, outWriter: EmptyWriter.Instance)) + using (var tlc = new ConsoleEnvironment(verbose: false, sensitivity: MessageSensitivity.None, outWriter: EmptyWriter.Instance)) { Maml.MainCore(tlc, cmd, alwaysPrintStacktrace: false); } @@ -56,7 +56,7 @@ public void SetupScoringSpeedTests() public void CV_Multiclass_WikiDetox_BigramsAndTrichar_OVAAveragedPerceptron() { string cmd = @"CV k=5 data=" + _dataPath_Wiki + " loader=TextLoader{quote=- sparse=- col=Label:R4:0 col=rev_id:TX:1 col=comment:TX:2 col=logged_in:BL:4 col=ns:TX:5 col=sample:TX:6 col=split:TX:7 col=year:R4:3 header=+} xf=Convert{col=logged_in type=R4} xf=CategoricalTransform{col=ns} xf=TextTransform{col=FeaturesText:comment wordExtractor=NGramExtractorTransform{ngram=2}} xf=Concat{col=Features:FeaturesText,logged_in,ns} tr=OVA{p=AveragedPerceptron{iter=10}}"; - using (var tlc = new TlcEnvironment(verbose: false, sensitivity: MessageSensitivity.None, outWriter: EmptyWriter.Instance)) + using (var tlc = new ConsoleEnvironment(verbose: false, sensitivity: MessageSensitivity.None, outWriter: EmptyWriter.Instance)) { Maml.MainCore(tlc, cmd, alwaysPrintStacktrace: false); } @@ -66,7 +66,7 @@ public void CV_Multiclass_WikiDetox_BigramsAndTrichar_OVAAveragedPerceptron() public void CV_Multiclass_WikiDetox_BigramsAndTrichar_LightGBMMulticlass() { string cmd = @"CV k=5 data=" + _dataPath_Wiki + " loader=TextLoader{quote=- sparse=- col=Label:R4:0 col=rev_id:TX:1 col=comment:TX:2 col=logged_in:BL:4 col=ns:TX:5 col=sample:TX:6 col=split:TX:7 col=year:R4:3 header=+} xf=Convert{col=logged_in type=R4} xf=CategoricalTransform{col=ns} xf=TextTransform{col=FeaturesText:comment wordExtractor=NGramExtractorTransform{ngram=2}} xf=Concat{col=Features:FeaturesText,logged_in,ns} tr=LightGBMMulticlass{}"; - using (var tlc = new TlcEnvironment(verbose: false, sensitivity: MessageSensitivity.None, outWriter: EmptyWriter.Instance)) + using (var tlc = new ConsoleEnvironment(verbose: false, sensitivity: MessageSensitivity.None, outWriter: EmptyWriter.Instance)) { Maml.MainCore(tlc, cmd, alwaysPrintStacktrace: false); } @@ -78,7 +78,7 @@ public void Test_Multiclass_WikiDetox_BigramsAndTrichar_OVAAveragedPerceptron() // This benchmark is profiling bulk scoring speed and not training speed. string modelpath = Path.Combine(Directory.GetCurrentDirectory(), @"WikiModel.fold000.zip"); string cmd = @"Test data=" + _dataPath_Wiki + " in=" + modelpath; - using (var tlc = new TlcEnvironment(verbose: false, sensitivity: MessageSensitivity.None, outWriter: EmptyWriter.Instance)) + using (var tlc = new ConsoleEnvironment(verbose: false, sensitivity: MessageSensitivity.None, outWriter: EmptyWriter.Instance)) { Maml.MainCore(tlc, cmd, alwaysPrintStacktrace: false); } @@ -88,7 +88,7 @@ public void Test_Multiclass_WikiDetox_BigramsAndTrichar_OVAAveragedPerceptron() public void CV_Multiclass_WikiDetox_WordEmbeddings_OVAAveragedPerceptron() { string cmd = @"CV tr=OVA{p=AveragedPerceptron{iter=10}} k=5 loader=TextLoader{quote=- sparse=- col=Label:R4:0 col=rev_id:TX:1 col=comment:TX:2 col=logged_in:BL:4 col=ns:TX:5 col=sample:TX:6 col=split:TX:7 col=year:R4:3 header=+} data=" + _dataPath_Wiki + " xf=Convert{col=logged_in type=R4} xf=CategoricalTransform{col=ns} xf=TextTransform{col=FeaturesText:comment tokens=+ wordExtractor=NGramExtractorTransform{ngram=2}} xf=WordEmbeddingsTransform{col=FeaturesWordEmbedding:FeaturesText_TransformedText model=FastTextWikipedia300D} xf=Concat{col=Features:FeaturesText,FeaturesWordEmbedding,logged_in,ns}"; - using (var tlc = new TlcEnvironment(verbose: false, sensitivity: MessageSensitivity.None, outWriter: EmptyWriter.Instance)) + using (var tlc = new ConsoleEnvironment(verbose: false, sensitivity: MessageSensitivity.None, outWriter: EmptyWriter.Instance)) { Maml.MainCore(tlc, cmd, alwaysPrintStacktrace: false); } @@ -98,7 +98,7 @@ public void CV_Multiclass_WikiDetox_WordEmbeddings_OVAAveragedPerceptron() public void CV_Multiclass_WikiDetox_WordEmbeddings_SDCAMC() { string cmd = @"CV tr=SDCAMC k=5 loader=TextLoader{quote=- sparse=- col=Label:R4:0 col=rev_id:TX:1 col=comment:TX:2 col=logged_in:BL:4 col=ns:TX:5 col=sample:TX:6 col=split:TX:7 col=year:R4:3 header=+} data=" + _dataPath_Wiki + " xf=Convert{col=logged_in type=R4} xf=CategoricalTransform{col=ns} xf=TextTransform{col=FeaturesText:comment tokens=+ wordExtractor={} charExtractor={}} xf=WordEmbeddingsTransform{col=FeaturesWordEmbedding:FeaturesText_TransformedText model=FastTextWikipedia300D} xf=Concat{col=Features:FeaturesWordEmbedding,logged_in,ns}"; - using (var tlc = new TlcEnvironment(verbose: false, sensitivity: MessageSensitivity.None, outWriter: EmptyWriter.Instance)) + using (var tlc = new ConsoleEnvironment(verbose: false, sensitivity: MessageSensitivity.None, outWriter: EmptyWriter.Instance)) { Maml.MainCore(tlc, cmd, alwaysPrintStacktrace: false); } diff --git a/test/Microsoft.ML.Core.Tests/UnitTests/TestCSharpApi.cs b/test/Microsoft.ML.Core.Tests/UnitTests/TestCSharpApi.cs index ed8d39facf..92754a551b 100644 --- a/test/Microsoft.ML.Core.Tests/UnitTests/TestCSharpApi.cs +++ b/test/Microsoft.ML.Core.Tests/UnitTests/TestCSharpApi.cs @@ -23,7 +23,7 @@ public TestCSharpApi(ITestOutputHelper output) : base(output) public void TestSimpleExperiment() { var dataPath = GetDataPath("adult.tiny.with-schema.txt"); - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var experiment = env.CreateExperiment(); @@ -54,7 +54,7 @@ public void TestSimpleExperiment() public void TestSimpleTrainExperiment() { var dataPath = GetDataPath("adult.tiny.with-schema.txt"); - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var experiment = env.CreateExperiment(); @@ -123,7 +123,7 @@ public void TestSimpleTrainExperiment() public void TestTrainTestMacro() { var dataPath = GetDataPath("adult.tiny.with-schema.txt"); - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var subGraph = env.CreateExperiment(); @@ -195,7 +195,7 @@ public void TestTrainTestMacro() public void TestCrossValidationBinaryMacro() { var dataPath = GetDataPath("adult.tiny.with-schema.txt"); - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var subGraph = env.CreateExperiment(); @@ -264,7 +264,7 @@ public void TestCrossValidationBinaryMacro() public void TestCrossValidationMacro() { var dataPath = GetDataPath(TestDatasets.winequalitymacro.trainFilename); - using (var env = new TlcEnvironment(42)) + using (var env = new ConsoleEnvironment(42)) { var subGraph = env.CreateExperiment(); @@ -411,7 +411,7 @@ public void TestCrossValidationMacro() public void TestCrossValidationMacroWithMultiClass() { var dataPath = GetDataPath(@"Train-Tiny-28x28.txt"); - using (var env = new TlcEnvironment(42)) + using (var env = new ConsoleEnvironment(42)) { var subGraph = env.CreateExperiment(); @@ -540,7 +540,7 @@ public void TestCrossValidationMacroWithMultiClass() public void TestCrossValidationMacroMultiClassWithWarnings() { var dataPath = GetDataPath(@"Train-Tiny-28x28.txt"); - using (var env = new TlcEnvironment(42)) + using (var env = new ConsoleEnvironment(42)) { var subGraph = env.CreateExperiment(); @@ -619,7 +619,7 @@ public void TestCrossValidationMacroMultiClassWithWarnings() public void TestCrossValidationMacroWithStratification() { var dataPath = GetDataPath(@"breast-cancer.txt"); - using (var env = new TlcEnvironment(42)) + using (var env = new ConsoleEnvironment(42)) { var subGraph = env.CreateExperiment(); @@ -715,7 +715,7 @@ public void TestCrossValidationMacroWithStratification() public void TestCrossValidationMacroWithNonDefaultNames() { string dataPath = GetDataPath(@"adult.tiny.with-schema.txt"); - using (var env = new TlcEnvironment(42)) + using (var env = new ConsoleEnvironment(42)) { var subGraph = env.CreateExperiment(); @@ -844,7 +844,7 @@ public void TestCrossValidationMacroWithNonDefaultNames() public void TestOvaMacro() { var dataPath = GetDataPath(@"iris.txt"); - using (var env = new TlcEnvironment(42)) + using (var env = new ConsoleEnvironment(42)) { // Specify subgraph for OVA var subGraph = env.CreateExperiment(); @@ -903,7 +903,7 @@ public void TestOvaMacro() public void TestOvaMacroWithUncalibratedLearner() { var dataPath = GetDataPath(@"iris.txt"); - using (var env = new TlcEnvironment(42)) + using (var env = new ConsoleEnvironment(42)) { // Specify subgraph for OVA var subGraph = env.CreateExperiment(); @@ -962,7 +962,7 @@ public void TestOvaMacroWithUncalibratedLearner() public void TestTensorFlowEntryPoint() { var dataPath = GetDataPath("Train-Tiny-28x28.txt"); - using (var env = new TlcEnvironment(42)) + using (var env = new ConsoleEnvironment(42)) { var experiment = env.CreateExperiment(); diff --git a/test/Microsoft.ML.Core.Tests/UnitTests/TestContracts.cs b/test/Microsoft.ML.Core.Tests/UnitTests/TestContracts.cs index db1f731392..6b4fd5297f 100644 --- a/test/Microsoft.ML.Core.Tests/UnitTests/TestContracts.cs +++ b/test/Microsoft.ML.Core.Tests/UnitTests/TestContracts.cs @@ -42,7 +42,7 @@ private void Helper(IExceptionContext ectx, MessageSensitivity expected) [Fact] public void ExceptionSensitivity() { - var env = new TlcEnvironment(); + var env = new ConsoleEnvironment(); // Default sensitivity should be unknown, that is, all bits set. Helper(null, MessageSensitivity.Unknown); // If we set it to be not sensitive, then the messages should be marked insensitive, diff --git a/test/Microsoft.ML.Core.Tests/UnitTests/TestEarlyStoppingCriteria.cs b/test/Microsoft.ML.Core.Tests/UnitTests/TestEarlyStoppingCriteria.cs index 81bde14a2b..53b77440dc 100644 --- a/test/Microsoft.ML.Core.Tests/UnitTests/TestEarlyStoppingCriteria.cs +++ b/test/Microsoft.ML.Core.Tests/UnitTests/TestEarlyStoppingCriteria.cs @@ -14,7 +14,7 @@ public sealed class TestEarlyStoppingCriteria private IEarlyStoppingCriterion CreateEarlyStoppingCriterion(string name, string args, bool lowerIsBetter) { var sub = new SubComponent(name, args); - return sub.CreateInstance(new TlcEnvironment(), lowerIsBetter); + return sub.CreateInstance(new ConsoleEnvironment(), lowerIsBetter); } [Fact] diff --git a/test/Microsoft.ML.Core.Tests/UnitTests/TestHosts.cs b/test/Microsoft.ML.Core.Tests/UnitTests/TestHosts.cs index 13672bef75..ce01945bcb 100644 --- a/test/Microsoft.ML.Core.Tests/UnitTests/TestHosts.cs +++ b/test/Microsoft.ML.Core.Tests/UnitTests/TestHosts.cs @@ -20,7 +20,7 @@ public class TestHosts [Fact] public void TestCancellation() { - var env = new TlcEnvironment(seed: 42); + var env = new ConsoleEnvironment(seed: 42); for (int z = 0; z < 1000; z++) { var mainHost = env.Register("Main"); diff --git a/test/Microsoft.ML.Predictor.Tests/CmdLine/CmdLine.cs b/test/Microsoft.ML.Predictor.Tests/CmdLine/CmdLine.cs index 1a01f5e5b2..0839a57ed3 100644 --- a/test/Microsoft.ML.Predictor.Tests/CmdLine/CmdLine.cs +++ b/test/Microsoft.ML.Predictor.Tests/CmdLine/CmdLine.cs @@ -97,7 +97,7 @@ public void CmdParsingSingle() /// private static void Init(IndentingTextWriter wrt, object defaults) { - var env = new TlcEnvironment(seed: 42); + var env = new ConsoleEnvironment(seed: 42); wrt.WriteLine("Usage:"); wrt.WriteLine(CmdParser.ArgumentsUsage(env, defaults.GetType(), defaults, false, 200)); } @@ -107,7 +107,7 @@ private static void Init(IndentingTextWriter wrt, object defaults) /// private static void Process(IndentingTextWriter wrt, string text, ArgsBase defaults) { - var env = new TlcEnvironment(seed: 42); + var env = new ConsoleEnvironment(seed: 42); using (wrt.Nest()) { var args1 = defaults.Clone(); diff --git a/test/Microsoft.ML.Predictor.Tests/CmdLine/CmdLineReverseTest.cs b/test/Microsoft.ML.Predictor.Tests/CmdLine/CmdLineReverseTest.cs index 652a4a7bc6..2369136f95 100644 --- a/test/Microsoft.ML.Predictor.Tests/CmdLine/CmdLineReverseTest.cs +++ b/test/Microsoft.ML.Predictor.Tests/CmdLine/CmdLineReverseTest.cs @@ -19,7 +19,7 @@ public class CmdLineReverseTests [TestCategory("Cmd Parsing")] public void ArgumentParseTest() { - var env = new TlcEnvironment(seed: 42); + var env = new ConsoleEnvironment(seed: 42); var innerArg1 = new SimpleArg() { required = -2, diff --git a/test/Microsoft.ML.Predictor.Tests/TestAutoInference.cs b/test/Microsoft.ML.Predictor.Tests/TestAutoInference.cs index 44e8f523ea..1b991300ea 100644 --- a/test/Microsoft.ML.Predictor.Tests/TestAutoInference.cs +++ b/test/Microsoft.ML.Predictor.Tests/TestAutoInference.cs @@ -26,7 +26,7 @@ public TestAutoInference(ITestOutputHelper helper) [TestCategory("EntryPoints")] public void TestLearn() { - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { string pathData = GetDataPath("adult.train"); string pathDataTest = GetDataPath("adult.test"); @@ -72,7 +72,7 @@ public void TestLearn() [Fact(Skip = "Need CoreTLC specific baseline update")] public void TestTextDatasetLearn() { - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { string pathData = GetDataPath(@"../UnitTest/tweets_labeled_10k_test_validation.tsv"); int batchSize = 5; @@ -96,7 +96,7 @@ public void TestTextDatasetLearn() [Fact] public void TestPipelineNodeCloning() { - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var lr1 = RecipeInference .AllowedLearners(env, MacroUtils.TrainerKinds.SignatureBinaryClassifierTrainer) @@ -138,7 +138,7 @@ public void TestHyperparameterFreezing() int batchSize = 1; int numIterations = 10; int numTransformLevels = 3; - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { SupportedMetric metric = PipelineSweeperSupportedMetrics.GetSupportedMetric(PipelineSweeperSupportedMetrics.Metrics.Auc); @@ -186,7 +186,7 @@ public void TestRegressionPipelineWithMinimizingMetric() int batchSize = 5; int numIterations = 10; int numTransformLevels = 1; - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { SupportedMetric metric = PipelineSweeperSupportedMetrics.GetSupportedMetric(PipelineSweeperSupportedMetrics.Metrics.AccuracyMicro); @@ -220,7 +220,7 @@ public void TestLearnerConstrainingByName() int numIterations = 1; int numTransformLevels = 2; var retainedLearnerNames = new[] { $"LogisticRegressionBinaryClassifier", $"FastTreeBinaryClassifier" }; - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { SupportedMetric metric = PipelineSweeperSupportedMetrics.GetSupportedMetric(PipelineSweeperSupportedMetrics.Metrics.Auc); diff --git a/test/Microsoft.ML.Predictor.Tests/TestConcurrency.cs b/test/Microsoft.ML.Predictor.Tests/TestConcurrency.cs index de48fbe136..8b62205f05 100644 --- a/test/Microsoft.ML.Predictor.Tests/TestConcurrency.cs +++ b/test/Microsoft.ML.Predictor.Tests/TestConcurrency.cs @@ -40,7 +40,7 @@ private void TestParallelRun(string basePrefix, string command, string predictor string consName = basePrefix + "-out.raw"; string consOutPath = DeleteOutputPath(Category, consName); using (var writer = OpenWriter(consOutPath)) - using (var env = new TlcEnvironment(42, outWriter: writer, errWriter: writer)) + using (var env = new ConsoleEnvironment(42, outWriter: writer, errWriter: writer)) { int res = MainForTest(env, writer, cmd); if (res != 0) diff --git a/test/Microsoft.ML.Predictor.Tests/TestDatasetInference.cs b/test/Microsoft.ML.Predictor.Tests/TestDatasetInference.cs index 0bde64a2af..d6c3c6ec6c 100644 --- a/test/Microsoft.ML.Predictor.Tests/TestDatasetInference.cs +++ b/test/Microsoft.ML.Predictor.Tests/TestDatasetInference.cs @@ -35,7 +35,7 @@ public void DatasetInferenceTest() GetDataPath(@"..\UnitTest\breast-cancer.txt"), }; - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var h = env.Register("InferDatasetFeatures", seed: 0, verbose: false); @@ -93,7 +93,7 @@ public void InferSchemaCommandTest() GetDataPath(Path.Combine("..", "data", "wikipedia-detox-250-line-data.tsv")) }; - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var h = env.Register("InferSchemaCommandTest", seed: 0, verbose: false); using (var ch = h.Start("InferSchemaCommandTest")) @@ -128,7 +128,7 @@ public void InferRecipesCommandTest() GetDataPath(Path.Combine("..", "data", "wikipedia-detox-250-line-data-schema.txt"))) }; - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var h = env.Register("InferRecipesCommandTest", seed: 0, verbose: false); using (var ch = h.Start("InferRecipesCommandTest")) diff --git a/test/Microsoft.ML.Predictor.Tests/TestPipelineSweeper.cs b/test/Microsoft.ML.Predictor.Tests/TestPipelineSweeper.cs index db3b47c830..5f65ca4c28 100644 --- a/test/Microsoft.ML.Predictor.Tests/TestPipelineSweeper.cs +++ b/test/Microsoft.ML.Predictor.Tests/TestPipelineSweeper.cs @@ -117,7 +117,7 @@ public void PipelineSweeperNoTransforms() const int batchSize = 5; const int numIterations = 20; const int numTransformLevels = 2; - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { SupportedMetric metric = PipelineSweeperSupportedMetrics.GetSupportedMetric(PipelineSweeperSupportedMetrics.Metrics.Auc); diff --git a/test/Microsoft.ML.StaticPipelineTesting/ImageAnalyticsTests.cs b/test/Microsoft.ML.StaticPipelineTesting/ImageAnalyticsTests.cs index ddb673947f..ad29dbfde5 100644 --- a/test/Microsoft.ML.StaticPipelineTesting/ImageAnalyticsTests.cs +++ b/test/Microsoft.ML.StaticPipelineTesting/ImageAnalyticsTests.cs @@ -20,7 +20,7 @@ public ImageAnalyticsTests(ITestOutputHelper output) [Fact] public void SimpleImageSmokeTest() { - var env = new TlcEnvironment(new SysRandom(0), verbose: true); + var env = new ConsoleEnvironment(0, verbose: true); var reader = TextLoader.CreateReader(env, ctx => ctx.LoadText(0).LoadAsImage().AsGrayscale().Resize(10, 8).ExtractPixels()); diff --git a/test/Microsoft.ML.StaticPipelineTesting/StaticPipeTests.cs b/test/Microsoft.ML.StaticPipelineTesting/StaticPipeTests.cs index b217c1d073..0095d2f4cd 100644 --- a/test/Microsoft.ML.StaticPipelineTesting/StaticPipeTests.cs +++ b/test/Microsoft.ML.StaticPipelineTesting/StaticPipeTests.cs @@ -51,7 +51,7 @@ private void CheckSchemaHasColumn(ISchema schema, string name, out int idx) [Fact] public void SimpleTextLoaderCopyColumnsTest() { - var env = new TlcEnvironment(new SysRandom(0), verbose: true); + var env = new ConsoleEnvironment(0, verbose: true); const string data = "0 hello 3.14159 -0 2\n" + "1 1 2 4 15"; @@ -131,7 +131,7 @@ private static KeyValuePair P(string name, ColumnType type) [Fact] public void AssertStaticSimple() { - var env = new TlcEnvironment(new SysRandom(0), verbose: true); + var env = new ConsoleEnvironment(0, verbose: true); var schema = new SimpleSchema(env, P("hello", TextType.Instance), P("my", new VectorType(NumberType.I8, 5)), @@ -155,7 +155,7 @@ private sealed class MetaCounted : ICounted [Fact] public void AssertStaticKeys() { - var env = new TlcEnvironment(new SysRandom(0), verbose: true); + var env = new ConsoleEnvironment(0, verbose: true); var counted = new MetaCounted(); // We'll test a few things here. First, the case where the key-value metadata is text. @@ -262,7 +262,7 @@ public void AssertStaticKeys() [Fact] public void Normalizer() { - var env = new TlcEnvironment(seed: 0); + var env = new ConsoleEnvironment(seed: 0); var dataPath = GetDataPath("external", "winequality-white.csv"); var dataSource = new MultiFileSource(dataPath); @@ -287,7 +287,7 @@ public void Normalizer() [Fact] public void NormalizerWithOnFit() { - var env = new TlcEnvironment(seed: 0); + var env = new ConsoleEnvironment(seed: 0); var dataPath = GetDataPath("external", "winequality-white.csv"); var dataSource = new MultiFileSource(dataPath); @@ -331,7 +331,7 @@ public void NormalizerWithOnFit() [Fact] public void ToKey() { - var env = new TlcEnvironment(seed: 0); + var env = new ConsoleEnvironment(seed: 0); var dataPath = GetDataPath("iris.data"); var reader = TextLoader.CreateReader(env, c => (label: c.LoadText(4), values: c.LoadFloat(0, 3)), @@ -369,7 +369,7 @@ public void ToKey() [Fact] public void ConcatWith() { - var env = new TlcEnvironment(seed: 0); + var env = new ConsoleEnvironment(seed: 0); var dataPath = GetDataPath("iris.data"); var reader = TextLoader.CreateReader(env, c => (label: c.LoadText(4), values: c.LoadFloat(0, 3), value: c.LoadFloat(2)), diff --git a/test/Microsoft.ML.StaticPipelineTesting/Training.cs b/test/Microsoft.ML.StaticPipelineTesting/Training.cs index 3bc2cdd435..3385ad3e78 100644 --- a/test/Microsoft.ML.StaticPipelineTesting/Training.cs +++ b/test/Microsoft.ML.StaticPipelineTesting/Training.cs @@ -22,7 +22,7 @@ public Training(ITestOutputHelper output) : base(output) [Fact] public void SdcaRegression() { - var env = new TlcEnvironment(seed: 0); + var env = new ConsoleEnvironment(seed: 0); var dataPath = GetDataPath("external", "winequality-white.csv"); var dataSource = new MultiFileSource(dataPath); @@ -62,7 +62,7 @@ public void SdcaRegression() [Fact] public void SdcaRegressionNameCollision() { - var env = new TlcEnvironment(seed: 0); + var env = new ConsoleEnvironment(seed: 0); var dataPath = GetDataPath("external", "winequality-white.csv"); var dataSource = new MultiFileSource(dataPath); @@ -91,7 +91,7 @@ public void SdcaRegressionNameCollision() [Fact] public void SdcaBinaryClassification() { - var env = new TlcEnvironment(seed: 0); + var env = new ConsoleEnvironment(seed: 0); var dataPath = GetDataPath("breast-cancer.txt"); var dataSource = new MultiFileSource(dataPath); @@ -135,7 +135,7 @@ public void SdcaBinaryClassification() [Fact] public void SdcaBinaryClassificationNoClaibration() { - var env = new TlcEnvironment(seed: 0); + var env = new ConsoleEnvironment(seed: 0); var dataPath = GetDataPath("breast-cancer.txt"); var dataSource = new MultiFileSource(dataPath); @@ -177,7 +177,7 @@ public void SdcaBinaryClassificationNoClaibration() [Fact] public void SdcaMulticlass() { - var env = new TlcEnvironment(seed: 0); + var env = new ConsoleEnvironment(seed: 0); var dataPath = GetDataPath("iris.txt"); var dataSource = new MultiFileSource(dataPath); diff --git a/test/Microsoft.ML.Sweeper.Tests/SweeperTest.cs b/test/Microsoft.ML.Sweeper.Tests/SweeperTest.cs index 4bcb69874f..2f19a5c4f3 100644 --- a/test/Microsoft.ML.Sweeper.Tests/SweeperTest.cs +++ b/test/Microsoft.ML.Sweeper.Tests/SweeperTest.cs @@ -21,7 +21,7 @@ public void UniformRandomSweeperReturnsDistinctValuesWhenProposeSweep() DiscreteValueGenerator valueGenerator = CreateDiscreteValueGenerator(); using (var writer = new StreamWriter(new MemoryStream())) - using (var env = new TlcEnvironment(42, outWriter: writer, errWriter: writer)) + using (var env = new ConsoleEnvironment(42, outWriter: writer, errWriter: writer)) { var sweeper = new UniformRandomSweeper(env, new SweeperBase.ArgumentsBase(), @@ -41,7 +41,7 @@ public void RandomGridSweeperReturnsDistinctValuesWhenProposeSweep() DiscreteValueGenerator valueGenerator = CreateDiscreteValueGenerator(); using (var writer = new StreamWriter(new MemoryStream())) - using (var env = new TlcEnvironment(42, outWriter: writer, errWriter: writer)) + using (var env = new ConsoleEnvironment(42, outWriter: writer, errWriter: writer)) { var sweeper = new RandomGridSweeper(env, new RandomGridSweeper.Arguments(), diff --git a/test/Microsoft.ML.Sweeper.Tests/TestSweeper.cs b/test/Microsoft.ML.Sweeper.Tests/TestSweeper.cs index 031c1aaa20..99bbff2401 100644 --- a/test/Microsoft.ML.Sweeper.Tests/TestSweeper.cs +++ b/test/Microsoft.ML.Sweeper.Tests/TestSweeper.cs @@ -93,7 +93,7 @@ public void TestDiscreteValueSweep(double normalizedValue, string expected) [Fact] public void TestRandomSweeper() { - using (var env = new TlcEnvironment(42)) + using (var env = new ConsoleEnvironment(42)) { var args = new SweeperBase.ArgumentsBase() { @@ -135,7 +135,7 @@ public void TestRandomSweeper() public void TestSimpleSweeperAsync() { var random = new Random(42); - using (var env = new TlcEnvironment(42)) + using (var env = new ConsoleEnvironment(42)) { int sweeps = 100; var sweeper = new SimpleAsyncSweeper(env, new SweeperBase.ArgumentsBase @@ -185,7 +185,7 @@ public void TestSimpleSweeperAsync() public void TestDeterministicSweeperAsyncCancellation() { var random = new Random(42); - using (var env = new TlcEnvironment(42)) + using (var env = new ConsoleEnvironment(42)) { var args = new DeterministicSweeperAsync.Arguments(); args.BatchSize = 5; @@ -237,7 +237,7 @@ public void TestDeterministicSweeperAsyncCancellation() public void TestDeterministicSweeperAsync() { var random = new Random(42); - using (var env = new TlcEnvironment(42)) + using (var env = new ConsoleEnvironment(42)) { var args = new DeterministicSweeperAsync.Arguments(); args.BatchSize = 5; @@ -308,7 +308,7 @@ public void TestDeterministicSweeperAsync() public void TestDeterministicSweeperAsyncParallel() { var random = new Random(42); - using (var env = new TlcEnvironment(42)) + using (var env = new ConsoleEnvironment(42)) { int batchSize = 5; int sweeps = 20; @@ -362,7 +362,7 @@ public void TestDeterministicSweeperAsyncParallel() public async Task TestNelderMeadSweeperAsync() { var random = new Random(42); - using (var env = new TlcEnvironment(42)) + using (var env = new ConsoleEnvironment(42)) { int batchSize = 5; int sweeps = 40; @@ -441,7 +441,7 @@ private void CheckAsyncSweeperResult(List paramSets) [Fact] public void TestRandomGridSweeper() { - using (var env = new TlcEnvironment(42)) + using (var env = new ConsoleEnvironment(42)) { var args = new RandomGridSweeper.Arguments() { @@ -553,7 +553,7 @@ public void TestRandomGridSweeper() public void TestNelderMeadSweeper() { var random = new Random(42); - using (var env = new TlcEnvironment(42)) + using (var env = new ConsoleEnvironment(42)) { var param = new IComponentFactory[] { ComponentFactoryUtils.CreateFromFunction( @@ -612,7 +612,7 @@ public void TestSmacSweeper() RunMTAThread(() => { var random = new Random(42); - using (var env = new TlcEnvironment(42)) + using (var env = new ConsoleEnvironment(42)) { int maxInitSweeps = 5; var args = new SmacSweeper.Arguments() diff --git a/test/Microsoft.ML.TestFramework/BaseTestBaseline.cs b/test/Microsoft.ML.TestFramework/BaseTestBaseline.cs index f26c40b7e0..99fb602490 100644 --- a/test/Microsoft.ML.TestFramework/BaseTestBaseline.cs +++ b/test/Microsoft.ML.TestFramework/BaseTestBaseline.cs @@ -88,7 +88,7 @@ void IDisposable.Dispose() // The writer to write to test log files. protected StreamWriter LogWriter; - protected TlcEnvironment Env; + protected ConsoleEnvironment Env; private bool _normal; private bool _passed; @@ -108,7 +108,7 @@ public void Init() string logPath = Path.Combine(logDir, FullTestName + LogSuffix); LogWriter = OpenWriter(logPath); _passed = true; - Env = new TlcEnvironment(42, outWriter: LogWriter, errWriter: LogWriter); + Env = new ConsoleEnvironment(42, outWriter: LogWriter, errWriter: LogWriter); InitializeCore(); } @@ -857,7 +857,7 @@ protected static StreamReader OpenReader(string path) /// protected static int MainForTest(string args) { - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { int result = Maml.MainCore(env, args, false); return result; diff --git a/test/Microsoft.ML.TestFramework/DataPipe/TestDataPipeBase.cs b/test/Microsoft.ML.TestFramework/DataPipe/TestDataPipeBase.cs index 64c85d88b2..42766d3934 100644 --- a/test/Microsoft.ML.TestFramework/DataPipe/TestDataPipeBase.cs +++ b/test/Microsoft.ML.TestFramework/DataPipe/TestDataPipeBase.cs @@ -175,7 +175,7 @@ private void CheckSameSchemaShape(SchemaShape promised, SchemaShape delivered) /// protected IDataLoader TestCore(string pathData, bool keepHidden, string[] argsPipe, Action actLoader = null, string suffix = "", string suffixBase = null, bool checkBaseline = true, - bool forceDense = false, bool logCurs = false, TlcEnvironment env = null, bool roundTripText = true, + bool forceDense = false, bool logCurs = false, ConsoleEnvironment env = null, bool roundTripText = true, bool checkTranspose = false, bool checkId = true, bool baselineSchema = true) { Contracts.AssertValue(Env); diff --git a/test/Microsoft.ML.TestFramework/ModelHelper.cs b/test/Microsoft.ML.TestFramework/ModelHelper.cs index 1a99bb10ff..94341e4a85 100644 --- a/test/Microsoft.ML.TestFramework/ModelHelper.cs +++ b/test/Microsoft.ML.TestFramework/ModelHelper.cs @@ -13,7 +13,7 @@ namespace Microsoft.ML.TestFramework { public static class ModelHelper { - private static TlcEnvironment s_environment = new TlcEnvironment(seed: 1); + private static ConsoleEnvironment s_environment = new ConsoleEnvironment(seed: 1); private static ITransformModel s_housePriceModel; public static void WriteKcHousePriceModel(string dataPath, string outputModelPath) diff --git a/test/Microsoft.ML.TestFramework/TestCommandBase.cs b/test/Microsoft.ML.TestFramework/TestCommandBase.cs index 943ef77b0b..5338b1e2db 100644 --- a/test/Microsoft.ML.TestFramework/TestCommandBase.cs +++ b/test/Microsoft.ML.TestFramework/TestCommandBase.cs @@ -281,7 +281,7 @@ protected bool TestCore(RunContextBase ctx, string cmdName, string args, params Contracts.AssertValueOrNull(args); OutputPath outputPath = ctx.StdoutPath(); using (var newWriter = OpenWriter(outputPath.Path)) - using (var env = new TlcEnvironment(42, outWriter: newWriter, errWriter: newWriter)) + using (var env = new ConsoleEnvironment(42, outWriter: newWriter, errWriter: newWriter)) { int res; res = MainForTest(env, newWriter, string.Format("{0} {1}", cmdName, args), ctx.BaselineProgress); @@ -311,7 +311,7 @@ protected bool TestCore(RunContextBase ctx, string cmdName, string args, params /// /// The arguments for MAML. /// Whether to print the progress summary. If true, progress summary will appear in the end of baseline output file. - protected static int MainForTest(TlcEnvironment env, TextWriter writer, string args, bool printProgress = false) + protected static int MainForTest(ConsoleEnvironment env, TextWriter writer, string args, bool printProgress = false) { Contracts.AssertValue(env); Contracts.AssertValue(writer); @@ -480,7 +480,7 @@ private string DataArg(string dataPath) protected void TestPipeFromModel(string dataPath, OutputPath model) { - using (var env = new TlcEnvironment(new SysRandom(42))) + using (var env = new ConsoleEnvironment(42)) { var files = new MultiFileSource(dataPath); @@ -1956,7 +1956,7 @@ public void CommandTrainingBinaryFactorizationMachineWithValidation() string args = $"{loaderArgs} data={trainData} valid={validData} test={validData} {extraArgs} out={model}"; OutputPath outputPath = StdoutPath(); using (var newWriter = OpenWriter(outputPath.Path)) - using (var env = new TlcEnvironment(42, outWriter: newWriter, errWriter: newWriter)) + using (var env = new ConsoleEnvironment(42, outWriter: newWriter, errWriter: newWriter)) { int res = MainForTest(env, newWriter, string.Format("{0} {1}", "traintest", args), true); Assert.True(res == 0); @@ -1977,7 +1977,7 @@ public void CommandTrainingBinaryFieldAwareFactorizationMachineWithValidation() string args = $"{loaderArgs} data={trainData} valid={validData} test={validData} {extraArgs} out={model}"; OutputPath outputPath = StdoutPath(); using (var newWriter = OpenWriter(outputPath.Path)) - using (var env = new TlcEnvironment(42, outWriter: newWriter, errWriter: newWriter)) + using (var env = new ConsoleEnvironment(42, outWriter: newWriter, errWriter: newWriter)) { int res = MainForTest(env, newWriter, string.Format("{0} {1}", "traintest", args), true); Assert.Equal(0, res); @@ -1999,7 +1999,7 @@ public void CommandTrainingBinaryFactorizationMachineWithValidationAndInitializa OutputPath outputPath = StdoutPath(); string args = $"data={data} test={data} valid={data} in={model.Path} cont+" + " " + loaderArgs + " " + extraArgs; using (var newWriter = OpenWriter(outputPath.Path)) - using (var env = new TlcEnvironment(42, outWriter: newWriter, errWriter: newWriter)) + using (var env = new ConsoleEnvironment(42, outWriter: newWriter, errWriter: newWriter)) { int res = MainForTest(env, newWriter, string.Format("{0} {1}", "traintest", args), true); Assert.True(res == 0); @@ -2021,7 +2021,7 @@ public void CommandTrainingBinaryFieldAwareFactorizationMachineWithValidationAnd OutputPath outputPath = StdoutPath(); string args = $"data={data} test={data} valid={data} in={model.Path} cont+" + " " + loaderArgs + " " + extraArgs; using (var newWriter = OpenWriter(outputPath.Path)) - using (var env = new TlcEnvironment(42, outWriter: newWriter, errWriter: newWriter)) + using (var env = new ConsoleEnvironment(42, outWriter: newWriter, errWriter: newWriter)) { int res = MainForTest(env, newWriter, string.Format("{0} {1}", "traintest", args), true); Assert.True(res == 0); diff --git a/test/Microsoft.ML.TestFramework/TestSparseDataView.cs b/test/Microsoft.ML.TestFramework/TestSparseDataView.cs index 08c9e17a28..ad21acb4ac 100644 --- a/test/Microsoft.ML.TestFramework/TestSparseDataView.cs +++ b/test/Microsoft.ML.TestFramework/TestSparseDataView.cs @@ -47,7 +47,7 @@ private void GenericSparseDataView(T[] v1, T[] v2) new SparseExample() { X = new VBuffer (5, 3, v1, new int[] { 0, 2, 4 }) }, new SparseExample() { X = new VBuffer (5, 3, v2, new int[] { 0, 1, 3 }) } }; - using (var host = new TlcEnvironment()) + using (var host = new ConsoleEnvironment()) { var data = host.CreateStreamingDataView(inputs); var value = new VBuffer(); @@ -89,7 +89,7 @@ private void GenericDenseDataView(T[] v1, T[] v2) new DenseExample() { X = v1 }, new DenseExample() { X = v2 } }; - using (var host = new TlcEnvironment()) + using (var host = new ConsoleEnvironment()) { var data = host.CreateStreamingDataView(inputs); var value = new VBuffer(); diff --git a/test/Microsoft.ML.Tests/CollectionDataSourceTests.cs b/test/Microsoft.ML.Tests/CollectionDataSourceTests.cs index c12c22290d..3749676dcd 100644 --- a/test/Microsoft.ML.Tests/CollectionDataSourceTests.cs +++ b/test/Microsoft.ML.Tests/CollectionDataSourceTests.cs @@ -59,7 +59,7 @@ public void CheckConstructor() public void CanSuccessfullyApplyATransform() { var collection = CollectionDataSource.Create(new List() { new Input { Number1 = 1, String1 = "1" } }); - using (var environment = new TlcEnvironment()) + using (var environment = new ConsoleEnvironment()) { Experiment experiment = environment.CreateExperiment(); Legacy.ILearningPipelineDataStep output = (Legacy.ILearningPipelineDataStep)collection.ApplyStep(null, experiment); @@ -79,7 +79,7 @@ public void CanSuccessfullyEnumerated() new Input { Number1 = 3, String1 = "3" } }); - using (var environment = new TlcEnvironment()) + using (var environment = new ConsoleEnvironment()) { Experiment experiment = environment.CreateExperiment(); Legacy.ILearningPipelineDataStep output = collection.ApplyStep(null, experiment) as Legacy.ILearningPipelineDataStep; @@ -484,7 +484,7 @@ public void RoundTripConversionWithBasicTypes() new ConversionNullalbeClass() }; - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var dataView = ComponentCreation.CreateDataView(env, data); var enumeratorSimple = dataView.AsEnumerable(env, false).GetEnumerator(); @@ -517,7 +517,7 @@ public class ConversionNotSupportedMinValueClass [Fact] public void ConversionExceptionsBehavior() { - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var data = new ConversionNotSupportedMinValueClass[1]; foreach (var field in typeof(ConversionNotSupportedMinValueClass).GetFields()) @@ -553,7 +553,7 @@ public class ConversionLossMinValueClass [Fact] public void ConversionMinValueToNullBehavior() { - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var data = new List @@ -589,7 +589,7 @@ public class ConversionLossMinValueClassProperties [Fact] public void ConversionMinValueToNullBehaviorProperties() { - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var data = new List @@ -628,7 +628,7 @@ public void ClassWithConstFieldsConversion() new ClassWithConstField(){ fInt=0, fString =null } }; - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var dataView = ComponentCreation.CreateDataView(env, data); var enumeratorSimple = dataView.AsEnumerable(env, false).GetEnumerator(); @@ -657,7 +657,7 @@ public void ClassWithMixOfFieldsAndPropertiesConversion() new ClassWithMixOfFieldsAndProperties(){ IntProp=0, fString =null } }; - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var dataView = ComponentCreation.CreateDataView(env, data); var enumeratorSimple = dataView.AsEnumerable(env, false).GetEnumerator(); @@ -713,7 +713,7 @@ public void ClassWithPrivateFieldsAndPropertiesConversion() new ClassWithPrivateFieldsAndProperties(){ StringProp ="baba" } }; - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var dataView = ComponentCreation.CreateDataView(env, data); var enumeratorSimple = dataView.AsEnumerable(env, false).GetEnumerator(); @@ -747,7 +747,7 @@ public void ClassWithInheritedPropertiesConversion() new ClassWithInheritedProperties(){ IntProp=0, StringProp =null, LongProp=18, ByteProp=5 } }; - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var dataView = ComponentCreation.CreateDataView(env, data); var enumeratorSimple = dataView.AsEnumerable(env, false).GetEnumerator(); @@ -836,7 +836,7 @@ public void RoundTripConversionWithArrays() new ClassWithNullableArrays() }; - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var dataView = ComponentCreation.CreateDataView(env, data); var enumeratorSimple = dataView.AsEnumerable(env, false).GetEnumerator(); @@ -960,7 +960,7 @@ public void RoundTripConversionWithArrayPropertiess() new ClassWithNullableArrayProperties() }; - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var dataView = ComponentCreation.CreateDataView(env, data); var enumeratorSimple = dataView.AsEnumerable(env, false).GetEnumerator(); @@ -1010,7 +1010,7 @@ public void PrivateGetSetProperties() new ClassWithGetter() }; - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var dataView = ComponentCreation.CreateDataView(env, data); var enumeratorSimple = dataView.AsEnumerable(env, false).GetEnumerator(); diff --git a/test/Microsoft.ML.Tests/CopyColumnEstimatorTests.cs b/test/Microsoft.ML.Tests/CopyColumnEstimatorTests.cs index 60d2dc2fb1..958e7052d4 100644 --- a/test/Microsoft.ML.Tests/CopyColumnEstimatorTests.cs +++ b/test/Microsoft.ML.Tests/CopyColumnEstimatorTests.cs @@ -38,7 +38,7 @@ class TestMetaClass void TestWorking() { var data = new[] { new TestClass() { A = 1, B = 2, C = 3, }, new TestClass() { A = 4, B = 5, C = 6 } }; - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var dataView = ComponentCreation.CreateDataView(env, data); var est = new CopyColumnsEstimator(env, new[] { ("A", "D"), ("B", "E"), ("A", "F") }); @@ -52,7 +52,7 @@ void TestWorking() void TestBadOriginalSchema() { var data = new[] { new TestClass() { A = 1, B = 2, C = 3, }, new TestClass() { A = 4, B = 5, C = 6 } }; - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var dataView = ComponentCreation.CreateDataView(env, data); var est = new CopyColumnsEstimator(env, new[] { ("D", "A"), ("B", "E") }); @@ -72,7 +72,7 @@ void TestBadTransformSchmea() { var data = new[] { new TestClass() { A = 1, B = 2, C = 3, }, new TestClass() { A = 4, B = 5, C = 6 } }; var xydata = new[] { new TestClassXY() { X = 10, Y = 100 }, new TestClassXY() { X = -1, Y = -100 } }; - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var dataView = ComponentCreation.CreateDataView(env, data); var xyDataView = ComponentCreation.CreateDataView(env, xydata); @@ -93,7 +93,7 @@ void TestBadTransformSchmea() void TestSavingAndLoading() { var data = new[] { new TestClass() { A = 1, B = 2, C = 3, }, new TestClass() { A = 4, B = 5, C = 6 } }; - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var dataView = ComponentCreation.CreateDataView(env, data); var est = new CopyColumnsEstimator(env, new[] { ("A", "D"), ("B", "E"), ("A", "F") }); @@ -114,7 +114,7 @@ void TestSavingAndLoading() void TestOldSavingAndLoading() { var data = new[] { new TestClass() { A = 1, B = 2, C = 3, }, new TestClass() { A = 4, B = 5, C = 6 } }; - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var dataView = ComponentCreation.CreateDataView(env, data); var est = new CopyColumnsEstimator(env, new[] { ("A", "D"), ("B", "E"), ("A", "F") }); @@ -135,7 +135,7 @@ void TestOldSavingAndLoading() void TestMetadataCopy() { var data = new[] { new TestMetaClass() { Term = "A", NotUsed = 1 }, new TestMetaClass() { Term = "B" }, new TestMetaClass() { Term = "C" } }; - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var dataView = ComponentCreation.CreateDataView(env, data); var term = TermTransform.Create(env, new TermTransform.Arguments() @@ -161,7 +161,7 @@ void TestMetadataCopy() [Fact] void TestCommandLine() { - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { Assert.Equal(Maml.Main(new[] { @"showschema loader=Text{col=A:R4:0} xf=copy{col=B:A} in=f:\1.txt" }), (int)0); } diff --git a/test/Microsoft.ML.Tests/ImagesTests.cs b/test/Microsoft.ML.Tests/ImagesTests.cs index 37e2ccd33c..d4ef47b2a9 100644 --- a/test/Microsoft.ML.Tests/ImagesTests.cs +++ b/test/Microsoft.ML.Tests/ImagesTests.cs @@ -25,7 +25,7 @@ public ImageTests(ITestOutputHelper output) : base(output) [Fact] public void TestEstimatorChain() { - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var dataFile = GetDataPath("images/images.tsv"); var imageFolder = Path.GetDirectoryName(dataFile); @@ -45,7 +45,7 @@ public void TestEstimatorChain() [Fact] public void TestEstimatorSaveLoad() { - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var dataFile = GetDataPath("images/images.tsv"); var imageFolder = Path.GetDirectoryName(dataFile); @@ -78,7 +78,7 @@ public void TestEstimatorSaveLoad() [Fact] public void TestSaveImages() { - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var dataFile = GetDataPath("images/images.tsv"); var imageFolder = Path.GetDirectoryName(dataFile); @@ -123,7 +123,7 @@ public void TestSaveImages() [Fact] public void TestGreyscaleTransformImages() { - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var imageHeight = 150; var imageWidth = 100; @@ -186,7 +186,7 @@ public void TestGreyscaleTransformImages() [Fact] public void TestBackAndForthConversionWithAlphaInterleave() { - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var imageHeight = 100; var imageWidth = 130; @@ -269,7 +269,7 @@ public void TestBackAndForthConversionWithAlphaInterleave() [Fact] public void TestBackAndForthConversionWithoutAlphaInterleave() { - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var imageHeight = 100; var imageWidth = 130; @@ -352,7 +352,7 @@ public void TestBackAndForthConversionWithoutAlphaInterleave() [Fact] public void TestBackAndForthConversionWithAlphaNoInterleave() { - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var imageHeight = 100; var imageWidth = 130; @@ -435,7 +435,7 @@ public void TestBackAndForthConversionWithAlphaNoInterleave() [Fact] public void TestBackAndForthConversionWithoutAlphaNoInterleave() { - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var imageHeight = 100; var imageWidth = 130; @@ -518,7 +518,7 @@ public void TestBackAndForthConversionWithoutAlphaNoInterleave() [Fact] public void TestBackAndForthConversionWithAlphaInterleaveNoOffset() { - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var imageHeight = 100; var imageWidth = 130; @@ -597,7 +597,7 @@ public void TestBackAndForthConversionWithAlphaInterleaveNoOffset() [Fact] public void TestBackAndForthConversionWithoutAlphaInterleaveNoOffset() { - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var imageHeight = 100; var imageWidth = 130; @@ -676,7 +676,7 @@ public void TestBackAndForthConversionWithoutAlphaInterleaveNoOffset() [Fact] public void TestBackAndForthConversionWithAlphaNoInterleaveNoOffset() { - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var imageHeight = 100; var imageWidth = 130; @@ -755,7 +755,7 @@ public void TestBackAndForthConversionWithAlphaNoInterleaveNoOffset() [Fact] public void TestBackAndForthConversionWithoutAlphaNoInterleaveNoOffset() { - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var imageHeight = 100; var imageWidth = 130; diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/AspirationalExamples.cs b/test/Microsoft.ML.Tests/Scenarios/Api/AspirationalExamples.cs index 3c14b33710..fd2c5f0142 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/AspirationalExamples.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/AspirationalExamples.cs @@ -75,7 +75,7 @@ public void FirstExperienceWithML() [Fact] public void SimpleIrisDescisionTrees() { - var env = new ConsoleEnvironment(); + var env = new LocalEnvironment(); string dataPath = "iris.txt"; // Create reader with specific schema. var dataReader = TextLoader.CreateReader(env, dataPath, @@ -108,7 +108,7 @@ public void SimpleIrisDescisionTrees() [Fact] public void TwitterSentimentAnalysis() { - var env = new ConsoleEnvironment(); + var env = new LocalEnvironment(); var dataPath = "wikipedia-detox-250-line-data.tsv"; // Load the data into the system. var dataReader = TextLoader.CreateReader(env, dataPath, @@ -136,7 +136,7 @@ public void TwitterSentimentAnalysis() [Fact] public void TwentyNewsGroups() { - var env = new ConsoleEnvironment(); + var env = new LocalEnvironment(); var dataPath = "20newsGroups.txt"; // Load the data into the system. var dataReader = TextLoader.CreateReader(env, dataPath, diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/AutoNormalizationAndCaching.cs b/test/Microsoft.ML.Tests/Scenarios/Api/AutoNormalizationAndCaching.cs index ca350555ff..00fb528307 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/AutoNormalizationAndCaching.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/AutoNormalizationAndCaching.cs @@ -21,7 +21,7 @@ public void AutoNormalizationAndCaching() var dataPath = GetDataPath(SentimentDataPath); var testDataPath = GetDataPath(SentimentTestPath); - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new LocalEnvironment(seed: 1, conc: 1)) { // Pipeline. var loader = TextLoader.ReadFile(env, MakeSentimentTextLoaderArgs(), new MultiFileSource(dataPath)); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/CrossValidation.cs b/test/Microsoft.ML.Tests/Scenarios/Api/CrossValidation.cs index c68dc04b28..e55fe53743 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/CrossValidation.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/CrossValidation.cs @@ -29,7 +29,7 @@ void CrossValidation() var testDataPath = GetDataPath(SentimentTestPath); int numFolds = 5; - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new LocalEnvironment(seed: 1, conc: 1)) { // Pipeline. var loader = TextLoader.ReadFile(env, MakeSentimentTextLoaderArgs(), new MultiFileSource(dataPath)); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/DecomposableTrainAndPredict.cs b/test/Microsoft.ML.Tests/Scenarios/Api/DecomposableTrainAndPredict.cs index 74ce75bd90..c883151590 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/DecomposableTrainAndPredict.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/DecomposableTrainAndPredict.cs @@ -25,7 +25,7 @@ public partial class ApiScenariosTests void DecomposableTrainAndPredict() { var dataPath = GetDataPath(IrisDataPath); - using (var env = new TlcEnvironment()) + using (var env = new LocalEnvironment()) { var loader = TextLoader.ReadFile(env, MakeIrisTextLoaderArgs(), new MultiFileSource(dataPath)); var term = TermTransform.Create(env, loader, "Label"); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/CrossValidation.cs b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/CrossValidation.cs index 4c66c149de..4073054051 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/CrossValidation.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/CrossValidation.cs @@ -24,7 +24,7 @@ void New_CrossValidation() var dataPath = GetDataPath(SentimentDataPath); var testDataPath = GetDataPath(SentimentTestPath); - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new LocalEnvironment(seed: 1, conc: 1)) { var data = new TextLoader(env, MakeSentimentTextLoaderArgs()) diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/DecomposableTrainAndPredict.cs b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/DecomposableTrainAndPredict.cs index a3b7c26e3a..9d1d68dc4b 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/DecomposableTrainAndPredict.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/DecomposableTrainAndPredict.cs @@ -24,7 +24,7 @@ public partial class ApiScenariosTests void New_DecomposableTrainAndPredict() { var dataPath = GetDataPath(IrisDataPath); - using (var env = new TlcEnvironment()) + using (var env = new LocalEnvironment()) { var data = new TextLoader(env, MakeIrisTextLoaderArgs()) .Read(new MultiFileSource(dataPath)); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/Evaluation.cs b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/Evaluation.cs index 7dce9690fa..cf62d68912 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/Evaluation.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/Evaluation.cs @@ -22,7 +22,7 @@ public void New_Evaluation() var dataPath = GetDataPath(SentimentDataPath); var testDataPath = GetDataPath(SentimentTestPath); - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new LocalEnvironment(seed: 1, conc: 1)) { var reader = new TextLoader(env, MakeSentimentTextLoaderArgs()); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/Extensibility.cs b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/Extensibility.cs index 702d75433d..4c5cddf767 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/Extensibility.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/Extensibility.cs @@ -23,7 +23,7 @@ public partial class ApiScenariosTests void New_Extensibility() { var dataPath = GetDataPath(IrisDataPath); - using (var env = new TlcEnvironment()) + using (var env = new LocalEnvironment()) { var data = new TextLoader(env, MakeIrisTextLoaderArgs()) .Read(new MultiFileSource(dataPath)); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/FileBasedSavingOfData.cs b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/FileBasedSavingOfData.cs index 73b658ae98..c291b37ced 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/FileBasedSavingOfData.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/FileBasedSavingOfData.cs @@ -25,7 +25,7 @@ void New_FileBasedSavingOfData() var dataPath = GetDataPath(SentimentDataPath); var testDataPath = GetDataPath(SentimentTestPath); - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new LocalEnvironment(seed: 1, conc: 1)) { var trainData = new TextLoader(env, MakeSentimentTextLoaderArgs()) .Append(new TextTransform(env, "SentimentText", "Features")) diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/IntrospectiveTraining.cs b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/IntrospectiveTraining.cs index ad8e4d9e19..17f452ff09 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/IntrospectiveTraining.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/IntrospectiveTraining.cs @@ -35,7 +35,7 @@ public void New_IntrospectiveTraining() var dataPath = GetDataPath(SentimentDataPath); var testDataPath = GetDataPath(SentimentTestPath); - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new LocalEnvironment(seed: 1, conc: 1)) { var data = new TextLoader(env, MakeSentimentTextLoaderArgs()) .Read(new MultiFileSource(dataPath)); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/Metacomponents.cs b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/Metacomponents.cs index a58c111cbc..05d7b33445 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/Metacomponents.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/Metacomponents.cs @@ -21,7 +21,7 @@ public partial class ApiScenariosTests public void New_Metacomponents() { var dataPath = GetDataPath(IrisDataPath); - using (var env = new TlcEnvironment()) + using (var env = new LocalEnvironment()) { var data = new TextLoader(env, MakeIrisTextLoaderArgs()) .Read(new MultiFileSource(dataPath)); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/MultithreadedPrediction.cs b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/MultithreadedPrediction.cs index 4edbb35313..2e35acd71a 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/MultithreadedPrediction.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/MultithreadedPrediction.cs @@ -27,7 +27,7 @@ void New_MultithreadedPrediction() var dataPath = GetDataPath(SentimentDataPath); var testDataPath = GetDataPath(SentimentTestPath); - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new LocalEnvironment(seed: 1, conc: 1)) { var reader = new TextLoader(env, MakeSentimentTextLoaderArgs()); var data = reader.Read(new MultiFileSource(dataPath)); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/ReconfigurablePrediction.cs b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/ReconfigurablePrediction.cs index 2218d59416..42697089c3 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/ReconfigurablePrediction.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/ReconfigurablePrediction.cs @@ -23,7 +23,7 @@ public void New_ReconfigurablePrediction() var dataPath = GetDataPath(SentimentDataPath); var testDataPath = GetDataPath(SentimentTestPath); - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new LocalEnvironment(seed: 1, conc: 1)) { var dataReader = new TextLoader(env, MakeSentimentTextLoaderArgs()); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/SimpleTrainAndPredict.cs b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/SimpleTrainAndPredict.cs index 407b7d47c6..1257196253 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/SimpleTrainAndPredict.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/SimpleTrainAndPredict.cs @@ -24,7 +24,7 @@ public void New_SimpleTrainAndPredict() var dataPath = GetDataPath(SentimentDataPath); var testDataPath = GetDataPath(SentimentTestPath); - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new LocalEnvironment(seed: 1, conc: 1)) { var reader = new TextLoader(env, MakeSentimentTextLoaderArgs()); var data = reader.Read(new MultiFileSource(dataPath)); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/TrainSaveModelAndPredict.cs b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/TrainSaveModelAndPredict.cs index f83874820a..013c269e92 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/TrainSaveModelAndPredict.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/TrainSaveModelAndPredict.cs @@ -25,7 +25,7 @@ public void New_TrainSaveModelAndPredict() var dataPath = GetDataPath(SentimentDataPath); var testDataPath = GetDataPath(SentimentTestPath); - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new LocalEnvironment(seed: 1, conc: 1)) { var reader = new TextLoader(env, MakeSentimentTextLoaderArgs()); var data = reader.Read(new MultiFileSource(dataPath)); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/TrainWithInitialPredictor.cs b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/TrainWithInitialPredictor.cs index 76c28baaed..09bca124e0 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/TrainWithInitialPredictor.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/TrainWithInitialPredictor.cs @@ -20,7 +20,7 @@ public void New_TrainWithInitialPredictor() { var dataPath = GetDataPath(SentimentDataPath); - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new LocalEnvironment(seed: 1, conc: 1)) { var data = new TextLoader(env, MakeSentimentTextLoaderArgs()).Read(new MultiFileSource(dataPath)); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/TrainWithValidationSet.cs b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/TrainWithValidationSet.cs index 4a2a1323cf..74431f7279 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/TrainWithValidationSet.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/TrainWithValidationSet.cs @@ -20,7 +20,7 @@ public void New_TrainWithValidationSet() var dataPath = GetDataPath(SentimentDataPath); var validationDataPath = GetDataPath(SentimentTestPath); - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new LocalEnvironment(seed: 1, conc: 1)) { // Pipeline. var reader = new TextLoader(env, MakeSentimentTextLoaderArgs()); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/Visibility.cs b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/Visibility.cs index fd5637e969..7d0e0e7236 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/Visibility.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/Estimators/Visibility.cs @@ -21,7 +21,7 @@ public partial class ApiScenariosTests void New_Visibility() { var dataPath = GetDataPath(SentimentDataPath); - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new LocalEnvironment(seed: 1, conc: 1)) { var pipeline = new TextLoader(env, MakeSentimentTextLoaderArgs()) .Append(new TextTransform(env, "SentimentText", "Features", s => s.OutputTokens = true)); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/Evaluation.cs b/test/Microsoft.ML.Tests/Scenarios/Api/Evaluation.cs index 6c14ca1aa3..3004155784 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/Evaluation.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/Evaluation.cs @@ -23,7 +23,7 @@ public void Evaluation() var dataPath = GetDataPath(SentimentDataPath); var testDataPath = GetDataPath(SentimentTestPath); - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new LocalEnvironment(seed: 1, conc: 1)) { // Pipeline var loader = TextLoader.ReadFile(env, MakeSentimentTextLoaderArgs(), new MultiFileSource(dataPath)); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/Extensibility.cs b/test/Microsoft.ML.Tests/Scenarios/Api/Extensibility.cs index e6ab03497e..00d0ee2a34 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/Extensibility.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/Extensibility.cs @@ -19,7 +19,7 @@ public partial class ApiScenariosTests void Extensibility() { var dataPath = GetDataPath(IrisDataPath); - using (var env = new TlcEnvironment()) + using (var env = new LocalEnvironment()) { var loader = TextLoader.ReadFile(env, MakeIrisTextLoaderArgs(), new MultiFileSource(dataPath)); Action action = (i, j) => diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/FileBasedSavingOfData.cs b/test/Microsoft.ML.Tests/Scenarios/Api/FileBasedSavingOfData.cs index 88059e7b4b..da6c4fcedb 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/FileBasedSavingOfData.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/FileBasedSavingOfData.cs @@ -24,7 +24,7 @@ void FileBasedSavingOfData() var dataPath = GetDataPath(SentimentDataPath); var testDataPath = GetDataPath(SentimentTestPath); - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new LocalEnvironment(seed: 1, conc: 1)) { // Pipeline var loader = TextLoader.ReadFile(env, MakeSentimentTextLoaderArgs(), new MultiFileSource(dataPath)); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/IntrospectiveTraining.cs b/test/Microsoft.ML.Tests/Scenarios/Api/IntrospectiveTraining.cs index 109206c76d..254485cebc 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/IntrospectiveTraining.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/IntrospectiveTraining.cs @@ -42,7 +42,7 @@ public void IntrospectiveTraining() { var dataPath = GetDataPath(SentimentDataPath); - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new LocalEnvironment(seed: 1, conc: 1)) { // Pipeline var loader = TextLoader.ReadFile(env, MakeSentimentTextLoaderArgs(), new MultiFileSource(dataPath)); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/Metacomponents.cs b/test/Microsoft.ML.Tests/Scenarios/Api/Metacomponents.cs index f8aef102bd..ed48171f4d 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/Metacomponents.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/Metacomponents.cs @@ -21,7 +21,7 @@ public partial class ApiScenariosTests public void Metacomponents() { var dataPath = GetDataPath(IrisDataPath); - using (var env = new TlcEnvironment()) + using (var env = new LocalEnvironment()) { var loader = TextLoader.ReadFile(env, MakeIrisTextLoaderArgs(), new MultiFileSource(dataPath)); var term = TermTransform.Create(env, loader, "Label"); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/MultithreadedPrediction.cs b/test/Microsoft.ML.Tests/Scenarios/Api/MultithreadedPrediction.cs index cbde9d6777..cb6b4dd6f0 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/MultithreadedPrediction.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/MultithreadedPrediction.cs @@ -28,7 +28,7 @@ void MultithreadedPrediction() var dataPath = GetDataPath(SentimentDataPath); var testDataPath = GetDataPath(SentimentTestPath); - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new LocalEnvironment(seed: 1, conc: 1)) { // Pipeline var loader = TextLoader.ReadFile(env, MakeSentimentTextLoaderArgs(), new MultiFileSource(dataPath)); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/ReconfigurablePrediction.cs b/test/Microsoft.ML.Tests/Scenarios/Api/ReconfigurablePrediction.cs index 94fffc8e9b..307f5e086a 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/ReconfigurablePrediction.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/ReconfigurablePrediction.cs @@ -24,7 +24,7 @@ void ReconfigurablePrediction() var dataPath = GetDataPath(SentimentDataPath); var testDataPath = GetDataPath(SentimentTestPath); - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new LocalEnvironment(seed: 1, conc: 1)) { // Pipeline var loader = TextLoader.ReadFile(env, MakeSentimentTextLoaderArgs(), new MultiFileSource(dataPath)); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/SimpleTrainAndPredict.cs b/test/Microsoft.ML.Tests/Scenarios/Api/SimpleTrainAndPredict.cs index b7f5e83f2b..26b9869aa8 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/SimpleTrainAndPredict.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/SimpleTrainAndPredict.cs @@ -24,7 +24,7 @@ public void SimpleTrainAndPredict() var dataPath = GetDataPath(SentimentDataPath); var testDataPath = GetDataPath(SentimentTestPath); - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new LocalEnvironment(seed: 1, conc: 1)) { // Pipeline var loader = TextLoader.ReadFile(env, MakeSentimentTextLoaderArgs(), new MultiFileSource(dataPath)); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/TrainSaveModelAndPredict.cs b/test/Microsoft.ML.Tests/Scenarios/Api/TrainSaveModelAndPredict.cs index 389009ba13..7cfe2aa73b 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/TrainSaveModelAndPredict.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/TrainSaveModelAndPredict.cs @@ -24,7 +24,7 @@ public void TrainSaveModelAndPredict() var dataPath = GetDataPath(SentimentDataPath); var testDataPath = GetDataPath(SentimentTestPath); - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new LocalEnvironment(seed: 1, conc: 1)) { // Pipeline var loader = TextLoader.ReadFile(env, MakeSentimentTextLoaderArgs(), new MultiFileSource(dataPath)); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/TrainWithInitialPredictor.cs b/test/Microsoft.ML.Tests/Scenarios/Api/TrainWithInitialPredictor.cs index a147ef8552..9683af241c 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/TrainWithInitialPredictor.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/TrainWithInitialPredictor.cs @@ -20,7 +20,7 @@ public void TrainWithInitialPredictor() { var dataPath = GetDataPath(SentimentDataPath); - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new LocalEnvironment(seed: 1, conc: 1)) { // Pipeline var loader = TextLoader.ReadFile(env, MakeSentimentTextLoaderArgs(), new MultiFileSource(dataPath)); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/TrainWithValidationSet.cs b/test/Microsoft.ML.Tests/Scenarios/Api/TrainWithValidationSet.cs index 11124356eb..c2fabcd970 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/TrainWithValidationSet.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/TrainWithValidationSet.cs @@ -20,7 +20,7 @@ public void TrainWithValidationSet() var dataPath = GetDataPath(SentimentDataPath); var validationDataPath = GetDataPath(SentimentTestPath); - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new LocalEnvironment(seed: 1, conc: 1)) { // Pipeline var loader = TextLoader.ReadFile(env, MakeSentimentTextLoaderArgs(), new MultiFileSource(dataPath)); diff --git a/test/Microsoft.ML.Tests/Scenarios/Api/Visibility.cs b/test/Microsoft.ML.Tests/Scenarios/Api/Visibility.cs index 0686df08b5..47a91e44c2 100644 --- a/test/Microsoft.ML.Tests/Scenarios/Api/Visibility.cs +++ b/test/Microsoft.ML.Tests/Scenarios/Api/Visibility.cs @@ -23,7 +23,7 @@ void Visibility() var dataPath = GetDataPath(SentimentDataPath); var testDataPath = GetDataPath(SentimentTestPath); - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new LocalEnvironment(seed: 1, conc: 1)) { // Pipeline. var loader = TextLoader.ReadFile(env, MakeSentimentTextLoaderArgs(), new MultiFileSource(dataPath)); diff --git a/test/Microsoft.ML.Tests/ScenariosWithDirectInstantiation/IrisPlantClassificationTests.cs b/test/Microsoft.ML.Tests/ScenariosWithDirectInstantiation/IrisPlantClassificationTests.cs index 457e1b31a3..4effd29e27 100644 --- a/test/Microsoft.ML.Tests/ScenariosWithDirectInstantiation/IrisPlantClassificationTests.cs +++ b/test/Microsoft.ML.Tests/ScenariosWithDirectInstantiation/IrisPlantClassificationTests.cs @@ -22,7 +22,7 @@ public void TrainAndPredictIrisModelUsingDirectInstantiationTest() string dataPath = GetDataPath("iris.txt"); string testDataPath = dataPath; - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new ConsoleEnvironment(seed: 1, conc: 1)) { // Pipeline var loader = TextLoader.ReadFile(env, diff --git a/test/Microsoft.ML.Tests/ScenariosWithDirectInstantiation/SentimentPredictionTests.cs b/test/Microsoft.ML.Tests/ScenariosWithDirectInstantiation/SentimentPredictionTests.cs index e9ebee50af..95b476b361 100644 --- a/test/Microsoft.ML.Tests/ScenariosWithDirectInstantiation/SentimentPredictionTests.cs +++ b/test/Microsoft.ML.Tests/ScenariosWithDirectInstantiation/SentimentPredictionTests.cs @@ -21,7 +21,7 @@ public void TrainAndPredictSentimentModelWithDirectionInstantiationTest() var dataPath = GetDataPath(SentimentDataPath); var testDataPath = GetDataPath(SentimentTestPath); - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new ConsoleEnvironment(seed: 1, conc: 1)) { // Pipeline var loader = TextLoader.ReadFile(env, @@ -90,7 +90,7 @@ public void TrainAndPredictSentimentModelWithDirectionInstantiationTestWithWordE var dataPath = GetDataPath(SentimentDataPath); var testDataPath = GetDataPath(SentimentTestPath); - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new ConsoleEnvironment(seed: 1, conc: 1)) { // Pipeline var loader = TextLoader.ReadFile(env, diff --git a/test/Microsoft.ML.Tests/ScenariosWithDirectInstantiation/TensorflowTests.cs b/test/Microsoft.ML.Tests/ScenariosWithDirectInstantiation/TensorflowTests.cs index dff26ac51c..da9102fbb2 100644 --- a/test/Microsoft.ML.Tests/ScenariosWithDirectInstantiation/TensorflowTests.cs +++ b/test/Microsoft.ML.Tests/ScenariosWithDirectInstantiation/TensorflowTests.cs @@ -30,7 +30,7 @@ private class TestData public void TensorFlowTransformMatrixMultiplicationTest() { var model_location = "model_matmul/frozen_saved_model.pb"; - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new ConsoleEnvironment(seed: 1, conc: 1)) { // Pipeline var loader = ComponentCreation.CreateDataView(env, @@ -76,7 +76,7 @@ public void TensorFlowTransformMatrixMultiplicationTest() public void TensorFlowTransformObjectDetectionTest() { var model_location = @"C:\models\TensorFlow\ssd_mobilenet_v1_coco_2018_01_28\frozen_inference_graph.pb"; - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new ConsoleEnvironment(seed: 1, conc: 1)) { var dataFile = GetDataPath("images/images.tsv"); var imageFolder = Path.GetDirectoryName(dataFile); @@ -136,7 +136,7 @@ public void TensorFlowTransformObjectDetectionTest() public void TensorFlowTransformInceptionTest() { var model_location = @"C:\models\TensorFlow\tensorflow_inception_graph.pb"; - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new ConsoleEnvironment(seed: 1, conc: 1)) { var dataFile = GetDataPath("images/images.tsv"); var imageFolder = Path.GetDirectoryName(dataFile); @@ -185,7 +185,7 @@ public void TensorFlowTransformInceptionTest() public void TensorFlowTransformMNISTConvTest() { var model_location = "mnist_model/frozen_saved_model.pb"; - using (var env = new TlcEnvironment(seed: 1, conc: 1)) + using (var env = new ConsoleEnvironment(seed: 1, conc: 1)) { var dataPath = GetDataPath("Train-Tiny-28x28.txt"); var testDataPath = GetDataPath("MNIST.Test.tiny.txt"); @@ -324,7 +324,7 @@ public void TensorFlowTransformCifar() { var model_location = "cifar_model/frozen_model.pb"; - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var imageHeight = 32; var imageWidth = 32; @@ -378,7 +378,7 @@ public void TensorFlowTransformCifarInvalidShape() { var model_location = "cifar_model/frozen_model.pb"; - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var imageHeight = 28; var imageWidth = 28; diff --git a/test/Microsoft.ML.Tests/TensorFlowEstimatorTests.cs b/test/Microsoft.ML.Tests/TensorFlowEstimatorTests.cs index 398d796a74..d102ea758c 100644 --- a/test/Microsoft.ML.Tests/TensorFlowEstimatorTests.cs +++ b/test/Microsoft.ML.Tests/TensorFlowEstimatorTests.cs @@ -132,7 +132,7 @@ void TestOldSavingAndLoading() [Fact] void TestCommandLine() { - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { Assert.Equal(Maml.Main(new[] { @"showschema loader=Text{col=a:R4:0-3 col=b:R4:0-3} xf=TFTransform{inputs=a inputs=b outputs=c model={model_matmul/frozen_saved_model.pb}} in=f:\2.txt" }), (int)0); } @@ -143,7 +143,7 @@ public void TestTensorFlowStatic() { var modelLocation = "cifar_model/frozen_model.pb"; - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var imageHeight = 32; var imageWidth = 32; diff --git a/test/Microsoft.ML.Tests/TermEstimatorTests.cs b/test/Microsoft.ML.Tests/TermEstimatorTests.cs index 9bed3bb7d9..040abe6d47 100644 --- a/test/Microsoft.ML.Tests/TermEstimatorTests.cs +++ b/test/Microsoft.ML.Tests/TermEstimatorTests.cs @@ -151,7 +151,7 @@ void TestMetadataCopy() [Fact] void TestCommandLine() { - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { Assert.Equal(Maml.Main(new[] { @"showschema loader=Text{col=A:R4:0} xf=Term{col=B:A} in=f:\2.txt" }), (int)0); } diff --git a/test/Microsoft.ML.Tests/TextLoaderTests.cs b/test/Microsoft.ML.Tests/TextLoaderTests.cs index defeac1a15..39a83d0f61 100644 --- a/test/Microsoft.ML.Tests/TextLoaderTests.cs +++ b/test/Microsoft.ML.Tests/TextLoaderTests.cs @@ -42,7 +42,7 @@ public void CanSuccessfullyApplyATransform() { var loader = new Legacy.Data.TextLoader("fakeFile.txt").CreateFrom(); - using (var environment = new TlcEnvironment()) + using (var environment = new ConsoleEnvironment()) { Experiment experiment = environment.CreateExperiment(); Legacy.ILearningPipelineDataStep output = loader.ApplyStep(null, experiment) as Legacy.ILearningPipelineDataStep; @@ -59,7 +59,7 @@ public void CanSuccessfullyRetrieveQuotedData() string dataPath = GetDataPath("QuotingData.csv"); var loader = new Legacy.Data.TextLoader(dataPath).CreateFrom(useHeader: true, separator: ',', allowQuotedStrings: true, supportSparse: false); - using (var environment = new TlcEnvironment()) + using (var environment = new ConsoleEnvironment()) { Experiment experiment = environment.CreateExperiment(); Legacy.ILearningPipelineDataStep output = loader.ApplyStep(null, experiment) as Legacy.ILearningPipelineDataStep; @@ -117,7 +117,7 @@ public void CanSuccessfullyRetrieveSparseData() string dataPath = GetDataPath("SparseData.txt"); var loader = new Legacy.Data.TextLoader(dataPath).CreateFrom(useHeader: true, allowQuotedStrings: false, supportSparse: true); - using (var environment = new TlcEnvironment()) + using (var environment = new ConsoleEnvironment()) { Experiment experiment = environment.CreateExperiment(); Legacy.ILearningPipelineDataStep output = loader.ApplyStep(null, experiment) as Legacy.ILearningPipelineDataStep; @@ -182,7 +182,7 @@ public void CanSuccessfullyTrimSpaces() string dataPath = GetDataPath("TrimData.csv"); var loader = new Legacy.Data.TextLoader(dataPath).CreateFrom(useHeader: true, separator: ',', allowQuotedStrings: false, supportSparse: false, trimWhitespace: true); - using (var environment = new TlcEnvironment()) + using (var environment = new ConsoleEnvironment()) { Experiment experiment = environment.CreateExperiment(); Legacy.ILearningPipelineDataStep output = loader.ApplyStep(null, experiment) as Legacy.ILearningPipelineDataStep; diff --git a/test/Microsoft.ML.Tests/TrainerEstimators/MetalinearEstimators.cs b/test/Microsoft.ML.Tests/TrainerEstimators/MetalinearEstimators.cs index 91fc72185d..eb4e845a6c 100644 --- a/test/Microsoft.ML.Tests/TrainerEstimators/MetalinearEstimators.cs +++ b/test/Microsoft.ML.Tests/TrainerEstimators/MetalinearEstimators.cs @@ -28,7 +28,7 @@ public void OVAWithExplicitCalibrator() { var dataPath = GetDataPath(IrisDataPath); - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var calibrator = new PavCalibratorTrainer(env); @@ -53,7 +53,7 @@ public void OVAWithAllConstructorArgs() string featNam = "Features"; string labNam = "Label"; - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var calibrator = new FixedPlattCalibratorTrainer(env, new FixedPlattCalibratorTrainer.Arguments()); @@ -76,7 +76,7 @@ public void OVAUncalibrated() { var dataPath = GetDataPath(IrisDataPath); - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var data = new TextLoader(env, GetIrisLoaderArgs()).Read(new MultiFileSource(dataPath)); @@ -97,7 +97,7 @@ public void Pkpd() { var dataPath = GetDataPath(IrisDataPath); - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { var calibrator = new PavCalibratorTrainer(env); diff --git a/test/Microsoft.ML.Tests/Transformers/KeyToBinaryVectorEstimatorTest.cs b/test/Microsoft.ML.Tests/Transformers/KeyToBinaryVectorEstimatorTest.cs index f3d7d149bf..d7b57c232a 100644 --- a/test/Microsoft.ML.Tests/Transformers/KeyToBinaryVectorEstimatorTest.cs +++ b/test/Microsoft.ML.Tests/Transformers/KeyToBinaryVectorEstimatorTest.cs @@ -150,7 +150,7 @@ private void ValidateMetadata(IDataView result) [Fact] public void TestCommandLine() { - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { Assert.Equal(Maml.Main(new[] { @"showschema loader=Text{col=A:R4:0} xf=Term{col=B:A} xf=KeyToBinary{col=C:B} in=f:\2.txt" }), (int)0); } diff --git a/test/Microsoft.ML.Tests/Transformers/KeyToVectorEstimatorTests.cs b/test/Microsoft.ML.Tests/Transformers/KeyToVectorEstimatorTests.cs index 9520966be3..1701c17083 100644 --- a/test/Microsoft.ML.Tests/Transformers/KeyToVectorEstimatorTests.cs +++ b/test/Microsoft.ML.Tests/Transformers/KeyToVectorEstimatorTests.cs @@ -215,7 +215,7 @@ private void ValidateMetadata(IDataView result) [Fact] public void TestCommandLine() { - using (var env = new TlcEnvironment()) + using (var env = new ConsoleEnvironment()) { Assert.Equal(Maml.Main(new[] { @"showschema loader=Text{col=A:R4:0} xf=Term{col=B:A} xf=KeyToVector{col=C:B col={name=D source=B bag+}} in=f:\2.txt" }), (int)0); }