1. 基本形式

  • 线性模型(linear model)试图学得一个通过属性的线性组合来进行预测的函数。

  • w和b学得之后,模型就得以确定。w直观表达了各属性在预测中的重要性。

2. 线性回归

  • 提出假设:给定数据集

    

  ,其中,

  “线性回归”(linear regression)试图学得一个线性模型以尽可能准确地预测实值输出标记。

  • 线性回归可以被看做是样本点的最佳拟合直线。

 

 

  • 这条最佳拟合线也被称为回归线(regression line),回归线与样本点之间的垂直连线即所谓的偏移(offset)或残差(residual)——预测的误差。
  • 在只有一个解释变量的特殊情况下,线性回归也称为简单线性回归(simple linear regression)
  • 当然,我们可以将线性回归模型扩展为多个解释变量。此时,即为所谓的多元线性回归(multiple linear regression)。如下图所示即为二元线性回归,一个回归平面来拟合样本点。

  • 基于最小二乘法构建线性回归模型
  • 设计代价函数:通过最小二乘法,基于均方误差最小化来求解回归曲线的参数,使得回归曲线到样本点垂直距离(残差或误差)的平方和最小。
  • 代价函数为:

  • 代价函数最小化求解:需要求解代价函数最小时的w和b的值。

  • 通过梯度下降法来计算回归参数。如下图所示,将梯度下降的原理形象地描述为下山,直到获得一个局部或者全局最小值。在每次迭代中,根据给定的学习速率和梯度的斜率,能够确定每次移动的步幅,按照步幅沿着梯度方向前进一步。

  • 梯度的推导过程如下图:

则使用梯度下降法求解模型的算法伪码:

1  初始化模型参数:(学习速率),w(权重)

2  判断循环条件是否达到(达到固定循环次数或者误差减小到某个门限)

3       对每一组训练数据

4    输入数据,并计算训练误差

5    计算代价函数的梯度

6    计算权重增量:

7      

8    更新每一个权重

9      

源代码如下:

linear_regression_gds.py      线性回归类模块

import numpy as np

class LinearRegressionGDS:    
    def __init__(self, eta=0.001, num_cycles=50):
        self.learning_rate = eta   #学习速率
        self.cycles = num_cycles    #循环次数

    # 计算线性回归的输出
    def lr_input(self, X):
        return np.dot(X, self.w[1:]) + self.w[0]

    # 训练模型 
    def fit(self, X, y):
        self.total_cost = []    #存储每一次迭代的的代价值
        self.w = np.zeros(np.shape(X)[1] + 1)    #初始化权值w
        self.delt_w = np.zeros(np.shape(X)[1] + 1)    #初始化权值增量
        for i in range(self.cycles):
            output = self.lr_input(X)
            errors = y - output
            self.delt_w[1:] = self.learning_rate * np.dot(X.T, errors)
            self.delt_w[0] = self.learning_rate * errors.sum()
            self.w = self.w + self.delt_w
            # 计算代价值
            cost = 0.5 * (errors ** 2).sum()
            self.total_cost.append(cost)
        return self.total_cost

    # 预测
    def predict(self, X):
        return self.lr_input(X)

linear_regression_test.py    类测试代码# In[]from linear_regression_gds import LinearRegressionGDS

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

# 载入BOSTON房价数据
from sklearn.datasets import load_boston
boston_dataset = load_boston()
X
= boston_dataset.data y = boston_dataset.target print(np.shape(y)) from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3) sc = StandardScaler() sc.fit(X) X_train_std = sc.transform(X_train) X_test_std = sc.transform(X_test) num_ = 200 lr = LinearRegressionGDS(eta=0.0001,num_cycles=num_) cost_ = lr.fit(X_train_std, y_train) x = range(num_) y = cost_ # In[] # 输入一些数据 y_pred = lr.predict(X_test_std) for i in range(len(y_pred)): str1 = ",".join([\'%.2f\' % x for x in X_test[i]]) print("%d-->[%s] predicting price: %.2f" % (i+1, str1, y_pred[i])) plt.figure() plt.plot(x, y) plt.show()

 运行结果

1. 代价函数

2. 运行结果

