コード例 #1
0
        window_MI = {}
        
        i = self._tau_max
        while i <= lx - self._window : 
            curr_coef_lag = []
            for k in lag_array :
                if k <= 0 :  # For negative tau
                    curr_x = x[i : i + self._window].values
                    curr_y = y[i + k : i + k + self._window].values
                        
                else :      # For positive tau
                    curr_x = x[i - k : i - k + self._window].values
                    curr_y = y[i : i + self._window].values
                    
                'Compute MI for current segments'
                curr_MI = mi.compute([pd.DataFrame(curr_x), pd.DataFrame(curr_y)])
                 
                curr_coef_lag.append(curr_MI['MI'])
                
            window_MI.update({float(i) : curr_coef_lag})
            
            ' go to the next window '
            i += self._win_inc

        window_MI['Lag'] = [float(x) for x in lag_array]

        self.res = window_MI
        
        self.plot()
        
        return window_MI
コード例 #2
0
        window_MI = {}

        i = self._tau_max

        while i <= lx - self._window:
            curr_coef_lag = []

            fixed_x = pd.DataFrame(x[i:i + self._window].values)
            fixed_y = pd.DataFrame(y[i:i + self._window].values)

            # For negative tau
            for k in lag_array[lag_array <= 0]:
                curr_y = y[i + k:i + k + self._window].values

                'Compute MI for current segments'
                curr_MI = mi.compute(fixed_x, pd.DataFrame(curr_y))

                curr_coef_lag.append(curr_MI['MI'])

            # For positive tau
            for k in lag_array[lag_array > 0]:
                curr_x = x[i - k:i - k + self._window].values

                'Compute MI for current segments'
                curr_MI = mi.compute(pd.DataFrame(curr_x), fixed_y)

                curr_coef_lag.append(curr_MI['MI'])

            window_MI.update({float(i): curr_coef_lag})

            ' go to the next window '
コード例 #3
0
        i = self._tau_max
        while i <= lx - self._window:
            curr_coef_lag = []
            for k in lag_array:
                if k <= 0:  # For negative tau
                    curr_x = x[i:i + self._window].values
                    curr_y = y[i + k:i + k + self._window].values

                else:  # For positive tau
                    curr_x = x[i - k:i - k + self._window].values
                    curr_y = y[i:i + self._window].values

                'Compute MI for current segments'
                curr_MI = mi.compute(
                    [pd.DataFrame(curr_x),
                     pd.DataFrame(curr_y)])

                curr_coef_lag.append(curr_MI['MI'])

            window_MI.update({float(i): curr_coef_lag})

            ' go to the next window '
            i += self._win_inc

        window_MI['Lag'] = [float(x) for x in lag_array]

        self.res = window_MI

        self.plot()
コード例 #4
0
        window_MI = {}

        i = self._tau_max

        while i <= lx - self._window:
            curr_coef_lag = []

            fixed_x = pd.DataFrame(x[i: i + self._window].values)
            fixed_y = pd.DataFrame(y[i: i + self._window].values)

            # For negative tau
            for k in lag_array[lag_array <= 0]:
                curr_y = y[i + k: i + k + self._window].values

                'Compute MI for current segments'
                curr_MI = mi.compute(fixed_x, pd.DataFrame(curr_y))

                curr_coef_lag.append(curr_MI['MI'])

            # For positive tau
            for k in lag_array[lag_array > 0]:
                curr_x = x[i - k: i - k + self._window].values

                'Compute MI for current segments'
                curr_MI = mi.compute(pd.DataFrame(curr_x), fixed_y)

                curr_coef_lag.append(curr_MI['MI'])

            window_MI.update({float(i) : curr_coef_lag})

            ' go to the next window '