Page 59 - MSDN Magazine, November 2018
P. 59

The Evaluate method returns an object containing several metrics, including log loss, precision, recall, F1 score and so on. The return object also has a neat ConfusionMatrix object that can be used to display counts such as the number of patients who were predicted to survive but in fact died.
Using the Trained Model
The demo program shows how to use the trained model to make a prediction:
Console.WriteLine("Predict 50-year male kidney = 4.80:"); KidneyData newPatient = new KidneyData()
{ Age = 50f, Sex = -1f, Kidney = 4.80f }; KidneyPrediction prediction = model.Predict(newPatient); string result = prediction.PredictedLabels; Console.WriteLine("Prediction = " + result);
In most ML scenarios you’d have two data files—one set used just for training and a second test dataset used only for model evaluation.
Notice that the numeric literals for age, sex and kidney score use the “f ” modifier because the model is expecting type float values. In this example, the trained model was available because the program just finished training. If you wanted to make a prediction from a dif- ferent program, you’d load the trained model using the ReadAsync method along the lines of:
PredictionModel<KidneyData, KidneyPrediction> model = null;
Task.Run(async () => {
model2 = await PredictionModel.ReadAsync
<KidneyData, KidneyPrediction>(ModelPath); }).GetAwaiter().GetResult();
Wrapping Up
Even though the ML.NET library is new, its origins go back many years. Shortly after the introduction of the Microsoft .NET Framework in 2002, Microsoft Research began a project called “text mining search and navigation”, or TMSN, to enable software developers to include ML code in Microsoft products and technologies. The project was very successful, and over the years grew in size and usage internally at Microsoft. Somewhere around 2011 the library was renamed to “the learning code” (TLC). TLC is widely used within Microsoft and is currently in version 3.9. The ML.NET library is a direct offshoot of TLC, with Microsoft-specific features removed. n
Dr. James mccaffrey works for Microsoft Research in Redmond, Wash. He has worked on several Microsoft products, including Internet Explorer and Bing. Dr. McCaffrey can be reached at jamccaff@microsoft.com.
Thanks to the following Microsoft technical experts who reviewed this article: Chris Lee and Ricky Loynd
msdnmagazine.com
magazine
STATEMENT OF OWNERSHIP, MANAGEMENT AND CIRCULATION
1. Publication Title: MSDN Magazine
2. Publication Number: 1528-4859
3. Filing Date: September 30, 2018
4. Frequency of Issue: Monthly with a special issue in November
5. Number of Issues Published Annually: 13
6. Annual Subscription Price: US $35, International $60
7. Complete Mailing Address of Known Office of Publication: 6300 Canoga Ave., Ste.
1150, Woodland Hills, CA 91367
8. Complete Mailing Address of the Headquarters of General Business Offices of the
Publisher: Same as above.
9. Full Name and Complete Mailing Address of Publisher, Editor, and Managing Editor:
Dan LaBianca, Chief Revenue Officer, 14901 Quorum Drive, Ste 425, Dallas, TX 75254
Michael Desmond, Editor-in-Chief, 8251 Greensboro Drive, Suite 510, McLean, VA 22102
Wendy Hernandez, Group Managing Editor, 4 Venture, Suite 150, Irvine, CA 92618
10. Owner(s): 1105 Media, Inc. dba: 101 Communications LLC, 6300 Canoga Ave., Ste. 1150, Woodland Hills, CA 91367 Listing of shareholders in 1105 Media, Inc.
11. Known Bondholders, Mortgagees, and Other Security Holders Owning or Holding 1 Percent or more of the Total Amount of Bonds, Mortgages or Other Securities: Nautic Partners V, L.P., 50 Kennedy Plaza, 12th Flr., Providence, RI 02903 Kennedy Plaza Partners III, LLC, 50 Kennedy Plaza, 12th Flr., Providence, RI 02903 Alta Communications IX, L.P., 1000 Winter Street, South Entrance, Suite 3500, Waltham, MA 02451
Alta Communications IX, B-L.P., 1000 Winter Street, South Entrance, Suite 3500, Waltham, MA 02451
Alta Communications IX, Associates LLC, 1000 Winter Street, South Entrance, Suite 3500, Waltham, MA 02451
12. The tax status has not changed during the preceding 12 months.
13. Publication Title: MSDN Magazine
14. Issue date for Circulation Data Below: September 2018
15. Extent & Nature of Circulation:
a. b.
c.
Total Number of Copies (Net Press Run) Legitimate Paid/and or Requested Distribution
1. Outside County Paid/Requested Mail Subscriptions Stated on PS Form 3541
2. In-County Paid/Requested Mail Subscriptions Stated on PS Form 3541
3. Sales Through Dealers and Carriers, Street Vendors, Counter Sales, and Other Paid or Requested Distribution Outside USPS®
4. Requested Copies Distributed by Other Mail Classes Through the USPS®
Total Paid and/or Requested Circulation Nonrequested Distribution
1. Outside County Nonrequested Copies
Stated on PS Form 3541
2. In-County Nonrequested Copies Distribution
Stated on PS Form 3541
3. Nonrequested Copies Distribution Through
the USPS by Other Classes of Mail
4. Nonrequested Copies Distributed
80,917 60,355
0 1,328
0
61,683
18,195
0
0
929
19,124 80,807 110 80,917 76.33%
Outside the Mail
Total Nonrequested Distribution
e.
f.
g.
h. Total
paid and/or Requested Circulation
Total Distribution Copies not Distributed
16. Electronic Copy Circulation
a. Requested and Paid Electronic Copies
b. Total Requested and Paid Print Copies (Line 15c) + Requested/Paid Electronic
Copies
c. Total Requested Copy Distribution (Line15f) + Requested/Paid Electronic
Copies (Line 16a)
d. Percent Paid and/or Requested Circulation (Both print & Electronic Copies)
(16b divided by 16c x 100)
þ I certify that 50% of all my distributed copies (electronic and paid print
are legitimate request or paid copies.
17. Publication of Statement of Ownership for a Requester Publication is required and will be printed in the November 2018 issue of this publication.
18. I certify that all information furnished on this form is true and complete: Peter B. Weller, Manager, Print Production
Average No. Copies Each Month During Preceding 12 Months
No. Copies of Single Issue Published Nearest to Filing Date
86,516 53,498
0 797
0
54,295
25,405
0
0
6,711
32,116 86,411 105 86,411i. Percent 62.83%


































































































   57   58   59   60   61