Esempio n. 1
0
 public BinaryCount(StreamingQueryable <T> s, double epsilon, int maxSteps) : base(s, epsilon)
 {
     this.maxSteps    = maxSteps;
     logT             = Convert.ToInt32(Math.Log(maxSteps, 2) + 0.5);
     internalEpsilon  = epsilon / (double)logT;
     LastOutput       = Laplace(1.0 / Epsilon);
     partialSums      = new int[logT];
     noisyPartialSums = new double[logT];
 }
Esempio n. 2
0
        public UserDensityContinuous(StreamingQueryable <T> s, double epsilon, List <T> universe, double accuracy, double confidence, int maxT)
            : base(s, epsilon, universe, accuracy, confidence)
        {
            this.maxT = maxT;
            d         = 1.0 / universe.Count + 2 * accuracy;
            k         = maxT;
            rho       = 1.0;
            logT      = Convert.ToInt32(Math.Log(maxT, 2) + 0.5);

            epsilon_threshold = rho * logT / epsilon;
            //Console.WriteLine("threshold: " + epsilon_threshold);
            epsilon_compare = 2 * rho * (k + 1) / epsilon;
            epsilon_answer  = 2 * rho * (k + 1) / epsilon;
            m = 0;

            threshold = d + 2 * accuracy;

            thresholds = new double[logT];
        }
Esempio n. 3
0
        public UserDensity(StreamingQueryable <T> s, double epsilon, List <T> universe, double accuracy, double confidence)
            : base(s, epsilon)
        {
            if (epsilon > 0.5)
            {
                throw new Exception("epsilon too high");
            }
            double beta = 1.0 - confidence;
            int    size = Convert.ToInt32((200 * Math.Log(1.0 / beta, 2)) / (epsilon * epsilon * accuracy * accuracy));

            size = Math.Min(universe.Count, size);
            IEnumerable <T> sample = universe.OrderBy(x => random.Next()).Take(size);

            sampled = new Dictionary <T, bool>(size);
            foreach (T item in sample)
            {
                sampled[item] = sampleInitial();
            }
        }
Esempio n. 4
0
 public RandomizedResponseCount(StreamingQueryable <T> s, double epsilon) : base(s, epsilon)
 {
     LastOutput = Laplace(1.0 / Epsilon);
 }
Esempio n. 5
0
 public NoisyAverageStreaming(StreamingQueryable <T> s, double epsilon, Expression <Func <T, double> > function) : base(s, epsilon)
 {
     this.function = function;
 }
Esempio n. 6
0
 public BufferedAlgorithm(StreamingQueryable <T> s, double epsilon) : base(s, epsilon)
 {
     events = new List <T>();
 }
Esempio n. 7
0
 public StreamingUserAlgorithm(StreamingQueryable <T> s, double epsilon) : base(s, epsilon)
 {
 }
Esempio n. 8
0
 public StreamingAlgorithm(StreamingQueryable <T> dataSource, double epsilon)
 {
     this.DataSource     = dataSource;
     this.Epsilon        = epsilon;
     this.eventProcessed = new Semaphore(0, 1);
 }