@@ -19,12 +19,9 @@ namespace Microsoft.ML.CLI.Templates.Console
19
19
/// <summary>
20
20
/// Class to produce the template output
21
21
/// </summary>
22
-
23
- #line 1 "E:\src\machinelearning\src\mlnet\Templates\Console\PredictProgram.tt"
24
22
[ global ::System . CodeDom . Compiler . GeneratedCodeAttribute ( "Microsoft.VisualStudio.TextTemplating" , "15.0.0.0" ) ]
25
23
public partial class PredictProgram : PredictProgramBase
26
24
{
27
- #line hidden
28
25
/// <summary>
29
26
/// Create the template output
30
27
/// </summary>
@@ -41,56 +38,21 @@ public virtual string TransformText()
41
38
using System.Linq;
42
39
using Microsoft.ML;
43
40
using " ) ;
44
-
45
- #line 18 "E:\src\machinelearning\src\mlnet\Templates\Console\PredictProgram.tt"
46
41
this . Write ( this . ToStringHelper . ToStringWithCulture ( Namespace ) ) ;
47
-
48
- #line default
49
- #line hidden
50
42
this . Write ( ".Model.DataModels;\r \n \r \n \r \n namespace " ) ;
51
-
52
- #line 21 "E:\src\machinelearning\src\mlnet\Templates\Console\PredictProgram.tt"
53
43
this . Write ( this . ToStringHelper . ToStringWithCulture ( Namespace ) ) ;
54
-
55
- #line default
56
- #line hidden
57
44
this . Write ( ".ConsoleApp\r \n {\r \n class Program\r \n {\r \n //Machine Learning model to loa" +
58
45
"d and use for predictions\r \n private const string MODEL_FILEPATH = @\" MLMod" +
59
46
"el.zip\" ;\r \n \r \n //Dataset to use for predictions \r \n " ) ;
60
-
61
- #line 29 "E:\src\machinelearning\src\mlnet\Templates\Console\PredictProgram.tt"
62
47
if ( string . IsNullOrEmpty ( TestDataPath ) ) {
63
-
64
- #line default
65
- #line hidden
66
48
this . Write ( " private const string DATA_FILEPATH = @\" " ) ;
67
-
68
- #line 30 "E:\src\machinelearning\src\mlnet\Templates\Console\PredictProgram.tt"
69
49
this . Write ( this . ToStringHelper . ToStringWithCulture ( TrainDataPath ) ) ;
70
-
71
- #line default
72
- #line hidden
73
50
this . Write ( "\" ;\r \n " ) ;
74
-
75
- #line 31 "E:\src\machinelearning\src\mlnet\Templates\Console\PredictProgram.tt"
76
51
} else {
77
-
78
- #line default
79
- #line hidden
80
52
this . Write ( " private const string DATA_FILEPATH = @\" " ) ;
81
-
82
- #line 32 "E:\src\machinelearning\src\mlnet\Templates\Console\PredictProgram.tt"
83
53
this . Write ( this . ToStringHelper . ToStringWithCulture ( TestDataPath ) ) ;
84
-
85
- #line default
86
- #line hidden
87
54
this . Write ( "\" ;\r \n " ) ;
88
-
89
- #line 33 "E:\src\machinelearning\src\mlnet\Templates\Console\PredictProgram.tt"
90
55
}
91
-
92
- #line default
93
- #line hidden
94
56
this . Write ( @"
95
57
static void Main(string[] args)
96
58
{
@@ -109,55 +71,20 @@ static void Main(string[] args)
109
71
SamplePrediction predictionResult = predEngine.Predict(sampleData);
110
72
111
73
" ) ;
112
-
113
- #line 51 "E:\src\machinelearning\src\mlnet\Templates\Console\PredictProgram.tt"
114
74
if ( "BinaryClassification" . Equals ( TaskType ) ) {
115
-
116
- #line default
117
- #line hidden
118
75
this . Write ( " Console.WriteLine($\" Single Prediction --> Actual value: {sampleData." ) ;
119
-
120
- #line 52 "E:\src\machinelearning\src\mlnet\Templates\Console\PredictProgram.tt"
121
76
this . Write ( this . ToStringHelper . ToStringWithCulture ( Utils . Normalize ( LabelName ) ) ) ;
122
-
123
- #line default
124
- #line hidden
125
77
this . Write ( "} | Predicted value: {predictionResult.Prediction}\" );\r \n " ) ;
126
-
127
- #line 53 "E:\src\machinelearning\src\mlnet\Templates\Console\PredictProgram.tt"
128
78
} else if ( "Regression" . Equals ( TaskType ) ) {
129
-
130
- #line default
131
- #line hidden
132
79
this . Write ( " Console.WriteLine($\" Single Prediction --> Actual value: {sampleData." ) ;
133
-
134
- #line 54 "E:\src\machinelearning\src\mlnet\Templates\Console\PredictProgram.tt"
135
80
this . Write ( this . ToStringHelper . ToStringWithCulture ( Utils . Normalize ( LabelName ) ) ) ;
136
-
137
- #line default
138
- #line hidden
139
81
this . Write ( "} | Predicted value: {predictionResult.Score}\" );\r \n " ) ;
140
-
141
- #line 55 "E:\src\machinelearning\src\mlnet\Templates\Console\PredictProgram.tt"
142
82
} else if ( "MulticlassClassification" . Equals ( TaskType ) ) {
143
-
144
- #line default
145
- #line hidden
146
83
this . Write ( " Console.WriteLine($\" Single Prediction --> Actual value: {sampleData." ) ;
147
-
148
- #line 56 "E:\src\machinelearning\src\mlnet\Templates\Console\PredictProgram.tt"
149
84
this . Write ( this . ToStringHelper . ToStringWithCulture ( Utils . Normalize ( LabelName ) ) ) ;
150
-
151
- #line default
152
- #line hidden
153
85
this . Write ( "} | Predicted value: {predictionResult.Prediction} | Predicted scores: [{String.J" +
154
86
"oin(\" ,\" , predictionResult.Score)}]\" );\r \n " ) ;
155
-
156
- #line 57 "E:\src\machinelearning\src\mlnet\Templates\Console\PredictProgram.tt"
157
87
}
158
-
159
- #line default
160
- #line hidden
161
88
this . Write ( @"
162
89
Console.WriteLine(""=============== End of process, hit any key to finish ==============="");
163
90
Console.ReadKey();
@@ -171,33 +98,13 @@ private static SampleObservation CreateSingleDataSample(MLContext mlContext, str
171
98
IDataView dataView = mlContext.Data.LoadFromTextFile<SampleObservation>(
172
99
path: dataFilePath,
173
100
hasHeader : " ) ;
174
-
175
- #line 70 "E:\src\machinelearning\src\mlnet\Templates\Console\PredictProgram.tt"
176
101
this . Write ( this . ToStringHelper . ToStringWithCulture ( HasHeader . ToString ( ) . ToLowerInvariant ( ) ) ) ;
177
-
178
- #line default
179
- #line hidden
180
102
this . Write ( ",\r \n separatorChar : \' " ) ;
181
-
182
- #line 71 "E:\src\machinelearning\src\mlnet\Templates\Console\PredictProgram.tt"
183
103
this . Write ( this . ToStringHelper . ToStringWithCulture ( Regex . Escape ( Separator . ToString ( ) ) ) ) ;
184
-
185
- #line default
186
- #line hidden
187
104
this . Write ( "\' ,\r \n allowQuoting : " ) ;
188
-
189
- #line 72 "E:\src\machinelearning\src\mlnet\Templates\Console\PredictProgram.tt"
190
105
this . Write ( this . ToStringHelper . ToStringWithCulture ( AllowQuoting . ToString ( ) . ToLowerInvariant ( ) ) ) ;
191
-
192
- #line default
193
- #line hidden
194
106
this . Write ( ",\r \n allowSparse: " ) ;
195
-
196
- #line 73 "E:\src\machinelearning\src\mlnet\Templates\Console\PredictProgram.tt"
197
107
this . Write ( this . ToStringHelper . ToStringWithCulture ( AllowSparse . ToString ( ) . ToLowerInvariant ( ) ) ) ;
198
-
199
- #line default
200
- #line hidden
201
108
this . Write ( @");
202
109
203
110
// Here (SampleObservation object) you could provide new test data, hardcoded or from the end-user application, instead of the row from the file.
@@ -220,8 +127,6 @@ public static string GetAbsolutePath(string relativePath)
220
127
" ) ;
221
128
return this . GenerationEnvironment . ToString ( ) ;
222
129
}
223
-
224
- #line 92 "E:\src\machinelearning\src\mlnet\Templates\Console\PredictProgram.tt"
225
130
226
131
public string TaskType { get ; set ; }
227
132
public string Namespace { get ; set ; }
@@ -233,13 +138,7 @@ public static string GetAbsolutePath(string relativePath)
233
138
public bool AllowSparse { get ; set ; }
234
139
public bool HasHeader { get ; set ; }
235
140
236
-
237
- #line default
238
- #line hidden
239
141
}
240
-
241
- #line default
242
- #line hidden
243
142
#region Base class
244
143
/// <summary>
245
144
/// Base class for this transformation
0 commit comments