本文整理汇总了Python中model_base.ModelBase类的典型用法代码示例。如果您正苦于以下问题:Python ModelBase类的具体用法?Python ModelBase怎么用?Python ModelBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ModelBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, parent, id, arg_list, dtype=float):
ModelBase.__init__(self, parent, id, arg_list[0], type)
arg_list.pop(0)
[self.raw_value] = arg_list.pop(0)
self.dtype = dtype
self.data = None
return
示例2: __init__
def __init__(self, parent, id, arg_list, dtype='float'):
ModelBase.__init__(self, parent, id, arg_list[1], 'Param List')
self.domain = arg_list.pop(0)
self.raw_list = arg_list[-1]
self.dtype = dtype
self.shape = []
self.data = array([])
return
示例3: __init__
def __init__(self, parent, id, arg_list, dtype='float'):
ModelBase.__init__(self, parent, id, arg_list[1], 'Variable')
self.domain = arg_list.pop(0)
arg_list.pop(0)
self.variable_type = arg_list.pop()
self.upper_bound = 10**30
self.lower_bound = -10**30
self.dtype = dtype
return
示例4: __init__
def __init__(self, parent, id, arg_list, dtype='float'):
ModelBase.__init__(self, parent, id, arg_list[1], 'Table')
self.domain = arg_list.pop(0)
arg_list.pop(0)
self.dtype = dtype
arg_list.pop(0)
self.raw_table = arg_list.pop()
self.data = array([])
return
示例5: __init__
def __init__(self):
"""
Constructor
"""
ModelBase.__init__(self, "Components")
self.AddAllowedAssociation(Unit = {"cid" : "C_DEVICE", "id" : "EACH"}, Part = {"cid" : "C_DEVICE_CHANNEL", "id" : "ANY"})
self.AddAllowedAssociation(Unit = {"cid" : "C_DEVICE_TYPE", "id" : "EACH"}, Part = {"cid" : "C_DEVICE_CHANNEL_GROUP", "id" : "ANY"})
self.GenerateValidator()
示例6: h2o_median_absolute_error
def h2o_median_absolute_error(y_actual, y_predicted):
"""
Median absolute error regression loss
:param y_actual: H2OFrame of actual response.
:param y_predicted: H2OFrame of predicted response.
:return: loss (float) (best is 0.0)
"""
ModelBase._check_targets(y_actual, y_predicted)
return (y_predicted-y_actual).abs().median()
示例7: __init__
def __init__(self):
"""
Constructor
"""
ModelBase.__init__(self, "Responsibilities")
self.AddAllowedAssociation(Responsible = {"cid" : "C_SERVER", "id" : "ANY"}, Subject = {"cid" : "C_IOC", "id" : "EACH"}, multiplicity=1)
self.AddAllowedAssociation(Responsible = {"cid" : "C_IOC", "id" : "ANY"}, Subject = {"cid" : "C_DEVICE", "id" : "EACH"}, multiplicity=1)
self.GenerateValidator()
示例8: __init__
def __init__(self):
"""
Constructor
"""
ModelBase.__init__(self, "Types")
self.AddAllowedAssociation(Type = {"cid" : "C_BUS_TYPE", "id" : "ANY"}, Subject = {"cid" : "C_BUS", "id" : "EACH"}, multiplicity = 1)
self.AddAllowedAssociation(Type = {"cid" : "C_BUS_CONTROLLER_TYPE", "id" : "ANY"}, Subject = {"cid" : "C_BUS_CONTROLLER", "id" : "EACH"}, multiplicity = 1)
self.AddAllowedAssociation(Type = {"cid" : "C_DEVICE_TYPE", "id" : "ANY"}, Subject = {"cid" : "C_DEVICE", "id" : "EACH"}, multiplicity = 1)
self.GenerateValidator()
示例9: h2o_mean_squared_error
def h2o_mean_squared_error(y_actual, y_predicted, weights=None):
"""
Mean squared error regression loss
:param y_actual: H2OFrame of actual response.
:param y_predicted: H2OFrame of predicted response.
:param weights: (Optional) sample weights
:return: loss (float) (best is 0.0)
"""
ModelBase._check_targets(y_actual, y_predicted)
return ((y_predicted-y_actual)**2).mean()
示例10: __init__
def __init__(self):
"""
Constructor
"""
ModelBase.__init__(self, "Tagging")
self.AddAllowedAssociation(Tag = {"cid" : "C_TAG", "id" : "ANY"}, Subject = {"cid" : "C_TAG", "id" : "EACH"}, multiplicity=1)
self.AddAllowedAssociation(Tag = {"cid" : "C_TAG", "id" : "ANY"}, Subject = {"cid" : "ANY", "id" : "ANY"})
self.GenerateValidator()
示例11: __init__
def __init__(self):
"""
Constructor
"""
ModelBase.__init__(self, "Physical Connections")
self.AddAllowedAssociation(From = {"cid" : "C_SERVER", "id" : "EACH"}, To = {"cid" : "C_BUS_CONTROLLER", "id" : "ANY"})
self.AddAllowedAssociation(From = {"cid" : "C_BUS_CONTROLLER", "id" : "EACH"}, To = {"cid" : "C_BUS", "id" : "ANY"})
self.AddAllowedAssociation(From = {"cid" : "C_BUS", "id" : "EACH"}, To = {"cid" : "C_DEVICE", "id" : "ANY"})
self.GenerateValidator()
示例12: __init__
def __init__(self):
"""
Constructor
"""
ModelBase.__init__(self, "Logical Connections")
self.AddAllowedAssociation(From = {"cid" : "C_DEVICE_LINK", "id" : "EACH"}, To = {"cid" : "C_DEVICE_CHANNEL", "id" : "ANY"}, multiplicity=1)
self.specific_validator = ValidatorConnectorsMatch(self)
self.GenerateValidator()
示例13: __init__
def __init__(self, parent, id, args, type):
ModelBase.__init__(self, parent, id, args[1], 'Equation')
self.identifier = id
self.domain = args[1]
# These values should be of the form: (rel_path.module, function_name)
self.imports = []
self.eqn_slash_eqns = args[3]
self.declared_variables = parent.declared_variables
self.declared_parameters = parent.declared_parameters
self.declared_equations = parent.declared_equations
self.warning_list = []
self.processed_eqs = []
self.domain_checking = parent.domain_checking
return
示例14: h2o_r2_score
def h2o_r2_score(y_actual, y_predicted, weights=1.):
"""
R^2 (coefficient of determination) regression score function
:param y_actual: H2OFrame of actual response.
:param y_predicted: H2OFrame of predicted response.
:param weights: (Optional) sample weights
:return: R^2 (float) (best is 1.0, lower is worse)
"""
ModelBase._check_targets(y_actual, y_predicted)
numerator = (weights * (y_actual - y_predicted) ** 2).sum()
denominator = (weights * (y_actual - y_actual.mean()) ** 2).sum()
if denominator == 0.0:
return 1. if numerator == 0. else 0. # 0/0 => 1, else 0
return 1 - numerator / denominator
示例15: h2o_explained_variance_score
def h2o_explained_variance_score(y_actual, y_predicted, weights=None):
"""
Explained variance regression score function
:param y_actual: H2OFrame of actual response.
:param y_predicted: H2OFrame of predicted response.
:param weights: (Optional) sample weights
:return: the explained variance score (float)
"""
ModelBase._check_targets(y_actual, y_predicted)
_, numerator = _mean_var(y_actual - y_predicted, weights)
_, denominator = _mean_var(y_actual, weights)
if denominator == 0.0:
return 1. if numerator == 0 else 0. # 0/0 => 1, otherwise, 0
return 1 - numerator / denominator