我想对尺寸为96x100的数据集执行回归分析。列代表天数(100)的值,而自变量是时间。我的目标变量是多列,如何执行线性回归。样本数据集为:
time day1 day2 day3 day4 day5 day6 day7 day8 day9 day10 day11 day12 day13 day14 day15 day16 day17 day18 day19 day20 day21 day22 day23 day24 day25 day26 day27 day28 day29 day30 day31 day32 day33 day34 day35 day36 day37 day38 day39 day40 day41 day42 day43 day44 day45 day46 day47 day48 day49 day50 day51 day52 day53 day54 day55 day56 day57 day58 day59 day60 day61 day62 day63 day64 day65 day66 day57 day68 day69 day70 day71 day72 day73 day74 day75 day76 day77 day78 day79 day80 day81 day82 day83 day84 day85 day86 day87 day88 day89 day90 day91 day92 day93 day94 day95 day96 day97 day98 day99 day100
500 6.07588E-10 6.13664E-10 5.89361E-10 5.95437E-10 6.31892E-10 6.37968E-10 5.83285E-10 6.01512E-10 5.83285E-10 6.1974E-10 3.03794E-09 -6.07588E-10 -2.43035E-09 1.21518E-09 2.43035E-09 6.07588E-10 6.07588E-10 -1.21518E-09 -1.21518E-09 0 3.03794E-09 1.82276E-09 -1.82276E-09 1.82276E-09 -2.43035E-09 -1.21518E-09 -1.21518E-09 -1.82276E-09 -1.21518E-09 2.43035E-09 1.82276E-09 -2.43035E-09 1.21518E-09 -6.07588E-10 -1.21518E-09 0 -1.21518E-09 1.21518E-09 -2.43035E-09 -2.43035E-09 3.03794E-09 -1.82276E-09 6.07588E-10 -1.82276E-09 3.03794E-09 -2.43035E-09 1.82276E-09 -1.82276E-09 0 0 1.82276E-09 -3.03794E-09 0 3.03794E-09 -1.21518E-09 -1.21518E-09 0 3.03794E-09 1.21518E-09 6.07588E-10 -3.03794E-09 1.21518E-09 3.03794E-09 0 6.07588E-10 -6.07588E-10 -6.07588E-10 1.82276E-09 -3.03794E-09 -1.21518E-09 1.21518E-09 1.82276E-09 1.82276E-09 2.43035E-09 3.03794E-09 1.21518E-09 1.21518E-09 -2.43035E-09 3.03794E-09 0 -1.21518E-09 -1.82276E-09 -1.82276E-09 1.82276E-09 -3.03794E-09 1.82276E-09 0 2.43035E-09 3.03794E-09 -2.43035E-09 -1.21518E-09 6.07588E-10 -1.21518E-09 6.07588E-10 3.03794E-09 0 -2.43035E-09 -1.21518E-09 -1.82276E-09 0
515 6.07588E-10 5.89361E-10 6.07588E-10 6.01512E-10 6.25816E-10 6.07588E-10 6.1974E-10 6.37968E-10 5.77209E-10 5.95437E-10 1.82276E-09 -3.03794E-09 0 2.43035E-09 1.21518E-09 -3.03794E-09 -3.03794E-09 -1.82276E-09 2.43035E-09 0 1.82276E-09 3.03794E-09 2.43035E-09 6.07588E-10 1.21518E-09 -2.43035E-09 -6.07588E-10 -1.82276E-09 -1.21518E-09 -2.43035E-09 1.82276E-09 -1.21518E-09 6.07588E-10 6.07588E-10 0 6.07588E-10 3.03794E-09 -3.03794E-09 -1.21518E-09 -1.82276E-09 0 -3.03794E-09 1.21518E-09 -2.43035E-09 -2.43035E-09 -2.43035E-09 1.82276E-09 -1.82276E-09 6.07588E-10 -3.03794E-09 -6.07588E-10 -1.21518E-09 3.03794E-09 -1.82276E-09 -6.07588E-10 -1.21518E-09 1.82276E-09 3.03794E-09 -1.21518E-09 -6.07588E-10 -1.82276E-09 -2.43035E-09 -1.21518E-09 1.82276E-09 3.03794E-09 1.21518E-09 6.07588E-10 -1.82276E-09 2.43035E-09 -3.03794E-09 0 -2.43035E-09 -1.82276E-09 -3.03794E-09 3.03794E-09 3.03794E-09 3.03794E-09 -6.07588E-10 -6.07588E-10 -6.07588E-10 -2.43035E-09 -2.43035E-09 -1.82276E-09 -3.03794E-09 -1.21518E-09 -6.07588E-10 6.07588E-10 -3.03794E-09 -1.82276E-09 6.07588E-10 2.43035E-09 1.82276E-09 1.21518E-09 0 0 1.21518E-09 3.03794E-09 2.43035E-09 6.07588E-10 3.03794E-09
530 6.07588E-10 6.01512E-10 6.1974E-10 6.13664E-10 5.95437E-10 6.31892E-10 6.01512E-10 5.77209E-10 6.13664E-10 6.25816E-10 1.82276E-09 2.43035E-09 1.82276E-09 -1.21518E-09 1.82276E-09 2.43035E-09 3.03794E-09 3.03794E-09 2.43035E-09 6.07588E-10 6.07588E-10 -6.07588E-10 2.43035E-09 0 1.82276E-09 6.07588E-10 0 3.03794E-09 -1.82276E-09 3.03794E-09 0 1.82276E-09 1.21518E-09 -2.43035E-09 -2.43035E-09 -3.03794E-09 1.21518E-09 -6.07588E-10 -1.82276E-09 2.43035E-09 3.03794E-09 -1.21518E-09 -6.07588E-10 6.07588E-10 2.43035E-09 0 -6.07588E-10 3.03794E-09 3.03794E-09 -1.82276E-09 3.03794E-09 1.82276E-09 6.07588E-10 0 -2.43035E-09 -3.03794E-09 -6.07588E-10 -2.43035E-09 -3.03794E-09 -1.21518E-09 1.82276E-09 6.07588E-10 3.03794E-09 6.07588E-10 0 3.03794E-09 2.43035E-09 0 -3.03794E-09 -3.03794E-09 1.21518E-09 -1.82276E-09 -3.03794E-09 0 -6.07588E-10 3.03794E-09 6.07588E-10 -2.43035E-09 -1.21518E-09 -2.43035E-09 -3.03794E-09 0 1.21518E-09 3.03794E-09 2.43035E-09 -1.82276E-09 -6.07588E-10 1.82276E-09 -2.43035E-09 1.21518E-09 1.21518E-09 -6.07588E-10 1.21518E-09 -3.03794E-09 -6.07588E-10 -2.43035E-09 -1.82276E-09 3.03794E-09 -2.43035E-09 3.03794E-09
545 6.07588E-10 6.25816E-10 6.07588E-10 6.13664E-10 6.07588E-10 6.01512E-10 5.95437E-10 6.07588E-10 5.95437E-10 6.01512E-10 3.03794E-09 1.21518E-09 -1.82276E-09 -3.03794E-09 3.03794E-09 1.82276E-09 1.21518E-09 6.07588E-10 6.07588E-10 -1.82276E-09 -1.21518E-09 3.03794E-09 1.82276E-09 2.43035E-09 1.21518E-09 2.43035E-09 -1.82276E-09 2.43035E-09 -3.03794E-09 1.82276E-09 -2.43035E-09 -6.07588E-10 3.03794E-09 2.43035E-09 1.21518E-09 3.03794E-09 -3.03794E-09 0 -1.82276E-09 2.43035E-09 -1.21518E-09 6.07588E-10 1.82276E-09 1.21518E-09 1.21518E-09 -6.07588E-10 -1.21518E-09 -6.07588E-10 3.03794E-09 1.21518E-09 2.43035E-09 -1.21518E-09 0 1.82276E-09 -1.82276E-09 1.21518E-09 1.21518E-09 3.03794E-09 -6.07588E-10 -1.21518E-09 6.07588E-10 -6.07588E-10 6.07588E-10 1.82276E-09 -6.07588E-10 3.03794E-09 -1.82276E-09 1.21518E-09 -6.07588E-10 1.21518E-09 1.82276E-09 -2.43035E-09 -2.43035E-09 -6.07588E-10 -6.07588E-10 6.07588E-10 6.07588E-10 3.03794E-09 -6.07588E-10 1.21518E-09 -6.07588E-10 2.43035E-09 -2.43035E-09 -2.43035E-09 -2.43035E-09 -1.82276E-09 0 -1.82276E-09 -3.03794E-09 1.21518E-09 3.03794E-09 1.21518E-09 3.03794E-09 -1.21518E-09 -3.03794E-09 -6.07588E-10 -1.21518E-09 1.21518E-09 -2.43035E-09 -6.07588E-10
600 6.07588E-10 6.13664E-10 6.07588E-10 6.01512E-10 6.13664E-10 6.01512E-10 6.1974E-10 6.1974E-10 5.77209E-10 5.89361E-10 1.21518E-09 -1.82276E-09 -2.43035E-09 1.82276E-09 3.03794E-09 -6.07588E-10 2.43035E-09 1.82276E-09 -6.07588E-10 -3.03794E-09 3.03794E-09 -3.03794E-09 -3.03794E-09 -1.21518E-09 -6.07588E-10 -1.82276E-09 1.82276E-09 3.03794E-09 -2.43035E-09 -2.43035E-09 -1.21518E-09 -3.03794E-09 -1.21518E-09 -3.03794E-09 -1.21518E-09 -3.03794E-09 -6.07588E-10 6.07588E-10 2.43035E-09 -6.07588E-10 -3.03794E-09 1.82276E-09 0 3.03794E-09 -1.21518E-09 3.03794E-09 -2.43035E-09 -1.82276E-09 -1.21518E-09 -1.82276E-09 -6.07588E-10 -1.21518E-09 1.82276E-09 0 0 -1.82276E-09 -1.21518E-09 -3.03794E-09 2.43035E-09 6.07588E-10 1.21518E-09 1.82276E-09 2.43035E-09 1.82276E-09 -1.82276E-09 1.82276E-09 0 3.03794E-09 1.82276E-09 1.82276E-09 1.82276E-09 -6.07588E-10 -1.82276E-09 -1.82276E-09 -6.07588E-10 -1.21518E-09 -1.82276E-09 3.03794E-09 -6.07588E-10 3.03794E-09 1.21518E-09 -1.82276E-09 -6.07588E-10 6.07588E-10 0 2.43035E-09 -2.43035E-09 -6.07588E-10 -3.03794E-09 2.43035E-09 -1.21518E-09 -1.82276E-09 1.21518E-09 3.03794E-09 1.82276E-09 3.03794E-09 3.03794E-09 6.07588E-10 1.21518E-09 -1.82276E-09
615 6.07588E-10 6.13664E-10 6.1974E-10 5.77209E-10 6.37968E-10 6.1974E-10 6.13664E-10 6.37968E-10 6.31892E-10 6.1974E-10 3.03794E-09 -6.07588E-10 6.07588E-10 0 1.82276E-09 -3.03794E-09 1.82276E-09 3.03794E-09 -3.03794E-09 6.07588E-10 2.43035E-09 3.03794E-09 -2.43035E-09 1.82276E-09 1.82276E-09 -1.21518E-09 -3.03794E-09 2.43035E-09 -2.43035E-09 -3.03794E-09 0 -2.43035E-09 -3.03794E-09 -6.07588E-10 -6.07588E-10 -2.43035E-09 3.03794E-09 3.03794E-09 -1.82276E-09 -1.21518E-09 6.07588E-10 -1.21518E-09 0 -1.82276E-09 0 6.07588E-10 3.03794E-09 -6.07588E-10 1.82276E-09 2.43035E-09 3.03794E-09 1.82276E-09 1.82276E-09 2.43035E-09 -3.03794E-09 -1.21518E-09 -1.21518E-09 1.82276E-09 6.07588E-10 6.07588E-10 -6.07588E-10 -3.03794E-09 1.82276E-09 3.03794E-09 -3.03794E-09 3.03794E-09 1.21518E-09 1.82276E-09 -1.82276E-09 -1.21518E-09 2.43035E-09 1.82276E-09 1.21518E-09 1.21518E-09 -1.82276E-09 1.82276E-09 1.82276E-09 3.03794E-09 -6.07588E-10 -1.82276E-09 1.21518E-09 1.21518E-09 -1.21518E-09 -2.43035E-09 -1.21518E-09 1.82276E-09 -6.07588E-10 0 2.43035E-09 -1.21518E-09 1.21518E-09 6.07588E-10 -1.21518E-09 1.82276E-09 1.82276E-09 1.21518E-09 6.07588E-10 -6.07588E-10 1.21518E-09 2.43035E-09
630 6.45127E-10 6.19322E-10 6.45127E-10 6.12871E-10 6.77384E-10 6.5803E-10 6.51578E-10 6.32225E-10 6.70932E-10 6.70932E-10 2.58051E-09 2.58051E-09 -1.29025E-09 -1.29025E-09 -3.22564E-09 1.93538E-09 3.22564E-09 -3.22564E-09 1.93538E-09 2.58051E-09 6.45127E-10 3.22564E-09 -1.29025E-09 0 3.22564E-09 6.45127E-10 -6.45127E-10 -6.45127E-10 -2.58051E-09 -1.93538E-09 -3.22564E-09 2.58051E-09 1.29025E-09 2.58051E-09 1.29025E-09 1.29025E-09 2.58051E-09 -1.29025E-09 -3.22564E-09 -3.22564E-09 1.93538E-09 -1.93538E-09 -3.22564E-09 -6.45127E-10 6.45127E-10 -1.29025E-09 -1.93538E-09 -6.45127E-10 6.45127E-10 -6.45127E-10 -3.22564E-09 1.29025E-09 2.58051E-09 -3.22564E-09 3.22564E-09 -1.93538E-09 -2.58051E-09 -2.58051E-09 -2.58051E-09 3.22564E-09 6.45127E-10 0 -3.22564E-09 3.22564E-09 -2.58051E-09 1.93538E-09 -1.93538E-09 6.45127E-10 6.45127E-10 3.22564E-09 -1.29025E-09 1.93538E-09 1.93538E-09 2.58051E-09 -3.22564E-09 0 -3.22564E-09 -2.58051E-09 1.93538E-09 1.93538E-09 -2.58051E-09 1.93538E-09 1.29025E-09 3.22564E-09 1.93538E-09 -1.93538E-09 3.22564E-09 -3.22564E-09 1.29025E-09 -1.29025E-09 3.22564E-09 -1.93538E-09 -3.22564E-09 -6.45127E-10 3.22564E-09 -3.22564E-09 -1.29025E-09 -2.58051E-09 -3.22564E-09 6.45127E-10
plt.scatter(reg.predict(X), reg.predict(X) - y,
color = "green", s = 10, label = 'Train data')
答案 0 :(得分:0)
您可以将时间作为因变量(标签)和值(在不同日期),模型的功能(因变量)。您可以使用sklearn轻松进行多级回归:
from sklearn.linear_model import LinearRegression
X=np.array(df.drop("time",1))
y=np.array(df["time"])
clf=LinearRegression()
clf.fit(X,y)