本文整理汇总了Python中Orange.data.DiscreteVariable.to_sql方法的典型用法代码示例。如果您正苦于以下问题:Python DiscreteVariable.to_sql方法的具体用法?Python DiscreteVariable.to_sql怎么用?Python DiscreteVariable.to_sql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orange.data.DiscreteVariable
的用法示例。
在下文中一共展示了DiscreteVariable.to_sql方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_discretized_var
# 需要导入模块: from Orange.data import DiscreteVariable [as 别名]
# 或者: from Orange.data.DiscreteVariable import to_sql [as 别名]
def create_discretized_var(cls, var, points):
lpoints = list(points)
if lpoints:
values = [
cls._fmt_interval(low, high, var.number_of_decimals)
for low, high in zip([-np.inf] + lpoints, lpoints + [np.inf])]
to_sql = BinSql(var, lpoints)
else:
values = ["single_value"]
to_sql = SingleValueSql(values[0])
dvar = DiscreteVariable(name=var.name, values=values,
compute_value=cls(var, points))
dvar.source_variable = var
dvar.to_sql = to_sql
return dvar
示例2: create_discretized_var
# 需要导入模块: from Orange.data import DiscreteVariable [as 别名]
# 或者: from Orange.data.DiscreteVariable import to_sql [as 别名]
def create_discretized_var(cls, var, points):
lpoints = list(points)
if points:
values = [
cls._fmt_interval(low, high, var.number_of_decimals)
for low, high in zip([-np.inf] + lpoints, lpoints + [np.inf])]
def discretized_attribute():
return 'bin(%s, ARRAY%s)' % (var.to_sql(), str(lpoints))
else:
values = ["single_value"]
def discretized_attribute():
return "'%s'" % values[0]
dvar = DiscreteVariable(name="D_" + var.name, values=values)
dvar.compute_value = cls(var, points)
dvar.source_variable = var
dvar.to_sql = discretized_attribute
return dvar