예제 #1
0
        internal static ImageClassification DeserializeImageClassification(JsonElement element)
        {
            Optional <ClassificationPrimaryMetrics>     primaryMetric = default;
            Optional <ImageModelSettingsClassification> modelSettings = default;
            Optional <IList <ImageModelDistributionSettingsClassification> > searchSpace = default;
            ImageVerticalDataSettings     dataSettings  = default;
            ImageLimitSettings            limitSettings = default;
            Optional <ImageSweepSettings> sweepSettings = default;
            Optional <LogVerbosity>       logVerbosity  = default;
            TaskType taskType = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("primaryMetric"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    primaryMetric = new ClassificationPrimaryMetrics(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("modelSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        modelSettings = null;
                        continue;
                    }
                    modelSettings = ImageModelSettingsClassification.DeserializeImageModelSettingsClassification(property.Value);
                    continue;
                }
                if (property.NameEquals("searchSpace"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        searchSpace = null;
                        continue;
                    }
                    List <ImageModelDistributionSettingsClassification> array = new List <ImageModelDistributionSettingsClassification>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ImageModelDistributionSettingsClassification.DeserializeImageModelDistributionSettingsClassification(item));
                    }
                    searchSpace = array;
                    continue;
                }
                if (property.NameEquals("dataSettings"))
                {
                    dataSettings = ImageVerticalDataSettings.DeserializeImageVerticalDataSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("limitSettings"))
                {
                    limitSettings = ImageLimitSettings.DeserializeImageLimitSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("sweepSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        sweepSettings = null;
                        continue;
                    }
                    sweepSettings = ImageSweepSettings.DeserializeImageSweepSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("logVerbosity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    logVerbosity = new LogVerbosity(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("taskType"))
                {
                    taskType = new TaskType(property.Value.GetString());
                    continue;
                }
            }
            return(new ImageClassification(Optional.ToNullable(logVerbosity), taskType, Optional.ToNullable(primaryMetric), modelSettings.Value, Optional.ToList(searchSpace), dataSettings, limitSettings, sweepSettings.Value));
        }
예제 #2
0
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     if (Optional.IsDefined(PrimaryMetric))
     {
         writer.WritePropertyName("primaryMetric");
         writer.WriteStringValue(PrimaryMetric.Value.ToString());
     }
     if (Optional.IsDefined(ModelSettings))
     {
         if (ModelSettings != null)
         {
             writer.WritePropertyName("modelSettings");
             writer.WriteObjectValue(ModelSettings);
         }
         else
         {
             writer.WriteNull("modelSettings");
         }
     }
     if (Optional.IsCollectionDefined(SearchSpace))
     {
         if (SearchSpace != null)
         {
             writer.WritePropertyName("searchSpace");
             writer.WriteStartArray();
             foreach (var item in SearchSpace)
             {
                 writer.WriteObjectValue(item);
             }
             writer.WriteEndArray();
         }
         else
         {
             writer.WriteNull("searchSpace");
         }
     }
     writer.WritePropertyName("dataSettings");
     writer.WriteObjectValue(DataSettings);
     writer.WritePropertyName("limitSettings");
     writer.WriteObjectValue(LimitSettings);
     if (Optional.IsDefined(SweepSettings))
     {
         if (SweepSettings != null)
         {
             writer.WritePropertyName("sweepSettings");
             writer.WriteObjectValue(SweepSettings);
         }
         else
         {
             writer.WriteNull("sweepSettings");
         }
     }
     if (Optional.IsDefined(LogVerbosity))
     {
         writer.WritePropertyName("logVerbosity");
         writer.WriteStringValue(LogVerbosity.Value.ToString());
     }
     writer.WritePropertyName("taskType");
     writer.WriteStringValue(TaskType.ToString());
     writer.WriteEndObject();
 }
