Menu

值得收藏!60个经济大数据,让你三分钟看明白一个月!



colspan=”2″>

写在前面

这是基于《机器学习实战》一书的第八章内容总结而成的知识,有一些案例和相关的代码,即可获取。

图片 1

首先声明哈,不是广告,我就是用的时候觉得这个功能比较好玩,就想着实现了一下。效果如图:

8.1 用线性回归找到最佳拟合曲线

style=”margin:0px; padding:0px; font-size:18px”>假设输入数据存放在矩阵 style=””>X中,而回归系数存放在向量 style=””>w中,那么对于给定的数据 style=””>X1,预测结果将会通过Y1= style=””>X1.T× style=””>w给出。如何找出误差最小的W,一般采用平方误差最小,即最小二乘法。平方误差可以写做:

图片 2

style=”margin:0px; padding:0px; font-size:18px”>用矩阵表示还可以写做( style=””>y-x*w).T*( style=””>y-x*w)。如果对w求导,得到 style=””>x.T*(y- style=””>xw),令其等于零,得到:

图片 3

style=”margin:0px; padding:0px; font-size:18px”>w帽即为当前估计出的w的最优值,表示最佳估计。一般数据矩阵 style=””>x并非有逆,而公式中需要对 style=””>x.T* style=””>x求逆,一般指伪逆,python的numpy包中,linalg函数有函数pinv求伪逆,也即 style=””>x.T* style=””>x的逆。

style=”margin:0px; padding:0px; font-size:18px”>拟合数据:

[python] view
plain > class=”tracking-ad”
style=”margin:0px; padding:0px”> copy

  1. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="comment"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#!/usr/bin/env python > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  2. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="comment"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”># coding=utf-8 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  3. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">  
    
  4. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>from > style=”margin:0px; padding:0px; border:none; background-color:inherit”> numpy  > class=”keyword”
    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>import > style=”margin:0px; padding:0px; border:none; background-color:inherit”> *  

  5. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>from > style=”margin:0px; padding:0px; border:none; background-color:inherit”> sklearn  > class=”keyword”
    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>import > style=”margin:0px; padding:0px; border:none; background-color:inherit”> linear_model  

  6. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">  
    
  7. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>def > style=”margin:0px; padding:0px; border:none; background-color:inherit”> loadDataSet(fileName):  

  8. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    numFeat  = len(open(fileName).readline().split( >     class="string"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,0,255); background-color:inherit”>”t” > style=”margin:0px; padding:0px; border:none; background-color:inherit”>))- > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>1 > class=”comment”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#-1是因为最后一列为目标值,前面为特征值 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  9. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    dataMat  = []  
    
  10. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    labelMat = []  
    
  11. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    fr = open(fileName)  
    
  12. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">     >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>for > style=”margin:0px; padding:0px; border:none; background-color:inherit”> line  > class=”keyword”
    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>in > style=”margin:0px; padding:0px; border:none; background-color:inherit”> fr.readlines():  

  13. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">        lineArr = []  
    
  14. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">        curLine = line.strip().split( >     class="string"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,0,255); background-color:inherit”>”t” > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)  

  15. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">         >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>for > style=”margin:0px; padding:0px; border:none; background-color:inherit”> i  > class=”keyword”
    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>in > style=”margin:0px; padding:0px; border:none; background-color:inherit”> range(numFeat):  

  16. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">            lineArr.append(float(curLine[i]))  
    
  17. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">        dataMat.append(lineArr)                  >     class="comment"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#准备好数据矩阵 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  18. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">        labelMat.append(float(curLine[- >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>1 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>]))      > class=”comment”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#准备好目标向量 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  19. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">     >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>return > style=”margin:0px; padding:0px; border:none; background-color:inherit”> dataMat, labelMat  

  20. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">  
    
  21. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>def > style=”margin:0px; padding:0px; border:none; background-color:inherit”> standRegres(xArr, yArr):  

  22. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    xMat = mat(xArr)  
    
  23. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    yMat = mat(yArr).T >     class="comment"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#原始文件为m*n的矩阵,那么特征矩阵dataMat为m*(n-1)维,labelMat为m*1维, > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  24. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    xTx  = xMat.T*xMat  
    
  25. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">     >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>if > style=”margin:0px; padding:0px; border:none; background-color:inherit”> linalg.det(xTx) ==  > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0.0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>:                       > class=”comment”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#计算行列式是否为0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  26. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">         >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>print > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  > class=”string”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,0,255); background-color:inherit”>”this matrix is singular, cannot do inverse” > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  27. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">        ws = linalg.pinv(xTx)*(xMat.T*yMat)        >     class="comment"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#用伪逆来代替逆 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  28. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">         >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>return > style=”margin:0px; padding:0px; border:none; background-color:inherit”> ws  

  29. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    ws = xTx.I*(xMat.T*yMat)  
    
  30. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">     >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>return > style=”margin:0px; padding:0px; border:none; background-color:inherit”> ws  

  31. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">  
    
  32. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">xArr, yArr = loadDataSet( >     class="string"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,0,255); background-color:inherit”>”ex0.txt” > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)  

  33. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">ws   = standRegres(xArr, yArr) >     class="comment"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#回归系数 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  34. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>print > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  > class=”string”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,0,255); background-color:inherit”>”最小二乘法得到的回归系数:n” > style=”margin:0px; padding:0px; border:none; background-color:inherit”>,ws  

  35. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">  
    
  36. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">xMat = mat(xArr)  
    
  37. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">yMat = mat(yArr)  
    
  38. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">yHat = xMat*ws           >     class="comment"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#预测值 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  39. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">  
    
  40. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="comment"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#===============绘制数据集散点图和最佳拟合直线图======= > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  41. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>import > style=”margin:0px; padding:0px; border:none; background-color:inherit”> matplotlib.pyplot as plt  

  42. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">fig = plt.figure()  
    
  43. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">ax  = fig.add_subplot( >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>111 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)  

  44. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">ax.scatter(xMat[:, >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>1 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>].flatten().A[ > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>], yMat.T[:, > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>].flatten().A[ > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>])  

  45. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">xCopy = xMat.copy()  
    
  46. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">yHat  = xCopy*ws  
    
  47. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">ax.plot(xCopy[:, >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>1 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>], yHat)  

  48. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">plt.show()  
    
  49. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">  
    
  50. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="comment"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#====================皮尔逊相关系数计算两个向量的相关性=== > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  51. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">yHat = xMat*ws  
    
  52. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>print > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  > class=”string”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,0,255); background-color:inherit”>”皮尔逊相关系数计算预测值和真实值之间的相关性:n” > style=”margin:0px; padding:0px; border:none; background-color:inherit”>,corrcoef(yHat.T, yMat)  

  53. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="comment"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#================sklearn里面的线性回归================ > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  54. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">  
    
  55. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">clf = linear_model.LinearRegression(fit_intercept= >     class="special"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>False > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)  

  56. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">clf.fit(xArr,yArr)  
    
  57. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>print > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  > class=”string”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,0,255); background-color:inherit”>”sklearn 里面线性回归训练得到的回归系数:n” > style=”margin:0px; padding:0px; border:none; background-color:inherit”>,clf.coef_  

