6 types derived from OptionBase
Microsoft.ML.SearchSpace (6)
Option\ChoiceOption.cs (1)
19
public sealed class ChoiceOption :
OptionBase
Option\NestOption.cs (2)
16
public sealed class SearchSpace :
OptionBase
, IDictionary<string,
OptionBase
>
Option\UniformNumericOption.cs (1)
17
public abstract class UniformNumericOption :
OptionBase
SearchSpace.cs (2)
27
public class SearchSpace :
OptionBase
, IDictionary<string,
OptionBase
>
73 references to OptionBase
Microsoft.ML.SearchSpace (73)
Converter\OptionConverter.cs (3)
14
internal class OptionConverter : JsonConverter<
OptionBase
>
16
public override
OptionBase
Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
46
public override void Write(Utf8JsonWriter writer,
OptionBase
value, JsonSerializerOptions options)
Converter\SearchSpaceConverter.cs (2)
18
var optionKVPairs = JsonSerializer.Deserialize<Dictionary<string,
OptionBase
>>(ref reader, options);
25
JsonSerializer.Serialize<IDictionary<string,
OptionBase
>>(value, options);
Option\NestOption.cs (28)
18
private readonly Dictionary<string,
OptionBase
> _options = new Dictionary<string,
OptionBase
>();
21
public
OptionBase
this[string key] { get => ((IDictionary<string,
OptionBase
>)_options)[key]; set => ((IDictionary<string,
OptionBase
>)_options)[key] = value; }
70
var
option = _options[key];
80
public ICollection<string> Keys => ((IDictionary<string,
OptionBase
>)_options).Keys;
83
public ICollection<
OptionBase
> Values => ((IDictionary<string,
OptionBase
>)_options).Values;
86
public int Count => ((ICollection<KeyValuePair<string,
OptionBase
>>)_options).Count;
89
public bool IsReadOnly => ((ICollection<KeyValuePair<string,
OptionBase
>>)_options).IsReadOnly;
92
public void Add(string key,
OptionBase
value)
94
((IDictionary<string,
OptionBase
>)_options).Add(key, value);
98
public void Add(KeyValuePair<string,
OptionBase
> item)
100
((ICollection<KeyValuePair<string,
OptionBase
>>)_options).Add(item);
106
((ICollection<KeyValuePair<string,
OptionBase
>>)_options).Clear();
110
public bool Contains(KeyValuePair<string,
OptionBase
> item)
112
return ((ICollection<KeyValuePair<string,
OptionBase
>>)_options).Contains(item);
118
return ((IDictionary<string,
OptionBase
>)_options).ContainsKey(key);
122
public void CopyTo(KeyValuePair<string,
OptionBase
>[] array, int arrayIndex)
124
((ICollection<KeyValuePair<string,
OptionBase
>>)_options).CopyTo(array, arrayIndex);
128
public IEnumerator<KeyValuePair<string,
OptionBase
>> GetEnumerator()
130
return ((IEnumerable<KeyValuePair<string,
OptionBase
>>)_options).GetEnumerator();
136
return ((IDictionary<string,
OptionBase
>)_options).Remove(key);
140
public bool Remove(KeyValuePair<string,
OptionBase
> item)
142
return ((ICollection<KeyValuePair<string,
OptionBase
>>)_options).Remove(item);
146
public bool TryGetValue(string key, out
OptionBase
value)
148
return ((IDictionary<string,
OptionBase
>)_options).TryGetValue(key, out value);
SearchSpace.cs (40)
17
/// This class is used to represent a set of <see cref="
OptionBase
"/>, which can be either one of <see cref="ChoiceOption"/>, <see cref="UniformNumericOption"/> or another nested search space.
29
private readonly Dictionary<string,
OptionBase
> _options;
33
/// Create <see cref="SearchSpace"/> using a group of <see cref="
OptionBase
"/>.
36
internal SearchSpace(params KeyValuePair<string,
OptionBase
>[] options)
42
internal SearchSpace(IEnumerable<KeyValuePair<string,
OptionBase
>> options)
51
_options = new Dictionary<string,
OptionBase
>();
83
public ICollection<string> Keys => ((IDictionary<string,
OptionBase
>)_options).Keys;
86
public ICollection<
OptionBase
> Values => ((IDictionary<string,
OptionBase
>)_options).Values;
89
public int Count => ((ICollection<KeyValuePair<string,
OptionBase
>>)_options).Count;
92
public bool IsReadOnly => ((ICollection<KeyValuePair<string,
OptionBase
>>)_options).IsReadOnly;
106
public
OptionBase
this[string key] { get => ((IDictionary<string,
OptionBase
>)_options)[key]; set => ((IDictionary<string,
OptionBase
>)_options)[key] = value; }
117
var
option = _options[key];
138
var
option = _options[key];
172
private Dictionary<string,
OptionBase
> GetOptionsFromType(Type typeInfo)
193
private Dictionary<string,
OptionBase
> GetOptionsFromField(Type typeInfo)
196
var res = new Dictionary<string,
OptionBase
>();
215
OptionBase
option = attributes.First() switch
240
private Dictionary<string,
OptionBase
> GetOptionsFromProperty(Type typeInfo)
243
var res = new Dictionary<string,
OptionBase
>();
262
OptionBase
option = attributes.First() switch
311
public void Add(string key,
OptionBase
value)
313
((IDictionary<string,
OptionBase
>)_options).Add(key, value);
319
return ((IDictionary<string,
OptionBase
>)_options).ContainsKey(key);
325
return ((IDictionary<string,
OptionBase
>)_options).Remove(key);
329
public bool TryGetValue(string key, out
OptionBase
value)
331
return ((IDictionary<string,
OptionBase
>)_options).TryGetValue(key, out value);
335
public void Add(KeyValuePair<string,
OptionBase
> item)
337
((ICollection<KeyValuePair<string,
OptionBase
>>)_options).Add(item);
343
((ICollection<KeyValuePair<string,
OptionBase
>>)_options).Clear();
347
public bool Contains(KeyValuePair<string,
OptionBase
> item)
349
return ((ICollection<KeyValuePair<string,
OptionBase
>>)_options).Contains(item);
353
public void CopyTo(KeyValuePair<string,
OptionBase
>[] array, int arrayIndex)
355
((ICollection<KeyValuePair<string,
OptionBase
>>)_options).CopyTo(array, arrayIndex);
359
public bool Remove(KeyValuePair<string,
OptionBase
> item)
361
return ((ICollection<KeyValuePair<string,
OptionBase
>>)_options).Remove(item);
365
public IEnumerator<KeyValuePair<string,
OptionBase
>> GetEnumerator()
367
return ((IEnumerable<KeyValuePair<string,
OptionBase
>>)_options).GetEnumerator();