linear_regression.py 文件源码

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

项目:Brainforge 作者: sakram07 项目源码 文件源码
def score(self,X_test,y_test):
        """
        returns the score on test set

        <PARAMETERS>
        X : input features of testing set (numpy array, list)
        y : values to map to of testing set (numpy array, list)

        <return type>
        returns score (int)

        """
        y_test = np.reshape(y_test,(y_test.shape[0],1))
        if self.normalize_ == True:
            X_test = self.normalize(X_test)
        X_test = self.add_bias(X_test)
        self.predict(X_test)
        u = np.square(y_test - self.predictions).sum()
        v = np.square(y_test - y_test.mean()).sum()
        self.score = 1 - u/v
        return self.score
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号