得到的系数即预测值与真实值之间的相关性:

图片 4

Figure 8-1:
预测得到的回归系数

style=”margin:0px; padding:0px; font-size:18px”>可以看出sklearn里面预测的和计算的回归系数是一样的。

图片 5

Figure 8-2: 拟合曲线及原始数据的散点图

python
sklearn包中有计算线性回归的机器学习算法:

图片 6

Figure 8-3: sklearn 计算线性回归方程

  style=”border: 0px; margin: 0px; padding: 0px; font-size: 16px;”>今天是11月份的最后一天,回看这一月,都公布了哪些经济数据?小编为你梳理,三分钟,让你看明白一个月!

   style=”border: 0px; margin: 0px; padding: 0px; font-size: 16px;”>宏观

图片 7

8.2 局部加权线性回归

style=”margin:0px; padding:0px; font-size:18px”>局部加权线性回归(Locally
Weighted Linear Regression, LWLR)

style=”margin:0px; padding:0px; font-size:18px”>给待预测点附近的每个点赋予一定的权重,然后在这个子集上基于最小均方差来进行普通的回归。算法预测每次均需要事先取出对应的数据子集,解出的回归系数w的形式如下:

图片 8

其中 > style=””>W是一个矩阵,用来给每个数据点赋予权重。

style=”margin:0px; padding:0px; font-size:18px”>LWLR使用“核”来对附近的点赋予更高的权重,该加权模型认为样本点距离越近,越可能符合同一个线性模型。核的类型通常用高斯核。权重计算如下:

图片 9

style=”margin:0px; padding:0px; font-size:18px”>权重矩阵w为对角阵,点x与x(i)越近,w(i,i)将会越大。

图片 10

coding:

[python] view
plain > class=”tracking-ad”
style=”margin:0px; padding:0px”> copy

  1. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="comment"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#===============局部加权线性回归函数================== > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  2. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>def > style=”margin:0px; padding:0px; border:none; background-color:inherit”> lwlr(testPoint, xArr, yArr, k= > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>1.0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>):  

  3. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    xMat    = mat(xArr)  
    
  4. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    yMat    = mat(yArr).T  
    
  5. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    m       = shape(xMat)[ >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>]     > class=”comment”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#xMat的行数 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  6. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    weights = mat(eye((m)))      >     class="comment"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#创建对角阵 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  7. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">     >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>for > style=”margin:0px; padding:0px; border:none; background-color:inherit”> j  > class=”keyword”
    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>in > style=”margin:0px; padding:0px; border:none; background-color:inherit”> range(m):           > class=”comment”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#对每个点的计算都用上了整个数据集 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  8. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">        diffMat = testPoint - xMat[j,:]  
    
  9. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">        weights[j, j] = exp(diffMat*diffMat.T/(- >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>2.0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>*k** > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>2 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)) > class=”comment”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#高斯核,对角阵,随样本点与待预测点距离的递增,权重值大小以指数级衰减 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  10. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    xTx = xMat.T *(weights*xMat)  
    
  11. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">     >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>if > style=”margin:0px; padding:0px; border:none; background-color:inherit”> linalg.det(xTx)== > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0.0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>:  

  12. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">         >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>print > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  > class=”string”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,0,255); background-color:inherit”>”this matrix is singular, cannot do inverse” > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  13. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">        ws = linalg.pinv(xTx)*(xMat.T*(weights*yMat))  
    
  14. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    ws =xTx.I*(xMat.T*(weights*yMat))                    >     class="comment"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#回归参数 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  15. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">     >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>return > style=”margin:0px; padding:0px; border:none; background-color:inherit”> testPoint*ws  

  16. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">  
    
  17. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>def > style=”margin:0px; padding:0px; border:none; background-color:inherit”> lwlrTest(testArr, xArr, yArr, k= > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>1.0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>):  > class=”comment”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#当对testArr中所有点的估计,testArr=xArr时,即对所以点的全部估计 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  18. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    m = shape(testArr)[ >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>]  

  19. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    yHat = zeros(m)  
    
  20. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">     >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>for > style=”margin:0px; padding:0px; border:none; background-color:inherit”> i  > class=”keyword”
    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>in > style=”margin:0px; padding:0px; border:none; background-color:inherit”> range(m):  

  21. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">        yHat[i] = lwlr(testArr[i], xArr, yArr, k)  
    
  22. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">     >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>return > style=”margin:0px; padding:0px; border:none; background-color:inherit”> yHat  

  23. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">  
    
  24. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">xArr, yArr = loadDataSet( >     class="string"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,0,255); background-color:inherit”>”ex0.txt” > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)  

  25. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>print > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  > class=”string”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,0,255); background-color:inherit”>”原始值:” > style=”margin:0px; padding:0px; border:none; background-color:inherit”>,yArr[ > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>]  

  26. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>print > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  > class=”string”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,0,255); background-color:inherit”>”估计值,k为1.0:” > style=”margin:0px; padding:0px; border:none; background-color:inherit”>,lwlr(xArr[ > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>], xArr, yArr, > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>1.0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)  

  27. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>print > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  > class=”string”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,0,255); background-color:inherit”>”估计值:k为0.001″ > style=”margin:0px; padding:0px; border:none; background-color:inherit”>,lwlr(xArr[ > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>], xArr, yArr, > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0.001 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)  

  28. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="comment"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#=========对所有点进行估计,绘图======== > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  29. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">yHat = lwlrTest(xArr, xArr, yArr,  >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0.003 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)  

  30. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">xMat = mat(xArr)  
    
  31. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">srtInd = xMat[:, >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>1 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>].argsort( > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)  

  32. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">xSort  = xMat[srtInd][:, >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>,:]  

  33. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">  
    
  34. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">fig = plt.figure()  
    
  35. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">ax  = fig.add_subplot( >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>111 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)  

  36. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">ax.plot(xSort[:, >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>1 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>], yHat[srtInd])  

  37. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">ax.scatter(xMat[:, >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>1 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>].flatten().A[ > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>], mat(yArr).T.flatten().A[ > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>], s =  > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>2 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>, c =  > class=”string”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,0,255); background-color:inherit”>”red” > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)  

  38. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">plt.show()  
    

 效果:

图片 11

Figure 8-5: LWLR对第一个点的估计

图片 12

图片 13

图片 14

Figure 8-6:
k分别为1.0, 0.01, 0.003时的模拟效果,上图欠拟合,下图则过拟合

style=”margin:0px; padding:0px; font-size:18px”>缺点:LWLR增加了计算量,对每个点做预测时都必需使用整个数据集。在Figure
8-4图中,k=0.01时,对预测点x=0.5估计的时候,大多数据点的权重为0,
就不必用上整个数据集,避免增加计算量。

  1、10月规模以上工业增加值同比实际增长6.1%;社会消费品零售总额31119亿元,同比名义增10.0%。

接下来简单的说一下思路吧~

8.3 示例:预测鲍鱼的年龄

