我试图在python中做一个简单的线性回归,其中x变量是单词
项目描述的计数,Y值是以天为单位的融资速度。
我有点困惑,因为测试的均方根误差(rmse)是13.77。
培训数据为13.88。首先,RMSE不应该在0和1之间吗?
第二,测试数据的RMSE不应该高于培训数据吗?
所以我想,我做错了什么,但不知道错误在哪里。
另外,我需要知道回归的权重系数,但不幸的是
不知道如何打印它,因为它隐藏在sklearn方法中。有人能帮忙吗?
这就是我目前为止所拥有的:
import numpy as np
import matplotlib.pyplot as plt
import sqlite3
from sklearn.model_selection import train_test_split
from sklearn import linear_model
con = sqlite3.connect('database.db')
cur = con.cursor()
# y-variable in regression is funding speed ("DAYS_NEEDED")
cur.execute("SELECT DAYS_NEEDED FROM success")
y = cur.fetchall() # list of tuples
y = np.array([i[0] for i in y]) # list of int # y.shape = (1324476,)
# x-variable in regression is the project description length ("WORD_COUNT")