@@ -26,47 +26,6 @@ namespace Microsoft.ML.Runtime
2626 public delegate void SignatureSequenceTrainer ( ) ;
2727 public delegate void SignatureMatrixRecommendingTrainer ( ) ;
2828
29- /// <summary>
30- /// Interface to provide extra information about a trainer.
31- /// </summary>
32- public interface ITrainerEx : ITrainer
33- {
34- // REVIEW: Ideally trainers should be able to communicate
35- // something about the type of data they are capable of being trained
36- // on, e.g., what ColumnKinds they want, how many of each, of what type,
37- // etc. This interface seems like the most natural conduit for that sort
38- // of extra information.
39-
40- // REVIEW: Can we please have consistent naming here?
41- // 'Need' vs. 'Want' looks arbitrary to me, and it's grammatically more correct to
42- // be 'Needs' / 'Wants' anyway.
43-
44- /// <summary>
45- /// Whether the trainer needs to see data in normalized form.
46- /// </summary>
47- bool NeedNormalization { get ; }
48-
49- /// <summary>
50- /// Whether the trainer needs calibration to produce probabilities.
51- /// </summary>
52- bool NeedCalibration { get ; }
53-
54- /// <summary>
55- /// Whether this trainer could benefit from a cached view of the data.
56- /// </summary>
57- bool WantCaching { get ; }
58-
59- bool SupportsValidation { get ; }
60- bool SupportsIncrementalTraining { get ; }
61- }
62-
63- // The Trainer (of Factory) can optionally implement this.
64- public interface IModelCombiner < TModel , TPredictor >
65- where TPredictor : IPredictor
66- {
67- TPredictor CombineModels ( IEnumerable < TModel > models ) ;
68- }
69-
7029 public delegate void SignatureModelCombiner ( PredictionKind kind ) ;
7130
7231 /// <summary>
@@ -130,6 +89,58 @@ public static TPredictor Train<TPredictor>(this ITrainer<TPredictor> trainer, Ro
13089 => trainer . Train ( new TrainContext ( trainData ) ) ;
13190 }
13291
92+ /// <summary>
93+ /// Interface to provide extra information about a trainer.
94+ /// </summary>
95+ public interface ITrainerEx : ITrainer
96+ {
97+ // REVIEW: Ideally trainers should be able to communicate
98+ // something about the type of data they are capable of being trained
99+ // on, e.g., what ColumnKinds they want, how many of each, of what type,
100+ // etc. This interface seems like the most natural conduit for that sort
101+ // of extra information.
102+
103+ // REVIEW: Can we please have consistent naming here?
104+ // 'Need' vs. 'Want' looks arbitrary to me, and it's grammatically more correct to
105+ // be 'Needs' / 'Wants' anyway.
106+
107+ /// <summary>
108+ /// Whether the trainer needs to see data in normalized form.
109+ /// </summary>
110+ bool NeedNormalization { get ; }
111+
112+ /// <summary>
113+ /// Whether the trainer needs calibration to produce probabilities.
114+ /// </summary>
115+ bool NeedCalibration { get ; }
116+
117+ /// <summary>
118+ /// Whether this trainer could benefit from a cached view of the data.
119+ /// </summary>
120+ bool WantCaching { get ; }
121+
122+ /// <summary>
123+ /// Whether the trainer supports validation sets via <see cref="TrainContext.ValidationSet"/>.
124+ /// Not implementing this interface and returning <c>true</c> from this property is an indication
125+ /// the trainer does not support that.
126+ /// </summary>
127+ bool SupportsValidation { get ; }
128+
129+ /// <summary>
130+ /// Whether the trainer can support incremental trainers via <see cref="TrainContext.InitialPredictor"/>.
131+ /// Not implementing this interface and returning <c>true</c> from this property is an indication
132+ /// the trainer does not support that.
133+ /// </summary>
134+ bool SupportsIncrementalTraining { get ; }
135+ }
136+
137+ // A trainer can optionally implement this to indicate it can combine multiple models into a single predictor.
138+ public interface IModelCombiner < TModel , TPredictor >
139+ where TPredictor : IPredictor
140+ {
141+ TPredictor CombineModels ( IEnumerable < TModel > models ) ;
142+ }
143+
133144 /// <summary>
134145 /// Interface implemented by the MetalinearLearners base class.
135146 /// Used to distinguish the MetaLinear Learners from the other learners
0 commit comments