Skip to content

Commit

Permalink
Get rid of default k (there is no such thing)
Browse files Browse the repository at this point in the history
  • Loading branch information
kochanczyk committed Aug 8, 2018
1 parent 40f9d73 commit 44926a1
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions cce/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# licenced under GNU GPL 3 (see file License.txt).
# Homepage: http://pmbm.ippt.pan.pl/software/cce

"""Weighted Kraskov estimator"""
"""Kraskov estimator for weighted input distributions"""

from collections import defaultdict
from scipy.spatial import cKDTree
Expand All @@ -12,9 +12,6 @@
from cce.optimize import weight_optimizer
from cce.score import weight_loss

# default number of neighbors
_DEF_K = 100


class WeightedKraskovEstimator:

Expand Down Expand Up @@ -74,7 +71,7 @@ def __init__(self, data: list = None, leaf_size: int = 16):
self.load(data)


def calculate_maximized_mi(self, k: int = _DEF_K):
def calculate_maximized_mi(self, k: int):
"""High-level function calculating maximal MI.
Parameters
Expand Down Expand Up @@ -166,7 +163,7 @@ def _check_if_data_are_loaded(self):
raise Exception("Data have not been loaded yet.")


def calculate_mi(self, k: int = _DEF_K) -> float:
def calculate_mi(self, k: int) -> float:
"""Calculates MI using Kraskov estimation using previously loaded data.
Parameters
Expand Down Expand Up @@ -194,7 +191,7 @@ def _n_x_for_a_given_point_index(i):
return (digamma(k) + digamma(n) - digammas.mean()) / np.log(2)


def calculate_weighted_mi(self, weights: dict, k: int = _DEF_K) -> float:
def calculate_weighted_mi(self, weights: dict, k: int) -> float:
"""Calculates mutual information for weighted input in bits.
Parameters
Expand Down Expand Up @@ -283,7 +280,7 @@ def _turn_into_neigh_list(self, indices, special_point_label):
return neigh_list


def calculate_neighborhoods(self, k: int = _DEF_K):
def calculate_neighborhoods(self, k: int):
"""Function that prepares neighborhood_array.
Parameters
Expand Down

0 comments on commit 44926a1

Please sign in to comment.