Exemplo n.º 1
0
 internal TrainingSettings(bool?enableDnnTraining, bool?enableModelExplainability, bool?enableOnnxCompatibleModels, bool?enableStackEnsemble, bool?enableVoteEnsemble, TimeSpan?ensembleModelDownloadTimeout, StackEnsembleSettings stackEnsembleSettings)
 {
     EnableDnnTraining            = enableDnnTraining;
     EnableModelExplainability    = enableModelExplainability;
     EnableOnnxCompatibleModels   = enableOnnxCompatibleModels;
     EnableStackEnsemble          = enableStackEnsemble;
     EnableVoteEnsemble           = enableVoteEnsemble;
     EnsembleModelDownloadTimeout = ensembleModelDownloadTimeout;
     StackEnsembleSettings        = stackEnsembleSettings;
 }
Exemplo n.º 2
0
        internal static TrainingSettings DeserializeTrainingSettings(JsonElement element)
        {
            Optional <bool>     enableDnnTraining                  = default;
            Optional <bool>     enableModelExplainability          = default;
            Optional <bool>     enableOnnxCompatibleModels         = default;
            Optional <bool>     enableStackEnsemble                = default;
            Optional <bool>     enableVoteEnsemble                 = default;
            Optional <TimeSpan> ensembleModelDownloadTimeout       = default;
            Optional <StackEnsembleSettings> stackEnsembleSettings = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("enableDnnTraining"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    enableDnnTraining = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("enableModelExplainability"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    enableModelExplainability = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("enableOnnxCompatibleModels"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    enableOnnxCompatibleModels = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("enableStackEnsemble"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    enableStackEnsemble = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("enableVoteEnsemble"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    enableVoteEnsemble = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("ensembleModelDownloadTimeout"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    ensembleModelDownloadTimeout = property.Value.GetTimeSpan("P");
                    continue;
                }
                if (property.NameEquals("stackEnsembleSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        stackEnsembleSettings = null;
                        continue;
                    }
                    stackEnsembleSettings = StackEnsembleSettings.DeserializeStackEnsembleSettings(property.Value);
                    continue;
                }
            }
            return(new TrainingSettings(Optional.ToNullable(enableDnnTraining), Optional.ToNullable(enableModelExplainability), Optional.ToNullable(enableOnnxCompatibleModels), Optional.ToNullable(enableStackEnsemble), Optional.ToNullable(enableVoteEnsemble), Optional.ToNullable(ensembleModelDownloadTimeout), stackEnsembleSettings.Value));
        }