style=”margin:0px; padding:0px; font-size:18px”>使用真实的数据观察k值对模型的效果,数据来自UCI数据集,预测鲍鱼的年龄。

图片 15

Figure 8-7: 鲍鱼数据

[python] view
plain > class=”tracking-ad”
style=”margin:0px; padding:0px”> copy

  1. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="comment"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#============预测鲍鱼的年龄================ > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  2. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>def > style=”margin:0px; padding:0px; border:none; background-color:inherit”> rssError(yArr, yHatArr):  

  3. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">     >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>return > style=”margin:0px; padding:0px; border:none; background-color:inherit”> ((yArr – yHatArr)** > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>2 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>).sum()  

  4. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">  
    
  5. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="comment"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#========训练集上的误差 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  6. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">abX, abY = loadDataSet( >     class="string"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,0,255); background-color:inherit”>”abalone.txt” > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)  

  7. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">yHat01   = lwlrTest(abX[ >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>: > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>99 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>], abX[ > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>: > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>99 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>], abY[ > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>: > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>99 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>],  > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0.1 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)  

  8. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">yHat1    = lwlrTest(abX[ >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>: > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>99 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>], abX[ > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>: > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>99 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>], abY[ > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>: > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>99 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>],  > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>1 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)  

  9. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">yHat10   = lwlrTest(abX[ >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>: > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>99 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>], abX[ > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>: > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>99 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>], abY[ > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>: > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>99 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>],  > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>10 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)  

  10. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">  
    
  11. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>print > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  > class=”string”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,0,255); background-color:inherit”>”k=0.1,训练集上的误差:” > style=”margin:0px; padding:0px; border:none; background-color:inherit”>,rssError(abY[ > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>: > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>99 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>], yHat01.T)  

  12. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>print > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  > class=”string”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,0,255); background-color:inherit”>”k=1,  训练集上的误差:” > style=”margin:0px; padding:0px; border:none; background-color:inherit”>,rssError(abY[ > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>: > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>99 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>], yHat1.T)  

  13. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>print > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  > class=”string”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,0,255); background-color:inherit”>”k=10, 训练集上的误差:” > style=”margin:0px; padding:0px; border:none; background-color:inherit”>,rssError(abY[ > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>: > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>99 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>], yHat10.T)  

  14. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="comment"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#========测试集上的误差 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  15. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">yHat01   = lwlrTest(abX[ >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>100 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>: > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>199 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>], abX[ > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>: > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>99 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>], abY[ > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>: > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>99 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>],  > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0.1 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)  

  16. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">yHat1    = lwlrTest(abX[ >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>100 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>: > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>199 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>], abX[ > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>: > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>99 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>], abY[ > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>: > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>99 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>],  > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>1 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)  

  17. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">yHat10   = lwlrTest(abX[ >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>100 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>: > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>199 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>], abX[ > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>: > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>99 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>], abY[ > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>: > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>99 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>],  > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>10 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)  

  18. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">  
    
  19. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>print > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  > class=”string”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,0,255); background-color:inherit”>”k=0.1,测试集上的误差:” > style=”margin:0px; padding:0px; border:none; background-color:inherit”>,rssError(abY[ > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>100 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>: > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>199 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>], yHat01.T)  

  20. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>print > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  > class=”string”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,0,255); background-color:inherit”>”k=1,  测试集上的误差:” > style=”margin:0px; padding:0px; border:none; background-color:inherit”>,rssError(abY[ > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>100 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>: > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>199 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>], yHat1.T)  

  21. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>print > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  > class=”string”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,0,255); background-color:inherit”>”k=10, 测试集上的误差:” > style=”margin:0px; padding:0px; border:none; background-color:inherit”>,rssError(abY[ > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>100 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>: > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>199 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>], yHat10.T)  

  22. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">  
    
  23. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">ws = standRegres(abX[ >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>: > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>99 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>], abY[ > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>: > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>99 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>])  

  24. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">yHat = mat(abX[ >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>100 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>: > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>199 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>])*ws  

  25. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>print > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  > class=”string”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,0,255); background-color:inherit”>”简单线性回归上的误差和:” > style=”margin:0px; padding:0px; border:none; background-color:inherit”>,rssError(abY[ > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>100 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>: > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>199 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>],yHat.T.A)  

    style=”margin:0px; padding:0px; font-size:18px”>使用较小的核得到较低的训练误差,但会导致过拟合,也即对新的数据预测的效果比较糟糕。在简单线性回归中,达到了与局部加权线性回归类似的效果,在未知数据中,比较效果才能选取到最佳模型。

  2、10月规模以上工业企业实现利润总额6161亿元,同比增9.8%。1-10月全国规模以上工业企业实现利润总额52567.7亿元,同比增8.6%。国家统计局:企业效益向好态势进一步稳固。

大体思路

8.4  缩减系数来“理解”数据

style=”margin:0px; padding:0px; font-size:18px”>当数据的特征比样本点还多时,就不能再用线性回归和LWLR,因为计算x.T*x的逆时会出错。为此引入岭回归(ridge
regression)的概念。

岭回归

style=”margin:0px; padding:0px; font-size:18px”>岭回归即在矩阵x.T*x上加一个 > style=”margin:0px; padding:0px; color:rgb(51,51,51); font-family:arial; line-height:20.02px”> > style=”margin:0px; padding:0px; font-size:18px”>λ > style=””>I从而使得矩阵非奇异,进而能对x.T*x+ > style=”margin:0px; padding:0px; line-height:20.02px”>λI求逆,此时回归系数的计算公式变为:

图片 16

style=”margin:0px; padding:0px; color:rgb(51,51,51); font-family:arial; line-height:20.02px”> > style=”margin:0px; padding:0px; font-size:18px”>岭回归最先用来处理特征数多于样本数的情况,在估计中加入偏差,从而得到更好的估计。引入 > style=”margin:0px; padding:0px; line-height:20.02px”>λ来限制了所有w之和,通过引入该乘法项,能够减少不重要的参数,即缩减(shrinkage)技术。

style=”margin:0px; padding:0px; color:rgb(51,51,51); font-family:arial; line-height:20.02px”> > style=”margin:0px; padding:0px; font-size:18px”>缩减能够去掉不重要的参数,因此能够更好的理解数据,取得更好的预测效果。

style=”margin:0px; padding:0px; color:rgb(51,51,51); font-family:arial; line-height:20.02px”> > style=”margin:0px; padding:0px; font-size:18px”>使用岭回归和缩减技术,需要对特征做标准化处理,即所有特征都减去各自的均值并除以方差。

style=”margin:0px; padding:0px; color:rgb(51,51,51); font-family:arial; line-height:20.02px”> > style=”margin:0px; padding:0px; font-size:18px”> > style=”margin:0px; padding:0px; line-height:20.02px”>

