code: WIP
This commit is contained in:
		@ -2,6 +2,7 @@
 | 
			
		||||
 | 
			
		||||
import itertools
 | 
			
		||||
from lmdk_lib import *
 | 
			
		||||
import exp_mech
 | 
			
		||||
import numpy as np
 | 
			
		||||
import random
 | 
			
		||||
import time
 | 
			
		||||
@ -297,6 +298,23 @@ def get_non_opts_from_bottom(seq, lmdks):
 | 
			
		||||
  return non_opts
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def find_lmdks(seq, lmdks, epsilon):
 | 
			
		||||
  eps_sel = 0
 | 
			
		||||
  if len(lmdks) > 0 and len(seq) != len(lmdks):
 | 
			
		||||
    # Get landmarks timestamps in sequence
 | 
			
		||||
    lmdks_seq = find_lmdks_seq(seq, lmdks)
 | 
			
		||||
    # Turn landmarks to histogram
 | 
			
		||||
    hist, h = get_hist(get_seq(1, len(seq)), lmdks_seq)
 | 
			
		||||
    # Find all possible options
 | 
			
		||||
    opts = get_opts_from_top_h(get_seq(1, len(seq)), lmdks_seq)
 | 
			
		||||
    # Landmarks selection budget
 | 
			
		||||
    eps_sel = epsilon/(len(lmdks_seq) + 1)
 | 
			
		||||
    # Get private landmarks timestamps
 | 
			
		||||
    lmdks_seq, _ = exp_mech.exponential_pareto(hist, opts, exp_mech.score, 1.0, eps_sel)
 | 
			
		||||
    # Get actual landmarks values
 | 
			
		||||
    lmdks = seq[lmdks_seq]
 | 
			
		||||
  return lmdks, epsilon - eps_sel
 | 
			
		||||
 | 
			
		||||
def test():
 | 
			
		||||
  # Start and end points of the sequence
 | 
			
		||||
  # # Nonrandom
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user