예제 #1
0
파일: incsfa.py 프로젝트: legendking/IncSFA
    def __init__(self, input_dim, whitening_output_dim, output_dim, eps=0.001, **kwargs):
        self.input_dim = input_dim
        self.whitening_output_dim = whitening_output_dim
        self.output_dim = output_dim
        self.eps = eps
        self.kwargs = kwargs
        
        self.whiteningnode = WhiteningNode(input_dim, whitening_output_dim, **kwargs)
        self.mcanode = MCANode(whitening_output_dim, output_dim, self.eps, **kwargs)
        self.singlepcanode = CCIPCANode(whitening_output_dim, output_dim=1)
        
        self.deMeanInput = self.kwargs.get('deMean', True)
        self.whiteningnode.deMeanInput = False
        self.mcanode.deMeanInput = False
        self.singlepcanode.deMeanInput = False
        
        self.xavg = signalAvgNode(mode=self.kwargs.get('avgMode', 'Avg'), avgN=self.kwargs.get('avgN',1000))
        self.xderiv = signalDerivNode()
        self.zbvar = signalVarNode()

        self.T = self.kwargs.get('T', 1)
        self._curreps = [self.eps for _ in xrange(output_dim)]           
        self._initExp = True
        
        self.n = 1
        self.v = np.zeros([output_dim, input_dim])
        self.wv = np.zeros([whitening_output_dim, input_dim])
        self.err = 0.0
        self.derr = 0.0
        self._newerr = 0.0
        self._errcnt = 0

        self._validTrainingModes = ['Incremental']
예제 #2
0
파일: ccipca.py 프로젝트: s7ev3n/IncSFA
    def __init__(self, input_dim, output_dim, **kwargs):
        self.input_dim = input_dim
        self.output_dim = output_dim
        self.kwargs = kwargs

        self.var_rel = self.kwargs.get('var_rel', 0.001)
        self.beta = self.kwargs.get('beta', 1.1)
        self.xavg = signalAvgNode(mode=self.kwargs.get('avgMode', 'Avg'),
                                  avgN=self.kwargs.get('avgN', 1000))

        self.deMeanInput = self.kwargs.get('deMean', True)
        self.reduce = self.kwargs.get('reduce', False)

        self.n = 1  # n value for the ccipca
        self._v = 0.1 * np.random.randn(
            self.output_dim,
            self.input_dim)  # Internal Eigen Vector (unNormalized)
        self._d = np.sum(np.absolute(self._v)**2,
                         axis=-1)**(1. / 2)  # Internal Eigen Values
        self._vn = self._v / self._d.reshape(
            self._v.shape[0], 1)  # Internal Eigen Vector (Normalized)
        self.explained_var_tot = self._d.sum()  # Total Explained Variance
        self.v = self._vn.copy(
        )  # Eigen Vector (Normalized) (reduced if reduce is True)
        self.d = self._d.copy()  # Eigen Value (reduced if reduce is True)

        self.reducedDim = self.output_dim

        self._validTrainingModes = ['Incremental']
예제 #3
0
    def __init__(self, input_dim, whitening_output_dim, output_dim, eps=0.001, **kwargs):
        self.input_dim = input_dim
        self.whitening_output_dim = whitening_output_dim
        self.output_dim = output_dim
        self.eps = eps
        self.kwargs = kwargs
        
        self.whiteningnode = WhiteningNode(input_dim, whitening_output_dim, **kwargs)
        self.mcanode = MCANode(whitening_output_dim, output_dim, self.eps, **kwargs)
        self.singlepcanode = CCIPCANode(whitening_output_dim, output_dim=1)
        
        self.deMeanInput = self.kwargs.get('deMean', True)
        self.whiteningnode.deMeanInput = False
        self.mcanode.deMeanInput = False
        self.singlepcanode.deMeanInput = False
        
        self.xavg = signalAvgNode(mode=self.kwargs.get('avgMode', 'Avg'), avgN=self.kwargs.get('avgN',1000))
        self.xderiv = signalDerivNode()
        self.zbvar = signalVarNode()

        self.T = self.kwargs.get('T', 1)
        self._curreps = [self.eps for _ in range(output_dim)]           
        self._initExp = True
        
        self.n = 1
        self.v = np.zeros([output_dim, input_dim])
        self.wv = np.zeros([whitening_output_dim, input_dim])
        self.err = 0.0
        self.derr = 0.0
        self._newerr = 0.0
        self._errcnt = 0

        self._validTrainingModes = ['Incremental']