예제 #3
0
        internal static Forecasting DeserializeForecasting(JsonElement element)
        {
            Optional <IList <ForecastingModels> >         allowedModels         = default;
            Optional <IList <ForecastingModels> >         blockedModels         = default;
            Optional <ForecastingSettings>                forecastingSettings   = default;
            Optional <ForecastingPrimaryMetrics>          primaryMetric         = default;
            Optional <TableVerticalDataSettings>          dataSettings          = default;
            Optional <TableVerticalFeaturizationSettings> featurizationSettings = default;
            Optional <TableVerticalLimitSettings>         limitSettings         = default;
            Optional <TrainingSettings> trainingSettings = default;
            Optional <LogVerbosity>     logVerbosity     = default;
            TaskType taskType = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("allowedModels"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        allowedModels = null;
                        continue;
                    }
                    List <ForecastingModels> array = new List <ForecastingModels>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(new ForecastingModels(item.GetString()));
                    }
                    allowedModels = array;
                    continue;
                }
                if (property.NameEquals("blockedModels"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        blockedModels = null;
                        continue;
                    }
                    List <ForecastingModels> array = new List <ForecastingModels>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(new ForecastingModels(item.GetString()));
                    }
                    blockedModels = array;
                    continue;
                }
                if (property.NameEquals("forecastingSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        forecastingSettings = null;
                        continue;
                    }
                    forecastingSettings = ForecastingSettings.DeserializeForecastingSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("primaryMetric"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    primaryMetric = new ForecastingPrimaryMetrics(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("dataSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        dataSettings = null;
                        continue;
                    }
                    dataSettings = TableVerticalDataSettings.DeserializeTableVerticalDataSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("featurizationSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        featurizationSettings = null;
                        continue;
                    }
                    featurizationSettings = TableVerticalFeaturizationSettings.DeserializeTableVerticalFeaturizationSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("limitSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        limitSettings = null;
                        continue;
                    }
                    limitSettings = TableVerticalLimitSettings.DeserializeTableVerticalLimitSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("trainingSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        trainingSettings = null;
                        continue;
                    }
                    trainingSettings = TrainingSettings.DeserializeTrainingSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("logVerbosity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    logVerbosity = new LogVerbosity(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("taskType"))
                {
                    taskType = new TaskType(property.Value.GetString());
                    continue;
                }
            }
            return(new Forecasting(Optional.ToNullable(logVerbosity), taskType, Optional.ToList(allowedModels), Optional.ToList(blockedModels), forecastingSettings.Value, Optional.ToNullable(primaryMetric), dataSettings.Value, featurizationSettings.Value, limitSettings.Value, trainingSettings.Value));
        }
예제 #4
0
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     if (Optional.IsCollectionDefined(AllowedModels))
     {
         if (AllowedModels != null)
         {
             writer.WritePropertyName("allowedModels");
             writer.WriteStartArray();
             foreach (var item in AllowedModels)
             {
                 writer.WriteStringValue(item.ToString());
             }
             writer.WriteEndArray();
         }
         else
         {
             writer.WriteNull("allowedModels");
         }
     }
     if (Optional.IsCollectionDefined(BlockedModels))
     {
         if (BlockedModels != null)
         {
             writer.WritePropertyName("blockedModels");
             writer.WriteStartArray();
             foreach (var item in BlockedModels)
             {
                 writer.WriteStringValue(item.ToString());
             }
             writer.WriteEndArray();
         }
         else
         {
             writer.WriteNull("blockedModels");
         }
     }
     if (Optional.IsDefined(ForecastingSettings))
     {
         if (ForecastingSettings != null)
         {
             writer.WritePropertyName("forecastingSettings");
             writer.WriteObjectValue(ForecastingSettings);
         }
         else
         {
             writer.WriteNull("forecastingSettings");
         }
     }
     if (Optional.IsDefined(PrimaryMetric))
     {
         writer.WritePropertyName("primaryMetric");
         writer.WriteStringValue(PrimaryMetric.Value.ToString());
     }
     if (Optional.IsDefined(DataSettings))
     {
         if (DataSettings != null)
         {
             writer.WritePropertyName("dataSettings");
             writer.WriteObjectValue(DataSettings);
         }
         else
         {
             writer.WriteNull("dataSettings");
         }
     }
     if (Optional.IsDefined(FeaturizationSettings))
     {
         if (FeaturizationSettings != null)
         {
             writer.WritePropertyName("featurizationSettings");
             writer.WriteObjectValue(FeaturizationSettings);
         }
         else
         {
             writer.WriteNull("featurizationSettings");
         }
     }
     if (Optional.IsDefined(LimitSettings))
     {
         if (LimitSettings != null)
         {
             writer.WritePropertyName("limitSettings");
             writer.WriteObjectValue(LimitSettings);
         }
         else
         {
             writer.WriteNull("limitSettings");
         }
     }
     if (Optional.IsDefined(TrainingSettings))
     {
         if (TrainingSettings != null)
         {
             writer.WritePropertyName("trainingSettings");
             writer.WriteObjectValue(TrainingSettings);
         }
         else
         {
             writer.WriteNull("trainingSettings");
         }
     }
     if (Optional.IsDefined(LogVerbosity))
     {
         writer.WritePropertyName("logVerbosity");
         writer.WriteStringValue(LogVerbosity.Value.ToString());
     }
     writer.WritePropertyName("taskType");
     writer.WriteStringValue(TaskType.ToString());
     writer.WriteEndObject();
 }
예제 #5
0
        internal static TextNer DeserializeTextNer(JsonElement element)
        {
            Optional <ClassificationPrimaryMetrics>     primaryMetric         = default;
            Optional <NlpVerticalDataSettings>          dataSettings          = default;
            Optional <NlpVerticalFeaturizationSettings> featurizationSettings = default;
            Optional <NlpVerticalLimitSettings>         limitSettings         = default;
            Optional <LogVerbosity> logVerbosity = default;
            TaskType taskType = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("primaryMetric"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    primaryMetric = new ClassificationPrimaryMetrics(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("dataSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        dataSettings = null;
                        continue;
                    }
                    dataSettings = NlpVerticalDataSettings.DeserializeNlpVerticalDataSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("featurizationSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        featurizationSettings = null;
                        continue;
                    }
                    featurizationSettings = NlpVerticalFeaturizationSettings.DeserializeNlpVerticalFeaturizationSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("limitSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        limitSettings = null;
                        continue;
                    }
                    limitSettings = NlpVerticalLimitSettings.DeserializeNlpVerticalLimitSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("logVerbosity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    logVerbosity = new LogVerbosity(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("taskType"))
                {
                    taskType = new TaskType(property.Value.GetString());
                    continue;
                }
            }
            return(new TextNer(Optional.ToNullable(logVerbosity), taskType, Optional.ToNullable(primaryMetric), dataSettings.Value, featurizationSettings.Value, limitSettings.Value));
        }