partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | elbow.__process_by_ccore | !
@brief Performs processing using C++ implementation. | pyclustering/cluster/elbow.py | def __process_by_ccore(self):
"""!
@brief Performs processing using C++ implementation.
"""
if isinstance(self.__initializer, kmeans_plusplus_initializer):
initializer = wrapper.elbow_center_initializer.KMEANS_PLUS_PLUS
else:
initializer = wrapper... | def __process_by_ccore(self):
"""!
@brief Performs processing using C++ implementation.
"""
if isinstance(self.__initializer, kmeans_plusplus_initializer):
initializer = wrapper.elbow_center_initializer.KMEANS_PLUS_PLUS
else:
initializer = wrapper... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/elbow.py#L148-L161 | [
"def",
"__process_by_ccore",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"__initializer",
",",
"kmeans_plusplus_initializer",
")",
":",
"initializer",
"=",
"wrapper",
".",
"elbow_center_initializer",
".",
"KMEANS_PLUS_PLUS",
"else",
":",
"initialize... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | elbow.__process_by_python | !
@brief Performs processing using python implementation. | pyclustering/cluster/elbow.py | def __process_by_python(self):
"""!
@brief Performs processing using python implementation.
"""
for amount in range(self.__kmin, self.__kmax):
centers = self.__initializer(self.__data, amount).initialize()
instance = kmeans(self.__data, centers, ccore=True... | def __process_by_python(self):
"""!
@brief Performs processing using python implementation.
"""
for amount in range(self.__kmin, self.__kmax):
centers = self.__initializer(self.__data, amount).initialize()
instance = kmeans(self.__data, centers, ccore=True... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/elbow.py#L164-L177 | [
"def",
"__process_by_python",
"(",
"self",
")",
":",
"for",
"amount",
"in",
"range",
"(",
"self",
".",
"__kmin",
",",
"self",
".",
"__kmax",
")",
":",
"centers",
"=",
"self",
".",
"__initializer",
"(",
"self",
".",
"__data",
",",
"amount",
")",
".",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | elbow.__calculate_elbows | !
@brief Calculates potential elbows.
@details Elbow is calculated as a distance from each point (x, y) to segment from kmin-point (x0, y0) to kmax-point (x1, y1). | pyclustering/cluster/elbow.py | def __calculate_elbows(self):
"""!
@brief Calculates potential elbows.
@details Elbow is calculated as a distance from each point (x, y) to segment from kmin-point (x0, y0) to kmax-point (x1, y1).
"""
x0, y0 = 0.0, self.__wce[0]
x1, y1 = float(len(self.__wce)), ... | def __calculate_elbows(self):
"""!
@brief Calculates potential elbows.
@details Elbow is calculated as a distance from each point (x, y) to segment from kmin-point (x0, y0) to kmax-point (x1, y1).
"""
x0, y0 = 0.0, self.__wce[0]
x1, y1 = float(len(self.__wce)), ... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/elbow.py#L197-L214 | [
"def",
"__calculate_elbows",
"(",
"self",
")",
":",
"x0",
",",
"y0",
"=",
"0.0",
",",
"self",
".",
"__wce",
"[",
"0",
"]",
"x1",
",",
"y1",
"=",
"float",
"(",
"len",
"(",
"self",
".",
"__wce",
")",
")",
",",
"self",
".",
"__wce",
"[",
"-",
"1... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | elbow.__find_optimal_kvalue | !
@brief Finds elbow and returns corresponding K-value. | pyclustering/cluster/elbow.py | def __find_optimal_kvalue(self):
"""!
@brief Finds elbow and returns corresponding K-value.
"""
optimal_elbow_value = max(self.__elbows)
self.__kvalue = self.__elbows.index(optimal_elbow_value) + 1 + self.__kmin | def __find_optimal_kvalue(self):
"""!
@brief Finds elbow and returns corresponding K-value.
"""
optimal_elbow_value = max(self.__elbows)
self.__kvalue = self.__elbows.index(optimal_elbow_value) + 1 + self.__kmin | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/elbow.py#L217-L223 | [
"def",
"__find_optimal_kvalue",
"(",
"self",
")",
":",
"optimal_elbow_value",
"=",
"max",
"(",
"self",
".",
"__elbows",
")",
"self",
".",
"__kvalue",
"=",
"self",
".",
"__elbows",
".",
"index",
"(",
"optimal_elbow_value",
")",
"+",
"1",
"+",
"self",
".",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | ordering_visualizer.show_ordering_diagram | !
@brief Display cluster-ordering (reachability-plot) diagram.
@param[in] analyser (ordering_analyser): cluster-ordering analyser whose ordering diagram should be displayed.
@param[in] amount_clusters (uint): if it is not 'None' then it displays connectivity radius line that can use... | pyclustering/cluster/optics.py | def show_ordering_diagram(analyser, amount_clusters = None):
"""!
@brief Display cluster-ordering (reachability-plot) diagram.
@param[in] analyser (ordering_analyser): cluster-ordering analyser whose ordering diagram should be displayed.
@param[in] amount_clusters (uint): i... | def show_ordering_diagram(analyser, amount_clusters = None):
"""!
@brief Display cluster-ordering (reachability-plot) diagram.
@param[in] analyser (ordering_analyser): cluster-ordering analyser whose ordering diagram should be displayed.
@param[in] amount_clusters (uint): i... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/optics.py#L58-L102 | [
"def",
"show_ordering_diagram",
"(",
"analyser",
",",
"amount_clusters",
"=",
"None",
")",
":",
"ordering",
"=",
"analyser",
".",
"cluster_ordering",
"axis",
"=",
"plt",
".",
"subplot",
"(",
"111",
")",
"if",
"amount_clusters",
"is",
"not",
"None",
":",
"rad... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | ordering_analyser.calculate_connvectivity_radius | !
@brief Calculates connectivity radius of allocation specified amount of clusters using ordering diagram and marks borders of clusters using indexes of values of ordering diagram.
@details Parameter 'maximum_iterations' is used to protect from hanging when it is impossible to allocate specified numbe... | pyclustering/cluster/optics.py | def calculate_connvectivity_radius(self, amount_clusters, maximum_iterations = 100):
"""!
@brief Calculates connectivity radius of allocation specified amount of clusters using ordering diagram and marks borders of clusters using indexes of values of ordering diagram.
@details Parameter 'maxi... | def calculate_connvectivity_radius(self, amount_clusters, maximum_iterations = 100):
"""!
@brief Calculates connectivity radius of allocation specified amount of clusters using ordering diagram and marks borders of clusters using indexes of values of ordering diagram.
@details Parameter 'maxi... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/optics.py#L143-L182 | [
"def",
"calculate_connvectivity_radius",
"(",
"self",
",",
"amount_clusters",
",",
"maximum_iterations",
"=",
"100",
")",
":",
"maximum_distance",
"=",
"max",
"(",
"self",
".",
"__ordering",
")",
"upper_distance",
"=",
"maximum_distance",
"lower_distance",
"=",
"0.0... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | ordering_analyser.extract_cluster_amount | !
@brief Obtains amount of clustering that can be allocated by using specified radius for ordering diagram and borders between them.
@details When growth of reachability-distances is detected than it is considered as a start point of cluster,
than pick is detected and after that rec... | pyclustering/cluster/optics.py | def extract_cluster_amount(self, radius):
"""!
@brief Obtains amount of clustering that can be allocated by using specified radius for ordering diagram and borders between them.
@details When growth of reachability-distances is detected than it is considered as a start point of cluster,
... | def extract_cluster_amount(self, radius):
"""!
@brief Obtains amount of clustering that can be allocated by using specified radius for ordering diagram and borders between them.
@details When growth of reachability-distances is detected than it is considered as a start point of cluster,
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/optics.py#L185-L244 | [
"def",
"extract_cluster_amount",
"(",
"self",
",",
"radius",
")",
":",
"amount_clusters",
"=",
"1",
"cluster_start",
"=",
"False",
"cluster_pick",
"=",
"False",
"total_similarity",
"=",
"True",
"previous_cluster_distance",
"=",
"None",
"previous_distance",
"=",
"Non... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | optics.__process_by_ccore | !
@brief Performs cluster analysis using CCORE (C/C++ part of pyclustering library). | pyclustering/cluster/optics.py | def __process_by_ccore(self):
"""!
@brief Performs cluster analysis using CCORE (C/C++ part of pyclustering library).
"""
(self.__clusters, self.__noise, self.__ordering, self.__eps,
objects_indexes, objects_core_distances, objects_reachability_distances) = \
... | def __process_by_ccore(self):
"""!
@brief Performs cluster analysis using CCORE (C/C++ part of pyclustering library).
"""
(self.__clusters, self.__noise, self.__ordering, self.__eps,
objects_indexes, objects_core_distances, objects_reachability_distances) = \
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/optics.py#L421-L442 | [
"def",
"__process_by_ccore",
"(",
"self",
")",
":",
"(",
"self",
".",
"__clusters",
",",
"self",
".",
"__noise",
",",
"self",
".",
"__ordering",
",",
"self",
".",
"__eps",
",",
"objects_indexes",
",",
"objects_core_distances",
",",
"objects_reachability_distance... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | optics.__process_by_python | !
@brief Performs cluster analysis using python code. | pyclustering/cluster/optics.py | def __process_by_python(self):
"""!
@brief Performs cluster analysis using python code.
"""
if self.__data_type == 'points':
self.__kdtree = kdtree(self.__sample_pointer, range(len(self.__sample_pointer)))
self.__allocate_clusters()
if (self.__a... | def __process_by_python(self):
"""!
@brief Performs cluster analysis using python code.
"""
if self.__data_type == 'points':
self.__kdtree = kdtree(self.__sample_pointer, range(len(self.__sample_pointer)))
self.__allocate_clusters()
if (self.__a... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/optics.py#L445-L461 | [
"def",
"__process_by_python",
"(",
"self",
")",
":",
"if",
"self",
".",
"__data_type",
"==",
"'points'",
":",
"self",
".",
"__kdtree",
"=",
"kdtree",
"(",
"self",
".",
"__sample_pointer",
",",
"range",
"(",
"len",
"(",
"self",
".",
"__sample_pointer",
")",... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | optics.__initialize | !
@brief Initializes internal states and resets clustering results in line with input sample. | pyclustering/cluster/optics.py | def __initialize(self, sample):
"""!
@brief Initializes internal states and resets clustering results in line with input sample.
"""
self.__processed = [False] * len(sample)
self.__optics_objects = [optics_descriptor(i) for i in range(len(sample))] #... | def __initialize(self, sample):
"""!
@brief Initializes internal states and resets clustering results in line with input sample.
"""
self.__processed = [False] * len(sample)
self.__optics_objects = [optics_descriptor(i) for i in range(len(sample))] #... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/optics.py#L464-L475 | [
"def",
"__initialize",
"(",
"self",
",",
"sample",
")",
":",
"self",
".",
"__processed",
"=",
"[",
"False",
"]",
"*",
"len",
"(",
"sample",
")",
"self",
".",
"__optics_objects",
"=",
"[",
"optics_descriptor",
"(",
"i",
")",
"for",
"i",
"in",
"range",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | optics.__allocate_clusters | !
@brief Performs cluster allocation and builds ordering diagram that is based on reachability-distances. | pyclustering/cluster/optics.py | def __allocate_clusters(self):
"""!
@brief Performs cluster allocation and builds ordering diagram that is based on reachability-distances.
"""
self.__initialize(self.__sample_pointer)
for optic_object in self.__optics_objects:
if o... | def __allocate_clusters(self):
"""!
@brief Performs cluster allocation and builds ordering diagram that is based on reachability-distances.
"""
self.__initialize(self.__sample_pointer)
for optic_object in self.__optics_objects:
if o... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/optics.py#L478-L490 | [
"def",
"__allocate_clusters",
"(",
"self",
")",
":",
"self",
".",
"__initialize",
"(",
"self",
".",
"__sample_pointer",
")",
"for",
"optic_object",
"in",
"self",
".",
"__optics_objects",
":",
"if",
"optic_object",
".",
"processed",
"is",
"False",
":",
"self",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | optics.get_ordering | !
@brief Returns clustering ordering information about the input data set.
@details Clustering ordering of data-set contains the information about the internal clustering structure in line with connectivity radius.
@return (ordering_analyser) Analyser of clustering ordering.
... | pyclustering/cluster/optics.py | def get_ordering(self):
"""!
@brief Returns clustering ordering information about the input data set.
@details Clustering ordering of data-set contains the information about the internal clustering structure in line with connectivity radius.
@return (ordering_analyser) Anal... | def get_ordering(self):
"""!
@brief Returns clustering ordering information about the input data set.
@details Clustering ordering of data-set contains the information about the internal clustering structure in line with connectivity radius.
@return (ordering_analyser) Anal... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/optics.py#L525-L549 | [
"def",
"get_ordering",
"(",
"self",
")",
":",
"if",
"self",
".",
"__ordering",
"is",
"None",
":",
"self",
".",
"__ordering",
"=",
"[",
"]",
"for",
"cluster",
"in",
"self",
".",
"__clusters",
":",
"for",
"index_object",
"in",
"cluster",
":",
"optics_objec... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | optics.__create_neighbor_searcher | !
@brief Returns neighbor searcher in line with data type.
@param[in] data_type (string): Data type (points or distance matrix). | pyclustering/cluster/optics.py | def __create_neighbor_searcher(self, data_type):
"""!
@brief Returns neighbor searcher in line with data type.
@param[in] data_type (string): Data type (points or distance matrix).
"""
if data_type == 'points':
return self.__neighbor_indexes_points
... | def __create_neighbor_searcher(self, data_type):
"""!
@brief Returns neighbor searcher in line with data type.
@param[in] data_type (string): Data type (points or distance matrix).
"""
if data_type == 'points':
return self.__neighbor_indexes_points
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/optics.py#L599-L611 | [
"def",
"__create_neighbor_searcher",
"(",
"self",
",",
"data_type",
")",
":",
"if",
"data_type",
"==",
"'points'",
":",
"return",
"self",
".",
"__neighbor_indexes_points",
"elif",
"data_type",
"==",
"'distance_matrix'",
":",
"return",
"self",
".",
"__neighbor_indexe... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | optics.__expand_cluster_order | !
@brief Expand cluster order from not processed optic-object that corresponds to object from input data.
Traverse procedure is performed until objects are reachable from core-objects in line with connectivity radius.
Order database is updated during expanding.
... | pyclustering/cluster/optics.py | def __expand_cluster_order(self, optics_object):
"""!
@brief Expand cluster order from not processed optic-object that corresponds to object from input data.
Traverse procedure is performed until objects are reachable from core-objects in line with connectivity radius.
... | def __expand_cluster_order(self, optics_object):
"""!
@brief Expand cluster order from not processed optic-object that corresponds to object from input data.
Traverse procedure is performed until objects are reachable from core-objects in line with connectivity radius.
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/optics.py#L614-L658 | [
"def",
"__expand_cluster_order",
"(",
"self",
",",
"optics_object",
")",
":",
"optics_object",
".",
"processed",
"=",
"True",
"neighbors_descriptor",
"=",
"self",
".",
"__neighbor_searcher",
"(",
"optics_object",
")",
"optics_object",
".",
"reachability_distance",
"="... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | optics.__extract_clusters | !
@brief Extract clusters and noise from order database. | pyclustering/cluster/optics.py | def __extract_clusters(self):
"""!
@brief Extract clusters and noise from order database.
"""
self.__clusters = []
self.__noise = []
current_cluster = self.__noise
for optics_object in self.__ordered_database:
if (optics_obje... | def __extract_clusters(self):
"""!
@brief Extract clusters and noise from order database.
"""
self.__clusters = []
self.__noise = []
current_cluster = self.__noise
for optics_object in self.__ordered_database:
if (optics_obje... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/optics.py#L661-L679 | [
"def",
"__extract_clusters",
"(",
"self",
")",
":",
"self",
".",
"__clusters",
"=",
"[",
"]",
"self",
".",
"__noise",
"=",
"[",
"]",
"current_cluster",
"=",
"self",
".",
"__noise",
"for",
"optics_object",
"in",
"self",
".",
"__ordered_database",
":",
"if",... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | optics.__update_order_seed | !
@brief Update sorted list of reachable objects (from core-object) that should be processed using neighbors of core-object.
@param[in] optic_descriptor (optics_descriptor): Core-object whose neighbors should be analysed.
@param[in] neighbors_descriptors (list): List of neighbors of... | pyclustering/cluster/optics.py | def __update_order_seed(self, optic_descriptor, neighbors_descriptors, order_seed):
"""!
@brief Update sorted list of reachable objects (from core-object) that should be processed using neighbors of core-object.
@param[in] optic_descriptor (optics_descriptor): Core-object whose neig... | def __update_order_seed(self, optic_descriptor, neighbors_descriptors, order_seed):
"""!
@brief Update sorted list of reachable objects (from core-object) that should be processed using neighbors of core-object.
@param[in] optic_descriptor (optics_descriptor): Core-object whose neig... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/optics.py#L682-L713 | [
"def",
"__update_order_seed",
"(",
"self",
",",
"optic_descriptor",
",",
"neighbors_descriptors",
",",
"order_seed",
")",
":",
"for",
"neighbor_descriptor",
"in",
"neighbors_descriptors",
":",
"index_neighbor",
"=",
"neighbor_descriptor",
"[",
"0",
"]",
"current_reachab... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | optics.__neighbor_indexes_points | !
@brief Return neighbors of the specified object in case of sequence of points.
@param[in] optic_object (optics_descriptor): Object for which neighbors should be returned in line with connectivity radius.
@return (list) List of indexes of neighbors in line the connectivity radius. | pyclustering/cluster/optics.py | def __neighbor_indexes_points(self, optic_object):
"""!
@brief Return neighbors of the specified object in case of sequence of points.
@param[in] optic_object (optics_descriptor): Object for which neighbors should be returned in line with connectivity radius.
@return (list) List ... | def __neighbor_indexes_points(self, optic_object):
"""!
@brief Return neighbors of the specified object in case of sequence of points.
@param[in] optic_object (optics_descriptor): Object for which neighbors should be returned in line with connectivity radius.
@return (list) List ... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/optics.py#L716-L727 | [
"def",
"__neighbor_indexes_points",
"(",
"self",
",",
"optic_object",
")",
":",
"kdnodes",
"=",
"self",
".",
"__kdtree",
".",
"find_nearest_dist_nodes",
"(",
"self",
".",
"__sample_pointer",
"[",
"optic_object",
".",
"index_object",
"]",
",",
"self",
".",
"__eps... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | optics.__neighbor_indexes_distance_matrix | !
@brief Return neighbors of the specified object in case of distance matrix.
@param[in] optic_object (optics_descriptor): Object for which neighbors should be returned in line with connectivity radius.
@return (list) List of indexes of neighbors in line the connectivity radius. | pyclustering/cluster/optics.py | def __neighbor_indexes_distance_matrix(self, optic_object):
"""!
@brief Return neighbors of the specified object in case of distance matrix.
@param[in] optic_object (optics_descriptor): Object for which neighbors should be returned in line with connectivity radius.
@return (list)... | def __neighbor_indexes_distance_matrix(self, optic_object):
"""!
@brief Return neighbors of the specified object in case of distance matrix.
@param[in] optic_object (optics_descriptor): Object for which neighbors should be returned in line with connectivity radius.
@return (list)... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/optics.py#L730-L741 | [
"def",
"__neighbor_indexes_distance_matrix",
"(",
"self",
",",
"optic_object",
")",
":",
"distances",
"=",
"self",
".",
"__sample_pointer",
"[",
"optic_object",
".",
"index_object",
"]",
"return",
"[",
"[",
"index_neighbor",
",",
"distances",
"[",
"index_neighbor",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | birch.process | !
@brief Performs cluster analysis in line with rules of BIRCH algorithm.
@remark Results of clustering can be obtained using corresponding gets methods.
@see get_clusters() | pyclustering/cluster/birch.py | def process(self):
"""!
@brief Performs cluster analysis in line with rules of BIRCH algorithm.
@remark Results of clustering can be obtained using corresponding gets methods.
@see get_clusters()
"""
self.__insert_data();
... | def process(self):
"""!
@brief Performs cluster analysis in line with rules of BIRCH algorithm.
@remark Results of clustering can be obtained using corresponding gets methods.
@see get_clusters()
"""
self.__insert_data();
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/birch.py#L99-L124 | [
"def",
"process",
"(",
"self",
")",
":",
"self",
".",
"__insert_data",
"(",
")",
"self",
".",
"__extract_features",
"(",
")",
"# in line with specification modify hierarchical algorithm should be used for further clustering\r",
"current_number_clusters",
"=",
"len",
"(",
"s... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | birch.__extract_features | !
@brief Extracts features from CF-tree cluster. | pyclustering/cluster/birch.py | def __extract_features(self):
"""!
@brief Extracts features from CF-tree cluster.
"""
self.__features = [];
if (len(self.__tree.leafes) == 1):
# parameters are too general, copy all entries
for entry in self.__tree.leaf... | def __extract_features(self):
"""!
@brief Extracts features from CF-tree cluster.
"""
self.__features = [];
if (len(self.__tree.leafes) == 1):
# parameters are too general, copy all entries
for entry in self.__tree.leaf... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/birch.py#L156-L172 | [
"def",
"__extract_features",
"(",
"self",
")",
":",
"self",
".",
"__features",
"=",
"[",
"]",
"if",
"(",
"len",
"(",
"self",
".",
"__tree",
".",
"leafes",
")",
"==",
"1",
")",
":",
"# parameters are too general, copy all entries\r",
"for",
"entry",
"in",
"... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | birch.__decode_data | !
@brief Decodes data from CF-tree features. | pyclustering/cluster/birch.py | def __decode_data(self):
"""!
@brief Decodes data from CF-tree features.
"""
self.__clusters = [ [] for _ in range(self.__number_clusters) ];
self.__noise = [];
for index_point in range(0, len(self.__pointer_data)):
(_, clu... | def __decode_data(self):
"""!
@brief Decodes data from CF-tree features.
"""
self.__clusters = [ [] for _ in range(self.__number_clusters) ];
self.__noise = [];
for index_point in range(0, len(self.__pointer_data)):
(_, clu... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/birch.py#L175-L187 | [
"def",
"__decode_data",
"(",
"self",
")",
":",
"self",
".",
"__clusters",
"=",
"[",
"[",
"]",
"for",
"_",
"in",
"range",
"(",
"self",
".",
"__number_clusters",
")",
"]",
"self",
".",
"__noise",
"=",
"[",
"]",
"for",
"index_point",
"in",
"range",
"(",... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | birch.__insert_data | !
@brief Inserts input data to the tree.
@remark If number of maximum number of entries is exceeded than diameter is increased and tree is rebuilt. | pyclustering/cluster/birch.py | def __insert_data(self):
"""!
@brief Inserts input data to the tree.
@remark If number of maximum number of entries is exceeded than diameter is increased and tree is rebuilt.
"""
for index_point in range(0, len(self.__pointer_data)):
... | def __insert_data(self):
"""!
@brief Inserts input data to the tree.
@remark If number of maximum number of entries is exceeded than diameter is increased and tree is rebuilt.
"""
for index_point in range(0, len(self.__pointer_data)):
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/birch.py#L190-L203 | [
"def",
"__insert_data",
"(",
"self",
")",
":",
"for",
"index_point",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"self",
".",
"__pointer_data",
")",
")",
":",
"point",
"=",
"self",
".",
"__pointer_data",
"[",
"index_point",
"]",
"self",
".",
"__tree",
".... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | birch.__rebuild_tree | !
@brief Rebuilt tree in case of maxumum number of entries is exceeded.
@param[in] index_point (uint): Index of point that is used as end point of re-building.
@return (cftree) Rebuilt tree with encoded points till specified point from input data space. | pyclustering/cluster/birch.py | def __rebuild_tree(self, index_point):
"""!
@brief Rebuilt tree in case of maxumum number of entries is exceeded.
@param[in] index_point (uint): Index of point that is used as end point of re-building.
@return (cftree) Rebuilt tree with encoded points till specifi... | def __rebuild_tree(self, index_point):
"""!
@brief Rebuilt tree in case of maxumum number of entries is exceeded.
@param[in] index_point (uint): Index of point that is used as end point of re-building.
@return (cftree) Rebuilt tree with encoded points till specifi... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/birch.py#L208-L242 | [
"def",
"__rebuild_tree",
"(",
"self",
",",
"index_point",
")",
":",
"rebuild_result",
"=",
"False",
"increased_diameter",
"=",
"self",
".",
"__tree",
".",
"threshold",
"*",
"self",
".",
"__diameter_multiplier",
"tree",
"=",
"None",
"while",
"(",
"rebuild_result"... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | birch.__find_nearest_cluster_features | !
@brief Find pair of nearest CF entries.
@return (list) List of two nearest enties that are represented by list [index_point1, index_point2]. | pyclustering/cluster/birch.py | def __find_nearest_cluster_features(self):
"""!
@brief Find pair of nearest CF entries.
@return (list) List of two nearest enties that are represented by list [index_point1, index_point2].
"""
minimum_distance = float("Inf");
index1 = 0... | def __find_nearest_cluster_features(self):
"""!
@brief Find pair of nearest CF entries.
@return (list) List of two nearest enties that are represented by list [index_point1, index_point2].
"""
minimum_distance = float("Inf");
index1 = 0... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/birch.py#L245-L269 | [
"def",
"__find_nearest_cluster_features",
"(",
"self",
")",
":",
"minimum_distance",
"=",
"float",
"(",
"\"Inf\"",
")",
"index1",
"=",
"0",
"index2",
"=",
"0",
"for",
"index_candidate1",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"self",
".",
"__features",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | birch.__get_nearest_feature | !
@brief Find nearest entry for specified point.
@param[in] point (list): Pointer to point from input dataset.
@param[in] feature_collection (list): Feature collection that is used for obtaining nearest feature for the specified point.
@return (double, uint) Tuple... | pyclustering/cluster/birch.py | def __get_nearest_feature(self, point, feature_collection):
"""!
@brief Find nearest entry for specified point.
@param[in] point (list): Pointer to point from input dataset.
@param[in] feature_collection (list): Feature collection that is used for obtaining nearest feature ... | def __get_nearest_feature(self, point, feature_collection):
"""!
@brief Find nearest entry for specified point.
@param[in] point (list): Pointer to point from input dataset.
@param[in] feature_collection (list): Feature collection that is used for obtaining nearest feature ... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/birch.py#L272-L294 | [
"def",
"__get_nearest_feature",
"(",
"self",
",",
"point",
",",
"feature_collection",
")",
":",
"minimum_distance",
"=",
"float",
"(",
"\"Inf\"",
")",
"index_nearest_feature",
"=",
"-",
"1",
"for",
"index_entry",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"fe... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | answer_reader.__read_answer_from_line | !
@brief Read information about point from the specific line and place it to cluster or noise in line with that
information.
@param[in] index_point (uint): Index point that should be placed to cluster or noise.
@param[in] line (string): Line where information about point sh... | pyclustering/samples/__init__.py | def __read_answer_from_line(self, index_point, line):
"""!
@brief Read information about point from the specific line and place it to cluster or noise in line with that
information.
@param[in] index_point (uint): Index point that should be placed to cluster or noise.
... | def __read_answer_from_line(self, index_point, line):
"""!
@brief Read information about point from the specific line and place it to cluster or noise in line with that
information.
@param[in] index_point (uint): Index point that should be placed to cluster or noise.
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/samples/__init__.py#L79-L96 | [
"def",
"__read_answer_from_line",
"(",
"self",
",",
"index_point",
",",
"line",
")",
":",
"if",
"line",
"[",
"0",
"]",
"==",
"'n'",
":",
"self",
".",
"__noise",
".",
"append",
"(",
"index_point",
")",
"else",
":",
"index_cluster",
"=",
"int",
"(",
"lin... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | answer_reader.__read_answer | !
@brief Read information about proper clusters and noises from the file. | pyclustering/samples/__init__.py | def __read_answer(self):
"""!
@brief Read information about proper clusters and noises from the file.
"""
if self.__clusters is not None:
return
file = open(self.__answer_path, 'r')
self.__clusters, self.__noise = [], []
index_point =... | def __read_answer(self):
"""!
@brief Read information about proper clusters and noises from the file.
"""
if self.__clusters is not None:
return
file = open(self.__answer_path, 'r')
self.__clusters, self.__noise = [], []
index_point =... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/samples/__init__.py#L99-L117 | [
"def",
"__read_answer",
"(",
"self",
")",
":",
"if",
"self",
".",
"__clusters",
"is",
"not",
"None",
":",
"return",
"file",
"=",
"open",
"(",
"self",
".",
"__answer_path",
",",
"'r'",
")",
"self",
".",
"__clusters",
",",
"self",
".",
"__noise",
"=",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | cluster_visualizer_multidim.append_cluster | !
@brief Appends cluster for visualization.
@param[in] cluster (list): cluster that may consist of indexes of objects from the data or object itself.
@param[in] data (list): If defines that each element of cluster is considered as a index of object from the data.
@param[in] marker ... | pyclustering/cluster/__init__.py | def append_cluster(self, cluster, data = None, marker = '.', markersize = None, color = None):
"""!
@brief Appends cluster for visualization.
@param[in] cluster (list): cluster that may consist of indexes of objects from the data or object itself.
@param[in] data (list): If defines... | def append_cluster(self, cluster, data = None, marker = '.', markersize = None, color = None):
"""!
@brief Appends cluster for visualization.
@param[in] cluster (list): cluster that may consist of indexes of objects from the data or object itself.
@param[in] data (list): If defines... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/__init__.py#L135-L157 | [
"def",
"append_cluster",
"(",
"self",
",",
"cluster",
",",
"data",
"=",
"None",
",",
"marker",
"=",
"'.'",
",",
"markersize",
"=",
"None",
",",
"color",
"=",
"None",
")",
":",
"if",
"len",
"(",
"cluster",
")",
"==",
"0",
":",
"raise",
"ValueError",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | cluster_visualizer_multidim.append_clusters | !
@brief Appends list of cluster for visualization.
@param[in] clusters (list): List of clusters where each cluster may consist of indexes of objects from the data or object itself.
@param[in] data (list): If defines that each element of cluster is considered as a index of object from the d... | pyclustering/cluster/__init__.py | def append_clusters(self, clusters, data=None, marker='.', markersize=None):
"""!
@brief Appends list of cluster for visualization.
@param[in] clusters (list): List of clusters where each cluster may consist of indexes of objects from the data or object itself.
@param[in] data (lis... | def append_clusters(self, clusters, data=None, marker='.', markersize=None):
"""!
@brief Appends list of cluster for visualization.
@param[in] clusters (list): List of clusters where each cluster may consist of indexes of objects from the data or object itself.
@param[in] data (lis... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/__init__.py#L160-L172 | [
"def",
"append_clusters",
"(",
"self",
",",
"clusters",
",",
"data",
"=",
"None",
",",
"marker",
"=",
"'.'",
",",
"markersize",
"=",
"None",
")",
":",
"for",
"cluster",
"in",
"clusters",
":",
"self",
".",
"append_cluster",
"(",
"cluster",
",",
"data",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | cluster_visualizer_multidim.show | !
@brief Shows clusters (visualize) in multi-dimensional space.
@param[in] pair_filter (list): List of coordinate pairs that should be displayed. This argument is used as a filter.
@param[in] **kwargs: Arbitrary keyword arguments (available arguments: 'visible_axis' 'visible_labels', 'visib... | pyclustering/cluster/__init__.py | def show(self, pair_filter=None, **kwargs):
"""!
@brief Shows clusters (visualize) in multi-dimensional space.
@param[in] pair_filter (list): List of coordinate pairs that should be displayed. This argument is used as a filter.
@param[in] **kwargs: Arbitrary keyword arguments (avai... | def show(self, pair_filter=None, **kwargs):
"""!
@brief Shows clusters (visualize) in multi-dimensional space.
@param[in] pair_filter (list): List of coordinate pairs that should be displayed. This argument is used as a filter.
@param[in] **kwargs: Arbitrary keyword arguments (avai... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/__init__.py#L175-L218 | [
"def",
"show",
"(",
"self",
",",
"pair_filter",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"len",
"(",
"self",
".",
"__clusters",
")",
">",
"0",
":",
"raise",
"ValueError",
"(",
"\"There is no non-empty clusters for visualization.\"",
")",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | cluster_visualizer_multidim.__create_grid_spec | !
@brief Create grid specification for figure to place canvases.
@param[in] amount_axis (uint): Amount of canvases that should be organized by the created grid specification.
@param[in] max_row_size (max_row_size): Maximum number of canvases on one row.
@return (gridspec.GridSpec... | pyclustering/cluster/__init__.py | def __create_grid_spec(self, amount_axis, max_row_size):
"""!
@brief Create grid specification for figure to place canvases.
@param[in] amount_axis (uint): Amount of canvases that should be organized by the created grid specification.
@param[in] max_row_size (max_row_size): Maximum... | def __create_grid_spec(self, amount_axis, max_row_size):
"""!
@brief Create grid specification for figure to place canvases.
@param[in] amount_axis (uint): Amount of canvases that should be organized by the created grid specification.
@param[in] max_row_size (max_row_size): Maximum... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/__init__.py#L221-L236 | [
"def",
"__create_grid_spec",
"(",
"self",
",",
"amount_axis",
",",
"max_row_size",
")",
":",
"row_size",
"=",
"amount_axis",
"if",
"row_size",
">",
"max_row_size",
":",
"row_size",
"=",
"max_row_size",
"col_size",
"=",
"math",
".",
"ceil",
"(",
"amount_axis",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | cluster_visualizer_multidim.__create_pairs | !
@brief Create coordinate pairs that should be displayed.
@param[in] dimension (uint): Data-space dimension.
@param[in] acceptable_pairs (list): List of coordinate pairs that should be displayed.
@return (list) List of coordinate pairs that should be displayed. | pyclustering/cluster/__init__.py | def __create_pairs(self, dimension, acceptable_pairs):
"""!
@brief Create coordinate pairs that should be displayed.
@param[in] dimension (uint): Data-space dimension.
@param[in] acceptable_pairs (list): List of coordinate pairs that should be displayed.
@return (list) L... | def __create_pairs(self, dimension, acceptable_pairs):
"""!
@brief Create coordinate pairs that should be displayed.
@param[in] dimension (uint): Data-space dimension.
@param[in] acceptable_pairs (list): List of coordinate pairs that should be displayed.
@return (list) L... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/__init__.py#L239-L252 | [
"def",
"__create_pairs",
"(",
"self",
",",
"dimension",
",",
"acceptable_pairs",
")",
":",
"if",
"len",
"(",
"acceptable_pairs",
")",
">",
"0",
":",
"return",
"acceptable_pairs",
"return",
"list",
"(",
"itertools",
".",
"combinations",
"(",
"range",
"(",
"di... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | cluster_visualizer_multidim.__create_canvas | !
@brief Create new canvas with user defined parameters to display cluster or chunk of cluster on it.
@param[in] dimension (uint): Data-space dimension.
@param[in] pairs (list): Pair of coordinates that will be displayed on the canvas. If empty than label will not
be di... | pyclustering/cluster/__init__.py | def __create_canvas(self, dimension, pairs, position, **kwargs):
"""!
@brief Create new canvas with user defined parameters to display cluster or chunk of cluster on it.
@param[in] dimension (uint): Data-space dimension.
@param[in] pairs (list): Pair of coordinates that will be dis... | def __create_canvas(self, dimension, pairs, position, **kwargs):
"""!
@brief Create new canvas with user defined parameters to display cluster or chunk of cluster on it.
@param[in] dimension (uint): Data-space dimension.
@param[in] pairs (list): Pair of coordinates that will be dis... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/__init__.py#L255-L297 | [
"def",
"__create_canvas",
"(",
"self",
",",
"dimension",
",",
"pairs",
",",
"position",
",",
"*",
"*",
"kwargs",
")",
":",
"visible_grid",
"=",
"kwargs",
".",
"get",
"(",
"'visible_grid'",
",",
"True",
")",
"visible_labels",
"=",
"kwargs",
".",
"get",
"(... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | cluster_visualizer_multidim.__draw_canvas_cluster | !
@brief Draw clusters.
@param[in] axis_storage (list): List of matplotlib axis where cluster dimensional chunks are displayed.
@param[in] cluster_descr (canvas_cluster_descr): Canvas cluster descriptor that should be displayed.
@param[in] pairs (list): List of coordinates that sho... | pyclustering/cluster/__init__.py | def __draw_canvas_cluster(self, axis_storage, cluster_descr, pairs):
"""!
@brief Draw clusters.
@param[in] axis_storage (list): List of matplotlib axis where cluster dimensional chunks are displayed.
@param[in] cluster_descr (canvas_cluster_descr): Canvas cluster descriptor that sh... | def __draw_canvas_cluster(self, axis_storage, cluster_descr, pairs):
"""!
@brief Draw clusters.
@param[in] axis_storage (list): List of matplotlib axis where cluster dimensional chunks are displayed.
@param[in] cluster_descr (canvas_cluster_descr): Canvas cluster descriptor that sh... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/__init__.py#L300-L315 | [
"def",
"__draw_canvas_cluster",
"(",
"self",
",",
"axis_storage",
",",
"cluster_descr",
",",
"pairs",
")",
":",
"for",
"index_axis",
"in",
"range",
"(",
"len",
"(",
"axis_storage",
")",
")",
":",
"for",
"item",
"in",
"cluster_descr",
".",
"cluster",
":",
"... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | cluster_visualizer_multidim.__draw_cluster_item_multi_dimension | !
@brief Draw cluster chunk defined by pair coordinates in data space with dimension greater than 1.
@param[in] ax (axis): Matplotlib axis that is used to display chunk of cluster point.
@param[in] pair (list): Coordinate of the point that should be displayed.
@param[in] item (list... | pyclustering/cluster/__init__.py | def __draw_cluster_item_multi_dimension(self, ax, pair, item, cluster_descr):
"""!
@brief Draw cluster chunk defined by pair coordinates in data space with dimension greater than 1.
@param[in] ax (axis): Matplotlib axis that is used to display chunk of cluster point.
@param[in] pai... | def __draw_cluster_item_multi_dimension(self, ax, pair, item, cluster_descr):
"""!
@brief Draw cluster chunk defined by pair coordinates in data space with dimension greater than 1.
@param[in] ax (axis): Matplotlib axis that is used to display chunk of cluster point.
@param[in] pai... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/__init__.py#L318-L337 | [
"def",
"__draw_cluster_item_multi_dimension",
"(",
"self",
",",
"ax",
",",
"pair",
",",
"item",
",",
"cluster_descr",
")",
":",
"index_dimension1",
"=",
"pair",
"[",
"0",
"]",
"index_dimension2",
"=",
"pair",
"[",
"1",
"]",
"if",
"cluster_descr",
".",
"data"... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | cluster_visualizer_multidim.__draw_cluster_item_one_dimension | !
@brief Draw cluster point in one dimensional data space..
@param[in] ax (axis): Matplotlib axis that is used to display chunk of cluster point.
@param[in] item (list): Data point or index of data point.
@param[in] cluster_descr (canvas_cluster_descr): Cluster description whose po... | pyclustering/cluster/__init__.py | def __draw_cluster_item_one_dimension(self, ax, item, cluster_descr):
"""!
@brief Draw cluster point in one dimensional data space..
@param[in] ax (axis): Matplotlib axis that is used to display chunk of cluster point.
@param[in] item (list): Data point or index of data point.
... | def __draw_cluster_item_one_dimension(self, ax, item, cluster_descr):
"""!
@brief Draw cluster point in one dimensional data space..
@param[in] ax (axis): Matplotlib axis that is used to display chunk of cluster point.
@param[in] item (list): Data point or index of data point.
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/__init__.py#L340-L355 | [
"def",
"__draw_cluster_item_one_dimension",
"(",
"self",
",",
"ax",
",",
"item",
",",
"cluster_descr",
")",
":",
"if",
"cluster_descr",
".",
"data",
"is",
"None",
":",
"ax",
".",
"plot",
"(",
"item",
"[",
"0",
"]",
",",
"0.0",
",",
"color",
"=",
"clust... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | cluster_visualizer.append_cluster | !
@brief Appends cluster to canvas for drawing.
@param[in] cluster (list): cluster that may consist of indexes of objects from the data or object itself.
@param[in] data (list): If defines that each element of cluster is considered as a index of object from the data.
@param... | pyclustering/cluster/__init__.py | def append_cluster(self, cluster, data=None, canvas=0, marker='.', markersize=None, color=None):
"""!
@brief Appends cluster to canvas for drawing.
@param[in] cluster (list): cluster that may consist of indexes of objects from the data or object itself.
@param[in] data (lis... | def append_cluster(self, cluster, data=None, canvas=0, marker='.', markersize=None, color=None):
"""!
@brief Appends cluster to canvas for drawing.
@param[in] cluster (list): cluster that may consist of indexes of objects from the data or object itself.
@param[in] data (lis... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/__init__.py#L424-L476 | [
"def",
"append_cluster",
"(",
"self",
",",
"cluster",
",",
"data",
"=",
"None",
",",
"canvas",
"=",
"0",
",",
"marker",
"=",
"'.'",
",",
"markersize",
"=",
"None",
",",
"color",
"=",
"None",
")",
":",
"if",
"len",
"(",
"cluster",
")",
"==",
"0",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | cluster_visualizer.append_cluster_attribute | !
@brief Append cluster attribure for cluster on specific canvas.
@details Attribute it is data that is visualized for specific cluster using its color, marker and markersize if last two is not specified.
@param[in] index_canvas (uint): Index canvas where cluster is located.
... | pyclustering/cluster/__init__.py | def append_cluster_attribute(self, index_canvas, index_cluster, data, marker = None, markersize = None):
"""!
@brief Append cluster attribure for cluster on specific canvas.
@details Attribute it is data that is visualized for specific cluster using its color, marker and markersize if last tw... | def append_cluster_attribute(self, index_canvas, index_cluster, data, marker = None, markersize = None):
"""!
@brief Append cluster attribure for cluster on specific canvas.
@details Attribute it is data that is visualized for specific cluster using its color, marker and markersize if last tw... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/__init__.py#L479-L504 | [
"def",
"append_cluster_attribute",
"(",
"self",
",",
"index_canvas",
",",
"index_cluster",
",",
"data",
",",
"marker",
"=",
"None",
",",
"markersize",
"=",
"None",
")",
":",
"cluster_descr",
"=",
"self",
".",
"__canvas_clusters",
"[",
"index_canvas",
"]",
"[",... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | cluster_visualizer.set_canvas_title | !
@brief Set title for specified canvas.
@param[in] text (string): Title for canvas.
@param[in] canvas (uint): Index of canvas where title should be displayed. | pyclustering/cluster/__init__.py | def set_canvas_title(self, text, canvas = 0):
"""!
@brief Set title for specified canvas.
@param[in] text (string): Title for canvas.
@param[in] canvas (uint): Index of canvas where title should be displayed.
"""
if canvas > self.__numb... | def set_canvas_title(self, text, canvas = 0):
"""!
@brief Set title for specified canvas.
@param[in] text (string): Title for canvas.
@param[in] canvas (uint): Index of canvas where title should be displayed.
"""
if canvas > self.__numb... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/__init__.py#L523-L535 | [
"def",
"set_canvas_title",
"(",
"self",
",",
"text",
",",
"canvas",
"=",
"0",
")",
":",
"if",
"canvas",
">",
"self",
".",
"__number_canvases",
":",
"raise",
"NameError",
"(",
"'Canvas does '",
"+",
"canvas",
"+",
"' not exists.'",
")",
"self",
".",
"__canv... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | cluster_visualizer.show | !
@brief Shows clusters (visualize).
@param[in] figure (fig): Defines requirement to use specified figure, if None - new figure is created for drawing clusters.
@param[in] invisible_axis (bool): Defines visibility of axes on each canvas, if True - axes are invisible.
@param... | pyclustering/cluster/__init__.py | def show(self, figure=None, invisible_axis=True, visible_grid=True, display=True, shift=None):
"""!
@brief Shows clusters (visualize).
@param[in] figure (fig): Defines requirement to use specified figure, if None - new figure is created for drawing clusters.
@param[in] invi... | def show(self, figure=None, invisible_axis=True, visible_grid=True, display=True, shift=None):
"""!
@brief Shows clusters (visualize).
@param[in] figure (fig): Defines requirement to use specified figure, if None - new figure is created for drawing clusters.
@param[in] invi... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/__init__.py#L546-L615 | [
"def",
"show",
"(",
"self",
",",
"figure",
"=",
"None",
",",
"invisible_axis",
"=",
"True",
",",
"visible_grid",
"=",
"True",
",",
"display",
"=",
"True",
",",
"shift",
"=",
"None",
")",
":",
"canvas_shift",
"=",
"shift",
"if",
"canvas_shift",
"is",
"N... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | cluster_visualizer.__draw_canvas_cluster | !
@brief Draw canvas cluster descriptor.
@param[in] ax (Axis): Axis of the canvas where canvas cluster descriptor should be displayed.
@param[in] dimension (uint): Canvas dimension.
@param[in] cluster_descr (canvas_cluster_descr): Canvas cluster descriptor that should be displayed.... | pyclustering/cluster/__init__.py | def __draw_canvas_cluster(self, ax, dimension, cluster_descr):
"""!
@brief Draw canvas cluster descriptor.
@param[in] ax (Axis): Axis of the canvas where canvas cluster descriptor should be displayed.
@param[in] dimension (uint): Canvas dimension.
@param[in] cluster_descr ... | def __draw_canvas_cluster(self, ax, dimension, cluster_descr):
"""!
@brief Draw canvas cluster descriptor.
@param[in] ax (Axis): Axis of the canvas where canvas cluster descriptor should be displayed.
@param[in] dimension (uint): Canvas dimension.
@param[in] cluster_descr ... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/__init__.py#L618-L653 | [
"def",
"__draw_canvas_cluster",
"(",
"self",
",",
"ax",
",",
"dimension",
",",
"cluster_descr",
")",
":",
"cluster",
"=",
"cluster_descr",
".",
"cluster",
"data",
"=",
"cluster_descr",
".",
"data",
"marker",
"=",
"cluster_descr",
".",
"marker",
"markersize",
"... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | gaussian | !
@brief Calculates gaussian for dataset using specified mean (mathematical expectation) and variance or covariance in case
multi-dimensional data.
@param[in] data (list): Data that is used for gaussian calculation.
@param[in] mean (float|numpy.array): Mathematical expectation used for... | pyclustering/cluster/ema.py | def gaussian(data, mean, covariance):
"""!
@brief Calculates gaussian for dataset using specified mean (mathematical expectation) and variance or covariance in case
multi-dimensional data.
@param[in] data (list): Data that is used for gaussian calculation.
@param[in] mean (float|n... | def gaussian(data, mean, covariance):
"""!
@brief Calculates gaussian for dataset using specified mean (mathematical expectation) and variance or covariance in case
multi-dimensional data.
@param[in] data (list): Data that is used for gaussian calculation.
@param[in] mean (float|n... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/ema.py#L48-L80 | [
"def",
"gaussian",
"(",
"data",
",",
"mean",
",",
"covariance",
")",
":",
"dimension",
"=",
"float",
"(",
"len",
"(",
"data",
"[",
"0",
"]",
")",
")",
"if",
"dimension",
"!=",
"1.0",
":",
"inv_variance",
"=",
"numpy",
".",
"linalg",
".",
"pinv",
"(... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | ema_initializer.initialize | !
@brief Calculates initial parameters for EM algorithm: means and covariances using
specified strategy.
@param[in] init_type (ema_init_type): Strategy for initialization.
@return (float|list, float|numpy.array) Initial means and variance (covariance matri... | pyclustering/cluster/ema.py | def initialize(self, init_type = ema_init_type.KMEANS_INITIALIZATION):
"""!
@brief Calculates initial parameters for EM algorithm: means and covariances using
specified strategy.
@param[in] init_type (ema_init_type): Strategy for initialization.
@... | def initialize(self, init_type = ema_init_type.KMEANS_INITIALIZATION):
"""!
@brief Calculates initial parameters for EM algorithm: means and covariances using
specified strategy.
@param[in] init_type (ema_init_type): Strategy for initialization.
@... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/ema.py#L137-L153 | [
"def",
"initialize",
"(",
"self",
",",
"init_type",
"=",
"ema_init_type",
".",
"KMEANS_INITIALIZATION",
")",
":",
"if",
"init_type",
"==",
"ema_init_type",
".",
"KMEANS_INITIALIZATION",
":",
"return",
"self",
".",
"__initialize_kmeans",
"(",
")",
"elif",
"init_typ... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | ema_initializer.__calculate_initial_clusters | !
@brief Calculate Euclidean distance to each point from the each cluster.
@brief Nearest points are captured by according clusters and as a result clusters are updated.
@return (list) updated clusters as list of clusters. Each cluster contains indexes of objects from data. | pyclustering/cluster/ema.py | def __calculate_initial_clusters(self, centers):
"""!
@brief Calculate Euclidean distance to each point from the each cluster.
@brief Nearest points are captured by according clusters and as a result clusters are updated.
@return (list) updated clusters as list of clusters... | def __calculate_initial_clusters(self, centers):
"""!
@brief Calculate Euclidean distance to each point from the each cluster.
@brief Nearest points are captured by according clusters and as a result clusters are updated.
@return (list) updated clusters as list of clusters... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/ema.py#L156-L177 | [
"def",
"__calculate_initial_clusters",
"(",
"self",
",",
"centers",
")",
":",
"clusters",
"=",
"[",
"[",
"]",
"for",
"_",
"in",
"range",
"(",
"len",
"(",
"centers",
")",
")",
"]",
"for",
"index_point",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"__... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | ema_observer.notify | !
@brief This method is used by the algorithm to notify observer about changes where the algorithm
should provide new values: means, covariances and allocated clusters.
@param[in] means (list): Mean of each cluster on currect step.
@param[in] covariances (list): Cov... | pyclustering/cluster/ema.py | def notify(self, means, covariances, clusters):
"""!
@brief This method is used by the algorithm to notify observer about changes where the algorithm
should provide new values: means, covariances and allocated clusters.
@param[in] means (list): Mean of each cluster ... | def notify(self, means, covariances, clusters):
"""!
@brief This method is used by the algorithm to notify observer about changes where the algorithm
should provide new values: means, covariances and allocated clusters.
@param[in] means (list): Mean of each cluster ... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/ema.py#L323-L335 | [
"def",
"notify",
"(",
"self",
",",
"means",
",",
"covariances",
",",
"clusters",
")",
":",
"self",
".",
"__means_evolution",
".",
"append",
"(",
"means",
")",
"self",
".",
"__covariances_evolution",
".",
"append",
"(",
"covariances",
")",
"self",
".",
"__c... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | ema_visualizer.show_clusters | !
@brief Draws clusters and in case of two-dimensional dataset draws their ellipses.
@param[in] clusters (list): Clusters that were allocated by the algorithm.
@param[in] sample (list): Dataset that were used for clustering.
@param[in] covariances (list): Covariances of the... | pyclustering/cluster/ema.py | def show_clusters(clusters, sample, covariances, means, figure = None, display = True):
"""!
@brief Draws clusters and in case of two-dimensional dataset draws their ellipses.
@param[in] clusters (list): Clusters that were allocated by the algorithm.
@param[in] sample (list... | def show_clusters(clusters, sample, covariances, means, figure = None, display = True):
"""!
@brief Draws clusters and in case of two-dimensional dataset draws their ellipses.
@param[in] clusters (list): Clusters that were allocated by the algorithm.
@param[in] sample (list... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/ema.py#L348-L379 | [
"def",
"show_clusters",
"(",
"clusters",
",",
"sample",
",",
"covariances",
",",
"means",
",",
"figure",
"=",
"None",
",",
"display",
"=",
"True",
")",
":",
"visualizer",
"=",
"cluster_visualizer",
"(",
")",
"visualizer",
".",
"append_clusters",
"(",
"cluste... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | ema_visualizer.animate_cluster_allocation | !
@brief Animates clustering process that is performed by EM algorithm.
@param[in] data (list): Dataset that is used for clustering.
@param[in] observer (ema_observer): EM observer that was used for collection information about clustering process.
@param[in] animation_veloc... | pyclustering/cluster/ema.py | def animate_cluster_allocation(data, observer, animation_velocity = 75, movie_fps = 1, save_movie = None):
"""!
@brief Animates clustering process that is performed by EM algorithm.
@param[in] data (list): Dataset that is used for clustering.
@param[in] observer (ema_observ... | def animate_cluster_allocation(data, observer, animation_velocity = 75, movie_fps = 1, save_movie = None):
"""!
@brief Animates clustering process that is performed by EM algorithm.
@param[in] data (list): Dataset that is used for clustering.
@param[in] observer (ema_observ... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/ema.py#L383-L420 | [
"def",
"animate_cluster_allocation",
"(",
"data",
",",
"observer",
",",
"animation_velocity",
"=",
"75",
",",
"movie_fps",
"=",
"1",
",",
"save_movie",
"=",
"None",
")",
":",
"figure",
"=",
"plt",
".",
"figure",
"(",
")",
"def",
"init_frame",
"(",
")",
"... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | ema.process | !
@brief Run clustering process of the algorithm.
@details This method should be called before call 'get_clusters()'. | pyclustering/cluster/ema.py | def process(self):
"""!
@brief Run clustering process of the algorithm.
@details This method should be called before call 'get_clusters()'.
"""
previous_likelihood = -200000
current_likelihood = -100000
current_iteration = 0
... | def process(self):
"""!
@brief Run clustering process of the algorithm.
@details This method should be called before call 'get_clusters()'.
"""
previous_likelihood = -200000
current_likelihood = -100000
current_iteration = 0
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/ema.py#L521-L545 | [
"def",
"process",
"(",
"self",
")",
":",
"previous_likelihood",
"=",
"-",
"200000",
"current_likelihood",
"=",
"-",
"100000",
"current_iteration",
"=",
"0",
"while",
"(",
"self",
".",
"__stop",
"is",
"False",
")",
"and",
"(",
"abs",
"(",
"previous_likelihood... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | euclidean_distance_numpy | !
@brief Calculate Euclidean distance between two objects using numpy.
@param[in] object1 (array_like): The first array_like object.
@param[in] object2 (array_like): The second array_like object.
@return (double) Euclidean distance between two objects. | pyclustering/utils/metric.py | def euclidean_distance_numpy(object1, object2):
"""!
@brief Calculate Euclidean distance between two objects using numpy.
@param[in] object1 (array_like): The first array_like object.
@param[in] object2 (array_like): The second array_like object.
@return (double) Euclidean distance between ... | def euclidean_distance_numpy(object1, object2):
"""!
@brief Calculate Euclidean distance between two objects using numpy.
@param[in] object1 (array_like): The first array_like object.
@param[in] object2 (array_like): The second array_like object.
@return (double) Euclidean distance between ... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/metric.py#L302-L312 | [
"def",
"euclidean_distance_numpy",
"(",
"object1",
",",
"object2",
")",
":",
"return",
"numpy",
".",
"sum",
"(",
"numpy",
".",
"sqrt",
"(",
"numpy",
".",
"square",
"(",
"object1",
"-",
"object2",
")",
")",
",",
"axis",
"=",
"1",
")",
".",
"T"
] | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | euclidean_distance_square | !
@brief Calculate square Euclidean distance between two vectors.
\f[
dist(a, b) = \sum_{i=0}^{N}(a_{i} - b_{i})^{2};
\f]
@param[in] point1 (array_like): The first vector.
@param[in] point2 (array_like): The second vector.
@return (double) Square Euclidean distance between two v... | pyclustering/utils/metric.py | def euclidean_distance_square(point1, point2):
"""!
@brief Calculate square Euclidean distance between two vectors.
\f[
dist(a, b) = \sum_{i=0}^{N}(a_{i} - b_{i})^{2};
\f]
@param[in] point1 (array_like): The first vector.
@param[in] point2 (array_like): The second vector.
@... | def euclidean_distance_square(point1, point2):
"""!
@brief Calculate square Euclidean distance between two vectors.
\f[
dist(a, b) = \sum_{i=0}^{N}(a_{i} - b_{i})^{2};
\f]
@param[in] point1 (array_like): The first vector.
@param[in] point2 (array_like): The second vector.
@... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/metric.py#L315-L335 | [
"def",
"euclidean_distance_square",
"(",
"point1",
",",
"point2",
")",
":",
"distance",
"=",
"0.0",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"point1",
")",
")",
":",
"distance",
"+=",
"(",
"point1",
"[",
"i",
"]",
"-",
"point2",
"[",
"i",
"]",
"... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | euclidean_distance_square_numpy | !
@brief Calculate square Euclidean distance between two objects using numpy.
@param[in] object1 (array_like): The first array_like object.
@param[in] object2 (array_like): The second array_like object.
@return (double) Square Euclidean distance between two objects. | pyclustering/utils/metric.py | def euclidean_distance_square_numpy(object1, object2):
"""!
@brief Calculate square Euclidean distance between two objects using numpy.
@param[in] object1 (array_like): The first array_like object.
@param[in] object2 (array_like): The second array_like object.
@return (double) Square Euclid... | def euclidean_distance_square_numpy(object1, object2):
"""!
@brief Calculate square Euclidean distance between two objects using numpy.
@param[in] object1 (array_like): The first array_like object.
@param[in] object2 (array_like): The second array_like object.
@return (double) Square Euclid... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/metric.py#L338-L348 | [
"def",
"euclidean_distance_square_numpy",
"(",
"object1",
",",
"object2",
")",
":",
"return",
"numpy",
".",
"sum",
"(",
"numpy",
".",
"square",
"(",
"object1",
"-",
"object2",
")",
",",
"axis",
"=",
"1",
")",
".",
"T"
] | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | manhattan_distance | !
@brief Calculate Manhattan distance between between two vectors.
\f[
dist(a, b) = \sum_{i=0}^{N}\left | a_{i} - b_{i} \right |;
\f]
@param[in] point1 (array_like): The first vector.
@param[in] point2 (array_like): The second vector.
@return (double) Manhattan distance between ... | pyclustering/utils/metric.py | def manhattan_distance(point1, point2):
"""!
@brief Calculate Manhattan distance between between two vectors.
\f[
dist(a, b) = \sum_{i=0}^{N}\left | a_{i} - b_{i} \right |;
\f]
@param[in] point1 (array_like): The first vector.
@param[in] point2 (array_like): The second vector.
... | def manhattan_distance(point1, point2):
"""!
@brief Calculate Manhattan distance between between two vectors.
\f[
dist(a, b) = \sum_{i=0}^{N}\left | a_{i} - b_{i} \right |;
\f]
@param[in] point1 (array_like): The first vector.
@param[in] point2 (array_like): The second vector.
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/metric.py#L351-L373 | [
"def",
"manhattan_distance",
"(",
"point1",
",",
"point2",
")",
":",
"distance",
"=",
"0.0",
"dimension",
"=",
"len",
"(",
"point1",
")",
"for",
"i",
"in",
"range",
"(",
"dimension",
")",
":",
"distance",
"+=",
"abs",
"(",
"point1",
"[",
"i",
"]",
"-... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | manhattan_distance_numpy | !
@brief Calculate Manhattan distance between two objects using numpy.
@param[in] object1 (array_like): The first array_like object.
@param[in] object2 (array_like): The second array_like object.
@return (double) Manhattan distance between two objects. | pyclustering/utils/metric.py | def manhattan_distance_numpy(object1, object2):
"""!
@brief Calculate Manhattan distance between two objects using numpy.
@param[in] object1 (array_like): The first array_like object.
@param[in] object2 (array_like): The second array_like object.
@return (double) Manhattan distance between ... | def manhattan_distance_numpy(object1, object2):
"""!
@brief Calculate Manhattan distance between two objects using numpy.
@param[in] object1 (array_like): The first array_like object.
@param[in] object2 (array_like): The second array_like object.
@return (double) Manhattan distance between ... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/metric.py#L376-L386 | [
"def",
"manhattan_distance_numpy",
"(",
"object1",
",",
"object2",
")",
":",
"return",
"numpy",
".",
"sum",
"(",
"numpy",
".",
"absolute",
"(",
"object1",
"-",
"object2",
")",
",",
"axis",
"=",
"1",
")",
".",
"T"
] | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | chebyshev_distance | !
@brief Calculate Chebyshev distance between between two vectors.
\f[
dist(a, b) = \max_{}i\left (\left | a_{i} - b_{i} \right |\right );
\f]
@param[in] point1 (array_like): The first vector.
@param[in] point2 (array_like): The second vector.
@return (double) Chebyshev distance... | pyclustering/utils/metric.py | def chebyshev_distance(point1, point2):
"""!
@brief Calculate Chebyshev distance between between two vectors.
\f[
dist(a, b) = \max_{}i\left (\left | a_{i} - b_{i} \right |\right );
\f]
@param[in] point1 (array_like): The first vector.
@param[in] point2 (array_like): The second ve... | def chebyshev_distance(point1, point2):
"""!
@brief Calculate Chebyshev distance between between two vectors.
\f[
dist(a, b) = \max_{}i\left (\left | a_{i} - b_{i} \right |\right );
\f]
@param[in] point1 (array_like): The first vector.
@param[in] point2 (array_like): The second ve... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/metric.py#L389-L411 | [
"def",
"chebyshev_distance",
"(",
"point1",
",",
"point2",
")",
":",
"distance",
"=",
"0.0",
"dimension",
"=",
"len",
"(",
"point1",
")",
"for",
"i",
"in",
"range",
"(",
"dimension",
")",
":",
"distance",
"=",
"max",
"(",
"distance",
",",
"abs",
"(",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | chebyshev_distance_numpy | !
@brief Calculate Chebyshev distance between two objects using numpy.
@param[in] object1 (array_like): The first array_like object.
@param[in] object2 (array_like): The second array_like object.
@return (double) Chebyshev distance between two objects. | pyclustering/utils/metric.py | def chebyshev_distance_numpy(object1, object2):
"""!
@brief Calculate Chebyshev distance between two objects using numpy.
@param[in] object1 (array_like): The first array_like object.
@param[in] object2 (array_like): The second array_like object.
@return (double) Chebyshev distance between ... | def chebyshev_distance_numpy(object1, object2):
"""!
@brief Calculate Chebyshev distance between two objects using numpy.
@param[in] object1 (array_like): The first array_like object.
@param[in] object2 (array_like): The second array_like object.
@return (double) Chebyshev distance between ... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/metric.py#L414-L424 | [
"def",
"chebyshev_distance_numpy",
"(",
"object1",
",",
"object2",
")",
":",
"return",
"numpy",
".",
"max",
"(",
"numpy",
".",
"absolute",
"(",
"object1",
"-",
"object2",
")",
",",
"axis",
"=",
"1",
")",
".",
"T"
] | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | minkowski_distance | !
@brief Calculate Minkowski distance between two vectors.
\f[
dist(a, b) = \sqrt[p]{ \sum_{i=0}^{N}\left(a_{i} - b_{i}\right)^{p} };
\f]
@param[in] point1 (array_like): The first vector.
@param[in] point2 (array_like): The second vector.
@param[in] degree (numeric): Degree of tha... | pyclustering/utils/metric.py | def minkowski_distance(point1, point2, degree=2):
"""!
@brief Calculate Minkowski distance between two vectors.
\f[
dist(a, b) = \sqrt[p]{ \sum_{i=0}^{N}\left(a_{i} - b_{i}\right)^{p} };
\f]
@param[in] point1 (array_like): The first vector.
@param[in] point2 (array_like): The seco... | def minkowski_distance(point1, point2, degree=2):
"""!
@brief Calculate Minkowski distance between two vectors.
\f[
dist(a, b) = \sqrt[p]{ \sum_{i=0}^{N}\left(a_{i} - b_{i}\right)^{p} };
\f]
@param[in] point1 (array_like): The first vector.
@param[in] point2 (array_like): The seco... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/metric.py#L427-L448 | [
"def",
"minkowski_distance",
"(",
"point1",
",",
"point2",
",",
"degree",
"=",
"2",
")",
":",
"distance",
"=",
"0.0",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"point1",
")",
")",
":",
"distance",
"+=",
"(",
"point1",
"[",
"i",
"]",
"-",
"point2"... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | minkowski_distance_numpy | !
@brief Calculate Minkowski distance between objects using numpy.
@param[in] object1 (array_like): The first array_like object.
@param[in] object2 (array_like): The second array_like object.
@param[in] degree (numeric): Degree of that is used for Minkowski distance.
@return (double) Minkow... | pyclustering/utils/metric.py | def minkowski_distance_numpy(object1, object2, degree=2):
"""!
@brief Calculate Minkowski distance between objects using numpy.
@param[in] object1 (array_like): The first array_like object.
@param[in] object2 (array_like): The second array_like object.
@param[in] degree (numeric): Degree of t... | def minkowski_distance_numpy(object1, object2, degree=2):
"""!
@brief Calculate Minkowski distance between objects using numpy.
@param[in] object1 (array_like): The first array_like object.
@param[in] object2 (array_like): The second array_like object.
@param[in] degree (numeric): Degree of t... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/metric.py#L451-L462 | [
"def",
"minkowski_distance_numpy",
"(",
"object1",
",",
"object2",
",",
"degree",
"=",
"2",
")",
":",
"return",
"numpy",
".",
"sum",
"(",
"numpy",
".",
"power",
"(",
"numpy",
".",
"power",
"(",
"object1",
"-",
"object2",
",",
"degree",
")",
",",
"1",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | canberra_distance_numpy | !
@brief Calculate Canberra distance between two objects using numpy.
@param[in] object1 (array_like): The first vector.
@param[in] object2 (array_like): The second vector.
@return (float) Canberra distance between two objects. | pyclustering/utils/metric.py | def canberra_distance_numpy(object1, object2):
"""!
@brief Calculate Canberra distance between two objects using numpy.
@param[in] object1 (array_like): The first vector.
@param[in] object2 (array_like): The second vector.
@return (float) Canberra distance between two objects.
"""
... | def canberra_distance_numpy(object1, object2):
"""!
@brief Calculate Canberra distance between two objects using numpy.
@param[in] object1 (array_like): The first vector.
@param[in] object2 (array_like): The second vector.
@return (float) Canberra distance between two objects.
"""
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/metric.py#L490-L506 | [
"def",
"canberra_distance_numpy",
"(",
"object1",
",",
"object2",
")",
":",
"with",
"numpy",
".",
"errstate",
"(",
"divide",
"=",
"'ignore'",
",",
"invalid",
"=",
"'ignore'",
")",
":",
"result",
"=",
"numpy",
".",
"divide",
"(",
"numpy",
".",
"abs",
"(",... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | chi_square_distance | !
@brief Calculate Chi square distance between two vectors.
\f[
dist(a, b) = \sum_{i=0}^{N}\frac{\left ( a_{i} - b_{i} \right )^{2}}{\left | a_{i} \right | + \left | b_{i} \right |};
\f]
@param[in] point1 (array_like): The first vector.
@param[in] point2 (array_like): The second vector... | pyclustering/utils/metric.py | def chi_square_distance(point1, point2):
"""!
@brief Calculate Chi square distance between two vectors.
\f[
dist(a, b) = \sum_{i=0}^{N}\frac{\left ( a_{i} - b_{i} \right )^{2}}{\left | a_{i} \right | + \left | b_{i} \right |};
\f]
@param[in] point1 (array_like): The first vector.
... | def chi_square_distance(point1, point2):
"""!
@brief Calculate Chi square distance between two vectors.
\f[
dist(a, b) = \sum_{i=0}^{N}\frac{\left ( a_{i} - b_{i} \right )^{2}}{\left | a_{i} \right | + \left | b_{i} \right |};
\f]
@param[in] point1 (array_like): The first vector.
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/metric.py#L509-L531 | [
"def",
"chi_square_distance",
"(",
"point1",
",",
"point2",
")",
":",
"distance",
"=",
"0.0",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"point1",
")",
")",
":",
"divider",
"=",
"abs",
"(",
"point1",
"[",
"i",
"]",
")",
"+",
"abs",
"(",
"point2",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | distance_metric.enable_numpy_usage | !
@brief Start numpy for distance calculation.
@details Useful in case matrices to increase performance. No effect in case of type_metric.USER_DEFINED type. | pyclustering/utils/metric.py | def enable_numpy_usage(self):
"""!
@brief Start numpy for distance calculation.
@details Useful in case matrices to increase performance. No effect in case of type_metric.USER_DEFINED type.
"""
self.__numpy = True
if self.__type != type_metric.USER_DEFINED:
... | def enable_numpy_usage(self):
"""!
@brief Start numpy for distance calculation.
@details Useful in case matrices to increase performance. No effect in case of type_metric.USER_DEFINED type.
"""
self.__numpy = True
if self.__type != type_metric.USER_DEFINED:
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/metric.py#L173-L181 | [
"def",
"enable_numpy_usage",
"(",
"self",
")",
":",
"self",
".",
"__numpy",
"=",
"True",
"if",
"self",
".",
"__type",
"!=",
"type_metric",
".",
"USER_DEFINED",
":",
"self",
".",
"__calculator",
"=",
"self",
".",
"__create_distance_calculator",
"(",
")"
] | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | distance_metric.__create_distance_calculator_basic | !
@brief Creates distance metric calculator that does not use numpy.
@return (callable) Callable object of distance metric calculator. | pyclustering/utils/metric.py | def __create_distance_calculator_basic(self):
"""!
@brief Creates distance metric calculator that does not use numpy.
@return (callable) Callable object of distance metric calculator.
"""
if self.__type == type_metric.EUCLIDEAN:
return euclidean_distance
... | def __create_distance_calculator_basic(self):
"""!
@brief Creates distance metric calculator that does not use numpy.
@return (callable) Callable object of distance metric calculator.
"""
if self.__type == type_metric.EUCLIDEAN:
return euclidean_distance
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/metric.py#L208-L240 | [
"def",
"__create_distance_calculator_basic",
"(",
"self",
")",
":",
"if",
"self",
".",
"__type",
"==",
"type_metric",
".",
"EUCLIDEAN",
":",
"return",
"euclidean_distance",
"elif",
"self",
".",
"__type",
"==",
"type_metric",
".",
"EUCLIDEAN_SQUARE",
":",
"return",... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | distance_metric.__create_distance_calculator_numpy | !
@brief Creates distance metric calculator that uses numpy.
@return (callable) Callable object of distance metric calculator. | pyclustering/utils/metric.py | def __create_distance_calculator_numpy(self):
"""!
@brief Creates distance metric calculator that uses numpy.
@return (callable) Callable object of distance metric calculator.
"""
if self.__type == type_metric.EUCLIDEAN:
return euclidean_distance_numpy
... | def __create_distance_calculator_numpy(self):
"""!
@brief Creates distance metric calculator that uses numpy.
@return (callable) Callable object of distance metric calculator.
"""
if self.__type == type_metric.EUCLIDEAN:
return euclidean_distance_numpy
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/utils/metric.py#L243-L275 | [
"def",
"__create_distance_calculator_numpy",
"(",
"self",
")",
":",
"if",
"self",
".",
"__type",
"==",
"type_metric",
".",
"EUCLIDEAN",
":",
"return",
"euclidean_distance_numpy",
"elif",
"self",
".",
"__type",
"==",
"type_metric",
".",
"EUCLIDEAN_SQUARE",
":",
"re... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | fsync_dynamic.extract_number_oscillations | !
@brief Extracts number of oscillations of specified oscillator.
@param[in] index (uint): Index of oscillator whose dynamic is considered.
@param[in] amplitude_threshold (double): Amplitude threshold when oscillation is taken into account, for example,
when osc... | pyclustering/nnet/fsync.py | def extract_number_oscillations(self, index, amplitude_threshold):
"""!
@brief Extracts number of oscillations of specified oscillator.
@param[in] index (uint): Index of oscillator whose dynamic is considered.
@param[in] amplitude_threshold (double): Amplitude threshold whe... | def extract_number_oscillations(self, index, amplitude_threshold):
"""!
@brief Extracts number of oscillations of specified oscillator.
@param[in] index (uint): Index of oscillator whose dynamic is considered.
@param[in] amplitude_threshold (double): Amplitude threshold whe... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/nnet/fsync.py#L114-L126 | [
"def",
"extract_number_oscillations",
"(",
"self",
",",
"index",
",",
"amplitude_threshold",
")",
":",
"return",
"pyclustering",
".",
"utils",
".",
"extract_number_oscillations",
"(",
"self",
".",
"__amplitude",
",",
"index",
",",
"amplitude_threshold",
")"
] | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | fsync_visualizer.show_output_dynamic | !
@brief Shows output dynamic (output of each oscillator) during simulation.
@param[in] fsync_output_dynamic (fsync_dynamic): Output dynamic of the fSync network.
@see show_output_dynamics | pyclustering/nnet/fsync.py | def show_output_dynamic(fsync_output_dynamic):
"""!
@brief Shows output dynamic (output of each oscillator) during simulation.
@param[in] fsync_output_dynamic (fsync_dynamic): Output dynamic of the fSync network.
@see show_output_dynamics
"""
... | def show_output_dynamic(fsync_output_dynamic):
"""!
@brief Shows output dynamic (output of each oscillator) during simulation.
@param[in] fsync_output_dynamic (fsync_dynamic): Output dynamic of the fSync network.
@see show_output_dynamics
"""
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/nnet/fsync.py#L137-L147 | [
"def",
"show_output_dynamic",
"(",
"fsync_output_dynamic",
")",
":",
"pyclustering",
".",
"utils",
".",
"draw_dynamics",
"(",
"fsync_output_dynamic",
".",
"time",
",",
"fsync_output_dynamic",
".",
"output",
",",
"x_title",
"=",
"\"t\"",
",",
"y_title",
"=",
"\"amp... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | fsync_network.simulate | !
@brief Performs static simulation of oscillatory network.
@param[in] steps (uint): Number simulation steps.
@param[in] time (double): Time of simulation.
@param[in] collect_dynamic (bool): If True - returns whole dynamic of oscillatory network, otherwise returns only last... | pyclustering/nnet/fsync.py | def simulate(self, steps, time, collect_dynamic = False):
"""!
@brief Performs static simulation of oscillatory network.
@param[in] steps (uint): Number simulation steps.
@param[in] time (double): Time of simulation.
@param[in] collect_dynamic (bool): If True - ret... | def simulate(self, steps, time, collect_dynamic = False):
"""!
@brief Performs static simulation of oscillatory network.
@param[in] steps (uint): Number simulation steps.
@param[in] time (double): Time of simulation.
@param[in] collect_dynamic (bool): If True - ret... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/nnet/fsync.py#L232-L265 | [
"def",
"simulate",
"(",
"self",
",",
"steps",
",",
"time",
",",
"collect_dynamic",
"=",
"False",
")",
":",
"dynamic_amplitude",
",",
"dynamic_time",
"=",
"(",
"[",
"]",
",",
"[",
"]",
")",
"if",
"collect_dynamic",
"is",
"False",
"else",
"(",
"[",
"self... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | fsync_network.__calculate | !
@brief Calculates new amplitudes for oscillators in the network in line with current step.
@param[in] t (double): Time of simulation.
@param[in] step (double): Step of solution at the end of which states of oscillators should be calculated.
@param[in] int_step (double): S... | pyclustering/nnet/fsync.py | def __calculate(self, t, step, int_step):
"""!
@brief Calculates new amplitudes for oscillators in the network in line with current step.
@param[in] t (double): Time of simulation.
@param[in] step (double): Step of solution at the end of which states of oscillators should b... | def __calculate(self, t, step, int_step):
"""!
@brief Calculates new amplitudes for oscillators in the network in line with current step.
@param[in] t (double): Time of simulation.
@param[in] step (double): Step of solution at the end of which states of oscillators should b... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/nnet/fsync.py#L268-L287 | [
"def",
"__calculate",
"(",
"self",
",",
"t",
",",
"step",
",",
"int_step",
")",
":",
"next_amplitudes",
"=",
"[",
"0.0",
"]",
"*",
"self",
".",
"_num_osc",
"for",
"index",
"in",
"range",
"(",
"0",
",",
"self",
".",
"_num_osc",
",",
"1",
")",
":",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | fsync_network.__oscillator_property | !
@brief Calculate Landau-Stuart oscillator constant property that is based on frequency and radius.
@param[in] index (uint): Oscillator index whose property is calculated.
@return (double) Oscillator property. | pyclustering/nnet/fsync.py | def __oscillator_property(self, index):
"""!
@brief Calculate Landau-Stuart oscillator constant property that is based on frequency and radius.
@param[in] index (uint): Oscillator index whose property is calculated.
@return (double) Oscillator property.
... | def __oscillator_property(self, index):
"""!
@brief Calculate Landau-Stuart oscillator constant property that is based on frequency and radius.
@param[in] index (uint): Oscillator index whose property is calculated.
@return (double) Oscillator property.
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/nnet/fsync.py#L290-L300 | [
"def",
"__oscillator_property",
"(",
"self",
",",
"index",
")",
":",
"return",
"numpy",
".",
"array",
"(",
"1j",
"*",
"self",
".",
"__frequency",
"[",
"index",
"]",
"+",
"self",
".",
"__radius",
"[",
"index",
"]",
"**",
"2",
",",
"dtype",
"=",
"numpy... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | fsync_network.__landau_stuart | !
@brief Calculate Landau-Stuart state.
@param[in] amplitude (double): Current amplitude of oscillator.
@param[in] index (uint): Oscillator index whose state is calculated.
@return (double) Landau-Stuart state. | pyclustering/nnet/fsync.py | def __landau_stuart(self, amplitude, index):
"""!
@brief Calculate Landau-Stuart state.
@param[in] amplitude (double): Current amplitude of oscillator.
@param[in] index (uint): Oscillator index whose state is calculated.
@return (double) Landau-Stuart st... | def __landau_stuart(self, amplitude, index):
"""!
@brief Calculate Landau-Stuart state.
@param[in] amplitude (double): Current amplitude of oscillator.
@param[in] index (uint): Oscillator index whose state is calculated.
@return (double) Landau-Stuart st... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/nnet/fsync.py#L303-L314 | [
"def",
"__landau_stuart",
"(",
"self",
",",
"amplitude",
",",
"index",
")",
":",
"return",
"(",
"self",
".",
"__properties",
"[",
"index",
"]",
"-",
"numpy",
".",
"absolute",
"(",
"amplitude",
")",
"**",
"2",
")",
"*",
"amplitude"
] | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | fsync_network.__synchronization_mechanism | !
@brief Calculate synchronization part using Kuramoto synchronization mechanism.
@param[in] amplitude (double): Current amplitude of oscillator.
@param[in] index (uint): Oscillator index whose synchronization influence is calculated.
@return (double) Synchronizat... | pyclustering/nnet/fsync.py | def __synchronization_mechanism(self, amplitude, index):
"""!
@brief Calculate synchronization part using Kuramoto synchronization mechanism.
@param[in] amplitude (double): Current amplitude of oscillator.
@param[in] index (uint): Oscillator index whose synchronization infl... | def __synchronization_mechanism(self, amplitude, index):
"""!
@brief Calculate synchronization part using Kuramoto synchronization mechanism.
@param[in] amplitude (double): Current amplitude of oscillator.
@param[in] index (uint): Oscillator index whose synchronization infl... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/nnet/fsync.py#L317-L335 | [
"def",
"__synchronization_mechanism",
"(",
"self",
",",
"amplitude",
",",
"index",
")",
":",
"sync_influence",
"=",
"0.0",
"for",
"k",
"in",
"range",
"(",
"self",
".",
"_num_osc",
")",
":",
"if",
"self",
".",
"has_connection",
"(",
"index",
",",
"k",
")"... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | fsync_network.__calculate_amplitude | !
@brief Returns new amplitude value for particular oscillator that is defined by index that is in 'argv' argument.
@details The method is used for differential calculation.
@param[in] amplitude (double): Current amplitude of oscillator.
@param[in] t (double): Current time ... | pyclustering/nnet/fsync.py | def __calculate_amplitude(self, amplitude, t, argv):
"""!
@brief Returns new amplitude value for particular oscillator that is defined by index that is in 'argv' argument.
@details The method is used for differential calculation.
@param[in] amplitude (double): Current ampli... | def __calculate_amplitude(self, amplitude, t, argv):
"""!
@brief Returns new amplitude value for particular oscillator that is defined by index that is in 'argv' argument.
@details The method is used for differential calculation.
@param[in] amplitude (double): Current ampli... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/nnet/fsync.py#L338-L354 | [
"def",
"__calculate_amplitude",
"(",
"self",
",",
"amplitude",
",",
"t",
",",
"argv",
")",
":",
"z",
"=",
"amplitude",
".",
"view",
"(",
"numpy",
".",
"complex",
")",
"dzdt",
"=",
"self",
".",
"__landau_stuart",
"(",
"z",
",",
"argv",
")",
"+",
"self... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | small_mind_image_recognition | !
@brief Trains network using letters 'M', 'I', 'N', 'D' and recognize each of them with and without noise. | pyclustering/nnet/examples/syncpr_examples.py | def small_mind_image_recognition():
"""!
@brief Trains network using letters 'M', 'I', 'N', 'D' and recognize each of them with and without noise.
"""
images = [];
images += IMAGE_SYMBOL_SAMPLES.LIST_IMAGES_SYMBOL_M;
images += IMAGE_SYMBOL_SAMPLES.LIST_IMAGES_SYMBOL_I;
images +=... | def small_mind_image_recognition():
"""!
@brief Trains network using letters 'M', 'I', 'N', 'D' and recognize each of them with and without noise.
"""
images = [];
images += IMAGE_SYMBOL_SAMPLES.LIST_IMAGES_SYMBOL_M;
images += IMAGE_SYMBOL_SAMPLES.LIST_IMAGES_SYMBOL_I;
images +=... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/nnet/examples/syncpr_examples.py#L79-L90 | [
"def",
"small_mind_image_recognition",
"(",
")",
":",
"images",
"=",
"[",
"]",
"images",
"+=",
"IMAGE_SYMBOL_SAMPLES",
".",
"LIST_IMAGES_SYMBOL_M",
"images",
"+=",
"IMAGE_SYMBOL_SAMPLES",
".",
"LIST_IMAGES_SYMBOL_I",
"images",
"+=",
"IMAGE_SYMBOL_SAMPLES",
".",
"LIST_IM... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | small_abc_image_recognition | !
@brief Trains network using letters 'A', 'B', 'C', and recognize each of them with and without noise. | pyclustering/nnet/examples/syncpr_examples.py | def small_abc_image_recognition():
"""!
@brief Trains network using letters 'A', 'B', 'C', and recognize each of them with and without noise.
"""
images = [];
images += IMAGE_SYMBOL_SAMPLES.LIST_IMAGES_SYMBOL_A;
images += IMAGE_SYMBOL_SAMPLES.LIST_IMAGES_SYMBOL_B;
images += IMAG... | def small_abc_image_recognition():
"""!
@brief Trains network using letters 'A', 'B', 'C', and recognize each of them with and without noise.
"""
images = [];
images += IMAGE_SYMBOL_SAMPLES.LIST_IMAGES_SYMBOL_A;
images += IMAGE_SYMBOL_SAMPLES.LIST_IMAGES_SYMBOL_B;
images += IMAG... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/nnet/examples/syncpr_examples.py#L93-L103 | [
"def",
"small_abc_image_recognition",
"(",
")",
":",
"images",
"=",
"[",
"]",
"images",
"+=",
"IMAGE_SYMBOL_SAMPLES",
".",
"LIST_IMAGES_SYMBOL_A",
"images",
"+=",
"IMAGE_SYMBOL_SAMPLES",
".",
"LIST_IMAGES_SYMBOL_B",
"images",
"+=",
"IMAGE_SYMBOL_SAMPLES",
".",
"LIST_IMA... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | small_ftk_image_recognition | !
@brief Trains network using letters 'F', 'T', 'K' and recognize each of them with and without noise. | pyclustering/nnet/examples/syncpr_examples.py | def small_ftk_image_recognition():
"""!
@brief Trains network using letters 'F', 'T', 'K' and recognize each of them with and without noise.
"""
images = [];
images += IMAGE_SYMBOL_SAMPLES.LIST_IMAGES_SYMBOL_F;
images += IMAGE_SYMBOL_SAMPLES.LIST_IMAGES_SYMBOL_T;
images += IMAGE... | def small_ftk_image_recognition():
"""!
@brief Trains network using letters 'F', 'T', 'K' and recognize each of them with and without noise.
"""
images = [];
images += IMAGE_SYMBOL_SAMPLES.LIST_IMAGES_SYMBOL_F;
images += IMAGE_SYMBOL_SAMPLES.LIST_IMAGES_SYMBOL_T;
images += IMAGE... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/nnet/examples/syncpr_examples.py#L106-L116 | [
"def",
"small_ftk_image_recognition",
"(",
")",
":",
"images",
"=",
"[",
"]",
"images",
"+=",
"IMAGE_SYMBOL_SAMPLES",
".",
"LIST_IMAGES_SYMBOL_F",
"images",
"+=",
"IMAGE_SYMBOL_SAMPLES",
".",
"LIST_IMAGES_SYMBOL_T",
"images",
"+=",
"IMAGE_SYMBOL_SAMPLES",
".",
"LIST_IMA... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | ga_math.get_clusters_representation | Convert chromosome to cluster representation:
chromosome : [0, 1, 1, 0, 2, 3, 3]
clusters: [[0, 3], [1, 2], [4], [5, 6]] | pyclustering/cluster/ga_maths.py | def get_clusters_representation(chromosome, count_clusters=None):
""" Convert chromosome to cluster representation:
chromosome : [0, 1, 1, 0, 2, 3, 3]
clusters: [[0, 3], [1, 2], [4], [5, 6]]
"""
if count_clusters is None:
count_clusters = ga_math.calc... | def get_clusters_representation(chromosome, count_clusters=None):
""" Convert chromosome to cluster representation:
chromosome : [0, 1, 1, 0, 2, 3, 3]
clusters: [[0, 3], [1, 2], [4], [5, 6]]
"""
if count_clusters is None:
count_clusters = ga_math.calc... | [
"Convert",
"chromosome",
"to",
"cluster",
"representation",
":",
"chromosome",
":",
"[",
"0",
"1",
"1",
"0",
"2",
"3",
"3",
"]",
"clusters",
":",
"[[",
"0",
"3",
"]",
"[",
"1",
"2",
"]",
"[",
"4",
"]",
"[",
"5",
"6",
"]]"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/ga_maths.py#L41-L57 | [
"def",
"get_clusters_representation",
"(",
"chromosome",
",",
"count_clusters",
"=",
"None",
")",
":",
"if",
"count_clusters",
"is",
"None",
":",
"count_clusters",
"=",
"ga_math",
".",
"calc_count_centers",
"(",
"chromosome",
")",
"# Initialize empty clusters",
"clust... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | ga_math.get_centres | ! | pyclustering/cluster/ga_maths.py | def get_centres(chromosomes, data, count_clusters):
"""!
"""
centres = ga_math.calc_centers(chromosomes, data, count_clusters)
return centres | def get_centres(chromosomes, data, count_clusters):
"""!
"""
centres = ga_math.calc_centers(chromosomes, data, count_clusters)
return centres | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/ga_maths.py#L60-L66 | [
"def",
"get_centres",
"(",
"chromosomes",
",",
"data",
",",
"count_clusters",
")",
":",
"centres",
"=",
"ga_math",
".",
"calc_centers",
"(",
"chromosomes",
",",
"data",
",",
"count_clusters",
")",
"return",
"centres"
] | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | ga_math.calc_centers | ! | pyclustering/cluster/ga_maths.py | def calc_centers(chromosomes, data, count_clusters=None):
"""!
"""
if count_clusters is None:
count_clusters = ga_math.calc_count_centers(chromosomes[0])
# Initialize center
centers = np.zeros(shape=(len(chromosomes), count_clusters, len(data[0])))
for _idx... | def calc_centers(chromosomes, data, count_clusters=None):
"""!
"""
if count_clusters is None:
count_clusters = ga_math.calc_count_centers(chromosomes[0])
# Initialize center
centers = np.zeros(shape=(len(chromosomes), count_clusters, len(data[0])))
for _idx... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/ga_maths.py#L69-L96 | [
"def",
"calc_centers",
"(",
"chromosomes",
",",
"data",
",",
"count_clusters",
"=",
"None",
")",
":",
"if",
"count_clusters",
"is",
"None",
":",
"count_clusters",
"=",
"ga_math",
".",
"calc_count_centers",
"(",
"chromosomes",
"[",
"0",
"]",
")",
"# Initialize ... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | ga_math.calc_probability_vector | ! | pyclustering/cluster/ga_maths.py | def calc_probability_vector(fitness):
"""!
"""
if len(fitness) == 0:
raise AttributeError("Has no any fitness functions.")
# Get 1/fitness function
inv_fitness = np.zeros(len(fitness))
#
for _idx in range(len(inv_fitness)):
if fitness[_... | def calc_probability_vector(fitness):
"""!
"""
if len(fitness) == 0:
raise AttributeError("Has no any fitness functions.")
# Get 1/fitness function
inv_fitness = np.zeros(len(fitness))
#
for _idx in range(len(inv_fitness)):
if fitness[_... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/ga_maths.py#L99-L132 | [
"def",
"calc_probability_vector",
"(",
"fitness",
")",
":",
"if",
"len",
"(",
"fitness",
")",
"==",
"0",
":",
"raise",
"AttributeError",
"(",
"\"Has no any fitness functions.\"",
")",
"# Get 1/fitness function",
"inv_fitness",
"=",
"np",
".",
"zeros",
"(",
"len",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | ga_math.set_last_value_to_one | !
@brief Update the last same probabilities to one.
@details All values of probability list equals to the last element are set to 1. | pyclustering/cluster/ga_maths.py | def set_last_value_to_one(probabilities):
"""!
@brief Update the last same probabilities to one.
@details All values of probability list equals to the last element are set to 1.
"""
# Start from the last elem
back_idx = - 1
# All values equal to the las... | def set_last_value_to_one(probabilities):
"""!
@brief Update the last same probabilities to one.
@details All values of probability list equals to the last element are set to 1.
"""
# Start from the last elem
back_idx = - 1
# All values equal to the las... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/ga_maths.py#L135-L153 | [
"def",
"set_last_value_to_one",
"(",
"probabilities",
")",
":",
"# Start from the last elem",
"back_idx",
"=",
"-",
"1",
"# All values equal to the last elem should be set to 1",
"last_val",
"=",
"probabilities",
"[",
"back_idx",
"]",
"# for all elements or if a elem not equal to... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | ga_math.get_uniform | !
@brief Returns index in probabilities.
@param[in] probabilities (list): List with segments in increasing sequence with val in [0, 1],
for example, [0 0.1 0.2 0.3 1.0]. | pyclustering/cluster/ga_maths.py | def get_uniform(probabilities):
"""!
@brief Returns index in probabilities.
@param[in] probabilities (list): List with segments in increasing sequence with val in [0, 1],
for example, [0 0.1 0.2 0.3 1.0].
"""
# Initialize return value
res_idx = None
... | def get_uniform(probabilities):
"""!
@brief Returns index in probabilities.
@param[in] probabilities (list): List with segments in increasing sequence with val in [0, 1],
for example, [0 0.1 0.2 0.3 1.0].
"""
# Initialize return value
res_idx = None
... | [
"!",
"@brief",
"Returns",
"index",
"in",
"probabilities",
"."
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/ga_maths.py#L156-L180 | [
"def",
"get_uniform",
"(",
"probabilities",
")",
":",
"# Initialize return value",
"res_idx",
"=",
"None",
"# Get random num in range [0, 1)",
"random_num",
"=",
"np",
".",
"random",
".",
"rand",
"(",
")",
"# Find segment with val1 < random_num < val2",
"for",
"_idx",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | cluster_sample1 | Start with wrong number of clusters. | pyclustering/cluster/examples/xmeans_examples.py | def cluster_sample1():
"Start with wrong number of clusters."
start_centers = [[3.7, 5.5]]
template_clustering(start_centers, SIMPLE_SAMPLES.SAMPLE_SIMPLE1, criterion = splitting_type.BAYESIAN_INFORMATION_CRITERION)
template_clustering(start_centers, SIMPLE_SAMPLES.SAMPLE_SIMPLE1, criterion = splitt... | def cluster_sample1():
"Start with wrong number of clusters."
start_centers = [[3.7, 5.5]]
template_clustering(start_centers, SIMPLE_SAMPLES.SAMPLE_SIMPLE1, criterion = splitting_type.BAYESIAN_INFORMATION_CRITERION)
template_clustering(start_centers, SIMPLE_SAMPLES.SAMPLE_SIMPLE1, criterion = splitt... | [
"Start",
"with",
"wrong",
"number",
"of",
"clusters",
"."
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/examples/xmeans_examples.py#L60-L64 | [
"def",
"cluster_sample1",
"(",
")",
":",
"start_centers",
"=",
"[",
"[",
"3.7",
",",
"5.5",
"]",
"]",
"template_clustering",
"(",
"start_centers",
",",
"SIMPLE_SAMPLES",
".",
"SAMPLE_SIMPLE1",
",",
"criterion",
"=",
"splitting_type",
".",
"BAYESIAN_INFORMATION_CRI... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | cluster_sample2 | Start with wrong number of clusters. | pyclustering/cluster/examples/xmeans_examples.py | def cluster_sample2():
"Start with wrong number of clusters."
start_centers = [[3.5, 4.8], [2.6, 2.5]]
template_clustering(start_centers, SIMPLE_SAMPLES.SAMPLE_SIMPLE2, criterion = splitting_type.BAYESIAN_INFORMATION_CRITERION)
template_clustering(start_centers, SIMPLE_SAMPLES.SAMPLE_SIMPLE2, criter... | def cluster_sample2():
"Start with wrong number of clusters."
start_centers = [[3.5, 4.8], [2.6, 2.5]]
template_clustering(start_centers, SIMPLE_SAMPLES.SAMPLE_SIMPLE2, criterion = splitting_type.BAYESIAN_INFORMATION_CRITERION)
template_clustering(start_centers, SIMPLE_SAMPLES.SAMPLE_SIMPLE2, criter... | [
"Start",
"with",
"wrong",
"number",
"of",
"clusters",
"."
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/examples/xmeans_examples.py#L70-L74 | [
"def",
"cluster_sample2",
"(",
")",
":",
"start_centers",
"=",
"[",
"[",
"3.5",
",",
"4.8",
"]",
",",
"[",
"2.6",
",",
"2.5",
"]",
"]",
"template_clustering",
"(",
"start_centers",
",",
"SIMPLE_SAMPLES",
".",
"SAMPLE_SIMPLE2",
",",
"criterion",
"=",
"split... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | cluster_sample3 | Start with wrong number of clusters. | pyclustering/cluster/examples/xmeans_examples.py | def cluster_sample3():
"Start with wrong number of clusters."
start_centers = [[0.2, 0.1], [4.0, 1.0]]
template_clustering(start_centers, SIMPLE_SAMPLES.SAMPLE_SIMPLE3, criterion = splitting_type.BAYESIAN_INFORMATION_CRITERION)
template_clustering(start_centers, SIMPLE_SAMPLES.SAMPLE_SIMPLE3, criter... | def cluster_sample3():
"Start with wrong number of clusters."
start_centers = [[0.2, 0.1], [4.0, 1.0]]
template_clustering(start_centers, SIMPLE_SAMPLES.SAMPLE_SIMPLE3, criterion = splitting_type.BAYESIAN_INFORMATION_CRITERION)
template_clustering(start_centers, SIMPLE_SAMPLES.SAMPLE_SIMPLE3, criter... | [
"Start",
"with",
"wrong",
"number",
"of",
"clusters",
"."
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/examples/xmeans_examples.py#L80-L84 | [
"def",
"cluster_sample3",
"(",
")",
":",
"start_centers",
"=",
"[",
"[",
"0.2",
",",
"0.1",
"]",
",",
"[",
"4.0",
",",
"1.0",
"]",
"]",
"template_clustering",
"(",
"start_centers",
",",
"SIMPLE_SAMPLES",
".",
"SAMPLE_SIMPLE3",
",",
"criterion",
"=",
"split... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | cluster_sample5 | Start with wrong number of clusters. | pyclustering/cluster/examples/xmeans_examples.py | def cluster_sample5():
"Start with wrong number of clusters."
start_centers = [[0.0, 1.0], [0.0, 0.0]]
template_clustering(start_centers, SIMPLE_SAMPLES.SAMPLE_SIMPLE5, criterion = splitting_type.BAYESIAN_INFORMATION_CRITERION)
template_clustering(start_centers, SIMPLE_SAMPLES.SAMPLE_SIMPLE5, criter... | def cluster_sample5():
"Start with wrong number of clusters."
start_centers = [[0.0, 1.0], [0.0, 0.0]]
template_clustering(start_centers, SIMPLE_SAMPLES.SAMPLE_SIMPLE5, criterion = splitting_type.BAYESIAN_INFORMATION_CRITERION)
template_clustering(start_centers, SIMPLE_SAMPLES.SAMPLE_SIMPLE5, criter... | [
"Start",
"with",
"wrong",
"number",
"of",
"clusters",
"."
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/examples/xmeans_examples.py#L99-L103 | [
"def",
"cluster_sample5",
"(",
")",
":",
"start_centers",
"=",
"[",
"[",
"0.0",
",",
"1.0",
"]",
",",
"[",
"0.0",
",",
"0.0",
"]",
"]",
"template_clustering",
"(",
"start_centers",
",",
"SIMPLE_SAMPLES",
".",
"SAMPLE_SIMPLE5",
",",
"criterion",
"=",
"split... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | cluster_elongate | Not so applicable for this sample | pyclustering/cluster/examples/xmeans_examples.py | def cluster_elongate():
"Not so applicable for this sample"
start_centers = [[1.0, 4.5], [3.1, 2.7]]
template_clustering(start_centers, SIMPLE_SAMPLES.SAMPLE_ELONGATE, criterion = splitting_type.BAYESIAN_INFORMATION_CRITERION)
template_clustering(start_centers, SIMPLE_SAMPLES.SAMPLE_ELONGATE, criter... | def cluster_elongate():
"Not so applicable for this sample"
start_centers = [[1.0, 4.5], [3.1, 2.7]]
template_clustering(start_centers, SIMPLE_SAMPLES.SAMPLE_ELONGATE, criterion = splitting_type.BAYESIAN_INFORMATION_CRITERION)
template_clustering(start_centers, SIMPLE_SAMPLES.SAMPLE_ELONGATE, criter... | [
"Not",
"so",
"applicable",
"for",
"this",
"sample"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/examples/xmeans_examples.py#L109-L113 | [
"def",
"cluster_elongate",
"(",
")",
":",
"start_centers",
"=",
"[",
"[",
"1.0",
",",
"4.5",
"]",
",",
"[",
"3.1",
",",
"2.7",
"]",
"]",
"template_clustering",
"(",
"start_centers",
",",
"SIMPLE_SAMPLES",
".",
"SAMPLE_ELONGATE",
",",
"criterion",
"=",
"spl... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | cluster_lsun | Not so applicable for this sample | pyclustering/cluster/examples/xmeans_examples.py | def cluster_lsun():
"Not so applicable for this sample"
start_centers = [[1.0, 3.5], [2.0, 0.5], [3.0, 3.0]]
template_clustering(start_centers, FCPS_SAMPLES.SAMPLE_LSUN, criterion = splitting_type.BAYESIAN_INFORMATION_CRITERION)
template_clustering(start_centers, FCPS_SAMPLES.SAMPLE_LSUN, criterion ... | def cluster_lsun():
"Not so applicable for this sample"
start_centers = [[1.0, 3.5], [2.0, 0.5], [3.0, 3.0]]
template_clustering(start_centers, FCPS_SAMPLES.SAMPLE_LSUN, criterion = splitting_type.BAYESIAN_INFORMATION_CRITERION)
template_clustering(start_centers, FCPS_SAMPLES.SAMPLE_LSUN, criterion ... | [
"Not",
"so",
"applicable",
"for",
"this",
"sample"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/examples/xmeans_examples.py#L115-L119 | [
"def",
"cluster_lsun",
"(",
")",
":",
"start_centers",
"=",
"[",
"[",
"1.0",
",",
"3.5",
"]",
",",
"[",
"2.0",
",",
"0.5",
"]",
",",
"[",
"3.0",
",",
"3.0",
"]",
"]",
"template_clustering",
"(",
"start_centers",
",",
"FCPS_SAMPLES",
".",
"SAMPLE_LSUN",... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | cluster_target | Not so applicable for this sample | pyclustering/cluster/examples/xmeans_examples.py | def cluster_target():
"Not so applicable for this sample"
start_centers = [[0.2, 0.2], [0.0, -2.0], [3.0, -3.0], [3.0, 3.0], [-3.0, 3.0], [-3.0, -3.0]]
template_clustering(start_centers, FCPS_SAMPLES.SAMPLE_TARGET, criterion = splitting_type.BAYESIAN_INFORMATION_CRITERION)
template_clustering(start_... | def cluster_target():
"Not so applicable for this sample"
start_centers = [[0.2, 0.2], [0.0, -2.0], [3.0, -3.0], [3.0, 3.0], [-3.0, 3.0], [-3.0, -3.0]]
template_clustering(start_centers, FCPS_SAMPLES.SAMPLE_TARGET, criterion = splitting_type.BAYESIAN_INFORMATION_CRITERION)
template_clustering(start_... | [
"Not",
"so",
"applicable",
"for",
"this",
"sample"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/examples/xmeans_examples.py#L121-L125 | [
"def",
"cluster_target",
"(",
")",
":",
"start_centers",
"=",
"[",
"[",
"0.2",
",",
"0.2",
"]",
",",
"[",
"0.0",
",",
"-",
"2.0",
"]",
",",
"[",
"3.0",
",",
"-",
"3.0",
"]",
",",
"[",
"3.0",
",",
"3.0",
"]",
",",
"[",
"-",
"3.0",
",",
"3.0"... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | cluster_two_diamonds | Start with wrong number of clusters. | pyclustering/cluster/examples/xmeans_examples.py | def cluster_two_diamonds():
"Start with wrong number of clusters."
start_centers = [[0.8, 0.2]]
template_clustering(start_centers, FCPS_SAMPLES.SAMPLE_TWO_DIAMONDS, criterion = splitting_type.BAYESIAN_INFORMATION_CRITERION)
template_clustering(start_centers, FCPS_SAMPLES.SAMPLE_TWO_DIAMONDS, criteri... | def cluster_two_diamonds():
"Start with wrong number of clusters."
start_centers = [[0.8, 0.2]]
template_clustering(start_centers, FCPS_SAMPLES.SAMPLE_TWO_DIAMONDS, criterion = splitting_type.BAYESIAN_INFORMATION_CRITERION)
template_clustering(start_centers, FCPS_SAMPLES.SAMPLE_TWO_DIAMONDS, criteri... | [
"Start",
"with",
"wrong",
"number",
"of",
"clusters",
"."
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/examples/xmeans_examples.py#L127-L131 | [
"def",
"cluster_two_diamonds",
"(",
")",
":",
"start_centers",
"=",
"[",
"[",
"0.8",
",",
"0.2",
"]",
"]",
"template_clustering",
"(",
"start_centers",
",",
"FCPS_SAMPLES",
".",
"SAMPLE_TWO_DIAMONDS",
",",
"criterion",
"=",
"splitting_type",
".",
"BAYESIAN_INFORMA... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | cluster_hepta | Start with wrong number of clusters. | pyclustering/cluster/examples/xmeans_examples.py | def cluster_hepta():
"Start with wrong number of clusters."
start_centers = [[0.0, 0.0, 0.0], [3.0, 0.0, 0.0], [-2.0, 0.0, 0.0], [0.0, 3.0, 0.0], [0.0, -3.0, 0.0], [0.0, 0.0, 2.5]]
template_clustering(start_centers, FCPS_SAMPLES.SAMPLE_HEPTA, criterion = splitting_type.BAYESIAN_INFORMATION_CRITERION)
... | def cluster_hepta():
"Start with wrong number of clusters."
start_centers = [[0.0, 0.0, 0.0], [3.0, 0.0, 0.0], [-2.0, 0.0, 0.0], [0.0, 3.0, 0.0], [0.0, -3.0, 0.0], [0.0, 0.0, 2.5]]
template_clustering(start_centers, FCPS_SAMPLES.SAMPLE_HEPTA, criterion = splitting_type.BAYESIAN_INFORMATION_CRITERION)
... | [
"Start",
"with",
"wrong",
"number",
"of",
"clusters",
"."
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/examples/xmeans_examples.py#L147-L151 | [
"def",
"cluster_hepta",
"(",
")",
":",
"start_centers",
"=",
"[",
"[",
"0.0",
",",
"0.0",
",",
"0.0",
"]",
",",
"[",
"3.0",
",",
"0.0",
",",
"0.0",
"]",
",",
"[",
"-",
"2.0",
",",
"0.0",
",",
"0.0",
"]",
",",
"[",
"0.0",
",",
"3.0",
",",
"0... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | somsc.process | !
@brief Performs cluster analysis by competition between neurons of SOM.
@remark Results of clustering can be obtained using corresponding get methods.
@see get_clusters() | pyclustering/cluster/somsc.py | def process(self):
"""!
@brief Performs cluster analysis by competition between neurons of SOM.
@remark Results of clustering can be obtained using corresponding get methods.
@see get_clusters()
"""
self.__network = som(1, sel... | def process(self):
"""!
@brief Performs cluster analysis by competition between neurons of SOM.
@remark Results of clustering can be obtained using corresponding get methods.
@see get_clusters()
"""
self.__network = som(1, sel... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/somsc.py#L87-L98 | [
"def",
"process",
"(",
"self",
")",
":",
"self",
".",
"__network",
"=",
"som",
"(",
"1",
",",
"self",
".",
"__amount_clusters",
",",
"type_conn",
".",
"grid_four",
",",
"None",
",",
"self",
".",
"__ccore",
")",
"self",
".",
"__network",
".",
"train",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | hsyncnet.process | !
@brief Performs clustering of input data set in line with input parameters.
@param[in] order (double): Level of local synchronization between oscillator that defines end of synchronization process, range [0..1].
@param[in] solution (solve_type) Type of solving differential equatio... | pyclustering/cluster/hsyncnet.py | def process(self, order = 0.998, solution = solve_type.FAST, collect_dynamic = False):
"""!
@brief Performs clustering of input data set in line with input parameters.
@param[in] order (double): Level of local synchronization between oscillator that defines end of synchronization pr... | def process(self, order = 0.998, solution = solve_type.FAST, collect_dynamic = False):
"""!
@brief Performs clustering of input data set in line with input parameters.
@param[in] order (double): Level of local synchronization between oscillator that defines end of synchronization pr... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/hsyncnet.py#L109-L165 | [
"def",
"process",
"(",
"self",
",",
"order",
"=",
"0.998",
",",
"solution",
"=",
"solve_type",
".",
"FAST",
",",
"collect_dynamic",
"=",
"False",
")",
":",
"if",
"(",
"self",
".",
"__ccore_network_pointer",
"is",
"not",
"None",
")",
":",
"analyser",
"=",... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | hsyncnet.__calculate_radius | !
@brief Calculate new connectivity radius.
@param[in] number_neighbors (uint): Average amount of neighbors that should be connected by new radius.
@param[in] radius (double): Current connectivity radius.
@return New connectivity radius. | pyclustering/cluster/hsyncnet.py | def __calculate_radius(self, number_neighbors, radius):
"""!
@brief Calculate new connectivity radius.
@param[in] number_neighbors (uint): Average amount of neighbors that should be connected by new radius.
@param[in] radius (double): Current connectivity radius.
... | def __calculate_radius(self, number_neighbors, radius):
"""!
@brief Calculate new connectivity radius.
@param[in] number_neighbors (uint): Average amount of neighbors that should be connected by new radius.
@param[in] radius (double): Current connectivity radius.
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/hsyncnet.py#L168-L182 | [
"def",
"__calculate_radius",
"(",
"self",
",",
"number_neighbors",
",",
"radius",
")",
":",
"if",
"(",
"number_neighbors",
">=",
"len",
"(",
"self",
".",
"_osc_loc",
")",
")",
":",
"return",
"radius",
"*",
"self",
".",
"__increase_persent",
"+",
"radius",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | hsyncnet.__store_dynamic | !
@brief Store specified state of Sync network to hSync.
@param[in] dyn_phase (list): Output dynamic of hSync where state should be stored.
@param[in] dyn_time (list): Time points that correspond to output dynamic where new time point should be stored.
@param[in] analyser (... | pyclustering/cluster/hsyncnet.py | def __store_dynamic(self, dyn_phase, dyn_time, analyser, begin_state):
"""!
@brief Store specified state of Sync network to hSync.
@param[in] dyn_phase (list): Output dynamic of hSync where state should be stored.
@param[in] dyn_time (list): Time points that correspond to o... | def __store_dynamic(self, dyn_phase, dyn_time, analyser, begin_state):
"""!
@brief Store specified state of Sync network to hSync.
@param[in] dyn_phase (list): Output dynamic of hSync where state should be stored.
@param[in] dyn_time (list): Time points that correspond to o... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/hsyncnet.py#L185-L202 | [
"def",
"__store_dynamic",
"(",
"self",
",",
"dyn_phase",
",",
"dyn_time",
",",
"analyser",
",",
"begin_state",
")",
":",
"if",
"(",
"begin_state",
"is",
"True",
")",
":",
"dyn_time",
".",
"append",
"(",
"0",
")",
"dyn_phase",
".",
"append",
"(",
"analyse... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | cluster_encoder.set_encoding | !
@brief Change clusters encoding to specified type (index list, object list, labeling).
@param[in] encoding (type_encoding): New type of clusters representation. | pyclustering/cluster/encoder.py | def set_encoding(self, encoding):
"""!
@brief Change clusters encoding to specified type (index list, object list, labeling).
@param[in] encoding (type_encoding): New type of clusters representation.
"""
if(encoding == self.__type_representation):
... | def set_encoding(self, encoding):
"""!
@brief Change clusters encoding to specified type (index list, object list, labeling).
@param[in] encoding (type_encoding): New type of clusters representation.
"""
if(encoding == self.__type_representation):
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/encoder.py#L114-L146 | [
"def",
"set_encoding",
"(",
"self",
",",
"encoding",
")",
":",
"if",
"(",
"encoding",
"==",
"self",
".",
"__type_representation",
")",
":",
"return",
"if",
"(",
"self",
".",
"__type_representation",
"==",
"type_encoding",
".",
"CLUSTER_INDEX_LABELING",
")",
":... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | dbscan.process | !
@brief Performs cluster analysis in line with rules of DBSCAN algorithm.
@see get_clusters()
@see get_noise() | pyclustering/cluster/dbscan.py | def process(self):
"""!
@brief Performs cluster analysis in line with rules of DBSCAN algorithm.
@see get_clusters()
@see get_noise()
"""
if self.__ccore is True:
(self.__clusters, self.__noise) = wrapper.dbscan(self.__poin... | def process(self):
"""!
@brief Performs cluster analysis in line with rules of DBSCAN algorithm.
@see get_clusters()
@see get_noise()
"""
if self.__ccore is True:
(self.__clusters, self.__noise) = wrapper.dbscan(self.__poin... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/dbscan.py#L109-L133 | [
"def",
"process",
"(",
"self",
")",
":",
"if",
"self",
".",
"__ccore",
"is",
"True",
":",
"(",
"self",
".",
"__clusters",
",",
"self",
".",
"__noise",
")",
"=",
"wrapper",
".",
"dbscan",
"(",
"self",
".",
"__pointer_data",
",",
"self",
".",
"__eps",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | dbscan.__expand_cluster | !
@brief Expands cluster from specified point in the input data space.
@param[in] index_point (list): Index of a point from the data.
@return (list) Return tuple of list of indexes that belong to the same cluster and list of points that are marked as noise: (cluster, noise), or No... | pyclustering/cluster/dbscan.py | def __expand_cluster(self, index_point):
"""!
@brief Expands cluster from specified point in the input data space.
@param[in] index_point (list): Index of a point from the data.
@return (list) Return tuple of list of indexes that belong to the same cluster and list of poi... | def __expand_cluster(self, index_point):
"""!
@brief Expands cluster from specified point in the input data space.
@param[in] index_point (list): Index of a point from the data.
@return (list) Return tuple of list of indexes that belong to the same cluster and list of poi... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/dbscan.py#L196-L228 | [
"def",
"__expand_cluster",
"(",
"self",
",",
"index_point",
")",
":",
"cluster",
"=",
"None",
"self",
".",
"__visited",
"[",
"index_point",
"]",
"=",
"True",
"neighbors",
"=",
"self",
".",
"__neighbor_searcher",
"(",
"index_point",
")",
"if",
"len",
"(",
"... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | dbscan.__neighbor_indexes_points | !
@brief Return neighbors of the specified object in case of sequence of points.
@param[in] index_point (uint): Index point whose neighbors are should be found.
@return (list) List of indexes of neighbors in line the connectivity radius. | pyclustering/cluster/dbscan.py | def __neighbor_indexes_points(self, index_point):
"""!
@brief Return neighbors of the specified object in case of sequence of points.
@param[in] index_point (uint): Index point whose neighbors are should be found.
@return (list) List of indexes of neighbors in line the connectivi... | def __neighbor_indexes_points(self, index_point):
"""!
@brief Return neighbors of the specified object in case of sequence of points.
@param[in] index_point (uint): Index point whose neighbors are should be found.
@return (list) List of indexes of neighbors in line the connectivi... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/dbscan.py#L231-L241 | [
"def",
"__neighbor_indexes_points",
"(",
"self",
",",
"index_point",
")",
":",
"kdnodes",
"=",
"self",
".",
"__kdtree",
".",
"find_nearest_dist_nodes",
"(",
"self",
".",
"__pointer_data",
"[",
"index_point",
"]",
",",
"self",
".",
"__eps",
")",
"return",
"[",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | dbscan.__neighbor_indexes_distance_matrix | !
@brief Return neighbors of the specified object in case of distance matrix.
@param[in] index_point (uint): Index point whose neighbors are should be found.
@return (list) List of indexes of neighbors in line the connectivity radius. | pyclustering/cluster/dbscan.py | def __neighbor_indexes_distance_matrix(self, index_point):
"""!
@brief Return neighbors of the specified object in case of distance matrix.
@param[in] index_point (uint): Index point whose neighbors are should be found.
@return (list) List of indexes of neighbors in line the conn... | def __neighbor_indexes_distance_matrix(self, index_point):
"""!
@brief Return neighbors of the specified object in case of distance matrix.
@param[in] index_point (uint): Index point whose neighbors are should be found.
@return (list) List of indexes of neighbors in line the conn... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/dbscan.py#L244-L255 | [
"def",
"__neighbor_indexes_distance_matrix",
"(",
"self",
",",
"index_point",
")",
":",
"distances",
"=",
"self",
".",
"__pointer_data",
"[",
"index_point",
"]",
"return",
"[",
"index_neighbor",
"for",
"index_neighbor",
"in",
"range",
"(",
"len",
"(",
"distances",... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | data_generator.generate | !
@brief Generates data in line with generator parameters. | pyclustering/cluster/generator.py | def generate(self):
"""!
@brief Generates data in line with generator parameters.
"""
data_points = []
for index_cluster in range(self.__amount_clusters):
for _ in range(self.__cluster_sizes[index_cluster]):
point = self.__generate_point(ind... | def generate(self):
"""!
@brief Generates data in line with generator parameters.
"""
data_points = []
for index_cluster in range(self.__amount_clusters):
for _ in range(self.__cluster_sizes[index_cluster]):
point = self.__generate_point(ind... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/generator.py#L67-L79 | [
"def",
"generate",
"(",
"self",
")",
":",
"data_points",
"=",
"[",
"]",
"for",
"index_cluster",
"in",
"range",
"(",
"self",
".",
"__amount_clusters",
")",
":",
"for",
"_",
"in",
"range",
"(",
"self",
".",
"__cluster_sizes",
"[",
"index_cluster",
"]",
")"... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | data_generator.__generate_point | !
@brief Generates point in line with parameters of specified cluster.
@param[in] index_cluster (uint): Index of cluster whose parameters are used for point generation.
@return (list) New generated point in line with normal distribution and cluster parameters. | pyclustering/cluster/generator.py | def __generate_point(self, index_cluster):
"""!
@brief Generates point in line with parameters of specified cluster.
@param[in] index_cluster (uint): Index of cluster whose parameters are used for point generation.
@return (list) New generated point in line with normal distributi... | def __generate_point(self, index_cluster):
"""!
@brief Generates point in line with parameters of specified cluster.
@param[in] index_cluster (uint): Index of cluster whose parameters are used for point generation.
@return (list) New generated point in line with normal distributi... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/generator.py#L82-L93 | [
"def",
"__generate_point",
"(",
"self",
",",
"index_cluster",
")",
":",
"return",
"[",
"random",
".",
"gauss",
"(",
"self",
".",
"__cluster_centers",
"[",
"index_cluster",
"]",
"[",
"index_dimension",
"]",
",",
"self",
".",
"__cluster_width",
"[",
"index_clust... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
valid | data_generator.__generate_cluster_centers | !
@brief Generates centers (means in statistical term) for clusters.
@param[in] width (list): Width of generated clusters.
@return (list) Generated centers in line with normal distribution. | pyclustering/cluster/generator.py | def __generate_cluster_centers(self, width):
"""!
@brief Generates centers (means in statistical term) for clusters.
@param[in] width (list): Width of generated clusters.
@return (list) Generated centers in line with normal distribution.
"""
centers = []
... | def __generate_cluster_centers(self, width):
"""!
@brief Generates centers (means in statistical term) for clusters.
@param[in] width (list): Width of generated clusters.
@return (list) Generated centers in line with normal distribution.
"""
centers = []
... | [
"!"
] | annoviko/pyclustering | python | https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/generator.py#L96-L111 | [
"def",
"__generate_cluster_centers",
"(",
"self",
",",
"width",
")",
":",
"centers",
"=",
"[",
"]",
"default_offset",
"=",
"max",
"(",
"width",
")",
"*",
"4.0",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"__amount_clusters",
")",
":",
"center",
"=",
... | 98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.