MLP.py 文件源码

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

项目:Python-Quant 作者: saberxxy 项目源码 文件源码
def indexThreeMLP():
    x = 10 ** 7
    #?????
    cur1 = conn.cursor()
    cur1.execute('select * from szzs_black_swan limit 2,9999999999999999;')
    result1 = cur1.fetchall()
    fv = []  #??
    for res in result1:
        a = []
        a.append(float(list(res)[3]))
        a.append(float(list(res)[5])/x)  #????????
        fv.append(a)

    cur2 = conn.cursor()
    cur2.execute('select rise_fall_next from szzs_black_swan limit 2,9999999999999999;')
    result2 = cur2.fetchall()
    cla = []  #??
    for res in result2:
        cla.append(int(list(res)[0]))

    cur3 = conn.cursor()
    cur3.execute('select * from szzs_black_swan order by date desc;')
    result3 = cur3.fetchmany(1)
    test = []  #????
    for res in result3:
        test.append(float(list(res)[3]))
        test.append(float(list(res)[5])/x)

    fv = np.array(fv)
    cla = np.array(cla)
    test = np.array(test)

    fv = np.array(fv)
    cla = np.array(cla)
    test = np.array(test)

    mlp = MLPClassifier(solver='lbfgs', alpha=0.0001, hidden_layer_sizes=(1000, 200), random_state=1, batch_size='auto')
    mlp.fit(fv, cla)  # ????????
    test = [test]  # ???????????
    prediction = mlp.predict(test)
    return test, prediction
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号