本文整理汇总了Python中model_base.ModelBase类的典型用法代码示例。如果您正苦于以下问题:Python ModelBase类的具体用法?Python ModelBase怎么用?Python ModelBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ModelBase类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
开发者ID:will3216,项目名称:optimization,代码行数:7,代码来源:scalar.py
示例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
开发者ID:will3216,项目名称:optimization,代码行数:8,代码来源:parameter_list.py
示例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
开发者ID:will3216,项目名称:optimization,代码行数:9,代码来源:variable.py
示例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
开发者ID:will3216,项目名称:optimization,代码行数:9,代码来源:table.py
示例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()
开发者ID:scythargon,项目名称:pce_web,代码行数:10,代码来源:model_components.py
示例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()
开发者ID:jrouquie,项目名称:h2o-3,代码行数:10,代码来源:regression.py
示例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()
开发者ID:scythargon,项目名称:pce_web,代码行数:11,代码来源:model_responsibilities.py
示例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()
开发者ID:scythargon,项目名称:pce_web,代码行数:11,代码来源:model_types.py
示例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()
开发者ID:jrouquie,项目名称:h2o-3,代码行数:11,代码来源:regression.py
示例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()
开发者ID:scythargon,项目名称:pce_web,代码行数:11,代码来源:model_tagging.py
示例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()
开发者ID:scythargon,项目名称:pce_web,代码行数:11,代码来源:model_physical_connections.py
示例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()
开发者ID:scythargon,项目名称:pce_web,代码行数:11,代码来源:model_logical_connections.py
示例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
开发者ID:will3216,项目名称:optimization,代码行数:15,代码来源:base_equation.py
示例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
开发者ID:jrouquie,项目名称:h2o-3,代码行数:16,代码来源:regression.py
示例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
开发者ID:jrouquie,项目名称:h2o-3,代码行数:16,代码来源:regression.py
示例16: size
def size(self, train=False, valid=False, xval=False):
"""
Get the sizes of each cluster.
If all are False (default), then return the training metric value.
If more than one options is set to True, then return a dictionary of metrics where
the keys are "train", "valid", and "xval"
Parameters
----------
train : bool, optional
If True, then return cluster sizes for the training data.
valid : bool, optional
If True, then return the cluster sizes for the validation data.
xval : bool, optional
If True, then return the cluster sizes for each of the cross-validated splits.
Returns
-------
Returns the cluster sizes for the specified key(s).
"""
tm = ModelBase._get_metrics(self, train, valid, xval)
m = {}
for k, v in zip(tm.keys(), tm.values()):
m[k] = None if v is None else [v[2] for v in v._metric_json["centroid_stats"].cell_values]
return m.values()[0] if len(m) == 1 else m
开发者ID:huamichaelchen,项目名称:h2o-3,代码行数:26,代码来源:clustering.py
示例17: totss
def totss(self, train=False, valid=False, xval=False):
"""
Get the total sum of squares.
If all are False (default), then return the training metric value.
If more than one options is set to True, then return a dictionary of metrics where
the keys are "train", "valid", and "xval".
Parameters
----------
train : bool, optional
If True, then return the total sum of squares value for the training
data.
valid : bool, optional
If True, then return the total sum of squares value for the validation
data.
xval : bool, optional
If True, then return the total sum of squares value for each of the
cross-validated splits.
Returns
-------
Returns the total sum of squares values for the specified key(s).
"""
tm = ModelBase._get_metrics(self, train, valid, xval)
m = {}
for k, v in zip(tm.keys(), tm.values()):
m[k] = None if v is None else v._metric_json["totss"]
return m.values()[0] if len(m) == 1 else m
开发者ID:huamichaelchen,项目名称:h2o-3,代码行数:29,代码来源:clustering.py
示例18: cat_err
def cat_err(self):
"""
:return: the Number of Misclassified categories over non-missing categorical entries, or None if not present.
"""
if ModelBase._has(self._metric_json, "caterr"):
return self._metric_json["caterr"]
return None
开发者ID:summerq8410,项目名称:h2o-3,代码行数:7,代码来源:metrics_base.py
示例19: null_deviance
def null_deviance(self):
"""
:return: the null deviance if the model has residual deviance, or None if no null deviance.
"""
if ModelBase._has(self._metric_json, "null_deviance"):
return self._metric_json["null_deviance"]
return None
开发者ID:venkatesh12341234,项目名称:h2o-dev,代码行数:7,代码来源:metrics_base.py
示例20: num_err
def num_err(self):
"""
:return: the Sum of Squared Error over non-missing numeric entries, or None if not present.
"""
if ModelBase._has(self._metric_json, "numerr"):
return self._metric_json["numerr"]
return None
开发者ID:summerq8410,项目名称:h2o-3,代码行数:7,代码来源:metrics_base.py
注:本文中的model_base.ModelBase类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论