Exemple #1
0
        internal static ImageVerticalValidationDataSettings DeserializeImageVerticalValidationDataSettings(JsonElement element)
        {
            Optional <MLTableJobInput> data = default;
            Optional <double?>         validationDataSize = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("data"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        data = null;
                        continue;
                    }
                    data = MLTableJobInput.DeserializeMLTableJobInput(property.Value);
                    continue;
                }
                if (property.NameEquals("validationDataSize"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        validationDataSize = null;
                        continue;
                    }
                    validationDataSize = property.Value.GetDouble();
                    continue;
                }
            }
            return(new ImageVerticalValidationDataSettings(data.Value, Optional.ToNullable(validationDataSize)));
        }
Exemple #2
0
        internal static TableVerticalValidationDataSettings DeserializeTableVerticalValidationDataSettings(JsonElement element)
        {
            Optional <IList <string> >   cvSplitColumnNames = default;
            Optional <NCrossValidations> nCrossValidations  = default;
            Optional <MLTableJobInput>   data = default;
            Optional <double?>           validationDataSize = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("cvSplitColumnNames"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        cvSplitColumnNames = null;
                        continue;
                    }
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    cvSplitColumnNames = array;
                    continue;
                }
                if (property.NameEquals("nCrossValidations"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        nCrossValidations = null;
                        continue;
                    }
                    nCrossValidations = NCrossValidations.DeserializeNCrossValidations(property.Value);
                    continue;
                }
                if (property.NameEquals("data"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        data = null;
                        continue;
                    }
                    data = MLTableJobInput.DeserializeMLTableJobInput(property.Value);
                    continue;
                }
                if (property.NameEquals("validationDataSize"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        validationDataSize = null;
                        continue;
                    }
                    validationDataSize = property.Value.GetDouble();
                    continue;
                }
            }
            return(new TableVerticalValidationDataSettings(data.Value, Optional.ToNullable(validationDataSize), Optional.ToList(cvSplitColumnNames), nCrossValidations.Value));
        }
Exemple #3
0
        internal static TrainingDataSettings DeserializeTrainingDataSettings(JsonElement element)
        {
            MLTableJobInput data = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("data"))
                {
                    data = MLTableJobInput.DeserializeMLTableJobInput(property.Value);
                    continue;
                }
            }
            return(new TrainingDataSettings(data));
        }
Exemple #4
0
        internal static JobInput DeserializeJobInput(JsonElement element)
        {
            if (element.TryGetProperty("jobInputType", out JsonElement discriminator))
            {
                switch (discriminator.GetString())
                {
                case "CustomModel": return(CustomModelJobInput.DeserializeCustomModelJobInput(element));

                case "Literal": return(LiteralJobInput.DeserializeLiteralJobInput(element));

                case "MLFlowModel": return(MLFlowModelJobInput.DeserializeMLFlowModelJobInput(element));

                case "MLTable": return(MLTableJobInput.DeserializeMLTableJobInput(element));

                case "TritonModel": return(TritonModelJobInput.DeserializeTritonModelJobInput(element));

                case "UriFile": return(UriFileJobInput.DeserializeUriFileJobInput(element));

                case "UriFolder": return(UriFolderJobInput.DeserializeUriFolderJobInput(element));
                }
            }
            Optional <string> description  = default;
            JobInputType      jobInputType = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("description"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        description = null;
                        continue;
                    }
                    description = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("jobInputType"))
                {
                    jobInputType = new JobInputType(property.Value.GetString());
                    continue;
                }
            }
            return(new JobInput(description.Value, jobInputType));
        }