Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New PFI API #5934

Merged
merged 8 commits into from Oct 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Microsoft.ML.Data/Prediction/CalibratorCatalog.cs
Expand Up @@ -162,7 +162,7 @@ public CalibratorTransformer<TICalibrator> Fit(IDataView input)
/// where score can be viewed as a feature while probability is treated as the label.
/// </summary>
/// <typeparam name="TICalibrator">The <see cref="ICalibrator"/> used to transform the data.</typeparam>
public abstract class CalibratorTransformer<TICalibrator> : RowToRowTransformerBase, ISingleFeaturePredictionTransformer<TICalibrator>
public abstract class CalibratorTransformer<TICalibrator> : RowToRowTransformerBase, ISingleFeaturePredictionTransformer<TICalibrator>, ISingleFeaturePredictionTransformer
where TICalibrator : class, ICalibrator
{
private readonly TICalibrator _calibrator;
Expand Down Expand Up @@ -201,6 +201,7 @@ private protected CalibratorTransformer(IHostEnvironment env, ModelLoadContext c
}

string ISingleFeaturePredictionTransformer<TICalibrator>.FeatureColumnName => DefaultColumnNames.Score;
string ISingleFeaturePredictionTransformer.FeatureColumnName => ((ISingleFeaturePredictionTransformer<TICalibrator>)this).FeatureColumnName;

DataViewType ISingleFeaturePredictionTransformer<TICalibrator>.FeatureColumnType => NumberDataViewType.Single;

Expand Down
12 changes: 12 additions & 0 deletions src/Microsoft.ML.Data/Prediction/IPredictionTransformer.cs
Expand Up @@ -34,4 +34,16 @@ public interface ISingleFeaturePredictionTransformer<out TModel> : IPredictionTr
/// <summary>Holds information about the type of the feature column.</summary>
DataViewType FeatureColumnType { get; }
}

/// <summary>
/// An ISingleFeaturePredictionTransformer contains the name of the <see cref="FeatureColumnName"/>
/// and its type, <see cref="FeatureColumnType"/>. Implementations of this interface, have the ability
/// to score the data of an input <see cref="IDataView"/> through the <see cref="ITransformer.Transform(IDataView)"/>
/// </summary>
[BestFriend]
internal interface ISingleFeaturePredictionTransformer : ITransformer
{
/// <summary>The name of the feature column.</summary>
string FeatureColumnName { get; }
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.ML.Data/Scorers/PredictionTransformer.cs
Expand Up @@ -204,7 +204,7 @@ public void Dispose()
/// Those are all the transformers that work with one feature column.
/// </summary>
/// <typeparam name="TModel">The model used to transform the data.</typeparam>
public abstract class SingleFeaturePredictionTransformerBase<TModel> : PredictionTransformerBase<TModel>, ISingleFeaturePredictionTransformer<TModel>
public abstract class SingleFeaturePredictionTransformerBase<TModel> : PredictionTransformerBase<TModel>, ISingleFeaturePredictionTransformer<TModel>, ISingleFeaturePredictionTransformer
where TModel : class
{
/// <summary>
Expand Down