예제 #4
0
    def __init__(self, input_dim, output_dim, eps=0.001, gamma=1.0, **kwargs):
        self.input_dim = input_dim
        self.output_dim = output_dim
        self.eps = eps
        self.gamma = gamma
        self.kwargs = kwargs

        self.deMeanInput = self.kwargs.get('deMean', True)
        self.xavg = signalAvgNode(mode=self.kwargs.get('avgMode', 'Avg'),
                                  avgN=self.kwargs.get('avgN', 1000))
        self.normalize = self.kwargs.get('normalize', True)

        self.n = 1  # n value for the mca
        self._v = 0.1 * np.random.randn(
            self.output_dim,
            self.input_dim)  # Internal Eigen Vector (unNormalized)
        _d = np.sum(np.absolute(self._v)**2,
                    axis=-1)**(1. / 2)  # Internal Eigen Values
        self._v = self._v / _d.reshape(self._v.shape[0],
                                       1)  # Internal Eigen Vector (Normalized)
        self.v = self._v.copy(
        )  # Eigen Vector (Normalized) (reduced if reduce is True)
        self.d = _d.copy()  # Eigen Value (reduced if reduce is True)

        self._validTrainingModes = ['Incremental']
예제 #5
0
파일: mca.py 프로젝트: akansal1/einstein
    def __init__(self, input_dim, output_dim, eps=0.001, gamma=1.0, **kwargs):
        self.input_dim = input_dim
        self.output_dim = output_dim
        self.eps = eps
        self.gamma = gamma
        self.kwargs = kwargs
        
        self.deMeanInput = self.kwargs.get('deMean', True)
        self.xavg = signalAvgNode(mode=self.kwargs.get('avgMode', 'Avg'), avgN=self.kwargs.get('avgN',1000))
        self.normalize = self.kwargs.get('normalize', True)
        
        self.n = 1                                                          # n value for the mca
        self._v = 0.1*np.random.randn(self.output_dim, self.input_dim)      # Internal Eigen Vector (unNormalized)
        _d = np.sum(np.absolute(self._v)**2,axis=-1)**(1./2)                # Internal Eigen Values     
        self._v = self._v/_d.reshape(self._v.shape[0],1)               # Internal Eigen Vector (Normalized)
        self.v = self._v.copy()                                             # Eigen Vector (Normalized) (reduced if reduce is True)
        self.d = _d.copy()                                                  # Eigen Value (reduced if reduce is True)

        self._validTrainingModes = ['Incremental']
예제 #6
0
파일: ccipca.py 프로젝트: akansal1/einstein
    def __init__(self, input_dim, output_dim, **kwargs):
        self.input_dim = input_dim
        self.output_dim = output_dim
        self.kwargs = kwargs

        self.var_rel = self.kwargs.get('var_rel',0.001)
        self.beta = self.kwargs.get('beta',1.1)
        self.xavg = signalAvgNode(mode=self.kwargs.get('avgMode', 'Avg'), avgN=self.kwargs.get('avgN',1000))

        self.deMeanInput = self.kwargs.get('deMean', True)
        self.reduce = self.kwargs.get('reduce', False)
        
        self.n = 1                                                          # n value for the ccipca
        self._v = 0.1*np.random.randn(self.output_dim, self.input_dim)      # Internal Eigen Vector (unNormalized)
        self._d = np.sum(np.absolute(self._v)**2,axis=-1)**(1./2)           # Internal Eigen Values     
        self._vn = self._v/self._d.reshape(self._v.shape[0],1)              # Internal Eigen Vector (Normalized)
        self.explained_var_tot = self._d.sum()                              # Total Explained Variance
        self.v = self._vn.copy()                                            # Eigen Vector (Normalized) (reduced if reduce is True)
        self.d = self._d.copy()                                             # Eigen Value (reduced if reduce is True)
        
        self.reducedDim = self.output_dim

        self._validTrainingModes = ['Incremental']