[python] view
plain > class=”tracking-ad”
style=”margin:0px; padding:0px”> copy

  1. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="comment"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#=========岭回归========== > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  2. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>def > style=”margin:0px; padding:0px; border:none; background-color:inherit”> ridgeRegres(xMat, yMat, lam= > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0.2 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>):  

  3. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    xTx   = xMat.T*xMat  
    
  4. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    denom = xTx + eye(shape(xMat)[ >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>1 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>])*lam  > class=”comment”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#得到中间结果,eye(shape(xMat)[1])得到xMat列数的单位对称阵 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  5. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">     >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>if > style=”margin:0px; padding:0px; border:none; background-color:inherit”> linalg.det(denom) == > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0.0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>:  

  6. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">         >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>print > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  > class=”string”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,0,255); background-color:inherit”>”this matrix is singular, cannot do inverse” > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  7. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">        ws = linalg.pinv(denom)*(xMat.T*yMat)  
    
  8. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    ws = denom.I*(xMat.T*yMat)  
    
  9. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">     >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>return > style=”margin:0px; padding:0px; border:none; background-color:inherit”> ws  

  10. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">  
    
  11. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>def > style=”margin:0px; padding:0px; border:none; background-color:inherit”> ridgeTest(xArr, yArr):  

  12. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    xMat       = mat(xArr)  
    
  13. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    yMat       = mat(yArr).T  
    
  14. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    yMean      = mean(yMat, >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)             > class=”comment”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#按照行取平均,每行平均 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  15. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    yMat       = yMat - yMean             >     class="comment"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#对y进行标准化 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  16. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    xMeans     = mean(xMat,  >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)  

  17. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    xVar       = var(xMat,  >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)             > class=”comment”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#按行取方差 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  18. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    xMat       = (xMat - xMeans)/xVar     >     class="comment"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#对数据进行标准化 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  19. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    numTestPts =  >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>30 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  20. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    wMat       = zeros((numTestPts, shape(xMat)[ >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>1 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>]))  

  21. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">     >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>for > style=”margin:0px; padding:0px; border:none; background-color:inherit”> i  > class=”keyword”
    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>in > style=”margin:0px; padding:0px; border:none; background-color:inherit”> range(numTestPts):                  > class=”comment”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#进行numTestPts次计算岭回归,每次的系数向量都放到wMat的一行中。 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  22. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">        ws = ridgeRegres(xMat, yMat, exp(i- >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>10 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>))  > class=”comment”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#参数lam每次以exp(i-10)变化 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  23. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">        wMat[i,:] = ws.T  
    
  24. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">     >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>return > style=”margin:0px; padding:0px; border:none; background-color:inherit”> wMat  

  25. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">  
    
  26. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">abX, abY     = loadDataSet( >     class="string"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,0,255); background-color:inherit”>”abalone.txt” > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)  

  27. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">ridgeWeights = ridgeTest(abX, abY)  
    
  28. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">fig = plt.figure()     
    
  29. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">ax  = fig.add_subplot( >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>111 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)  

  30. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">ax.plot(ridgeWeights)        >     class="comment"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#ridgeWeights,为30*8的矩阵,对矩阵画图,则以每列为一个根线,为纵坐标,横坐标为range(shape(ridgeWeights)[0])也即从0到29,第一行的横坐标为0,最后一行的行坐标为29 > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  31. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">plt.show()  
    

图片 17

Figure
8-8: 岭回归参数与回归系数的关系

style=”margin:0px; padding:0px; color:rgb(51,51,51); font-family:arial; line-height:20.02px”> > style=”margin:0px; padding:0px; font-size:18px”> > style=”margin:0px; padding:0px; line-height:20.02px”>上图显示回归系数与log( > style=”margin:0px; padding:0px; line-height:20.02px”>λ)的关系,最左边 > style=”margin:0px; padding:0px; line-height:20.02px”>λ最小时,8个系数的原始值与线性回归一样,最右边8个回归系数全部缩减为0,为找到最佳参数 > style=”margin:0px; padding:0px; line-height:20.02px”>λ,还需要将ws乘以测试集比较原始测试集对比误差大小。0对应lam=exp(0-10),30对应lam=exp(30-10)

style=”margin:0px; padding:0px; font-family:arial; font-size:18px; color:rgb(51,51,51)”> style=”margin:0px; padding:0px; line-height:20.02px”>lasso

style=”margin:0px; padding:0px; font-family:arial; font-size:18px; color:rgb(51,51,51)”> > style=”margin:0px; padding:0px; line-height:20.02px”>在增加约束:所有回归系数的平方和不能大于 > style=”margin:0px; padding:0px; line-height:20.02px”>λ的条件下。普通的最小二乘法回归会得到与岭回归一样的公式。

style=”margin:0px; padding:0px; font-family:arial; font-size:18px; color:rgb(51,51,51)”> > style=”margin:0px; padding:0px; line-height:20.02px”>

style=”margin:0px; padding:0px; font-family:arial; font-size:18px; color:rgb(51,51,51)”> > style=”margin:0px; padding:0px; line-height:20.02px”>使用普通的最小二乘法回归在两个或更多的特征相关时,可能会得出一个很大的正系数和一个很大的负系数。在上述约束中,可以约束避免这个问题。

style=”margin:0px; padding:0px; font-family:arial; color:rgb(51,51,51)”> > style=”margin:0px; padding:0px; font-size:18px; line-height:20.02px”>缩减方法lasso也对回归系数做了约束:

style=”margin:0px; padding:0px; font-family:arial; color:rgb(51,51,51)”> > style=”margin:0px; padding:0px; font-size:18px; line-height:20.02px”>

style=”margin:0px; padding:0px; font-family:arial; color:rgb(51,51,51)”> > style=”margin:0px; padding:0px; font-size:18px; line-height:20.02px”>在 > style=”margin:0px; padding:0px; line-height:20.02px”>λ足够小的时候,一些系数会被迫缩减到0。约束条件为平方差的时候,可通过求偏导找到最优解,为绝对值形式时,需要使用二次规划,这里使用前向逐步回归。

style=”margin:0px; padding:0px; font-family:arial; font-size:18px; color:rgb(51,51,51)”> style=”margin:0px; padding:0px; line-height:20.02px”>前向逐步回归

style=”margin:0px; padding:0px; font-family:arial; font-size:18px; color:rgb(51,51,51)”> > style=”margin:0px; padding:0px; line-height:20.02px”>每一步都尽可能减少误差,每一步所做的决策是对某个权重增加或减少一个很小的值。

style=”margin:0px; padding:0px; font-family:arial; font-size:18px; color:rgb(51,51,51)”> > style=”margin:0px; padding:0px; line-height:20.02px”>伪代码:

style=”margin:0px; padding:0px; font-family:arial; color:rgb(51,51,51)”> > > style=”margin:0px; padding:0px; font-size:18px; line-height:20.02px”>图片 18

style=”margin:0px; padding:0px; font-family:arial; color:rgb(51,51,51)”> > style=”margin:0px; padding:0px; font-size:18px; line-height:20.02px”>coding:

style=”margin:0px; padding:0px; font-family:arial; color:rgb(51,51,51)”> > > style=”margin:0px; padding:0px; font-size:18px; line-height:20.02px”>

