def training_k_data(): df = ts.get_hs300s() for code in df['code'].values: try: logger.debug('begin training mode, code:%s' % code) data, features = k_data_60m_dao.get_k_data_with_features( code, '2015-01-01', datetime.now().strftime("%Y-%m-%d")) pca = PCAModel(MODULE_NAME) lr = LogisticRegressionClassifier() svc = SupportVectorClassifier() rf = RandomForestClassifierModel() xgb = XGBoostClassier() ann = SequantialNeuralClassifier() pca.training_model(code, data, features) lr.training_model(code, data, features) svc.training_model(code, data, features) rf.training_model(code, data, features) xgb.training_model(code, data, features) ann.training_model(code, data, features) logger.debug('training mode end, code:%s' % code) except Exception as e: logger.error("training k data error, code:%s, error:%s" % (code, repr(e)))
def test_training(self): code = '600276' data, features = k_data_60m_dao.get_k_data_with_features( code, '2015-01-01', datetime_utils.get_current_date()) pac = PCAModel('k_data_60m') pac.training_model(code=code, data=data, features=features) model = SequantialNeuralClassifier() model.training_model(code, data, features)
def test_training(self): code = '600196' data, features = k_data_60m_dao.get_k_data_with_features(code, '2015-01-01', datetime.now().strftime("%Y-%m-%d")) logger.debug("features:%s, length:%s" % (features, len(features))) pac = PCAModel('k_data') pac.training_model(code=code, data=data, features=features) model = RidgeRegressionModel() model.training_model(code, data, features)
def test_training(self): code = '600276' data, features = k_data_60m_dao.get_k_data_with_features( code, '2015-01-01', datetime.now().strftime("%Y-%m-%d")) pac = PCAModel('k_data_60m') pac.training_model(code=code, data=data, features=features) model = RandomForestClassifierModel() model.training_model(code, data, features)
def test_training(self): code = '600276' # 从数据库中获取2015-01-01到今天的所有数据 data, features = k_data_60m_dao.get_k_data_with_features( code, '2015-01-01', datetime.now().strftime("%Y-%m-%d")) logger.debug("features:%s" % features) pac = PCAModel(MODULE_NAME) pac.training_model(code=code, data=data, features=features) model = XGBoostClassier() model.training_model(code, data, features)
def test_training(self): code = '600196' # 从数据库中获取2015-01-01到今天的所有数据 data, features = k_data_60m_dao.get_k_data_with_features( code, '2015-01-01', datetime.now().strftime("%Y-%m-%d")) logger.debug("features:%s, length:%s" % (features, len(features))) data.to_csv("result.csv") pac = PCAModel(MODULE_NAME) pac.training_model(code=code, data=data, features=features) model = LogisticRegressionClassifier() model.training_model(code, data, features)