示例#1
0
        internal static DataSettings DeserializeDataSettings(JsonElement element)
        {
            string targetColumnName = default;
            Optional <TestDataSettings> testData     = default;
            TrainingDataSettings        trainingData = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("targetColumnName"))
                {
                    targetColumnName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("testData"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        testData = null;
                        continue;
                    }
                    testData = TestDataSettings.DeserializeTestDataSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("trainingData"))
                {
                    trainingData = TrainingDataSettings.DeserializeTrainingDataSettings(property.Value);
                    continue;
                }
            }
            return(new DataSettings(targetColumnName, testData.Value, trainingData));
        }
示例#2
0
        internal static TableVerticalDataSettings DeserializeTableVerticalDataSettings(JsonElement element)
        {
            Optional <TableVerticalValidationDataSettings> validationData = default;
            Optional <string>           weightColumnName = default;
            string                      targetColumnName = default;
            Optional <TestDataSettings> testData         = default;
            TrainingDataSettings        trainingData     = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("validationData"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        validationData = null;
                        continue;
                    }
                    validationData = TableVerticalValidationDataSettings.DeserializeTableVerticalValidationDataSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("weightColumnName"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        weightColumnName = null;
                        continue;
                    }
                    weightColumnName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("targetColumnName"))
                {
                    targetColumnName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("testData"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        testData = null;
                        continue;
                    }
                    testData = TestDataSettings.DeserializeTestDataSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("trainingData"))
                {
                    trainingData = TrainingDataSettings.DeserializeTrainingDataSettings(property.Value);
                    continue;
                }
            }
            return(new TableVerticalDataSettings(targetColumnName, testData.Value, trainingData, validationData.Value, weightColumnName.Value));
        }