Search Results for

    Show / Hide Table of Contents

    Interface IPredictor<TInstanceSource, TInstance, TLabelSource, TResult, TResultDist>

    Interface to a learner that acts on some data to predict a label.

    Inherited Members
    ILearner.Settings
    Namespace: Microsoft.ML.Probabilistic.Learners
    Assembly: Microsoft.ML.Probabilistic.Learners.dll
    Syntax
    public interface IPredictor<in TInstanceSource, in TInstance, in TLabelSource, out TResult, out TResultDist> : ILearner
    Type Parameters
    Name Description
    TInstanceSource

    The type of a source of instances.

    TInstance

    The type of an instance.

    TLabelSource

    The type of a source of labels.

    TResult

    The type of a prediction for a single instance.

    TResultDist

    The type of an uncertain prediction for a single instance.

    Remarks

    Intended usage:

    An instance refers to the data that can be attributed to a label. It may include the label itself if it is known. Typically, an instance provides the feature values which characterize the label. In spam detection, for example, an instance might refer to an email which may be labeled 'spam' or 'no spam'. In finance, an instance might refer to a commodity and the label may be its price.

    An instance source provides all instances of interest.

    A label source provides the known labels of some given instances.

    Labels may hence be provided by label source or instance source.

    Properties

    Capabilities

    Gets the capabilities of the predictor.

    Declaration
    IPredictorCapabilities Capabilities { get; }
    Property Value
    Type Description
    IPredictorCapabilities

    Methods

    Predict(TInstanceSource)

    Makes predictions for the specified instances. Uncertainty in the predictions is discarded and the "best" predictions are returned.

    Declaration
    IEnumerable<TResult> Predict(TInstanceSource instanceSource)
    Parameters
    Type Name Description
    TInstanceSource instanceSource

    The source of instances to make predictions for.

    Returns
    Type Description
    IEnumerable<TResult>

    The "best" prediction for every instance in instanceSource, discarding uncertainty.

    Remarks

    The definition of "best" depends on the particular implementation of the predictor and its settings.

    Predict(TInstance, TInstanceSource)

    Makes a prediction for the specified instance. Uncertainty in the prediction is discarded and a "best" prediction is returned.

    Declaration
    TResult Predict(TInstance instance, TInstanceSource instanceSource = null)
    Parameters
    Type Name Description
    TInstance instance

    The instance to make predictions for.

    TInstanceSource instanceSource

    The source of instances which provides instance.

    Returns
    Type Description
    TResult

    The "best" prediction for instance, discarding uncertainty.

    Remarks

    The definition of "best" depends on the particular implementation of the predictor and its settings.

    PredictDistribution(TInstanceSource)

    Makes predictions for the specified instances. Uncertainty in the predictions is characterized by the returned distribution type.

    Declaration
    IEnumerable<TResultDist> PredictDistribution(TInstanceSource instanceSource)
    Parameters
    Type Name Description
    TInstanceSource instanceSource

    The source of instances to make predictions for.

    Returns
    Type Description
    IEnumerable<TResultDist>

    The predictions of all instances provided by instanceSource, with uncertainty.

    PredictDistribution(TInstance, TInstanceSource)

    Makes a prediction for the specified instance. Uncertainty in the prediction is characterized by the returned distribution type.

    Declaration
    TResultDist PredictDistribution(TInstance instance, TInstanceSource instanceSource = null)
    Parameters
    Type Name Description
    TInstance instance

    The instance to make predictions for.

    TInstanceSource instanceSource

    The source of instances which provides instance.

    Returns
    Type Description
    TResultDist

    The prediction for instance, with uncertainty.

    Train(TInstanceSource, TLabelSource)

    Trains the predictor on the specified instances.

    Declaration
    void Train(TInstanceSource instanceSource, TLabelSource labelSource = null)
    Parameters
    Type Name Description
    TInstanceSource instanceSource

    The source of instances.

    TLabelSource labelSource

    The source of labels.

    Extension Methods

    Utilities.Save(ILearner, String)
    Utilities.Save(ILearner, Stream, IFormatter)
    In This Article
    Back to top Copyright © .NET Foundation. All rights reserved.