Example #1
0
        /// <summary>
        /// Deserializes the object out of a JSON dynamic object.
        /// </summary>
        /// <param name="jsonObject">the JSON dynamic object</param>
        /// <returns>the deserialized object</returns>
        public static ModelVersion Deserialize(dynamic jsonObject)
        {
            int activeConceptCount = 0;

            if (jsonObject.active_concept_count != null)
            {
                activeConceptCount = (int)jsonObject.active_concept_count;
            }

            int totalInputCount = 0;

            if (jsonObject.total_input_count != null)
            {
                totalInputCount = (int)jsonObject.total_input_count;
            }

            ModelMetricsStatus modelMetricsStatus = null;

            if (jsonObject.metrics != null)
            {
                modelMetricsStatus = Models.ModelMetricsStatus.Deserialize(
                    jsonObject.metrics.status);
            }

            return(new ModelVersion(
                       (string)jsonObject.id,
                       (DateTime)jsonObject.created_at,
                       ModelTrainingStatus.Deserialize(jsonObject.status),
                       activeConceptCount,
                       totalInputCount,
                       modelMetricsStatus));
        }
Example #2
0
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="id">the model-version id</param>
 /// <param name="createdAt">the date & time of creation</param>
 /// <param name="status">the model training status</param>
 /// <param name="activeConceptCount">the active concept count</param>
 /// <param name="totalInputCount">the total input count</param>
 /// <param name="modelMetricsStatus">the model metrics status</param>
 private ModelVersion(string id, DateTime createdAt, ModelTrainingStatus status,
                      int activeConceptCount = 0, int totalInputCount = 0,
                      ModelMetricsStatus modelMetricsStatus = null)
 {
     ID                 = id;
     CreatedAt          = createdAt;
     Status             = status;
     ActiveConceptCount = activeConceptCount;
     TotalInputCount    = totalInputCount;
     ModelMetricsStatus = modelMetricsStatus;
 }