コード例 #1
0
 internal Forecasting(LogVerbosity?logVerbosity, TaskType taskType, IList <ForecastingModels> allowedModels, IList <ForecastingModels> blockedModels, ForecastingSettings forecastingSettings, ForecastingPrimaryMetrics?primaryMetric, TableVerticalDataSettings dataSettings, TableVerticalFeaturizationSettings featurizationSettings, TableVerticalLimitSettings limitSettings, TrainingSettings trainingSettings) : base(logVerbosity, taskType)
 {
     AllowedModels         = allowedModels;
     BlockedModels         = blockedModels;
     ForecastingSettings   = forecastingSettings;
     PrimaryMetric         = primaryMetric;
     DataSettings          = dataSettings;
     FeaturizationSettings = featurizationSettings;
     LimitSettings         = limitSettings;
     TrainingSettings      = trainingSettings;
     TaskType = taskType;
 }
コード例 #2
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));
        }