diff --git a/opfython/core/heap.py b/opfython/core/heap.py index 6bfaad4..cffd0fa 100644 --- a/opfython/core/heap.py +++ b/opfython/core/heap.py @@ -71,7 +71,7 @@ def policy(self, policy): @property def cost(self): - """list: List of node's costs. + """list: List of nodes' costs. """ @@ -86,7 +86,7 @@ def cost(self, cost): @property def color(self): - """list: List of node's colors. + """list: List of nodes' colors. """ @@ -101,7 +101,7 @@ def color(self, color): @property def p(self): - """list: List of node's values. + """list: List of nodes' values. """ @@ -116,7 +116,7 @@ def p(self, p): @property def pos(self): - """list: List of node's positioning markers. + """list: List of nodes' positioning markers. """ diff --git a/opfython/core/opf.py b/opfython/core/opf.py index 1b0bd3c..4b4c8dc 100644 --- a/opfython/core/opf.py +++ b/opfython/core/opf.py @@ -86,18 +86,30 @@ def distance(self): @distance.setter def distance(self, distance): - if distance not in ['bray_curtis', 'canberra', 'chi_squared', 'chord', 'cosine', 'euclidean', - 'gaussian', 'log_euclidean', 'log_squared_euclidean', - 'manhattan', 'squared_chord', 'squared_euclidean']: - raise e.TypeError('`distance` should be `bray_curtis`, `canberra`, `chi_squared`, ' - '`chord`, `cosine`, `euclidean`, `gaussian`, `log_euclidean`, `log_squared_euclidean`, ' - '`manhattan`, `squared_chord` or `squared_euclidean`') + if distance not in ['additive_symmetric', 'average_euclidean', 'bhattacharyya', 'bray_curtis', + 'canberra', 'chebyshev', 'chi_squared', 'chord', 'clark', 'cosine', 'dice', + 'divergence', 'euclidean', 'gaussian', 'gower', 'hamming', 'hassanat', 'hellinger', + 'jaccard', 'jeffreys', 'jensen', 'jensen_shannon', 'k_divergence', 'kulczynski', + 'kullback_leibler', 'log_euclidean', 'log_squared_euclidean', 'lorentzian', + 'manhattan', 'matusita', 'max_symmetric', 'mean_censored_euclidean', 'min_symmetric', + 'neyman', 'non_intersection', 'pearson', 'sangvi', 'soergel', 'squared', 'squared_chord', + 'squared_euclidean', 'statistic', 'topsoe', 'vicis_symmetric1', 'vicis_symmetric2', + 'vicis_symmetric3', 'vicis_wave_hedges']: + raise e.TypeError('`distance` should be `additive_symmetric`, `average_euclidean`, `bhattacharyya`, ' + '`bray_curtis`, `canberra`, `chebyshev`, `chi_squared`, `chord`, `clark`, `cosine`, ' + '`dice`, `divergence`, `euclidean`, `gaussian`, `gower`, `hamming`, `hassanat`, `hellinger`, ' + '`jaccard`, `jeffreys`, `jensen`, `jensen_shannon`, `k_divergence`, `kulczynski`, ' + '`kullback_leibler`, `log_euclidean`, `log_squared_euclidean`, `lorentzian`, `manhattan`, ' + '`matusita`, `max_symmetric`, `mean_censored_euclidean`, `min_symmetric`, `neyman`, ' + '`non_intersection`, `pearson`, `sangvi`, `soergel`, `squared`, `squared_chord`, ' + '`squared_euclidean`, `statistic`, `topsoe`, `vicis_symmetric1`, `vicis_symmetric2`, ' + '`vicis_symmetric3` or `vicis_wave_hedges`') self._distance = distance @property def distance_fn(self): - """bool: Distance function to be used. + """callable: Distance function to be used. """ diff --git a/opfython/core/subgraph.py b/opfython/core/subgraph.py index 2cc5ab4..06d8193 100644 --- a/opfython/core/subgraph.py +++ b/opfython/core/subgraph.py @@ -95,7 +95,7 @@ def n_features(self, n_features): @property def nodes(self): - """list: List of Nodes that belongs to the Subgraph. + """list: List of nodes that belongs to the Subgraph. """ @@ -110,7 +110,7 @@ def nodes(self, nodes): @property def idx_nodes(self): - """list: List of indexes of ordered nodes. + """list: List of ordered nodes indexes. """ diff --git a/opfython/models/knn_supervised.py b/opfython/models/knn_supervised.py index 083a892..ba5f257 100644 --- a/opfython/models/knn_supervised.py +++ b/opfython/models/knn_supervised.py @@ -16,7 +16,8 @@ class KNNSupervisedOPF(OPF): """A KNNSupervisedOPF which implements the supervised version of OPF classifier with a KNN subgraph. References: - J. P. Papa and A. X. Falcão. A Learning Algorithm for the Optimum-Path Forest Classifier. Graph-Based Representations in Pattern Recognition (2009). + J. P. Papa and A. X. Falcão. A Learning Algorithm for the Optimum-Path Forest Classifier. + Graph-Based Representations in Pattern Recognition (2009). """ diff --git a/opfython/subgraphs/knn.py b/opfython/subgraphs/knn.py index 07c9c38..83c86bc 100644 --- a/opfython/subgraphs/knn.py +++ b/opfython/subgraphs/knn.py @@ -342,27 +342,3 @@ def eliminate_maxima_height(self, height): self.nodes[i].cost = np.maximum(self.nodes[i].density - height, 0) logger.debug('Maxima eliminated.') - - # def eliminate_maxima_area(self, area): - # """Eliminates maxima values in the subgraph that are below the inputted area. - - # Args: - # area (float): Area's threshold. - - # """ - - # logger.debug(f'Eliminating maxima above area = {area} ...') - - # logger.debug('Maxima eliminated.') - - # def eliminate_maxima_volume(self, volume): - # """Eliminates maxima values in the subgraph that are below the inputted volume. - - # Args: - # volume (float): Volume's threshold. - - # """ - - # logger.debug(f'Eliminating maxima above volume = {volume} ...') - - # logger.debug('Maxima eliminated.')