investmodel.py 文件源码

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

项目:Artificial-Intelligence 作者: Jaisonbabu 项目源码 文件源码
def get_X_y(self):
        """Builds an X, y feature/target pair from the data.

        :returns: a tuple of (feature matrix, labels)
        """

        # X
        X = np.array(self.data[self.features])
        X = scale(X)

        # y
        stock_change = np.array(self.data["stock_p_change"])
        sp500_change = np.array(self.data["sp500_p_change"])

        is_above_threshold = stock_change-sp500_change > self.threshold
        y = is_above_threshold.astype('i')

        return (X, y)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号