pycore.py 文件源码

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

项目:datanode 作者: jay-johnson 项目源码 文件源码
def sk_generate_random_classification_set(self, samples, features, classes, informative, rds, dbs, debug=False):

        record              = {
                                "Test"  : { 
                                            "X" : {},
                                            "Y" : {}
                                        },
                                "Train" : { 
                                            "X" : {},
                                            "Y" : {}
                                        }
                            }
        results             = self.build_def_hash("Display Error", "Not Run", record )

        try:

            from sklearn.datasets import make_classification

            self.lg("Processing ROC", 6)

            X, Y = make_classification(n_samples=samples, 
                                        n_features=features, 
                                        n_classes=classes, 
                                        n_informative=informative)

            record["Test"]["X"]     = X[9000:] 
            record["Test"]["Y"]     = Y[9000:] 
            record["Train"]["X"]    = X[:9000]
            record["Train"]["Y"]    = Y[:9000]

            results         = self.build_def_hash("SUCCESS", "", record)

        except Exception,k:
            status          = "FAILED"
            err_msg         = "Unable to Generate Random Classification set with Ex(" + str(k) + ")"
            self.lg("ERROR: " + str(err_msg), 0)
            results         = self.build_def_hash("Display Error", err_msg, {})
        # end of try/ex

        return results
    # end of sk_generate_random_classification_set
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号