[python] view
plain > > class=”tracking-ad”
style=”margin:0px; padding:0px”> copy

  1. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> > >     class="comment"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#=============前向逐步回归================= > > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  2. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> > >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>def > > style=”margin:0px; padding:0px; border:none; background-color:inherit”> regularize(xMat):            > > class=”comment”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#按行标准化 > > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  3. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    inMat = xMat.copy()  
    
  4. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    inMeans = mean(inMat,  > >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)  

  5. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    inVar   = var(inMat,  > >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)  

  6. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    inMat   = (inMat-inMeans)/inVar  
    
  7. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">     > >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>return > > style=”margin:0px; padding:0px; border:none; background-color:inherit”> inMat  

  8. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">  
    
  9. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> > >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>def > > style=”margin:0px; padding:0px; border:none; background-color:inherit”> stageWise(xArr, yArr, eps= > > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0.01 > > style=”margin:0px; padding:0px; border:none; background-color:inherit”>, numIt= > > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>100 > > style=”margin:0px; padding:0px; border:none; background-color:inherit”>):  

  10. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    xMat      = mat(xArr)  
    
  11. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    yMat      = mat(yArr).T  
    
  12. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    yMean     = mean(yMat,  > >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)  

  13. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    yMat      = yMat - yMean  
    
  14. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    xMat      = regularize(xMat)         > >     class="comment"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#对xMat进行标准化 > > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  15. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    m,n       = shape(xMat)  
    
  16. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    returnMat = zeros((numIt, n))  
    
  17. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    ws        = zeros((n, > >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>1 > > style=”margin:0px; padding:0px; border:none; background-color:inherit”>))  

  18. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    wsTest    = ws.copy()  
    
  19. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">    wsMax     = ws.copy()  
    
  20. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">     > >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>for > > style=”margin:0px; padding:0px; border:none; background-color:inherit”> i  > > class=”keyword”
    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>in > > style=”margin:0px; padding:0px; border:none; background-color:inherit”> range(numIt):  

  21. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">         > >     class="comment"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#print ws.T > > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  22. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">        lowestError = inf  
    
  23. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">         > >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>for > > style=”margin:0px; padding:0px; border:none; background-color:inherit”> j  > > class=”keyword”
    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>in > > style=”margin:0px; padding:0px; border:none; background-color:inherit”> range(n):  

  24. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">             > >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>for > > style=”margin:0px; padding:0px; border:none; background-color:inherit”> sign  > > class=”keyword”
    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>in > > style=”margin:0px; padding:0px; border:none; background-color:inherit”> [- > > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>1 > > style=”margin:0px; padding:0px; border:none; background-color:inherit”>, > > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>1 > > style=”margin:0px; padding:0px; border:none; background-color:inherit”>]:          > > class=”comment”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#分别计算增加或减少该特征对误差的影响 > > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  25. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">                wsTest     = ws.copy()  
    
  26. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">                wsTest[j] += eps*sign  
    
  27. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">                yTest      = xMat*wsTest  
    
  28. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">                rssE       = rssError(yMat.A, yTest.A) > >     class="comment"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,130,0); background-color:inherit”>#得到平方误差进行比较 > > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  

  29. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">                 > >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>if > > style=”margin:0px; padding:0px; border:none; background-color:inherit”> rssE < lowestError:  

  30. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">                    lowestError = rssE  
    
  31. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">                    wsMax       = wsTest  
    
  32. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">        ws = wsMax.copy()  
    
  33. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">        returnMat[i,:] = ws.T  
    
  34. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">     > >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>return > > style=”margin:0px; padding:0px; border:none; background-color:inherit”> returnMat  

  35. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">  
    
  36. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">xArr,yArr = loadDataSet( > >     class="string"
    

    style=”margin:0px; padding:0px; border:none; color:rgb(0,0,255); background-color:inherit”>”abalone.txt” > > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)  

  37. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> > >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>print > > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  > > class=”string”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,0,255); background-color:inherit”>”步长为0.01,迭代次数为200:n” > > style=”margin:0px; padding:0px; border:none; background-color:inherit”>,stageWise(xArr, yArr,  > > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0.01 > > style=”margin:0px; padding:0px; border:none; background-color:inherit”>,  > > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>200 > > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)  

  38. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> > >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>print > > style=”margin:0px; padding:0px; border:none; background-color:inherit”>  > > class=”string”
    style=”margin:0px; padding:0px; border:none; color:rgb(0,0,255); background-color:inherit”>”步长为0.001,迭代次数为5000:n” > > style=”margin:0px; padding:0px; border:none; background-color:inherit”>,stageWise(xArr, yArr,  > > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0.001 > > style=”margin:0px; padding:0px; border:none; background-color:inherit”>,  > > class=”number”
    style=”margin:0px; padding:0px; border:none; background-color:inherit”>5000 > > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)  

  39. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">  
    
  40. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">xMat = mat(xArr)  
    
  41. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">yMat = mat(yArr).T  
    
  42. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">xMat = regularize(xMat)  
    
  43. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">yM   = mean(yMat,  > >     class="number"
    

    style=”margin:0px; padding:0px; border:none; background-color:inherit”>0 > > style=”margin:0px; padding:0px; border:none; background-color:inherit”>)  

  44. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">yMat = yMat- yM  
    
  45. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit">weights = standRegres(xMat, yMat.T)  
    
  46. style="margin:0px; padding:0px; border:none; color:rgb(0,0,0); background-color:inherit"> > >     class="keyword"
    

    style=”margin:0px; padding:0px; font-weight:700; background-color:inherit; color:rgb(0,102,153); font-size:14px; word-wrap:normal; border:none”>print > > style=”margin:0px; padding:0px; border:none; background-color:inherit”> weights.T  

图片 19

  3、31省份前三季GDP增速排名出炉:重庆、西藏和贵州位列前三,实现两位数增长;黑龙江、山西和辽宁增速低于全国水平。

可能我们看到这种功能的实现的时候,首先想着的是我在这个控制器中左右各放一个tableView,然后进行关联。我是用了另一个思路,具体如下:

Figure 8-9: 逐步线性回归迭代得到的回归系数

图片 20

style=”margin:0px; padding:0px; font-size:18px”>逐步线性回归算法可以帮助人们理解现有的模型并做出改进。构建了一个模型后,可以运行算法找出重要的特征,这样就有可能及时停止对那些不重要特征的收集。如上面步长0.01,迭代200次后为w1和w6都为0,表明它们对目标值没有影响,也即这些特征很可能是不需要的。

style=”margin:0px; padding:0px; font-size:18px”>当应用缩减方法(逐步线性回归或岭回归)时,模型也就增加了偏差(bias),与此同时却减少了模型的方差。

  4、1-10月,国有企业营业总收入367398.3亿元,同比增1.5%;国有企业营业总成本357969.5亿元,同比增1.6%;国有企业利润总额19196.5亿元,同比增0.4%。

我建了两个类LGJCategoryVC用来盛放左边写着第几类的tableView和LGJProductsVC用来盛放右边写在各种产品的tableView。然后将LGJProductsVC作为LGJCategoryVC的childViewController,将LGJProductsVC的viewaddSubView到LGJCategoryVC的view上。

8.5 权衡偏差与方差

