Beispiel #1
0
 def __new__(cls, keyvals):
     # This method is called by the simplejson.json(object_pairs_hook=<this>)
     # `keyvals` is a list of (key,value) tuples. For example:
     #    [("schema_version", 3), ("schema_name", "InitIDV3"), ("schema_type", "Iced")]
     schema = None
     for k, v in keyvals:
         if k == "__meta" and isinstance(v, dict):
             schema = v["schema_name"]
             break
         if k == "__schema" and is_type(v, str):
             schema = v
             break
     if schema == "MetadataV3": return H2OMetadataV3.make(keyvals)
     if schema == "CloudV3": return H2OCluster.make(keyvals)
     if schema == "H2OErrorV3": return H2OErrorV3.make(keyvals)
     if schema == "H2OModelBuilderErrorV3":
         return H2OModelBuilderErrorV3.make(keyvals)
     if schema == "TwoDimTableV3": return H2OTwoDimTable.make(keyvals)
     if schema == "ModelMetricsRegressionV3":
         return H2ORegressionModelMetrics.make(keyvals)
     if schema == "ModelMetricsClusteringV3":
         return H2OClusteringModelMetrics.make(keyvals)
     if schema == "ModelMetricsBinomialV3":
         return H2OBinomialModelMetrics.make(keyvals)
     if schema == "ModelMetricsBinomialUpliftV3":
         return H2OBinomialUpliftModelMetrics.make(keyvals)
     if schema == "ModelMetricsMultinomialV3":
         return H2OMultinomialModelMetrics.make(keyvals)
     if schema == "ModelMetricsOrdinalV3":
         return H2OOrdinalModelMetrics.make(keyvals)
     if schema == "ModelMetricsAutoEncoderV3":
         return H2OAutoEncoderModelMetrics.make(keyvals)
     return super(H2OResponse, cls).__new__(cls, keyvals)
Beispiel #2
0
 def __new__(cls, keyvals):
     # This method is called by the simplejson.json(object_pairs_hook=<this>)
     # `keyvals` is a list of (key,value) tuples. For example:
     #    [("schema_version", 3), ("schema_name", "InitIDV3"), ("schema_type", "Iced")]
     schema = None
     for k, v in keyvals:
         if k == "__meta" and isinstance(v, dict):
             schema = v["schema_name"]
             break
         if k == "__schema" and is_str(v):
             schema = v
             break
     if schema == "CloudV3": return H2OCluster(keyvals)
     if schema == "H2OErrorV3": return H2OErrorV3(keyvals)
     if schema == "H2OModelBuilderErrorV3": return H2OModelBuilderErrorV3(keyvals)
     if schema == "TwoDimTableV3": return H2OTwoDimTable.make(keyvals)
     if schema == "ModelMetricsRegressionV3": return H2ORegressionModelMetrics.make(keyvals)
     if schema == "ModelMetricsClusteringV3": return H2OClusteringModelMetrics.make(keyvals)
     if schema == "ModelMetricsBinomialV3": return H2OBinomialModelMetrics.make(keyvals)
     if schema == "ModelMetricsMultinomialV3": return H2OMultinomialModelMetrics.make(keyvals)
     if schema == "ModelMetricsAutoEncoderV3": return H2OAutoEncoderModelMetrics.make(keyvals)
     return super(H2OResponse, cls).__new__(cls, keyvals)