4.7 - ACE/Analysis/models.py
def calculate_cross_entropies_set_windows(self, contribution_windows, toks, limit=None):
        """
        Method for calculating the cross entropy of a given set of contributions, which has already been split into windows.
        :param contribution_windows: This is a series of dataframes (one for each window). These must be the same as the snapshot windows.
        :returns: a dictionary of the cross-entropies for each window.
        """
        # Initialise output
        cross_entropies = dict()

        # Loop through each window in the data
        for window, curr_contributions in contribution_windows.items():
            # Get the current tokenised contributions for the window
            curr_toks = toks[curr_contributions.index]

            # Calculate cross-entropy for the current lot of tokens
            cross_entropies[window] = curr_toks.apply(lambda x: self.snapshots[window].get_cross_entropy(x[:limit]))

        return cross_entropies

        Method for calculating the cross entropy of a given set of contributions, which has already been split into windows.
        :param contribution_windows: This is a series of dataframes (one for each window). These must be the same as the snapshot windows.
        :returns: a dictionary of the cross-entropies for each window.
        
Method for calculating the cross entropy of a given set of contributions, which has already been split into windows.
Method for calculating the cross entropy of a given set of contributions which has already been split into windows .
def calculate_cross_entropies_set_windows(self, contribution_windows, toks, limit=None):
        cross_entropies = dict()
        for window, curr_contributions in contribution_windows.items():
            curr_toks = toks[curr_contributions.index]
            cross_entropies[window] = curr_toks.apply(lambda x: self.snapshots[window].get_cross_entropy(x[:limit]))
        return cross_entropies
def calculate_cross_entropies_set_windows ( self , contribution_windows , toks , limit = None ) : cross_entropies = dict ( ) for window , curr_contributions in contribution_windows . items ( ) : curr_toks = toks [ curr_contributions . index ] cross_entropies [ window ] = curr_toks . apply ( lambda x : self . snapshots [ window ] . get_cross_entropy ( x [ : limit ] ) ) return cross_entropies
Method for calculating the cross entropy of a given set of contributions, which has already been split into windows.
Method for calculating the cross entropy of a given set of contributions which has already been split into windows .
"""
        Method for calculating the cross entropy of a given set of contributions, which has already been split into windows.
        :param contribution_windows: This is a series of dataframes (one for each window). These must be the same as the snapshot windows.
        :returns: a dictionary of the cross-entropies for each window.
        """ # Initialise output # Loop through each window in the data # Get the current tokenised contributions for the window # Calculate cross-entropy for the current lot of tokens
a dictionary of the cross-entropies for each window.
a dictionary of the cross - entropies for each window .
self
contribution_windows
This is a series of dataframes (one for each window). These must be the same as the snapshot windows.
This is a series of dataframes ( one for each window ) . These must be the same as the snapshot windows .
toks
limit