Interface IPredictor<TInstanceSource, TInstance, TLabelSource, TResult, TResultDist>
Interface to a learner that acts on some data to predict a label.
Inherited Members
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 |
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 |
Returns
Type | Description |
---|---|
TResult | The "best" prediction for |
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 |
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 |
Returns
Type | Description |
---|---|
TResultDist | The prediction for |
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. |