- 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.
推薦閱讀
- 基于LabWindows/CVI的虛擬儀器設計與應用
- 群體智能與數據挖掘
- Hands-On Linux for Architects
- Associations and Correlations
- 四向穿梭式自動化密集倉儲系統的設計與控制
- 中國戰略性新興產業研究與發展·智能制造
- 基于Xilinx ISE的FPAG/CPLD設計與應用
- Hadoop應用開發基礎
- 基于元胞自動機的人群疏散系統建模與分析
- 深度學習實戰
- Hyper-V Security
- Machine Learning with R Quick Start Guide
- Office 2010辦公應用
- KUKA工業機器人與西門子S7-1200 PLC技術及應用
- 大數據技術原理與應用(第2版)