94 references to AsType
Microsoft.ML.AutoML (10)
API\AutoCatalog.cs (1)
304return new SweepableEstimator((MLContext context, Parameter param) => factory(context, param.AsType<T>()), ss);
AutoMLExperiment\IDatasetManager.cs (1)
78var subSampleRatio = parameter.ContainsKey(_subSamplingKey) ? parameter[_subSamplingKey].AsType<double>() : 1;
SweepableEstimator\Converter\SweepablePipelineConverter.cs (1)
29jsonObject["currentSchema"] = value.CurrentParameter["_SCHEMA_"].AsType<string>();
SweepableEstimator\SweepableEstimator.cs (2)
67get => base.Parameter.AsType<TOption>(); 74return BuildFromOption(context, param.AsType<TOption>());
SweepableEstimator\SweepablePipeline.cs (2)
86_currentSchema = parameter[SchemaOption].AsType<string>(); 155var schema = pipelineParameter["_SCHEMA_"].AsType<string>();
Tuner\AutoZeroTuner.cs (2)
99var label = parameter[trainerEstimatorName]["LabelColumnName"].AsType<string>(); 100var feature = parameter[trainerEstimatorName]["FeatureColumnName"].AsType<string>();
Tuner\EciCfoTuner.cs (1)
69var schema = result.TrialSettings.Parameter[AutoMLExperiment.PipelineSearchspaceName]["_SCHEMA_"].AsType<string>();
Microsoft.ML.AutoML.Samples (3)
Sweepable\ParameterExample.cs (3)
22var i = intParam.AsType<int>(); // i == 10 23var d = doubleParam.AsType<double>(); // d == 20 24var b = boolParam.AsType<bool>(); // b == false
Microsoft.ML.AutoML.Tests (11)
AutoMLExperimentTests.cs (1)
373.AsType<float>().Should().Be(0.1f);
TunerTests.cs (10)
54var option = param.AsType<LbfgsOption>(); 85var option = param.AsType<LbfgsOption>(); 120var lseParam = param.AsType<LSE3DSearchSpace>(); 139var lseParameterFromNewCfo = nextParameterFromNewCfo.AsType<LSE3DSearchSpace>(); 155var param = cfo.Propose(trialSettings).AsType<LSE3DSearchSpace>(); 264var lseParam = param.AsType<LSE3DSearchSpace>(); 319var lseParam = param.AsType<LSE3DSearchSpace>(); 365var lseParam = param.AsType<LSE3DSearchSpace>(); 404var param = cfo.Propose(trialSettings).AsType<LSE3DSearchSpace>(); 417var param = cfo.Propose(trialSettings).AsType<LSE3DSearchSpace>();
Microsoft.ML.Fairlearn (1)
Reductions\GridSearchTrialRunner.cs (1)
64var value = lambdas[x].AsType<float>();
Microsoft.ML.SearchSpace (10)
Converter\NumericOptionConverter.cs (3)
57Default = intOption.SampleFromFeatureSpace(intOption.Default).AsType<int>(), 65Default = doubleOption.SampleFromFeatureSpace(doubleOption.Default).AsType<double>(), 73Default = singleOption.SampleFromFeatureSpace(singleOption.Default).AsType<Single>(),
Option\ChoiceOption.cs (1)
84var value = param.AsType<float>();
Option\UniformNumericOption.cs (5)
59var x = param.AsType<double>(); 141var singleValue = param.AsType<float>(); 149var doubleValue = base.SampleFromFeatureSpace(values).AsType<double>(); 180var intValue = Convert.ToInt32(Math.Floor(param.AsType<double>())); 188var value = param.AsType<int>();
SearchSpace.cs (1)
434var option = param.AsType<T>();
Microsoft.ML.SearchSpace.Tests (59)
ChoiceOptionTest.cs (13)
22option.SampleFromFeatureSpace(new[] { 0.0 }).AsType<string>().Should().Be("a"); 23option.SampleFromFeatureSpace(new[] { 0.33 }).AsType<string>().Should().Be("a"); 24option.SampleFromFeatureSpace(new[] { 0.34 }).AsType<string>().Should().Be("b"); 25option.SampleFromFeatureSpace(new[] { 0.66 }).AsType<string>().Should().Be("b"); 26option.SampleFromFeatureSpace(new[] { 0.67 }).AsType<string>().Should().Be("c"); 27option.SampleFromFeatureSpace(new[] { 0.97 }).AsType<string>().Should().Be("c"); 28option.SampleFromFeatureSpace(new[] { 0.999999999 }).AsType<string>().Should().Be("c"); 29option.SampleFromFeatureSpace(new[] { 1.0 }).AsType<string>().Should().Be("c"); 36option.SampleFromFeatureSpace(new[] { 0.0 }).AsType<string>().Should().Be("a"); 37option.SampleFromFeatureSpace(new[] { 0.99 }).AsType<string>().Should().Be("a"); 50parameter.AsType<string>().Should().Be("c"); 60option.SampleFromFeatureSpace(new double[0]).AsType<string>().Should().Be("b"); 70parameter["choice"].AsType<int>().Should().Be(2);
ParameterTest.cs (25)
44parameter.AsType<string[]>().Should().Equal("A", "B", "C"); 53parameter.AsType<int>().Should().Be(3); 57parameter.AsType<double>().Should().Be(3.1415926); 61parameter.AsType<float>().Should().Be(3.1415926F); 65parameter.AsType<string>().Should().Be("abc"); 69parameter.AsType<bool>().Should().BeFalse(); 73parameter.AsType<string[]>().Should().BeEquivalentTo("a", "b", "c"); 77parameter.AsType<JsonTokenType>().Should().Be(JsonTokenType.None); 81parameter.AsType<long>().Should().Be(long.MaxValue); 90parameter["Int"].AsType<int>().Should().Be(0); 91parameter["Float"].AsType<float>().Should().Be(1f); 92parameter["Double"].AsType<double>().Should().Be(2); 93parameter["Bool"].AsType<bool>().Should().BeFalse(); 94parameter["String"].AsType<string>().Should().Be("String"); 95parameter["Strings"].AsType<string[]>().Should().BeEquivalentTo("A", "B", "C"); 96parameter["JTokenType"].AsType<JsonTokenType>().Should().Be(JsonTokenType.Null); 97parameter["A"].AsType<A>().Strings.Should().BeEquivalentTo("A", "B", "C"); 98parameter.AsType<B>().Strings.Should().BeEquivalentTo("A", "B", "C"); 113parameter["Int"].AsType<int>().Should().Be(0); 114parameter["Float"].AsType<float>().Should().Be(1f); 115parameter["Double"].AsType<double>().Should().Be(2); 116parameter["Bool"].AsType<bool>().Should().BeFalse(); 117parameter["Strings"].AsType<string[]>().Should().BeEquivalentTo("A", "B", "C"); 118parameter["JTokenType"].AsType<JsonTokenType>().Should().Be(JsonTokenType.Null); 132parameter["_SampleSize"].AsType<double>().Should().Be(15000.0);
SearchSpaceTest.cs (14)
138param["A"].AsType<int>().Should().Be(0); 167var param = defaultTuner.Propose().AsType<NestSearchSpace>(); 229parameter["nestOption"]["choice"].AsType<string>().Should().Be("d"); 230parameter["nestOption"]["int"].AsType<int>().Should().Be(2); 231parameter["choice"].AsType<string>().Should().Be("a"); 232parameter["int"].AsType<int>().Should().Be(0); 235parameter["nestOption"]["choice"].AsType<string>().Should().Be("e"); 236parameter["nestOption"]["int"].AsType<int>().Should().Be(3); 237parameter["choice"].AsType<string>().Should().Be("c"); 238parameter["int"].AsType<int>().Should().Be(1); 265parameter["a"].AsType<int>().Should().Be(0); 267parameter["a"].AsType<int>().Should().Be(1); 273parameter["b"].AsType<int>().Should().Be(1); 275parameter["b"].AsType<int>().Should().Be(2);
UniformNumericOptionTests.cs (7)
28sampleOutputs.Select(x => x.AsType<int>()).Should().Equal(0, 10, 20, 30, 40, 50, 60, 70, 80, 90); 39sampleOutputs.Select(x => x.AsType<int>()).Should().Equal(1, 2, 4, 8, 16, 32, 64, 128, 256, 512); 57option.SampleFromFeatureSpace(new double[] { 0.0 }).AsType<int>().Should().Be(20); 82sampleOutputs.Select((x, i) => (x.AsType<double>(), i * 10)) 95sampleOutputs.Select((x, i) => (x.AsType<double>(), Math.Pow(2, i))) 130option.SampleFromFeatureSpace(option.Default).AsType<double>().Should().Be(2e-10); 131option.SampleFromFeatureSpace(new[] { 1.0 }).AsType<double>().Should().Be(1.0);