Beispiel #1
0
        /**
         * {@inheritDoc}
         */
        public override List <EncoderResult> TopDownCompute(int[] encoded)
        {
            //Get/generate the topDown mapping table
            SparseObjectMatrix <int[]> topDownMapping = scalarEncoder.GetTopDownMapping();
            // See which "category" we match the closest.
            int category = ArrayUtils.Argmax(RightVecProd(topDownMapping, encoded));

            return(GetBucketInfo(new int[] { category }));
        }
Beispiel #2
0
        /**
         * {@inheritDoc}
         */
        public override List <EncoderResult> TopDownCompute(int[] encoded)
        {
            if (_sdrByCategory.Count == 0)
            {
                return(new List <EncoderResult>());
            }
            //TODO the rightVecProd method belongs to SparseBinaryMatrix in Nupic Core, In python this method call stack: topDownCompute [sdrcategory.py:317]/rightVecProd [math.py:4474] -->return _math._SparseMatrix32_rightVecProd(self, *args)
            int categoryIndex = ArrayUtils.Argmax(RightVecProd(GetTopDownMapping(), encoded));

            return(GetEncoderResultsByIndex(GetTopDownMapping(), categoryIndex));
        }