LearningModelEvaluationResult LearningModelEvaluationResult LearningModelEvaluationResult LearningModelEvaluationResult LearningModelEvaluationResult Class


Get the results of the evaluation.

public : sealed class LearningModelEvaluationResult
struct winrt::Windows::AI::MachineLearning::LearningModelEvaluationResult
public sealed class LearningModelEvaluationResult
Public NotInheritable Class LearningModelEvaluationResult
// This class does not provide a public constructor.

Windows 10 requirements

Device family
Windows 10, version 1809 (introduced v10.0.17763.0)
API contract
Windows.AI.MachineLearning.MachineLearningContract (introduced v1)


The following example retrieves the first input and output features of the model, creates an output frame, binds the input and output features, and evaluates the model.

private async Task EvaluateModelAsync(
    VideoFrame _inputFrame, 
    LearningModelSession _session, 
    IReadOnlyList<ILearningModelFeatureDescriptor> _inputFeatures, 
    IReadOnlyList<ILearningModelFeatureDescriptor> _outputFeatures,
    LearningModel _model)
    ImageFeatureDescriptor _inputImageDescription;
    TensorFeatureDescriptor _outputImageDescription;
    LearningModelBinding _binding = null;
    VideoFrame _outputFrame = null;
    LearningModelEvaluationResult _results;

        // Retrieve the first input feature which is an image
        _inputImageDescription =
            _inputFeatures.FirstOrDefault(feature => feature.Kind == LearningModelFeatureKind.Image)
            as ImageFeatureDescriptor;

        // Retrieve the first output feature which is a tensor
        _outputImageDescription =
            _outputFeatures.FirstOrDefault(feature => feature.Kind == LearningModelFeatureKind.Tensor)
            as TensorFeatureDescriptor;

        // Create output frame based on expected image width and height
        _outputFrame = new VideoFrame(

        // Create binding and then bind input/output features
        _binding = new LearningModelBinding(_session);

        _binding.Bind(_inputImageDescription.Name, _inputFrame);
        _binding.Bind(_outputImageDescription.Name, _outputFrame);

        // Evaluate and get the results
        _results = await _session.EvaluateAsync(_binding, "test");
    catch (Exception ex)
        StatusBlock.Text = $"error: {ex.Message}";
        _model = null;


Windows Server

To use this API on Windows Server, you must use Windows Server 2019 with Desktop Experience.

Thread safety

This API is thread-safe.


CorrelationId CorrelationId CorrelationId CorrelationId CorrelationId

The optional string that was passed to LearningModelSession.Evaluate.

ErrorStatus ErrorStatus ErrorStatus ErrorStatus ErrorStatus

If the evaluation failed, returns an error code for what caused the failure.

Outputs Outputs Outputs Outputs Outputs

Gets the output features of the model.

Succeeded Succeeded Succeeded Succeeded Succeeded

True if the evaluation completed successfully; otherwise, false.

See also