- Machine Learning with Swift
- Alexander Sosnovshchenko
- 189字
- 2021-06-24 18:54:57
Making predictions
We use the predict function to get outcome labels for two samples. The first one is light-black, fluffy creature, 24 meters long. The second one is purple polka dot, non-fluffy, and 34 meters long. If you already don't remember the meaning of each feature, consult the feature_names variable:
In []: samples = [[24,1,0,1,0,0], [34,0,0,0,1,0]] tree_model.predict(samples) Out[]: array([u'platyhog', u'rabbosaurus'], dtype=object)
Our model predicted platyhog for the first sample, and rabbosaurus for the second one. A decision tree can also provide probabilistic output (how sure it is about the prediction):
In []: tree_model.predict_proba(samples) Out[]: array([[ 1., 0.], [ 0., 1.]])
The array contains two nested arrays, one for every prediction. Elements in the nested arrays are probabilities of the sample belonging to the corresponding class. This means that our model is 100% sure that the first sample belongs to the first class, and 100% sure that the second sample belongs to the second class.
But how sure can we be about these predictions? We have a whole set of different tools to evaluate the model's accuracy, and the simplest one is the built-in scoring functions.
- Learning SQL Server Reporting Services 2012
- Learning AngularJS Animations
- Augmented Reality with Kinect
- Mastering Delphi Programming:A Complete Reference Guide
- 硬件產(chǎn)品經(jīng)理手冊(cè):手把手構(gòu)建智能硬件產(chǎn)品
- Artificial Intelligence Business:How you can profit from AI
- Learning Stencyl 3.x Game Development Beginner's Guide
- Mastering Adobe Photoshop Elements
- Hands-On Machine Learning with C#
- 固態(tài)存儲(chǔ):原理、架構(gòu)與數(shù)據(jù)安全
- 深入理解序列化與反序列化
- 單片機(jī)技術(shù)及應(yīng)用
- STM32自學(xué)筆記
- The Machine Learning Workshop
- 施耐德M241/251可編程序控制器應(yīng)用技術(shù)