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


Python Model.merge方法代码示例

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


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

示例1: merge

# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import merge [as 别名]
    def merge(models):
        newmodels = BinModel.consistent_bins(models)

        allmodel = Model.merge(map(lambda m: m.model, newmodels))

        model = BinModel(newmodels[0].get_xx(), allmodel)

        return model
开发者ID:delgadom,项目名称:open-estimate,代码行数:10,代码来源:bin_model.py

示例2: merge

# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import merge [as 别名]
    def merge(models):
        allxx = set()
        for model in models:
            if not model.scaled:
                raise ValueError("Only scaled distributions can be merged.")
            allxx.update(set(model.xx))

        allxx = np.array(sorted(allxx))
        midpts = (allxx[1:] + allxx[:-1]) / 2
        newmodels = []
        for model in models:
            newmodels.append(model.model.recategorize_x(map(model.get_bin_at, midpts), range(1, len(allxx))))

        allmodel = Model.merge(newmodels)

        model = BinModel(allxx, allmodel)

        return model
开发者ID:brownaa,项目名称:open-estimate,代码行数:20,代码来源:bin_model.py

示例3: ValueError

# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import merge [as 别名]
                    univar.xx_is_categorical = False

            return univar
        else:
            # This case isn't "bad", it's just not something we've needed to handle yet
            raise ValueError("condition called with multiple unconditioned variables")

    def default_condition(self):
        return self.condition([None] + map(lambda xx: xx[0], self.xxs[1:]))

    re_numeric = re.compile(r"\d*\.?\d*")

    @staticmethod
    def re_condition(condition):
        if condition is None:
            return "([^:]*)"
        
        if isinstance(condition, float):
            return OuterMultiModel.re_condition(str(condition))
            
        if condition != '.' and OuterMultiModel.re_numeric.match(condition):
            if '.' in condition:
                condition += '0*'
            else:
                condition += '\.?0*'
        return condition
        
Model.mergers["outer_model"] = lambda models: Model.merge(map(lambda model: model.default_condition(), models))
Model.mergers["outer_model+ddp_model"] = lambda models: Model.merge([models[0].default_condition(), models[1]])
Model.mergers["outer_model+spline_model"] = lambda models: Model.merge([models[0].default_condition(), models[1]])
开发者ID:brownaa,项目名称:open-estimate,代码行数:32,代码来源:outer_multi_model.py


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