Policy Information
ML之回归预测之Lasso:利用Lasso算法解决回归(实数值评分预测)问题—优化模型【增加新(组合)属性】
目录
- names[-1] = "a^2"
- names.append("a*b")
-
-
- nrows = len(xList)
- ncols = len(xList[0])
-
- xMeans = []
- xSD = []
- for i in range(ncols):
- col = [xList[j][i] for j in range(nrows)]
- mean = sum(col)/nrows
- xMeans.append(mean)
- colDiff = [(xList[j][i] - mean) for j in range(nrows)]
- sumSq = sum([colDiff[i] * colDiff[i] for i in range(nrows)])
- stdDev = sqrt(sumSq/nrows)
- xSD.append(stdDev)
-
-
- X = numpy.array(xList) Unnormalized X's
- X = numpy.array(xNormalized) Normlized Xss
- Y = numpy.array(labels) Unnormalized labels
评论