4
4
5
5
using System ;
6
6
using System . Collections . Generic ;
7
+ using System . Collections . Immutable ;
7
8
using System . Linq ;
8
- using Microsoft . ML . Calibrators ;
9
+ // using System.Linq ;
9
10
using Microsoft . ML . Data ;
10
11
using Microsoft . ML . Functional . Tests . Datasets ;
11
12
using Microsoft . ML . RunTests ;
@@ -20,7 +21,7 @@ namespace Microsoft.ML.Functional.Tests
20
21
{
21
22
public class IntrospectiveTraining : BaseTestClass
22
23
{
23
- public IntrospectiveTraining ( ITestOutputHelper output ) : base ( output )
24
+ public IntrospectiveTraining ( ITestOutputHelper output ) : base ( output )
24
25
{
25
26
}
26
27
@@ -259,10 +260,26 @@ void IntrospectNormalization()
259
260
var model = pipeline . Fit ( data ) ;
260
261
261
262
// Extract the normalizer from the trained pipeline.
262
- // TODO #2854: Extract the normalizer parameters.
263
263
var normalizer = model . LastTransformer ;
264
- }
265
264
265
+ // Extract the normalizer parameters.
266
+ // TODO #2854: Normalizer parameters are easy to find via intellisense.
267
+ int i = 0 ;
268
+ bool found = false ;
269
+ foreach ( var column in normalizer . Columns )
270
+ {
271
+ if ( column . Name == "Features" )
272
+ {
273
+ found = true ;
274
+ var featuresNormalizer = normalizer . Columns [ i ] . ModelParameters as NormalizingTransformer . AffineNormalizerModelParameters < ImmutableArray < float > > ;
275
+ Assert . NotNull ( featuresNormalizer ) ;
276
+ Common . AssertFiniteNumbers ( featuresNormalizer . Offset ) ;
277
+ Common . AssertFiniteNumbers ( featuresNormalizer . Scale ) ;
278
+ }
279
+ i ++ ;
280
+ }
281
+ Assert . True ( found ) ;
282
+ }
266
283
/// <summary>
267
284
/// Introspective Training: I can inspect a pipeline to determine which transformers were included.
268
285
/// </summary>
0 commit comments