style=”margin:0px; padding:0px”>方差:模型训练时,模型值之间的差异。

style=”margin:0px; padding:0px; font-size:18px”>偏差:模型预测值与数据之间的差异。

图片 21

style=”margin:0px; padding:0px; font-size:18px”>通过缩减法,可以将一些系数缩减成很小的值或者为0,增大模型偏差,同时模型复杂度降低

  5、10月,全社会用电量4890亿千瓦时,同比增长7.0%。1-10月,全国全社会用电量累计48776亿千瓦时,同比增长4.8%。

代码实现如下:

  6、10月,全国一般公共预算收入15359亿元,同比增5.9%。其中,个人所得税708亿元,同比增22.5%。印花税143亿元,同比降27.8%。

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(0,111,224)!important”>- style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=””>void style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(51,51,51)!important”>) style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(0,45,122)!important”>createProductsVC style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(51,51,51)!important”>{

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> 

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>     style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>_productsVC style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>
= style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>[[ style=””>LGJProductsVC style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=””>alloc style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>] style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>
init style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>];

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>     style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>_productsVC style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>. style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>delegate style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>
= self style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>;

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>     style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>[ style=””>self style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>
addChildViewController style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>: style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>_productsVC style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>];

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>     style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>[ style=””>self style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>. style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>view style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>
addSubview style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>: style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>_productsVC style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>. style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>view style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>];

style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>}

  7、10月末社会融资规模存量为152.41万亿元,同比增长12.7%。前10月社会融资规模增量累计为14.35万亿元,比去年同期多1.78万亿元。10月社会融资规模增量为8963亿元,比去年同期多3370亿元。

这样做有什么好处呢?简单的说就是将tableView分离,各自使用一个congtroller,这样做使每个控制器管理自己的tableView里面的事件,可以更好的分离代码,降低两个tableView之间的耦合度,同时也避免了把两个
tableView放在一个controller里造成一个controller代码的冗余,这样使逻辑更清晰。

  8、10月末,M2余额151.95万亿元,同比增长11.6%;M1余额46.54万亿元,同比增长23.9%。10月人民币贷款增加6513亿元,人民币存款增加1.21万亿元。

接下来说一下我们点击左边tableView的cell的时候怎样使右边的tableView跟着滑动。我在LGJCategoryVC也就是左边tableView的这个代理方法中didSelectRowAtIndexPath做了些操作:

  9、10月CPI同比涨2.1%,结束连续4个月的“1时代”,重返“2时代”;PPI环比涨0.7%,同比涨1.2%。

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(0,111,224)!important”>- style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=””>void style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(51,51,51)!important”>) style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:teal!important”>tableView style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(0,111,224)!important”>: style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=””>UITableView style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=””>* style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(51,51,51)!important”>) style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(0,45,122)!important”>tableView style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:teal!important”>
didSelectRowAtIndexPath style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(0,111,224)!important”>: style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=””>NSIndexPath style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=””>* style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(51,51,51)!important”>) style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(0,45,122)!important”>indexPath style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(51,51,51)!important”>{

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> 

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>     style=””>if style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>_productsVC style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>) style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>{

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>         style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>[ style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important”>_productsVC style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>
scrollToSelectedIndexPath style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>:indexPath style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>];

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>     style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>}

style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>}

  10、10月我国进出口总值2.05万亿元人民币,下降0.6%。其中,出口1.19万亿元,下降3.2%;进口8606亿元,增长3.2%;贸易顺差3252.5亿元,收窄16.8%。

其中这个scrollToSelectedIndexPath方法是在_productsVC中声明的。这个方法就是具体调动右边tableView滑动的。

  图片 22

style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(184,92,0)!important”>#pragma
mark – 一级tableView滚动时 实现当前类tableView的联动

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>- style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=””>void style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>) style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>scrollToSelectedIndexPath style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>: style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=””>NSIndexPath style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=””>* style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>) style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>indexPath style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>{

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> 

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>     style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>[ style=””>self style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>. style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>productsTableView style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>
selectRowAtIndexPath style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>: style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>([ style=””>NSIndexPath style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>
indexPathForRow style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>: style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,153,153)!important”>0 style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>
inSection style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>:indexPath style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>. style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>row style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>]) style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>
animated style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>:YES style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>
scrollPosition style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>:UITableViewScrollPositionTop style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>];

style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>}

   style=”border: 0px; margin: 0px; padding: 0px; font-size: 16px;”>部委

我们需要的只是让右边tableView的sectionHeaderView跟随左边的点击cell移动到最上部就可以了,所以在这里我们设置selectRowAtIndexPath:([NSIndexPath
indexPathForRow:0 inSection:indexPath.row])

  11、国家发改委批复京津冀城际铁路网规划,到2020年,基本实现京津石中心城区与周边城镇0.5至1小时通勤圈,京津保0.5至1小时交通圈。

接下来就是当我们滑动右边tableView的时候左边的tableView的cell跟随滑动。这里我们在LGJProductsVC类中声明了一个协议。

  12、国家发改委:1-10月,全国施工项目计划总投资1022874亿元,同比增9.1%;新开工项目计划总投资410913亿元,同比增21.8%。

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=””>@protocol style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=””>ProductsDelegate style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(102,102,102)!important”><NSObject>

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> 

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>- style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=””>void style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>) style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>willDisplayHeaderView style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>: style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=””>NSInteger style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>) style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>section style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>;

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>- style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=””>void style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>) style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>didEndDisplayingHeaderView style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>: style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=””>NSInteger style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>) style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>section style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>;

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> 

@end

  13、国家发改委等多部委印发《冰雪运动发展规划(2016—2025年)》,到2020年我国冰雪产业总规模达6000亿元,到2025年达10000亿元。

同时声明两个变量,这两个变量非常有用。

  14、财政部:2014至2016年,中央财政累计安排165亿元,支持实施新一轮退耕还林还草3010万亩,其中,2016年安排90亿元,新增任务1510万亩。

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=””>@property style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(128,0,128)!important”>nonatomic style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(51,51,51)!important”>, style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(128,0,128)!important”>assign style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(51,51,51)!important”>) style=””>BOOL style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(0,45,122)!important”>isScrollUp style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(51,51,51)!important”>; style=””>//是否是向上滚动

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=””>@property style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(128,0,128)!important”>nonatomic style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>, style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(128,0,128)!important”>assign style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>) style=””>CGFloat style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>lastOffsetY style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>; style=””>//滚动即将结束时scrollView的偏移量

  15、财政部:截至今年9月底,全国地方已经发行新增地方政府债券11347亿元,占全年新增限额的96.2%。

具体作用就在这里了:

  16、外汇局:中国11月末人民币合格境外机构投资者(RQFII)获批额度为5237.75亿元,上月末为5149.88亿元。

