model.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:hydrus 作者: mark-r-g 项目源码 文件源码
def __init__(self, z, w, name='', quadrature=None, cfg=None):
        self.t0 = datetime.datetime.now()

        # If given a namespace of configuration settings, use it.
        # Otherwise fall back to whatever is in `constants.py`.
        self.cfg = cfg or constants

        # If w or z are DataFrames, convert them to ndarrays.
        self.w = w.values if hasattr(w, 'values') else w
        self.z = z.values if hasattr(z, 'values') else z

        self.w2 = np.nan_to_num(self.w)
        self.num2 = np.nan_to_num(self.z)

        self.name, self.n = name, w.shape[0]
        self.ests_init = np.array(pack(self.cfg.INITIAL_LVM_PARAMS, w.shape[1]))

        if quadrature or (cfg is not None and cfg.QUADRATURE):
            self.ests_ll = self.ests_ll_quad
            self.ests_bounds = pack(self.cfg.QUAD_BOUNDS, w.shape[1])
        else:
            self.ests_ll = self.ests_ll_exact
            self.ests_bounds = pack(self.cfg.EXACT_BOUNDS, w.shape[1])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号