当前位置: 首页>>代码示例>>Python>>正文


Python ContinuousVariable.get_value_from方法代码示例

本文整理汇总了Python中Orange.data.ContinuousVariable.get_value_from方法的典型用法代码示例。如果您正苦于以下问题:Python ContinuousVariable.get_value_from方法的具体用法?Python ContinuousVariable.get_value_from怎么用?Python ContinuousVariable.get_value_from使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Orange.data.ContinuousVariable的用法示例。


在下文中一共展示了ContinuousVariable.get_value_from方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: transform_continuous

# 需要导入模块: from Orange.data import ContinuousVariable [as 别名]
# 或者: from Orange.data.ContinuousVariable import get_value_from [as 别名]
 def transform_continuous(var):
     if not self.normalize_continuous:
         return var
     new_var = ContinuousVariable(var.name)
     dma, dmi = dists[var_ptr].max(), dists[var_ptr].min()
     diff = dma - dmi
     if diff < 1e-15:
         diff = 1
     if self.zero_based:
         new_var.get_value_from = Normalizer(var, dmi, 1 / diff)
     else:
         new_var.get_value_from = Normalizer(var, (dma + dmi) / 2,
                                             2 / diff)
     return new_var
开发者ID:agiz,项目名称:orange3,代码行数:16,代码来源:continuizer.py

示例2: transform_continuous

# 需要导入模块: from Orange.data import ContinuousVariable [as 别名]
# 或者: from Orange.data.ContinuousVariable import get_value_from [as 别名]
 def transform_continuous(var):
     if self.normalize_continuous == self.Leave:
         return var
     elif self.normalize_continuous == self.NormalizeBySpan:
         new_var = ContinuousVariable(var.name)
         dma, dmi = dists[var_ptr].max(), dists[var_ptr].min()
         diff = dma - dmi
         if diff < 1e-15:
             diff = 1
         if self.zero_based:
             new_var.get_value_from = Normalizer(var, dmi, 1 / diff)
         else:
             new_var.get_value_from = Normalizer(var, (dma + dmi) / 2,
                                             2 / diff)
         return new_var
     elif self.normalize_continuous == self.NormalizeBySD:
         new_var = ContinuousVariable(var.name)
         avg = dists[var_ptr].mean()
         sd = dists[var_ptr].standard_deviation()
         new_var.get_value_from = Normalizer(var, avg, 1 / sd)
         return new_var
开发者ID:amela,项目名称:orange3,代码行数:23,代码来源:continuizer.py

示例3: transform_discrete

# 需要导入模块: from Orange.data import ContinuousVariable [as 别名]
# 或者: from Orange.data.ContinuousVariable import get_value_from [as 别名]
        def transform_discrete(var):
            if (len(var.values) < 2 or
                    treat == self.Ignore or
                    treat == self.IgnoreMulti and len(var.values) > 2):
                return []
            if treat == self.AsOrdinal:
                new_var = ContinuousVariable(var.name)
                new_var.get_value_from = Identity(var)
                return [new_var]
            if treat == self.AsNormalizedOrdinal:
                new_var = ContinuousVariable(var.name)
                n_values = max(1, len(var.values))
                if self.zero_based:
                    new_var.get_value_from = \
                        Normalizer(var, 0, 1 / (n_values - 1))
                else:
                    new_var.get_value_from = \
                        Normalizer(var, (n_values - 1) / 2, 2 / (n_values - 1))
                return [new_var]

            new_vars = []
            if treat == self.NValues:
                base = -1
            elif treat == self.LowestIsBase or treat == self.IgnoreMulti:
                base = max(var.base_value, 0)
            else:
                base = dists[var_ptr].modus()
            IndClass = [Indicator_1, Indicator][self.zero_based]
            for i, val in enumerate(var.values):
                if i == base:
                    continue
                new_var = ContinuousVariable(
                    "{}={}".format(var.name, val))
                new_var.get_value_from = IndClass(var, i)
                new_vars.append(new_var)
            return new_vars
开发者ID:amela,项目名称:orange3,代码行数:38,代码来源:continuizer.py


注:本文中的Orange.data.ContinuousVariable.get_value_from方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。