- Go Machine Learning Projects
- Xuanyi Chew
- 123字
- 2021-06-10 18:46:37
Cross-validation
And now we come to the final part—in order to compare models, we would like to cross-validate the model. We've already set aside a portion of the data. Now, we will have to test the model on the data that was set aside, and compute a score.
The score we'll be using is a Root Mean Square Error. It's used because it's simple and straightforward to understand:
// VERY simple cross validation
var MSE float64
for i, row := range testingSet {
pred, err := r.Predict(row)
mHandleErr(err)
correct := testingYs[i]
eStar := correct - pred
e2 := eStar * eStar
MSE += e2
}
MSE /= float64(len(testingSet))
fmt.Printf("RMSE: %v\n", math.Sqrt(MSE))
With this, now we're really ready to run the regression analysis.
推薦閱讀
- 21天學(xué)通PHP
- 空間機(jī)器人遙操作系統(tǒng)及控制
- 輕松學(xué)Java
- 影視后期制作(Avid Media Composer 5.0)
- 最簡數(shù)據(jù)挖掘
- Mastering Machine Learning Algorithms
- 機(jī)器人創(chuàng)新實(shí)訓(xùn)教程
- B2B2C網(wǎng)上商城開發(fā)指南
- 大數(shù)據(jù)技術(shù)與應(yīng)用
- ESP8266 Home Automation Projects
- 菜鳥起飛系統(tǒng)安裝與重裝
- 工業(yè)機(jī)器人維護(hù)與保養(yǎng)
- INSTANT VMware vCloud Starter
- Mastering OpenStack(Second Edition)
- 玩機(jī)器人 學(xué)單片機(jī)