|
| 1 | +using System; |
| 2 | +using System.Linq; |
| 3 | +using Microsoft.VisualStudio.TestTools.UnitTesting; |
| 4 | + |
| 5 | +namespace Microsoft.ML.Auto.Test |
| 6 | +{ |
| 7 | + [TestClass] |
| 8 | + public class EstimatorExtensionTests |
| 9 | + { |
| 10 | + [TestMethod] |
| 11 | + public void EstimatorExtensionInstanceTests() |
| 12 | + { |
| 13 | + var context = new MLContext(); |
| 14 | + var pipelineNode = new PipelineNode() |
| 15 | + { |
| 16 | + InColumns = new string[] { "Input" }, |
| 17 | + OutColumns = new string[] { "Output" } |
| 18 | + }; |
| 19 | + |
| 20 | + var estimatorNames = Enum.GetValues(typeof(EstimatorName)).Cast<EstimatorName>(); |
| 21 | + foreach (var estimatorName in estimatorNames) |
| 22 | + { |
| 23 | + var extension = EstimatorExtensionCatalog.GetExtension(estimatorName); |
| 24 | + var instance = extension.CreateInstance(context, pipelineNode); |
| 25 | + Assert.IsNotNull(instance); |
| 26 | + } |
| 27 | + } |
| 28 | + |
| 29 | + [TestMethod] |
| 30 | + public void EstimatorExtensionStaticTests() |
| 31 | + { |
| 32 | + var context = new MLContext(); |
| 33 | + var inCol = "Input"; |
| 34 | + var outCol = "Output"; |
| 35 | + var inCols = new string[] { inCol }; |
| 36 | + var outCols = new string[] { outCol }; |
| 37 | + Assert.IsNotNull(ColumnConcatenatingExtension.CreateSuggestedTransform(context, inCols, outCol)); |
| 38 | + Assert.IsNotNull(ColumnCopyingExtension.CreateSuggestedTransform(context, inCol, outCol)); |
| 39 | + Assert.IsNotNull(MissingValueIndicatorExtension.CreateSuggestedTransform(context, inCols, outCols)); |
| 40 | + Assert.IsNotNull(NormalizingExtension.CreateSuggestedTransform(context, inCol, outCol)); |
| 41 | + Assert.IsNotNull(OneHotEncodingExtension.CreateSuggestedTransform(context, inCols, outCols)); |
| 42 | + Assert.IsNotNull(OneHotHashEncodingExtension.CreateSuggestedTransform(context, inCols, outCols)); |
| 43 | + Assert.IsNotNull(TextFeaturizingExtension.CreateSuggestedTransform(context, inCol, outCol)); |
| 44 | + Assert.IsNotNull(TypeConvertingExtension.CreateSuggestedTransform(context, inCols, outCols)); |
| 45 | + Assert.IsNotNull(ValueToKeyMappingExtension.CreateSuggestedTransform(context, inCol, outCol)); |
| 46 | + } |
| 47 | + } |
| 48 | +} |
0 commit comments