Ejemplo n.º 1
0
        /**
         * Open up for internal Network API use.
         * Returns an {@link Encoder.Builder} which corresponds to the specified name.
         * @param encoderName
         * @return
         */
        public IBuilder GetBuilder(string encoderName)
        {
            switch (encoderName)
            {
            case "CategoryEncoder":
                return(CategoryEncoder.GetBuilder());

            case "CoordinateEncoder":
                return(CoordinateEncoder.GetBuilder());

            case "GeospatialCoordinateEncoder":
                return(GeospatialCoordinateEncoder.GetGeobuilder());

            case "LogEncoder":
                return(LogEncoder.GetBuilder());

            case "PassThroughEncoder":
                return(PassThroughEncoder <int[]> .GetBuilder());

            case "ScalarEncoder":
                return(ScalarEncoder.GetBuilder());

            case "AdaptiveScalarEncoder":
                return(AdaptiveScalarEncoder.GetAdaptiveBuilder());

            case "SparsePassThroughEncoder":
                return(SparsePassThroughEncoder.GetSparseBuilder());

            case "SDRCategoryEncoder":
                return(SDRCategoryEncoder.GetBuilder());

            case "RandomDistributedScalarEncoder":
                return(RandomDistributedScalarEncoder.GetBuilder());

            case "DateEncoder":
                return(DateEncoder.GetBuilder());

            case "DeltaEncoder":
                return(DeltaEncoder.GetDeltaBuilder());

            case "SDRPassThroughEncoder":
                return(SDRPassThroughEncoder.GetSptBuilder());

            default:
                throw new ArgumentException("Invalid encoder: " + encoderName);
            }
        }
Ejemplo n.º 2
0
            public override IEncoder Build()
            {
                if (n == 0)
                {
                    throw new InvalidOperationException("\"N\" should be set");
                }
                if (w == 0)
                {
                    throw new InvalidOperationException("\"W\" should be set");
                }
                if (categoryList == null)
                {
                    throw new InvalidOperationException("Category List cannot be null");
                }
                SDRCategoryEncoder sdrCategoryEncoder = new SDRCategoryEncoder();

                sdrCategoryEncoder.Init(n, w, categoryList, name, encoderSeed, forced);

                return(sdrCategoryEncoder);
            }