You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add an example for static pipeline with in-memory data and show how to get class probabilities (#1953)
* Add an example for static pipeline with in-memory data and show how to get class probabilities
* Really extract labels from learned pipeline
* Extend a comment to mention that extracting labels is a temporal solution
* Bypass 32-bit LightGbm test
* Address comments
* Move example data structure to SamplesUtils
varnativeLabels=labelBuffer.DenseValues().ToArray();// nativeLabels[nativePrediction.PredictedLabelIndex - 1] is the original label indexed by nativePrediction.PredictedLabelIndex.
84
+
85
+
86
+
// Show prediction result for the 3rd example.
87
+
varnativePrediction=nativePredictions[2];
88
+
// Console output:
89
+
// Our predicted label to this example is "AA" with probability 0.922597349.
90
+
Console.WriteLine("Our predicted label to this example is {0} with probability {1}",
Copy file name to clipboardExpand all lines: src/Microsoft.ML.LightGBM.StaticPipe/LightGbmStaticExtensions.cs
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -181,6 +181,13 @@ public static Scalar<float> LightGbm<TVal>(this RankingContext.RankingTrainers c
181
181
/// the linear model that was trained. Note that this action cannot change the
182
182
/// result in any way; it is only a way for the caller to be informed about what was learnt.</param>
183
183
/// <returns>The set of output columns including in order the predicted per-class likelihoods (between 0 and 1, and summing up to 1), and the predicted label.</returns>
varnativeLabels=labelBuffer.DenseValues().ToList();// nativeLabels[nativePrediction.PredictedLabelIndex-1] is the original label indexed by nativePrediction.PredictedLabelIndex.
0 commit comments