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