Skip to content

Commit

Permalink
Correcting some typos and properties checking.
Browse files Browse the repository at this point in the history
  • Loading branch information
gugarosa committed Jun 26, 2020
1 parent 95ba131 commit ddac0e2
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 38 deletions.
8 changes: 4 additions & 4 deletions opfython/core/heap.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def policy(self, policy):

@property
def cost(self):
"""list: List of node's costs.
"""list: List of nodes' costs.
"""

Expand All @@ -86,7 +86,7 @@ def cost(self, cost):

@property
def color(self):
"""list: List of node's colors.
"""list: List of nodes' colors.
"""

Expand All @@ -101,7 +101,7 @@ def color(self, color):

@property
def p(self):
"""list: List of node's values.
"""list: List of nodes' values.
"""

Expand All @@ -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.
"""

Expand Down
26 changes: 19 additions & 7 deletions opfython/core/opf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""

Expand Down
4 changes: 2 additions & 2 deletions opfython/core/subgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""

Expand All @@ -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.
"""

Expand Down
3 changes: 2 additions & 1 deletion opfython/models/knn_supervised.py
Original file line number Diff line number Diff line change
Expand Up @@ -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).
"""

Expand Down
24 changes: 0 additions & 24 deletions opfython/subgraphs/knn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.')

0 comments on commit ddac0e2

Please sign in to comment.