1-->[0.06,12.50,6.07,0.00,0.41,5.88,21.40,6.50,4.00,345.00,18.90,396.21,8.10] predicting price: 21.87
2-->[0.06,0.00,5.96,0.00,0.50,5.93,68.20,3.36,5.00,279.00,19.20,396.90,9.68] predicting price: 23.62
3-->[20.08,0.00,18.10,0.00,0.70,4.37,91.20,1.44,24.00,666.00,20.20,285.83,30.63] predicting price: 3.08
4-->[0.04,20.00,3.33,0.00,0.44,6.97,37.20,5.24,5.00,216.00,14.90,392.23,4.59] predicting price: 33.68
5-->[0.02,85.00,0.74,0.00,0.41,6.38,35.70,9.19,2.00,313.00,17.30,396.90,5.77] predicting price: 25.22
6-->[14.33,0.00,18.10,0.00,0.70,4.88,100.00,1.59,24.00,666.00,20.20,372.92,30.62] predicting price: 6.38
7-->[13.91,0.00,18.10,0.00,0.71,6.21,95.00,2.22,24.00,666.00,20.20,100.63,15.17] predicting price: 16.28
8-->[2.38,0.00,18.10,0.00,0.58,5.87,41.90,3.72,24.00,666.00,20.20,370.73,13.34] predicting price: 19.56
9-->[0.07,0.00,3.24,0.00,0.46,5.87,25.80,5.21,4.00,430.00,16.90,382.44,9.97] predicting price: 22.80
10-->[0.16,0.00,10.81,0.00,0.41,5.96,17.50,5.29,4.00,305.00,19.20,376.94,9.88] predicting price: 21.92
11-->[0.18,0.00,27.74,0.00,0.61,5.41,98.30,1.76,4.00,711.00,20.10,344.05,23.97] predicting price: 10.68
12-->[0.09,20.00,6.96,1.00,0.46,5.92,61.50,3.92,3.00,223.00,18.60,391.34,13.65] predicting price: 25.09
13-->[1.15,0.00,8.14,0.00,0.54,5.70,95.00,3.79,4.00,307.00,21.00,358.77,18.35] predicting price: 14.67
14-->[0.36,0.00,6.20,1.00,0.51,6.95,88.50,2.86,8.00,307.00,17.40,391.70,9.71] predicting price: 32.98
15-->[10.06,0.00,18.10,0.00,0.58,6.83,94.30,2.09,24.00,666.00,20.20,81.33,19.69] predicting price: 18.43
16-->[9.92,0.00,18.10,0.00,0.74,6.25,96.60,2.20,24.00,666.00,20.20,388.52,16.44] predicting price: 18.72
17-->[0.08,0.00,5.96,0.00,0.50,5.85,41.50,3.93,5.00,279.00,19.20,396.90,8.77] predicting price: 23.13
18-->[0.35,0.00,9.90,0.00,0.54,5.97,76.70,3.10,4.00,304.00,18.40,396.24,9.97] predicting price: 23.68
19-->[5.87,0.00,18.10,0.00,0.69,6.41,96.00,1.68,24.00,666.00,20.20,396.90,19.37] predicting price: 19.50
20-->[0.40,0.00,9.90,0.00,0.54,6.38,67.20,3.53,4.00,304.00,18.40,395.21,10.36] predicting price: 24.64
21-->[0.09,12.50,7.87,0.00,0.52,5.89,39.00,5.45,5.00,311.00,15.20,390.50,15.71] predicting price: 21.18
22-->[5.71,0.00,18.10,0.00,0.53,6.75,74.90,3.33,24.00,666.00,20.20,393.07,7.74] predicting price: 27.05
23-->[0.13,0.00,10.01,0.00,0.55,6.18,72.50,2.73,6.00,432.00,17.80,393.30,12.04] predicting price: 24.16
24-->[0.98,0.00,21.89,0.00,0.62,5.76,98.40,2.35,4.00,437.00,21.20,262.76,17.31] predicting price: 14.05
25-->[0.03,0.00,5.19,0.00,0.52,5.89,59.60,5.62,5.00,224.00,20.20,394.81,10.56] predicting price: 19.44
26-->[0.14,0.00,10.01,0.00,0.55,6.25,84.20,2.26,6.00,432.00,17.80,388.74,10.45] predicting price: 25.81
27-->[1.80,0.00,19.58,0.00,0.60,5.88,79.20,2.43,5.00,403.00,14.70,227.61,12.14] predicting price: 23.14
28-->[0.08,0.00,12.83,0.00,0.44,6.27,6.00,4.25,5.00,398.00,18.70,394.92,6.78] predicting price: 26.15
29-->[0.17,0.00,6.91,0.00,0.45,5.68,33.80,5.10,3.00,233.00,17.90,396.90,10.21] predicting price: 21.96
30-->[0.48,0.00,9.90,0.00,0.54,6.11,58.80,4.00,4.00,304.00,18.40,396.23,12.73] predicting price: 21.76
31-->[0.55,20.00,3.97,0.00,0.65,7.21,91.60,1.93,5.00,264.00,13.00,387.89,8.10] predicting price: 35.51
32-->[1.43,0.00,19.58,0.00,0.87,6.51,100.00,1.77,5.00,403.00,14.70,364.31,7.39] predicting price: 27.01
33-->[2.64,0.00,9.90,0.00,0.54,4.97,37.80,2.52,4.00,304.00,18.40,350.45,12.64] predicting price: 18.31
34-->[0.30,0.00,6.20,0.00,0.50,7.69,17.00,3.38,8.00,307.00,17.40,377.51,3.92] predicting price: 35.57
35-->[0.58,20.00,3.97,0.00,0.57,8.30,67.00,2.42,5.00,264.00,13.00,384.54,7.44] predicting price: 40.67
36-->[1.66,0.00,19.58,0.00,0.87,6.12,97.30,1.62,5.00,403.00,14.70,372.80,14.10] predicting price: 22.16
37-->[0.03,0.00,2.18,0.00,0.46,7.00,45.80,6.06,3.00,222.00,18.70,394.63,2.94] predicting price: 29.30
38-->[0.34,0.00,21.89,0.00,0.62,6.46,98.90,2.12,4.00,437.00,21.20,395.04,12.60] predicting price: 21.04
39-->[0.63,0.00,8.14,0.00,0.54,5.83,56.50,4.50,4.00,307.00,21.00,395.62,8.47] predicting price: 20.03
40-->[8.79,0.00,18.10,0.00,0.58,5.57,70.60,2.06,24.00,666.00,20.20,3.65,17.16] predicting price: 13.97
41-->[0.11,0.00,27.74,0.00,0.61,5.98,83.50,2.11,4.00,711.00,20.10,396.90,13.35] predicting price: 18.70
42-->[0.09,0.00,10.81,0.00,0.41,6.07,7.80,5.29,4.00,305.00,19.20,390.91,5.52] predicting price: 24.80
43-->[0.21,20.00,3.33,0.00,0.44,6.81,32.20,4.10,5.00,216.00,14.90,396.90,4.85] predicting price: 34.33
44-->[0.21,22.00,5.86,0.00,0.43,5.59,76.50,7.95,7.00,330.00,19.10,372.49,12.50] predicting price: 16.57
45-->[0.02,90.00,2.02,0.00,0.41,6.73,36.10,12.13,5.00,187.00,17.00,384.46,4.50] predicting price: 24.94
46-->[0.21,12.50,7.87,0.00,0.52,5.63,100.00,6.08,5.00,311.00,15.20,386.63,29.93] predicting price: 11.75
47-->[13.08,0.00,18.10,0.00,0.58,5.71,56.70,2.82,24.00,666.00,20.20,396.90,14.76] predicting price: 18.56
48-->[0.06,40.00,1.25,0.00,0.43,6.49,44.40,8.79,1.00,335.00,19.70,396.90,5.98] predicting price: 22.18
49-->[0.03,55.00,3.78,0.00,0.48,6.87,28.10,6.47,5.00,370.00,17.60,387.97,4.61] predicting price: 29.17
50-->[0.04,34.00,6.09,0.00,0.43,6.59,40.40,5.49,7.00,329.00,16.10,395.75,9.50] predicting price: 28.49
51-->[9.60,0.00,18.10,0.00,0.69,6.40,100.00,1.64,24.00,666.00,20.20,376.11,20.31] predicting price: 18.50
52-->[0.04,95.00,2.68,0.00,0.42,7.85,33.20,5.12,4.00,224.00,14.70,392.78,3.81] predicting price: 40.23
53-->[0.11,0.00,13.89,1.00,0.55,5.95,93.80,2.89,5.00,276.00,16.40,396.90,17.92] predicting price: 24.43
54-->[0.53,0.00,6.20,0.00,0.50,8.72,83.00,2.89,8.00,307.00,17.40,382.00,4.63] predicting price: 39.91
55-->[15.87,0.00,18.10,0.00,0.67,6.54,99.10,1.52,24.00,666.00,20.20,396.90,21.08] predicting price: 18.74
56-->[0.07,45.00,3.44,0.00,0.44,6.74,30.80,6.48,5.00,398.00,15.20,389.71,4.69] predicting price: 30.94
57-->[0.05,0.00,11.93,0.00,0.57,6.03,80.80,2.50,1.00,273.00,21.00,396.90,7.88] predicting price: 22.69
58-->[0.06,70.00,2.24,0.00,0.40,7.04,10.00,7.83,5.00,358.00,14.80,371.58,4.74] predicting price: 32.07
59-->[0.08,30.00,4.93,0.00,0.43,6.48,18.50,6.19,6.00,300.00,16.60,379.41,6.36] predicting price: 28.24
60-->[0.24,0.00,9.69,0.00,0.58,6.02,65.30,2.41,6.00,391.00,19.20,396.90,12.92] predicting price: 21.93
61-->[0.56,0.00,21.89,0.00,0.62,6.33,98.20,2.11,4.00,437.00,21.20,394.67,16.96] predicting price: 18.25
62-->[0.14,12.50,7.87,0.00,0.52,6.17,96.10,5.95,5.00,311.00,15.20,396.90,19.15] predicting price: 19.87
63-->[0.26,0.00,21.89,0.00,0.62,5.69,96.00,1.79,4.00,437.00,21.20,392.11,17.19] predicting price: 15.89
64-->[0.20,0.00,10.59,0.00,0.49,6.18,42.40,3.95,4.00,277.00,18.60,393.63,9.47] predicting price: 24.46
65-->[18.08,0.00,18.10,0.00,0.68,6.43,100.00,1.83,24.00,666.00,20.20,27.25,29.05] predicting price: 9.73
66-->[0.19,22.00,5.86,0.00,0.43,6.72,17.50,7.83,7.00,330.00,19.10,393.74,6.56] predicting price: 24.80
67-->[0.23,0.00,6.91,0.00,0.45,6.03,85.50,5.69,3.00,233.00,17.90,392.74,18.80] predicting price: 18.03
68-->[0.01,80.00,0.46,0.00,0.42,7.88,32.00,5.65,4.00,255.00,14.40,394.23,2.97] predicting price: 39.88
69-->[0.02,80.00,1.76,0.00,0.39,6.23,31.50,9.09,1.00,241.00,18.20,341.60,12.93] predicting price: 19.92
70-->[0.18,0.00,5.96,0.00,0.50,5.97,30.20,3.85,5.00,279.00,19.20,393.43,10.13] predicting price: 22.98
71-->[0.09,0.00,25.65,0.00,0.58,5.96,92.90,2.09,2.00,188.00,19.10,378.09,17.93] predicting price: 19.13
72-->[0.04,52.50,5.32,0.00,0.41,6.57,22.90,7.32,6.00,293.00,16.60,371.72,9.51] predicting price: 26.40
73-->[0.04,28.00,15.04,0.00,0.46,6.44,53.60,3.67,4.00,270.00,18.20,395.01,8.16] predicting price: 27.86
74-->[0.99,0.00,8.14,0.00,0.54,5.81,100.00,4.10,4.00,307.00,21.00,394.54,19.88] predicting price: 14.32
75-->[5.44,0.00,18.10,0.00,0.71,6.66,98.20,2.36,24.00,666.00,20.20,355.29,17.73] predicting price: 19.93
76-->[0.05,0.00,13.89,1.00,0.55,5.89,56.00,3.11,5.00,276.00,16.40,392.80,13.51] predicting price: 26.26
77-->[0.17,12.50,7.87,0.00,0.52,6.00,85.90,6.59,5.00,311.00,15.20,386.71,17.10] predicting price: 19.40
78-->[0.22,0.00,6.91,0.00,0.45,5.60,62.00,6.09,3.00,233.00,17.90,396.90,16.20] predicting price: 17.25
79-->[4.04,0.00,18.10,0.00,0.53,6.23,90.70,3.10,24.00,666.00,20.20,395.33,12.87] predicting price: 22.65
80-->[7.99,0.00,18.10,0.00,0.70,5.52,100.00,1.53,24.00,666.00,20.20,396.90,24.56] predicting price: 13.04
81-->[0.01,60.00,2.93,0.00,0.40,6.60,18.80,6.22,1.00,265.00,15.60,376.70,4.38] predicting price: 31.21
82-->[0.13,0.00,13.92,0.00,0.44,6.68,31.10,5.96,4.00,289.00,16.00,396.90,6.27] predicting price: 28.63
83-->[2.45,0.00,19.58,0.00,0.60,6.40,95.20,2.26,5.00,403.00,14.70,330.04,11.32] predicting price: 26.85
84-->[0.04,25.00,4.86,0.00,0.43,6.17,46.70,5.40,4.00,281.00,19.00,390.64,7.51] predicting price: 24.89
85-->[0.04,25.00,4.86,0.00,0.43,6.73,33.50,5.40,4.00,281.00,19.00,396.90,5.29] predicting price: 28.44
86-->[0.03,40.00,1.25,0.00,0.43,6.94,34.50,8.79,1.00,335.00,19.70,389.85,5.89] predicting price: 24.03
87-->[0.27,0.00,9.69,0.00,0.58,5.79,70.60,2.89,6.00,391.00,19.20,396.90,14.10] predicting price: 19.79
88-->[1.00,0.00,8.14,0.00,0.54,6.67,87.30,4.24,4.00,307.00,21.00,380.23,11.98] predicting price: 21.69
89-->[7.05,0.00,18.10,0.00,0.61,6.10,85.10,2.02,24.00,666.00,20.20,2.52,23.29] predicting price: 12.76
90-->[0.22,0.00,10.59,1.00,0.49,5.81,53.80,3.65,4.00,277.00,18.60,390.94,16.03] predicting price: 22.69
91-->[0.18,0.00,7.38,0.00,0.49,6.38,54.30,4.54,5.00,287.00,19.60,396.90,6.87] predicting price: 25.16
92-->[0.14,0.00,10.01,0.00,0.55,5.73,65.20,2.76,6.00,432.00,17.80,391.50,13.61] predicting price: 21.48
93-->[0.07,0.00,4.49,0.00,0.45,6.12,56.80,3.75,3.00,247.00,18.50,395.15,8.44] predicting price: 25.72
94-->[7.75,0.00,18.10,0.00,0.71,6.30,83.70,2.78,24.00,666.00,20.20,272.21,16.23] predicting price: 17.73
95-->[0.10,0.00,5.96,0.00,0.50,5.84,61.40,3.38,5.00,279.00,19.20,377.56,11.41] predicting price: 22.14
96-->[0.58,0.00,6.20,0.00,0.51,8.34,73.30,3.84,8.00,307.00,17.40,385.91,2.47] predicting price: 38.33
97-->[0.41,0.00,6.20,0.00,0.50,7.16,79.90,3.22,8.00,307.00,17.40,372.08,6.36] predicting price: 32.13
98-->[8.27,0.00,18.10,1.00,0.67,5.88,89.60,1.13,24.00,666.00,20.20,347.88,8.88] predicting price: 25.98
99-->[0.03,0.00,5.19,0.00,0.52,6.06,37.30,4.81,5.00,224.00,20.20,396.14,8.51] predicting price: 22.22
100-->[6.54,0.00,18.10,1.00,0.63,7.02,97.50,1.20,24.00,666.00,20.20,392.05,2.96] predicting price: 34.71
101-->[0.22,20.00,6.96,1.00,0.46,7.69,51.80,4.37,3.00,223.00,18.60,390.77,6.58] predicting price: 35.51
102-->[0.62,0.00,6.20,1.00,0.51,6.88,77.70,3.27,8.00,307.00,17.40,390.39,9.93] predicting price: 32.07
103-->[3.47,0.00,18.10,1.00,0.72,8.78,82.90,1.90,24.00,666.00,20.20,354.55,5.29] predicting price: 38.72
104-->[2.78,0.00,19.58,0.00,0.87,4.90,97.80,1.35,5.00,403.00,14.70,396.90,29.29] predicting price: 9.70
105-->[0.09,34.00,6.09,0.00,0.43,6.50,18.40,5.49,7.00,329.00,16.10,383.61,8.67] predicting price: 28.46
106-->[1.27,0.00,19.58,1.00,0.60,6.25,92.60,1.80,5.00,403.00,14.70,338.92,5.50] predicting price: 32.93
107-->[0.07,0.00,4.05,0.00,0.51,6.86,74.40,2.92,5.00,296.00,16.60,391.27,6.92] predicting price: 31.50
108-->[0.61,0.00,6.20,0.00,0.51,6.62,80.80,3.27,8.00,307.00,17.40,396.90,7.60] predicting price: 29.37
109-->[0.05,33.00,2.18,0.00,0.47,6.62,58.10,3.37,7.00,222.00,18.40,393.36,8.93] predicting price: 29.35
110-->[0.05,80.00,1.52,0.00,0.40,7.11,36.60,7.31,2.00,329.00,12.60,354.31,8.61] predicting price: 32.58
111-->[0.17,0.00,7.38,0.00,0.49,6.43,52.30,4.54,5.00,287.00,19.60,396.90,7.20] predicting price: 25.20
112-->[0.08,45.00,3.44,0.00,0.44,6.78,41.10,3.79,5.00,398.00,15.20,393.87,6.68] predicting price: 33.33
113-->[0.88,0.00,21.89,0.00,0.62,5.64,94.70,1.98,4.00,437.00,21.20,396.90,18.34] predicting price: 14.82
114-->[25.05,0.00,18.10,0.00,0.69,5.99,100.00,1.59,24.00,666.00,20.20,396.90,26.77] predicting price: 12.29
115-->[0.06,33.00,2.18,0.00,0.47,7.24,41.10,4.02,7.00,222.00,18.40,393.68,6.93] predicting price: 32.20
116-->[0.09,30.00,4.93,0.00,0.43,6.61,42.20,6.19,6.00,300.00,16.60,383.78,7.37] predicting price: 28.21
117-->[15.29,0.00,18.10,0.00,0.67,6.65,93.30,1.34,24.00,666.00,20.20,363.02,23.24] predicting price: 17.98
118-->[0.17,0.00,8.56,0.00,0.52,5.84,91.90,2.21,5.00,384.00,20.90,395.67,18.66] predicting price: 17.57
119-->[8.64,0.00,18.10,0.00,0.69,6.19,92.60,1.79,24.00,666.00,20.20,396.90,15.17] predicting price: 20.44
120-->[0.11,20.00,6.96,0.00,0.46,6.54,58.70,3.92,3.00,223.00,18.60,394.96,7.73] predicting price: 27.86
121-->[0.04,52.50,5.32,0.00,0.41,6.21,31.30,7.32,6.00,293.00,16.60,396.90,7.14] predicting price: 26.41
122-->[0.01,75.00,4.00,0.00,0.41,5.89,47.60,7.32,3.00,469.00,21.10,396.90,14.80] predicting price: 16.48
123-->[0.08,0.00,2.46,0.00,0.49,5.60,89.80,2.99,3.00,193.00,17.80,391.00,13.98] predicting price: 21.90
124-->[0.45,0.00,6.20,1.00,0.51,6.73,66.50,3.65,8.00,307.00,17.40,360.20,8.05] predicting price: 31.70
125-->[0.02,85.00,4.15,0.00,0.43,6.52,27.70,8.54,4.00,351.00,17.90,392.43,6.36] predicting price: 25.49
126-->[0.05,0.00,3.41,0.00,0.49,6.42,66.10,3.09,2.00,270.00,17.80,392.18,8.81] predicting price: 27.39
127-->[1.13,0.00,8.14,0.00,0.54,5.71,94.10,4.23,4.00,307.00,21.00,360.17,22.60] predicting price: 11.98
128-->[0.14,0.00,10.59,0.00,0.49,6.38,32.30,3.95,4.00,277.00,18.60,385.81,9.38] predicting price: 25.25
129-->[15.02,0.00,18.10,0.00,0.61,5.30,97.30,2.10,24.00,666.00,20.20,349.48,24.91] predicting price: 11.28
130-->[0.03,0.00,4.39,0.00,0.44,6.01,48.50,8.01,3.00,352.00,18.80,385.64,10.53] predicting price: 18.39
131-->[0.51,0.00,6.20,0.00,0.51,7.36,71.60,4.15,8.00,307.00,17.40,390.07,4.73] predicting price: 32.81
132-->[0.15,0.00,8.56,0.00,0.52,6.73,79.90,2.78,5.00,384.00,20.90,394.76,9.42] predicting price: 25.39
133-->[0.12,12.50,7.87,0.00,0.52,6.01,82.90,6.23,5.00,311.00,15.20,396.90,13.27] predicting price: 21.97
134-->[15.58,0.00,18.10,0.00,0.58,5.93,71.00,2.91,24.00,666.00,20.20,368.74,18.13] predicting price: 17.03
135-->[0.01,55.00,2.25,0.00,0.39,6.45,31.90,7.31,1.00,300.00,15.30,394.72,8.23] predicting price: 27.59
136-->[0.35,0.00,7.38,0.00,0.49,6.04,49.90,4.72,5.00,287.00,19.60,396.90,7.70] predicting price: 23.13
137-->[0.11,0.00,27.74,0.00,0.61,5.98,98.80,1.87,4.00,711.00,20.10,390.11,18.07] predicting price: 16.42
138-->[0.09,45.00,3.44,0.00,0.44,7.18,26.30,6.48,5.00,398.00,15.20,390.49,2.87] predicting price: 33.70
139-->[0.08,0.00,12.83,0.00,0.44,5.87,36.60,4.50,5.00,398.00,18.70,396.06,9.10] predicting price: 22.93
140-->[0.17,25.00,5.13,0.00,0.45,5.97,93.40,6.82,8.00,284.00,19.70,378.08,14.44] predicting price: 18.09
141-->[0.27,0.00,9.90,0.00,0.54,6.27,82.80,3.26,4.00,304.00,18.40,393.39,7.90] predicting price: 25.73
142-->[0.29,0.00,9.69,0.00,0.58,5.39,72.90,2.80,6.00,391.00,19.20,396.90,21.14] predicting price: 14.57
143-->[0.32,0.00,21.89,0.00,0.62,5.94,93.50,1.97,4.00,437.00,21.20,378.25,16.90] predicting price: 16.71
144-->[0.03,75.00,2.95,0.00,0.43,7.02,15.80,5.40,3.00,252.00,18.30,395.62,1.98] predicting price: 33.36
145-->[17.87,0.00,18.10,0.00,0.67,6.22,100.00,1.39,24.00,666.00,20.20,393.74,21.78] predicting price: 17.00
146-->[51.14,0.00,18.10,0.00,0.60,5.76,100.00,1.41,24.00,666.00,20.20,2.60,10.11] predicting price: 15.17
147-->[0.15,0.00,25.65,0.00,0.58,5.86,97.00,1.94,2.00,188.00,19.10,370.31,25.41] predicting price: 14.87
148-->[0.10,0.00,10.01,0.00,0.55,6.71,81.60,2.68,6.00,432.00,17.80,395.59,10.16] predicting price: 27.42
149-->[0.05,35.00,6.06,0.00,0.44,5.71,28.40,6.64,1.00,304.00,16.90,394.02,12.43] predicting price: 20.44
150-->[2.31,0.00,19.58,0.00,0.60,5.88,97.30,2.39,5.00,403.00,14.70,348.13,12.03] predicting price: 24.38
151-->[0.25,0.00,10.59,0.00,0.49,5.78,72.70,4.35,4.00,277.00,18.60,389.43,18.06] predicting price: 17.72
152-->[0.59,0.00,21.89,0.00,0.62,6.37,97.90,2.33,4.00,437.00,21.20,385.76,11.12] predicting price: 21.10

运行结果

 

版权声明:本文为aviator999原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/aviator999/p/9966533.html