def local_score(self, variable, parents):
        "Computes a score that measures how much a \
        given variable is \"influenced\" by a given list of potential parents."

        var_states = self.state_names[variable]
        var_cardinality = len(var_states)
        state_counts = self.state_counts(variable, parents)
        num_parents_states = float(len(state_counts.columns))

        score = 0
        for parents_state in state_counts:  # iterate over df columns (only 1 if no parents)
            conditional_sample_size = sum(state_counts[parents_state])

            score += (lgamma(self.equivalent_sample_size / num_parents_states) -
                      lgamma(conditional_sample_size + self.equivalent_sample_size / num_parents_states))

            for state in var_states:
                if state_counts[parents_state][state] > 0:
                    score += (lgamma(state_counts[parents_state][state] +
                                     self.equivalent_sample_size / (num_parents_states * var_cardinality)) -
                              lgamma(self.equivalent_sample_size / (num_parents_states * var_cardinality)))
        return score