Ejemplo n.º 1
0
@author: musselle
"""

import scipy.io as sio
from utils import analysis
from PedrosFrahst import frahst_pedro
from Frahst_v3 import FRAHST_V3
from artSigs import genCosSignals_no_rand , genCosSignals

#AbileneMat = sio.loadmat('C:\DataSets\Abilene\Abilene.mat')
#data = AbileneMat['F']

data = genCosSignals_no_rand()

data = genCosSignals(0,-3.0)

e_high = 0.98
e_low = 0.96
alpha = 0.96


holdTime = 0
# My version  
res_me = FRAHST_V3(data, alpha=0.96, e_low=0.96, e_high=0.98, sci = -1, \
holdOffTime = holdTime, r = 1, evalMetrics = 'T') 
#metric_me_5, sets_me, anom_det_tab_me = analysis(res_me, AbileneMat['F_g_truth_tab'])

# Pedros Version
res_ped = frahst_pedro(data, r=1, alpha=0.96, energy_low=0.96, energy_high=0.98,  \
holdOffTime = holdTime, evaluateTruth='T')
mainPath = 'C:/DataSets/Results/Fraust'

os.chdir(mainPath)

# Parameters List  (of Dictionaries)
param = {'alpha' : 0.996,
         'rr' : 4,
         'sci' : 1}

# Results list (of dictionaris) 
# results = []
e_qq_mat = npm.empty((10000,numRuns))

for i in range(numRuns):
    # Generate artificial data streams
    streams = genCosSignals(i, -3)
    
    # Run Fast row householder subspace tracker
    Q_t, S_t, rr, E_t, E_dash_t, hid_var, z_dash, RSRE, no_inp_count, \
    no_inp_marker = FRHH(streams, param['rr'], param['alpha'], param['sci'])
    
    # Calculate deviations from orthogonality and subspace
    e_qq, f_qq  = plotEqqFqq(streams, Q_t, param['alpha'],0, 0)
    
    # Store results in Dictionary
    dic_name = 'res_' + str(i) # string of the name of the Dictionary
    vars()[dic_name] = {'param' : param,
                        'Q_t' : Q_t,
                        'S_t': S_t,
                        'rr' : rr,
                        'E_t' : E_t, 
Ejemplo n.º 3
0
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 05 23:19:11 2011
THIS IS THE VERSION TO RUN ON MAC, NOT WINDOWS
@author: musselle
"""
from numpy import eye, zeros, dot, sqrt, log10, trace, arccos, nan, arange, ones
import numpy as np
from numpy.random import rand
from numpy.linalg import qr, eig, norm, solve
from matplotlib.pyplot import plot, figure, title, step
from artSigs import genCosSignals_no_rand , genCosSignals
import scipy.io as sio
from utils import analysis, QRsolveA, pltSummary2
from PedrosFrahst import frahst_pedro_original
from Frahst_v3_1 import FRAHST_V3_1
from Frahst_v3_3 import FRAHST_V3_3
from Frahst_v3_4 import FRAHST_V3_4
from load_syn_ping_data import load_n_store
from QR_eig_solve import QRsolve_eigV
def FRAHST_V4_0(data, r=1, alpha=0.96, e_low=0.96, e_high=0.98, fix_init_Q = 0, holdOffTime=0, 
                evalMetrics = 'F', static_r = 0, r_upper_bound = None, L = 5, ignoreUp2 = 0):
    """
        Fast Rank Adaptive Householder Subspace Tracking Algorithm (FRAHST)  
    
    Version 4.0 - Now also approximates eigenvalues for the approximated tracked basis for the eignevectors          
                - Approach uses an orthogonal iteration arround X.T 
                - Note, only a good approximation if alpha ~< 1. Used as its the fastest method 
                as X.T b --> b must be solved anyway. 
                - New entries in res
Ejemplo n.º 4
0
        figure()
        plot(e_qq)
        title('Deviation of true tracked subspace')

    return e_qq, f_qq, g_qq


if __name__ == '__main__':

    streams = genSimSignalsA(0, -3.0)

    # streams = array([[0,0,0], [1,2,2], [1,3,4], [3,6,6], [5,6,10], [6,8,11]])

    streams = genCosSignals_no_rand()

    streams2 = genCosSignals(0, -3.0)

    energyThresh = [0.96, 0.98]
    alpha = 0.96
    # rr = 4
    sci = -1

    Q_t, S_t, RSRE, rr, E_t, E_dash_t, z_dash, hidden_var \
    = frhh_A(streams, energyThresh, alpha, sci)

    e_qq, f_qq, g_qq = plotEqqFqqA(streams, Q_t, alpha, p=1)

    figure()
    plot(RSRE)
    figure()
    plot(rr)
Ejemplo n.º 5
0
        title('Deviation from orthonormality')    
        figure()
        plot(e_qq)
        title('Deviation of true tracked subspace') 
    
    return e_qq, f_qq, g_qq     
     
if __name__ == '__main__' : 
    
    streams = genSimSignalsA(0, -3.0)    
    
    # streams = array([[0,0,0], [1,2,2], [1,3,4], [3,6,6], [5,6,10], [6,8,11]])   
    
    streams = genCosSignals_no_rand()
    
    streams2 = genCosSignals(0, -3.0)    
    
    energyThresh = [0.96, 0.98]
    alpha = 0.96
    # rr = 4
    sci = -1
    
    Q_t, S_t, RSRE, rr, E_t, E_dash_t, z_dash, hidden_var \
    = frhh_A(streams, energyThresh, alpha, sci)
    
    e_qq, f_qq, g_qq = plotEqqFqqA(streams, Q_t, alpha, p = 1)
    
    figure(); plot(RSRE)
    figure(); plot(rr)
    figure(); plot(E_t)
    plot(E_dash_t)
Ejemplo n.º 6
0
@author: musselle
"""

import scipy.io as sio
from utils import analysis
from PedrosFrahst import frahst_pedro
from Frahst_v3 import FRAHST_V3
from artSigs import genCosSignals_no_rand, genCosSignals

#AbileneMat = sio.loadmat('C:\DataSets\Abilene\Abilene.mat')
#data = AbileneMat['F']

data = genCosSignals_no_rand()

data = genCosSignals(0, -3.0)

e_high = 0.98
e_low = 0.96
alpha = 0.96

holdTime = 0
# My version
res_me = FRAHST_V3(data, alpha=0.96, e_low=0.96, e_high=0.98, sci = -1, \
holdOffTime = holdTime, r = 1, evalMetrics = 'T')
#metric_me_5, sets_me, anom_det_tab_me = analysis(res_me, AbileneMat['F_g_truth_tab'])

# Pedros Version
res_ped = frahst_pedro(data, r=1, alpha=0.96, energy_low=0.96, energy_high=0.98,  \
holdOffTime = holdTime, evaluateTruth='T')
#metric_ped_5, sets_ped, anom_det_tab_ped = analysis(res_ped, AbileneMat['F_g_truth_tab'])