只选了一个股票,做了特征的重要性以及预测值和实际值对比的图,后面附实现代码。尚未做GridSearchCV。
(参数和代码部分还没优化,万里长征只迈出0.1步)。
import numpy as np
import pandas as pd
import matplotlib
matplotlib.use(‘TkAgg’)
import matplotlib.pyplot as plt
import sklearn
from sklearn.model_selection import TimeSeriesSplit
from FeaturesUtil import *
from sklearn.ensemble import ExtraTreesRegressor
import tushare as ts
import MySQLdb as mdb
import csv
from sklearn.metrics import r2_score
pro=ts.pro_api()
con = mdb.connect(host=‘localhost’,user=‘root’,db=‘lqj’,passwd=‘123456’,use_unicode=True,
charset=‘utf8’)
sql = ‘select ts_code as code from l