- Hands-On Machine Learning with ML.NET
- Jarred Capellman
- 302字
- 2021-06-24 16:43:33
Running the application
To run the application the process is nearly identical to Chapter 2's sample application. To iterate more quickly, the debug configuration automatically passes in the included sampledata.csv file as a command-line parameter:
Going forward, due to the increasing complexity of the applications, all sample applications will have this preset:
- To run the training on the command line as we did in Chapter 1, Getting Started with Machine Learning and ML.NET, simply pass in the following command (assuming you are using the included sample dataset):
PS chapter03\bin\Debug\netcoreapp3.0> .\chapter03.exe train ..\..\..\Data\sampledata.csv
Loss Function: 324.71
Mean Absolute Error: 12.68
Mean Squared Error: 324.71
RSquared: 0.14
Root Mean Squared Error: 18.02
Note the expanded output to include several metric data points—we will go through what each one of these means at the end of this chapter.
- After training the model, build a sample JSON file and save it as input.json:
{
"durationInMonths": 0.0,
"isMarried": 0,
"bsDegree": 1,
"msDegree": 1,
"yearsExperience": 2,
"ageAtHire": 29,
"hasKids": 0,
"withinMonthOfVesting": 0,
"deskDecorations": 1,
"longCommute": 1
}
- To run the model with this file, simply pass in the filename to the built application and the predicted output will show:
PS chapter03\bin\Debug\netcoreapp3.0> .\chapter03.exe predict input.json
Based on input json:
{
"durationInMonths": 0.0,
"isMarried": 0,
"bsDegree": 1,
"msDegree": 1,
"yearsExperience": 2,
"ageAtHire": 29,
"hasKids": 0,
"withinMonthOfVesting": 0,
"deskDecorations": 1,
"longCommute": 1
}
The employee is predicted to work 22.82 months
Feel free to modify the values and see how the prediction changes based on the dataset that the model was trained on. A few areas of experimentation from this point might be to do the following:
- Add some additional features based on your own experience.
- Modify sampledata.csv to include your team's experience.
- Modify the sample application to have a GUI to make running predicts easier.
推薦閱讀
- Learning LibGDX Game Development(Second Edition)
- 自己動(dòng)手寫搜索引擎
- 構(gòu)建移動(dòng)網(wǎng)站與APP:HTML 5移動(dòng)開(kāi)發(fā)入門與實(shí)戰(zhàn)(跨平臺(tái)移動(dòng)開(kāi)發(fā)叢書(shū))
- 動(dòng)手玩轉(zhuǎn)Scratch3.0編程:人工智能科創(chuàng)教育指南
- Mastering Natural Language Processing with Python
- Neo4j Essentials
- Raspberry Pi 2 Server Essentials
- Microsoft System Center Orchestrator 2012 R2 Essentials
- Integrating Facebook iOS SDK with Your Application
- Visual FoxPro程序設(shè)計(jì)習(xí)題集及實(shí)驗(yàn)指導(dǎo)(第四版)
- C和C++游戲趣味編程
- 第一行代碼 C語(yǔ)言(視頻講解版)
- Creating Data Stories with Tableau Public
- 代替VBA!用Python輕松實(shí)現(xiàn)Excel編程
- Getting Started with Python