/// <summary>
 /// Rehydrate the hybrid estimator from full data.
 /// </summary>
 /// <param name="data">The data to restore</param>
 public void Rehydrate(IHybridEstimatorFullData <int, TCount> data)
 {
     if (data == null)
     {
         return;
     }
     _minwiseEstimator?.Rehydrate(data.BitMinwiseEstimator);
     _strataEstimator.Rehydrate(data.StrataEstimator);
     _minwiseReplacementCount = Math.Max(0, data.ItemCount - (_strataEstimator.ItemCount + (_minwiseEstimator?.ItemCount ?? 0L)));
 }
예제 #2
0
        /// <summary>
        /// Compress the estimator.
        /// </summary>
        /// <param name="inPlace"></param>
        /// <returns></returns>
        public IStrataEstimator <TEntity, int, TCount> Compress(bool inPlace = false)
        {
            var res = Extract().Compress(Configuration);

            if (inPlace)
            {
                Rehydrate(res);
                return(this);
            }
            var estimator = new StrataEstimator <TEntity, TId, TCount>(res.BlockSize, Configuration, res.StrataCount);

            estimator.Rehydrate(res);
            return(estimator);
        }
예제 #3
0
        /// <summary>
        /// Fold the strata estimator.
        /// </summary>
        /// <param name="factor"></param>
        /// <param name="inPlace"></param>
        /// <returns></returns>
        public virtual IStrataEstimator <TEntity, int, TCount> Fold(uint factor, bool inPlace = false)
        {
            var res = Extract().Fold(Configuration, factor);

            if (inPlace)
            {
                Rehydrate(res);
                return(this);
            }
            var strataEstimator = new StrataEstimator <TEntity, TId, TCount>(res.BlockSize, Configuration, res.StrataCount);

            strataEstimator.Rehydrate(res);
            return(strataEstimator);
        }