style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(184,92,0)!important”>#pragma
mark – scrollViewDelegate

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>- style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=””>void style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>) style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>scrollViewDidScroll style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>: style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=””>UIScrollView style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=””>* style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>) style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>scrollView style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>{

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> 

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>     style=””>NSLog style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(221,17,68)!important”>@”_lastOffsetY
: %f,scrollView.contentOffset.y : %f” style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>, style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>_lastOffsetY style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>, style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>scrollView style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>. style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>contentOffset style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>. style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>y style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>);

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>     style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>_isScrollUp style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>
= style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>_lastOffsetY style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>
< style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>scrollView style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>. style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>contentOffset style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>. style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>y style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>;

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>     style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>_lastOffsetY style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>
= style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>scrollView style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>. style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>contentOffset style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>. style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>y style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>;

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>     style=””>NSLog style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(221,17,68)!important”>@”______lastOffsetY:
%f” style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>, style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>_lastOffsetY style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>);

style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>}

  17、外汇局:10月,我国国际收支口径的国际货物和服务贸易收入13074亿元人民币,支出11120亿元,顺差1955亿元。

在这个方法中,_isScrollUp用来判断右边的tableView是否是向上滑,当scrollView滑动时,我们用上次的偏移量和本次的偏移量作对比,如果上次的偏移量小于本次的偏移量说明tableView是向上滑动的。(关于contentOffset我在上篇的《iOS
实现NavigationController的titleView动态缩放效果》链接:
中有简单介绍)此时,_isScrollUp为YES,反之为NO。我们根据_isScrollUp这个重要的标识来到这儿:UITableViewDelegate的这两个代理方法

  18、外汇局:三季度经常账户顺差712亿美元,环比增11%。其中,货物贸易顺差1371亿美元,环比增9%。

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(0,111,224)!important”>- style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=””>void style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(51,51,51)!important”>) style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:teal!important”>tableView style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(0,111,224)!important”>: style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=””>UITableView style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=””>* style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(51,51,51)!important”>) style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(0,45,122)!important”>tableView style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:teal!important”>
willDisplayHeaderView style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(0,111,224)!important”>: style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=””>UIView style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=””>* style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(51,51,51)!important”>) style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(0,45,122)!important”>view style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:teal!important”>
forSection style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(0,111,224)!important”>: style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=””>NSInteger style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(51,51,51)!important”>) style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(0,45,122)!important”>section style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; line-height:inherit!important; color:rgb(51,51,51)!important”>{

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> 

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>     style=””>if style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=””>self style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>. style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>delegate style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>
!= nil style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>
&& style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>[ style=””>self style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>. style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>delegate style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>
respondsToSelector style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>: style=””>@selector style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>willDisplayHeaderView style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>: style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>)] style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>
!= style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>_isScrollUp style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>) style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>{

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>         style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>[ style=””>self style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>. style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>delegate style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>
willDisplayHeaderView style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>:section style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>];

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>     style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>}

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> 

style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>}

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> 

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>- style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=””>void style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>) style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>tableView style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>: style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=””>UITableView style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=””>* style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>) style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>tableView style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>
didEndDisplayingHeaderView style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>: style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=””>UIView style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=””>* style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>) style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>view style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>
forSection style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>: style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=””>NSInteger style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>) style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>section style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>{

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> 

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>     style=””>if style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=””>self style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>. style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>delegate style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>
!= nil style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>
&& style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>[ style=””>self style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>. style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>delegate style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>
respondsToSelector style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>: style=””>@selector style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>didEndDisplayingHeaderView style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>: style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>)] style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>
&& style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>_isScrollUp style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>) style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>{

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>         style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>[ style=””>self style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>. style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>delegate style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>
didEndDisplayingHeaderView style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>:section style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>];

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>     style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>}

style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>}

  19、外汇局:10月,银行结汇7274亿元人民币,售汇8258亿元人民币,结售汇逆差984亿元人民币。

在UITableViewDelegate的这两个代理方法中,第一个方法是当headerView将要显示时调用。第二个方法是当headerView结束显示时调用。在这里我们根据_isScrollUp的BOOL值,当headerView将要显示的时候说明此时_isScrollUp为NO,因为此时是向下滑动的。当headerView结束显示的时候说明此时_isScrollUp为YES,因为此时是向上滑动的。此时我们调用ProductsDelegate代理方法,在LGJCategoryVC类中实现代理方法:

  20、银监会:截至10月末,银行业金融机构总资产219.61万亿元,同比增16.5%;总负债202.47万亿元,同比增16.4%。

style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(184,92,0)!important”>#pragma
mark – ProductsDelegate

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>- style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=””>void style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>) style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>willDisplayHeaderView style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>: style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=””>NSInteger style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>) style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>section style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>{

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> 

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>     style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>[ style=””>self style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>. style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>categoryTableView style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>
selectRowAtIndexPath style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>: style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>[ style=””>NSIndexPath style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>
indexPathForRow style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>:section style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>
inSection style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>: style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,153,153)!important”>0 style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>] style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>
animated style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>:YES style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>
scrollPosition style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>:UITableViewScrollPositionMiddle style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>];

style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>}

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> 

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>- style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=””>void style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>) style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>didEndDisplayingHeaderView style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>: style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>( style=””>NSInteger style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>) style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>section style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>{

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> 

style=”margin:0px; padding:0px; max-width:100%!important; word-wrap:break-word!important; font-size:12px”> style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>     style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>[ style=””>self style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>. style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>categoryTableView style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>
selectRowAtIndexPath style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>: style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>[ style=””>NSIndexPath style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>
indexPathForRow style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>:section style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>

  • style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,153,153)!important”>1 style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>
    inSection style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,111,224)!important”>: style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,153,153)!important”>0 style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>] style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>
    animated style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>:YES style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:teal!important”>
    scrollPosition style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(0,45,122)!important”>:UITableViewScrollPositionMiddle style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>];

    style=”margin:0px; padding:0px; border:0px; font-family:inherit; height:inherit; max-width:100%!important; word-wrap:break-word!important; font-size:inherit!important; line-height:inherit!important; color:rgb(51,51,51)!important”>}

  图片 23

在willDisplayHeaderView这个代理方法中,右边tableView向下滑动,此时headerView即将显示,左边cell选择indexPathForRow:section,在didEndDisplayingHeaderView代理方法中,右边tableView向上滑动,此时headerView结束显示,左边cell选择indexPathForRow:section+1

  21、交通部:1到10月,公路建设完成投资14478亿元,同比增8.8%,增速较前三季度加快1.1个百分点。前10月,全国农村公路累计完成新改建规模23.6万公里,提前完成20万公里的年度任务。

总结

  22、农业部:10月全国农业农村经济运行稳健,农产品批发价格指数环比降6.53%、同比涨7.62%,“菜篮子”产品批发价格指数环比降7.76%、同比涨9.40%。

基本的大体思路就是上面这些,可能老是左边tableView右边tableView的看起来有点儿绕了,具体的还是看代码吧。最后贴上代码链接:

  23、国土资源部:前三季度,全国国有建设用地供应31.88万公顷,同比降4.6%。全国土地出让面积14.31万公顷,同比降4.8%;合同成交价款2.28万亿元,同比增24.8%。

  24、环保部:2015年,全国246个大中城市生活垃圾产生量约为18564万吨,处置率达97.3%。其中,北京城市生活垃圾产生量最大,为790.3万吨。

