# Eigen-Adaptive 'F_min' : 0.9, 'epsilon' : 0.05, # Pedro Adaptive 'e_low' : 0.95, 'e_high' : 0.98, 'static_r' : 0, 'r_upper_bound' : None, 'fix_init_Q' : 0, 'small_value' : 0.0001, 'ignoreUp2' : 0 } p['x_thresh'] = sp.stats.t.isf(0.5* p['FP_rate'], p['sample_N']) ''' Load Data ''' data = load_ts_data('isp_routers', 'full') #data, sins = sin_rand_combo(5, 1000, [10, 35, 60], noise_scale = 0.2, seed = 1) data = zscore(data) z_iter = iter(data) numStreams = data.shape[1] '''Initialise''' st = initialise(p, numStreams) '''Begin Frahst''' # Main iterative loop. for zt in z_iter: zt = zt.reshape(zt.shape[0],1) # Convert to a column Vector st['anomaly'] = False '''Frahst Version '''
# Eigen-Adaptive 'F_min': 0.9, 'epsilon': 0.05, # Pedro Adaptive 'e_low': 0.95, 'e_high': 0.98, 'static_r': 0, 'r_upper_bound': None, 'fix_init_Q': 0, 'small_value': 0.0001, 'ignoreUp2': 0 } p['x_thresh'] = sp.stats.t.isf(0.5 * p['FP_rate'], p['sample_N']) ''' Load Data ''' data = load_ts_data('isp_routers', 'full') #data, sins = sin_rand_combo(5, 1000, [10, 35, 60], noise_scale = 0.2, seed = 1) data = zscore(data) z_iter = iter(data) numStreams = data.shape[1] '''Initialise''' st = initialise(p, numStreams) '''Begin Frahst''' # Main iterative loop. for zt in z_iter: zt = zt.reshape(zt.shape[0], 1) # Convert to a column Vector st['anomaly'] = False '''Frahst Version ''' st = FRAHST_V7_0_iter(zt, st, p) # Calculate reconstructed data if needed
"M": 5, "pA": 0.1, "noise_sig": 0.1, "seed": None, } anomaly_type = "peak_dip" gen_funcs = dict( peak_dip=gen_a_peak_dip, grad_persist=gen_a_grad_persist, step=gen_a_step, trend=gen_a_periodic_shift ) # D = gen_funcs[anomaly_type](**a) # data = D['data'] data = load_ts_data("isp_routers", "full") # execfile('/Users/chris/Dropbox/Work/MacSpyder/Utils/gen_simple_peakORshift_data.py') # data = B """ Mean Centering """ # data = zscore_win(data, 100) data = zscore(data) z_iter = iter(data) numStreams = data.shape[1] """Initialise""" Frahst_alg = FRAHST("F-7.A-recS.R-static", p, numStreams) """Begin Frahst""" # Main iterative loop. for zt in z_iter:
step = gen_a_step) """ Choice of data sets. Comment/Uncomment to choose. """ """----------------------------------------------------""" ''' Synthetic Data sets ''' #data_name = 'synth' #D = gen_funcs[anomaly_type](**a) #raw_data = D['data'] #data = raw_data.copy() '''ISP data sets ''' data_name = 'isp_routers' raw_data = load_ts_data(data_name, 'full') data = raw_data.copy() ''' Sensor Motes data sets ''' #data_name = 'motes_l' #raw_data = load_data(data_name) #data = clean_zeros(raw_data, cpy=1) ''' Data Preprocessing ''' """ Data is loaded into memory, mean centered and standardised then converted to an iterable to read by the CD-ST each iteration""" #data = zscore_win(data, 100) # Sliding window implimentation data = zscore(data) # Batch method implimentation