示例#1
0
    def _build_ast(self):
        coef = utils.to_2d_array(self._get_coef())
        intercept = utils.to_1d_array(self._get_intercept())

        if coef.shape[0] == 1:
            return _linear_to_ast(coef[0], intercept[0])

        exprs = []
        for idx in range(coef.shape[0]):
            exprs.append(_linear_to_ast(coef[idx], intercept[idx]))
        return ast.VectorVal(exprs)
示例#2
0
    def _build_ast(self):
        coef = utils.to_2d_array(self._get_coef())
        intercept = utils.to_1d_array(self._get_intercept())

        if coef.shape[0] == 1:
            return self._final_transform(_linear_to_ast(coef[0], intercept[0]))

        exprs = [
            self._final_transform(_linear_to_ast(coef[idx], intercept[idx]))
            for idx in range(coef.shape[0])
        ]
        return ast.VectorVal(exprs)