internal static ITransformGenerator GetInstance(PipelineNode node)
        {
            ITransformGenerator result = null;

            if (Enum.TryParse(node.Name, out EstimatorName trainer))
            {
                switch (trainer)
                {
                case EstimatorName.Normalizing:
                    result = new Normalizer(node);
                    break;

                case EstimatorName.OneHotEncoding:
                    result = new OneHotEncoding(node);
                    break;

                case EstimatorName.ColumnConcatenating:
                    result = new ColumnConcat(node);
                    break;

                case EstimatorName.ColumnCopying:
                    result = new ColumnCopying(node);
                    break;

                case EstimatorName.KeyToValueMapping:
                    result = new KeyToValueMapping(node);
                    break;

                case EstimatorName.MissingValueIndicating:
                    result = new MissingValueIndicator(node);
                    break;

                case EstimatorName.MissingValueReplacing:
                    result = new MissingValueReplacer(node);
                    break;

                case EstimatorName.OneHotHashEncoding:
                    result = new OneHotHashEncoding(node);
                    break;

                case EstimatorName.TextFeaturizing:
                    result = new TextFeaturizing(node);
                    break;

                case EstimatorName.TypeConverting:
                    result = new TypeConverting(node);
                    break;

                case EstimatorName.ValueToKeyMapping:
                    result = new ValueToKeyMapping(node);
                    break;

                default:
                    return(null);
                }
            }
            return(result);
        }
Esempio n. 2
0
        internal static ITransformGenerator GetInstance(PipelineNode node)
        {
            ITransformGenerator result = null;

            if (Enum.TryParse(node.Name, out EstimatorName trainer))
            {
                switch (trainer)
                {
                case EstimatorName.Normalizing:
                    result = new Normalizer(node);
                    break;

                case EstimatorName.OneHotEncoding:
                    result = new OneHotEncoding(node);
                    break;

                case EstimatorName.ColumnConcatenating:
                    result = new ColumnConcat(node);
                    break;

                case EstimatorName.ColumnCopying:
                    result = new ColumnCopying(node);
                    break;

                case EstimatorName.KeyToValueMapping:
                    result = new KeyToValueMapping(node);
                    break;

                case EstimatorName.MissingValueIndicating:
                    result = new MissingValueIndicator(node);
                    break;

                case EstimatorName.MissingValueReplacing:
                    result = new MissingValueReplacer(node);
                    break;

                case EstimatorName.OneHotHashEncoding:
                    result = new OneHotHashEncoding(node);
                    break;

                case EstimatorName.TextFeaturizing:
                    result = new TextFeaturizing(node);
                    break;

                case EstimatorName.TypeConverting:
                    result = new TypeConverting(node);
                    break;

                case EstimatorName.ValueToKeyMapping:
                    result = new ValueToKeyMapping(node);
                    break;

                case EstimatorName.RawByteImageLoading:
                    result = new ImageLoadingRawBytes(node);
                    break;

                case EstimatorName.ImageLoading:
                    result = new ImageLoading(node);
                    break;

                default:
                    // see if node is one of those Transformer
                    return(null);
                }
            }

            // For AzureAttach
            if (Enum.TryParse(node.Name, out SpecialTransformer transformer))
            {
                switch (transformer)
                {
                case SpecialTransformer.ExtractPixel:
                    result = new PixelExtract(node);
                    break;

                case SpecialTransformer.NormalizeMapping:
                    result = new CustomNormalizeMapping(node);
                    break;

                case SpecialTransformer.ResizeImage:
                    result = new ImageResizing(node);
                    break;

                case SpecialTransformer.ApplyOnnxModel:
                    result = new ApplyOnnxModel(node);
                    break;

                case SpecialTransformer.LabelMapping:
                    result = new CustomLabelMapping(node);
                    break;

                default:
                    return(null);
                }
            }
            return(result);
        }