Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.9k
fix #6949#6951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
fix #6949 #6951
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| // 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.SearchSpace; | ||
| /// <summary> | ||
| /// Boolean choice attribute | ||
| /// </summary> | ||
| [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, Inherited = false, AllowMultiple = false)] | ||
| public sealed class BooleanChoiceAttribute : Attribute | ||
| { | ||
| /// <summary> | ||
| /// Create a <see cref="BooleanChoiceAttribute"/>. | ||
| /// </summary> | ||
| public BooleanChoiceAttribute() | ||
| { | ||
| DefaultValue = true; | ||
| } | ||
| /// <summary> | ||
| /// Create a <see cref="BooleanChoiceAttribute"/> with default value. | ||
| /// </summary> | ||
| /// <param name="defaultValue">default value for this option.</param> | ||
| public BooleanChoiceAttribute(bool defaultValue) | ||
| { | ||
| DefaultValue = defaultValue; | ||
| } | ||
| public bool DefaultValue { get; } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| // 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; | ||
| using System.Diagnostics.Contracts; | ||
| using System.Linq; | ||
| namespace Microsoft.ML.SearchSpace; | ||
| /// <summary> | ||
| /// Choice attribute | ||
| /// </summary> | ||
| [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, Inherited = false, AllowMultiple = false)] | ||
| public sealed class ChoiceAttribute : Attribute | ||
| { | ||
| /// <summary> | ||
| /// Create a <see cref="ChoiceAttribute"/> with <paramref name="candidates"/>. | ||
| /// </summary> | ||
| public ChoiceAttribute(params object[] candidates) | ||
| { | ||
| var candidatesType = candidates.Select(o => o.GetType()).Distinct(); | ||
| Contract.Assert(candidatesType.Count() == 1, "multiple candidates type detected"); | ||
| this.Candidates = candidates; | ||
| this.DefaultValue = null; | ||
| } | ||
| /// <summary> | ||
| /// Create a <see cref="ChoiceAttribute"/> with <paramref name="candidates"/> and <paramref name="defaultValue"/>. | ||
| /// </summary> | ||
| public ChoiceAttribute(object[] candidates, object defaultValue) | ||
| { | ||
| var candidatesType = candidates.Select(o => o.GetType()).Distinct(); | ||
| Contract.Assert(candidatesType.Count() == 1, "multiple candidates type detected"); | ||
| Contract.Assert(candidatesType.First() == defaultValue.GetType(), "candidates type doesn't match with defaultValue type"); | ||
| this.Candidates = candidates; | ||
| this.DefaultValue = defaultValue; | ||
| } | ||
| /// <summary> | ||
| /// Get the candidates of this option. | ||
| /// </summary> | ||
| public object[] Candidates { get; } | ||
| /// <summary> | ||
| /// Get the default value of this option. | ||
| /// </summary> | ||
| public object DefaultValue { get; } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| // 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.SearchSpace; | ||
| /// <summary> | ||
| /// attribution class for nest option. | ||
| /// </summary> | ||
| [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, Inherited = false, AllowMultiple = false)] | ||
| public sealed class NestOptionAttribute : Attribute | ||
| { | ||
| /// <summary> | ||
| /// Create an <see cref="NestOptionAttribute"/>. | ||
| /// </summary> | ||
| public NestOptionAttribute() | ||
| { | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| // 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.SearchSpace; | ||
| /// <summary> | ||
| /// Range attribute | ||
| /// </summary> | ||
| [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, Inherited = false, AllowMultiple = false)] | ||
| public sealed class RangeAttribute : Attribute | ||
| { | ||
| /// <summary> | ||
| /// Create a <see cref="RangeAttribute"/> | ||
| /// </summary> | ||
| public RangeAttribute(double min, double max, bool logBase = false) | ||
| { | ||
| this.Min = min; | ||
| this.Max = max; | ||
| this.Init = null; | ||
| this.LogBase = logBase; | ||
| } | ||
| /// <summary> | ||
| /// Create a <see cref="RangeAttribute"/> | ||
| /// </summary> | ||
| public RangeAttribute(double min, double max, double init, bool logBase = false) | ||
| { | ||
| this.Min = min; | ||
| this.Max = max; | ||
| this.Init = init; | ||
| this.LogBase = logBase; | ||
| } | ||
| /// <summary> | ||
| /// Create a <see cref="RangeAttribute"/> | ||
| /// </summary> | ||
| public RangeAttribute(int min, int max, bool logBase = false) | ||
| { | ||
| this.Min = min; | ||
| this.Max = max; | ||
| this.Init = null; | ||
| this.LogBase = logBase; | ||
| } | ||
| /// <summary> | ||
| /// Create a <see cref="RangeAttribute"/> | ||
| /// </summary> | ||
| public RangeAttribute(int min, int max, int init, bool logBase = false) | ||
| { | ||
| this.Min = min; | ||
| this.Max = max; | ||
| this.Init = init; | ||
| this.LogBase = logBase; | ||
| } | ||
| /// <summary> | ||
| /// Create a <see cref="RangeAttribute"/> | ||
| /// </summary> | ||
| public RangeAttribute(float min, float max, bool logBase = false) | ||
| { | ||
| this.Min = min; | ||
| this.Max = max; | ||
| this.Init = null; | ||
| this.LogBase = logBase; | ||
| } | ||
| /// <summary> | ||
| /// Create a <see cref="RangeAttribute"/> | ||
| /// </summary> | ||
| public RangeAttribute(float min, float max, float init, bool logBase = false) | ||
| { | ||
| this.Min = min; | ||
| this.Max = max; | ||
| this.Init = init; | ||
| this.LogBase = logBase; | ||
| } | ||
| public object Min { get; } | ||
| public object Max { get; } | ||
| public object Init { get; } | ||
| public bool LogBase { get; } | ||
| } |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.