希望可以和大家一起交流,一同进步。

   style=”border: 0px; margin: 0px; padding: 0px; font-size: 16px;”>产业

  25、10月规模以上工业原油产量1605.1万吨,同比降11.3%;天然气产量108.3亿立方米,同比降1.4%。

  26、1-10月,全国粗钢产量67296万吨,同比增0.7%;钢材产量94829万吨,同比增2.4%。

  27、前9月,全国风电平均利用小时数1251小时,同比降66小时;风电弃风电量394.7亿千瓦时;平均弃风率19%。

  28、数据显示,10月我国广义乘用车销量222万辆,同比增长20%。前10月,广义乘用车销量1867万辆,同比增长15.2%。前10月,中国新能源汽车累计销量约33.7万辆,同比增长82.2%。

  29、数据显示,截至10月底,35个城市新建商品住宅库存总量为23726万平方米,环比降1.4%,同比降10.8%。合肥、南京和上海库存量同比降幅较大,分别为59.9%、55.0%和46.5%。

  30、10月,70大中城市中,一、二线城市房地产市场明显降温。与上半月比,10月下半月,深圳和成都新建商品住宅价格继续下降,北京、天津、上海、厦门和郑州等5个城市由升转降。

  图片 24

  31、前三季度,中国国内旅游人数33.6亿人次,入出境旅游人数1.94亿人次,旅游收入2.9万亿,同比分别增11%、13.5%和3.7%。中国已连续4年成世界第一大出境旅游消费国,对全球旅游收入贡献平均超过13%。

  32、数据显示,截至10月底,P2P网贷行业贷款余额增至7486.72亿元,环比上月底增加5.00%。相比2015年同期,增幅达128%。

  33、据不完全统计,目前,全国休闲农业经营主体超过200万家,年营业收入3500亿元,带动3300万农民受益。

  34、前10月,我国企业签订服务外包合同额7166亿元,执行额5050亿元,分别增长9.5%和6.9%。

  35、铁总:截至10月底,已有郑州至徐州高速铁路等22个项目投产运营,投产里程1209.9公里;预计年底前还将有35个项目陆续投产;2017年春运铁路客运能力同比增7.5%。

  36、今年“双11”期间(11日到16日),全国邮政、快递企业共揽收快件11.2亿件;“双11”当天共处理快件2.51亿件,刷新我国快递最高日处理量的纪录。中国快递协会预计今年快递业务总量有望突破300亿件,业务收入将达到4000亿元,分别增长50%和40%以上。

  37、数据显示,2016年中国游戏行业整体市场规模将达1830.62亿元,同比将增26.3%。前三季度网络游戏市场营收为1276亿元,预计全年将达1671.7亿元。

   style=”border: 0px; margin: 0px; padding: 0px; font-size: 16px;”>机构

  38、10月“经济日报-中国邮政储蓄银行小微企业运行指数”为45.8,与上月持平,小微企业总体运行保持平稳。

  39、2016年10月中经有色金属产业月度景气指数报告显示,10月指数为27.6,较上月回升2.2点,上升至“偏冷”区域上沿,行业整体出现了积极向好的趋势。

  40、10月财新服务业PM为52.4,高出9月0.4个百分点,为四个月以来最高。

  图片 25

  41、报告显示,中国在创新领域发展迅猛,仅2015年研发支出总额就达到1.422万亿元人民币,占世界各国研发总支出的20%,位列全球第二。

  42、前三季度,工、建、中、农、交利息净收入同比全部出现负增长,而且降幅都超过6%。五大行实现非息业务收入5970亿元,同比大幅增长22.2%,占全部营业收入比例同比提升5.7个百分点到31.5%。

  43、数据显示,今年12月和明年1月限售股解禁规模分别为3714亿元和4432亿元,占2016年、2017年解禁规模的15%、16%,是今明两年解禁规模最高月份。

  44、截至目前,新三板公司数量已达9637家,挂牌的公司总市值超过了3.6万亿。2013年至今,挂牌公司累计完成融资超过5000次股票发行,融资额超过2200亿。

  45、统计显示,三季度末A股127家上市房企总负债额达4.48万亿元,创历史新高,平均资产负债率达77.59%。负债率超80%的房企有29家,其中包括万科A、绿地控股等销售千亿级房企。

  46、Wind数据显示,前三季度,23家上市整车车企业绩整体上扬,近七成企业实现净利润增加。上汽集团净利润为230.92亿元,居全行业之首;一汽夏利难改颓势,亏损8.25亿元,为行业倒数第一。

  47、调查显示,从2015年下半年到2016年上半年,我国网民因垃圾信息、诈骗信息等遭受的经济损失高达915亿元。

  48、截至11月11日24时,2016天猫双11全球狂欢节总交易额超1207亿元,无线交易额占比81.87%,覆盖235个国家和地区。

  49、微博三季度财报显示,截至三季度,微博月活跃用户2.97亿,同比增34%,创今年最大增幅;三季度总营收11.8亿元,同比增49%,净利润同比增156%。

  50、2015年,全国社会保险基金总收入46354亿元,比上年增14.6%;总支出39118亿元,比上年增16.1%;本年收支结余7236亿元,年末滚存结余58893亿元。

  图片 26

  51、三季度末,全国68家信托公司管理的信托资产规模达到18.17万亿元,再次刷新纪录。

  52、高德纳咨询公司调查表明,2016年第三季度5家最大的智能手机生产商只有3家售卖成功上涨:华为、OPPO、步步高,三星市场占有率从23.6%降至19.2%,苹果从12.0%降至11.5%。

  53、《创业企业调查报告》显示,43.2%的企业2015年利润为0%或处于亏损状态;86.74%的企业员工月平均工资在5000到10000元。

   style=”border: 0px; margin: 0px; padding: 0px; font-size: 16px;”>国际

  54、据估算,2016年“黑色星期五”,美国市场在线购物交易额首破30亿美元,达33.4亿美元。相比之下,阿里巴巴双十一成交量达1207亿元人民币。

  55、最新报告显示,在全球手机利润排名中,三星首次跌出前五名,苹果依然位居榜首,华为则首次成为全球利润最高的Android智能机厂商。

  56、联合国世界知识产权组织发布报告称,2015年,中国专利申请量达101万件,超过全球总量的1/3,位列世界第一。美国以52.6万件位居第二。

  57、报告显示,2015年,中国对美直接投资超过150亿美元,历史上首次超过美国对华投资;中美双向投资的效益已覆盖两国90%的州和省。

  58、中国9月减持281亿美元美债,仍居美国最大债权国地位。从6月至今,中国已累计减持870亿美元美债。

  59、报告称,2015年全球零售总额约为22.5万亿美元,同比增5.6%,中国对全球零售业整体增长的贡献高达37%;预计2019年,中国有望超越美国,成为全球最大的消费市场。

  60、11月1日,比特币诞生八周年。当天,比特币价格突破5000元大关,最高价达5025元/个,创下4个多月新纪录。

图片 27

发表评论

电子邮件地址不会被公开。 必填项已用*标注

相关文章

网站地图xml地图