internal Classification(LogVerbosity?logVerbosity, TaskType taskType, IList <ClassificationModels> allowedModels, IList <ClassificationModels> blockedModels, ClassificationPrimaryMetrics?primaryMetric, TableVerticalDataSettings dataSettings, TableVerticalFeaturizationSettings featurizationSettings, TableVerticalLimitSettings limitSettings, TrainingSettings trainingSettings) : base(logVerbosity, taskType) { AllowedModels = allowedModels; BlockedModels = blockedModels; PrimaryMetric = primaryMetric; DataSettings = dataSettings; FeaturizationSettings = featurizationSettings; LimitSettings = limitSettings; TrainingSettings = trainingSettings; TaskType = taskType; }
internal static Classification DeserializeClassification(JsonElement element) { Optional <IList <ClassificationModels> > allowedModels = default; Optional <IList <ClassificationModels> > blockedModels = default; Optional <ClassificationPrimaryMetrics> 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 <ClassificationModels> array = new List <ClassificationModels>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(new ClassificationModels(item.GetString())); } allowedModels = array; continue; } if (property.NameEquals("blockedModels")) { if (property.Value.ValueKind == JsonValueKind.Null) { blockedModels = null; continue; } List <ClassificationModels> array = new List <ClassificationModels>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(new ClassificationModels(item.GetString())); } blockedModels = array; continue; } 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 = 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 Classification(Optional.ToNullable(logVerbosity), taskType, Optional.ToList(allowedModels), Optional.ToList(blockedModels), Optional.ToNullable(primaryMetric), dataSettings.Value, featurizationSettings.Value, limitSettings.Value, trainingSettings.Value)); }