StockPredictor.py 文件源码

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

项目:pythonml 作者: nicholastoddsmith 项目源码 文件源码
def TestPerformance(self, df = None):
        #If no dataframe is provided, use the currently learned one
        if(df is None):
            D = self.D
        else:
            D = self.S.transform(df.copy())
        #Get features from the data frame
        A = self._ExtractFeat(D)
        #Get the target values and their corresponding column names
        y, _ = self._ExtractTarg(D)
        #Begin cross validation
        ss = ShuffleSplit(n_splits = 1)
        for trn, tst in ss.split(A):
            s1 = self.R.score(A, y)
            s2 = self.R.score(A[tst], y[tst])
            s3 = self.R.score(A[trn], y[trn])
            print('C-V:\t' + str(s1) + '\nTst:\t' + str(s2) + '\nTrn:\t' + str(s3))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号