Skip to content

Commit 2da3488

Browse files
New PFI API (#5934)
1 parent d4c9dd4 commit 2da3488

File tree

5 files changed

+591
-15
lines changed

5 files changed

+591
-15
lines changed

src/Microsoft.ML.Data/Prediction/CalibratorCatalog.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public CalibratorTransformer<TICalibrator> Fit(IDataView input)
162162
/// where score can be viewed as a feature while probability is treated as the label.
163163
/// </summary>
164164
/// <typeparam name="TICalibrator">The <see cref="ICalibrator"/> used to transform the data.</typeparam>
165-
public abstract class CalibratorTransformer<TICalibrator> : RowToRowTransformerBase, ISingleFeaturePredictionTransformer<TICalibrator>
165+
public abstract class CalibratorTransformer<TICalibrator> : RowToRowTransformerBase, ISingleFeaturePredictionTransformer<TICalibrator>, ISingleFeaturePredictionTransformer
166166
where TICalibrator : class, ICalibrator
167167
{
168168
private readonly TICalibrator _calibrator;
@@ -201,6 +201,7 @@ private protected CalibratorTransformer(IHostEnvironment env, ModelLoadContext c
201201
}
202202

203203
string ISingleFeaturePredictionTransformer<TICalibrator>.FeatureColumnName => DefaultColumnNames.Score;
204+
string ISingleFeaturePredictionTransformer.FeatureColumnName => ((ISingleFeaturePredictionTransformer<TICalibrator>)this).FeatureColumnName;
204205

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

src/Microsoft.ML.Data/Prediction/IPredictionTransformer.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,16 @@ public interface ISingleFeaturePredictionTransformer<out TModel> : IPredictionTr
3434
/// <summary>Holds information about the type of the feature column.</summary>
3535
DataViewType FeatureColumnType { get; }
3636
}
37+
38+
/// <summary>
39+
/// An ISingleFeaturePredictionTransformer contains the name of the <see cref="FeatureColumnName"/>
40+
/// and its type, <see cref="FeatureColumnType"/>. Implementations of this interface, have the ability
41+
/// to score the data of an input <see cref="IDataView"/> through the <see cref="ITransformer.Transform(IDataView)"/>
42+
/// </summary>
43+
[BestFriend]
44+
internal interface ISingleFeaturePredictionTransformer : ITransformer
45+
{
46+
/// <summary>The name of the feature column.</summary>
47+
string FeatureColumnName { get; }
48+
}
3749
}

src/Microsoft.ML.Data/Scorers/PredictionTransformer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public void Dispose()
204204
/// Those are all the transformers that work with one feature column.
205205
/// </summary>
206206
/// <typeparam name="TModel">The model used to transform the data.</typeparam>
207-
public abstract class SingleFeaturePredictionTransformerBase<TModel> : PredictionTransformerBase<TModel>, ISingleFeaturePredictionTransformer<TModel>
207+
public abstract class SingleFeaturePredictionTransformerBase<TModel> : PredictionTransformerBase<TModel>, ISingleFeaturePredictionTransformer<TModel>, ISingleFeaturePredictionTransformer
208208
where TModel : class
209209
{
210210
/// <summary>

0 commit comments

Comments
 (0)