Search is not available for this dataset
text
stringlengths
75
104k
def __update_central_neurons(self, t, next_cn_membrane, next_cn_active_sodium, next_cn_inactive_sodium, next_cn_active_potassium): """! @brief Update of central neurons in line with new values of current in channels. @param[in] t (doubles): Current time of simulation. @para...
def hnn_state(self, inputs, t, argv): """! @brief Returns new values of excitatory and inhibitory parts of oscillator and potential of oscillator. @param[in] inputs (list): States of oscillator for integration [v, m, h, n] (see description below). @param[in] t (double): Cur...
def __alfa_function(self, time, alfa, betta): """! @brief Calculates value of alfa-function for difference between spike generation time and current simulation time. @param[in] time (double): Difference between last spike generation time and current time. @param[in] alfa (d...
def show_grid(cells, data): """! @brief Show CLIQUE blocks as a grid in data space. @details Each block contains points and according to this density is displayed. CLIQUE grid helps to visualize grid that was used for clustering process. @param[in] cells (list): ...
def show_clusters(data, clusters, noise=None): """! @brief Display CLIQUE clustering results. @param[in] data (list): Data that was used for clustering. @param[in] clusters (array_like): Clusters that were allocated by the algorithm. @param[in] noise (array_like): Noise th...
def __draw_two_dimension_data(ax, data, pair): """! @brief Display data in two-dimensional canvas. @param[in] ax (Axis): Canvas where data should be displayed. @param[in] data (list): Data points that should be displayed. @param[in] pair (tuple): Pair of dimension indexes....
def capture_points(self, data, point_availability): """! @brief Finds points that belong to this block using availability map to reduce computational complexity by checking whether the point belongs to the block. @details Algorithm complexity of this method is O(n). ...
def get_location_neighbors(self, edge): """! @brief Forms list of logical location of each neighbor for this particular CLIQUE block. @param[in] edge (uint): Amount of intervals in each dimension that is used for clustering process. @return (list) Logical location of each neighbo...
def increment(self): """! @brief Forms logical location for next block. """ for index_dimension in range(self.__dimension): if self.__coordiate[index_dimension] + 1 < self.__intervals: self.__coordiate[index_dimension] += 1 return ...
def __process_by_ccore(self): """! @brief Performs cluster analysis using C++ implementation of CLIQUE algorithm that is used by default if user's target platform is supported. """ (self.__clusters, self.__noise, block_logical_locations, block_max_corners, block_mi...
def __validate_arguments(self): """! @brief Check input arguments of CLIQUE algorithm and if one of them is not correct then appropriate exception is thrown. """ if len(self.__data) == 0: raise ValueError("Empty input data. Data should contain at lea...
def __allocate_clusters(self): """! @brief Performs cluster analysis using formed CLIQUE blocks. """ for cell in self.__cells: if cell.visited is False: self.__expand_cluster(cell)
def __expand_cluster(self, cell): """! @brief Tries to expand cluster from specified cell. @details During expanding points are marked as noise or append to new cluster. @param[in] cell (clique_block): CLIQUE block from that cluster should be expanded. """ cell....
def __get_neighbors(self, cell): """! @brief Returns neighbors for specified CLIQUE block as clique_block objects. @return (list) Neighbors as clique_block objects. """ neighbors = [] location_neighbors = cell.get_location_neighbors(self.__amount_intervals) ...
def __create_grid(self): """! @brief Creates CLIQUE grid that consists of CLIQUE blocks for clustering process. """ data_sizes, min_corner, max_corner = self.__get_data_size_derscription() dimension = len(self.__data[0]) cell_sizes = [dimension_length / self.__a...
def __get_spatial_location(self, logical_location, min_corner, max_corner, cell_sizes): """! @brief Calculates spatial location for CLIQUE block with logical coordinates defined by logical_location. @param[in] logical_location (list): Logical location of CLIQUE block for that spatial locati...
def __get_data_size_derscription(self): """! @brief Calculates input data description that is required to create CLIQUE grid. @return (list, list, list): Data size in each dimension, minimum and maximum corners. """ min_corner = self.__data[0][:] max_corner = se...
def process(self): """! @brief Performs cluster analysis in line with rules of X-Means algorithm. @remark Results of clustering can be obtained using corresponding gets methods. @see get_clusters() @see get_centers() """ ...
def __improve_parameters(self, centers, available_indexes = None): """! @brief Performs k-means clustering in the specified region. @param[in] centers (list): Centers of clusters. @param[in] available_indexes (list): Indexes that defines which points can be used for k-means...
def __local_to_global_clusters(self, local_clusters, available_indexes): """! @brief Converts clusters in local region define by 'available_indexes' to global clusters. @param[in] local_clusters (list): Local clusters in specific region. @param[in] available_indexes (list): Map bet...
def __improve_structure(self, clusters, centers): """! @brief Check for best structure: divides each cluster into two and checks for best results using splitting criterion. @param[in] clusters (list): Clusters that have been allocated (each cluster contains indexes of points from da...
def __splitting_criterion(self, clusters, centers): """! @brief Calculates splitting criterion for input clusters. @param[in] clusters (list): Clusters for which splitting criterion should be calculated. @param[in] centers (list): Centers of the clusters. ...
def __minimum_noiseless_description_length(self, clusters, centers): """! @brief Calculates splitting criterion for input clusters using minimum noiseless description length criterion. @param[in] clusters (list): Clusters for which splitting criterion should be calculated. ...
def __bayesian_information_criterion(self, clusters, centers): """! @brief Calculates splitting criterion for input clusters using bayesian information criterion. @param[in] clusters (list): Clusters for which splitting criterion should be calculated. @param[in] centers (li...
def segmentation_image_simple1(): "Perfect" parameters = legion_parameters(); parameters.eps = 0.02; parameters.alpha = 0.005; parameters.betta = 0.1; parameters.gamma = 7.0; parameters.teta = 0.9; parameters.lamda = 0.1; parameters.teta_x = -0.5; parameters.teta_p = 7....
def show_clusters(sample, clusters, representatives, **kwargs): """! @brief Display BSAS clustering results. @param[in] sample (list): Dataset that was used for clustering. @param[in] clusters (array_like): Clusters that were allocated by the algorithm. @param[in] representative...
def _find_nearest_cluster(self, point): """! @brief Find nearest cluster to the specified point. @param[in] point (list): Point from dataset. @return (uint, double) Index of nearest cluster and distance to it. """ index_cluster = -1; nearest_distance = float('i...
def _update_representative(self, index_cluster, point): """! @brief Update cluster representative in line with new cluster size and added point to it. @param[in] index_cluster (uint): Index of cluster whose representative should be updated. @param[in] point (list): Point that was added ...
def show_second_layer_dynamic(analyser): """! @brief Shows output dynamic of the second layer. @param[in] analyser (syncsegm_analyser): Analyser of output dynamic of the 'syncsegm' oscillatory network. """ second_layer_analysers = analyser.get_s...
def allocate_colors(self, eps = 0.01, noise_size = 1): """! @brief Allocates color segments. @param[in] eps (double): Tolerance level that define maximal difference between phases of oscillators in one segment. @param[in] noise_size (uint): Threshold that defines noise - se...
def allocate_objects(self, eps = 0.01, noise_size = 1): """! @brief Allocates object segments. @param[in] eps (double): Tolerance level that define maximal difference between phases of oscillators in one segment. @param[in] noise_size (uint): Threshold that defines noise - ...
def process(self, image_source, collect_dynamic = False, order_color = 0.9995, order_object = 0.999): """! @brief Performs image segmentation. @param[in] image_source (string): Path to image file that should be processed. @param[in] collect_dynamic (bool): If 'True' then wh...
def __analyse_colors(self, image_data, collect_dynamic): """! @brief Performs color segmentation by the first layer. @param[in] image_data (array_like): Image sample as a array-like structure. @param[in] collect_dynamic (bool): If 'True' then whole dynamic of the first laye...
def __analyse_objects(self, image_source, color_analyser, collect_dynamic): """! @brief Performs object segmentation by the second layer. @param[in] image_source (string): Path to image file that should be processed. @param[in] color_analyser (syncnet_analyser): Analyser of...
def __analyse_color_segment(self, image_size, color_segment, collect_dynamic): """! @brief Performs object segmentation of separate segment. @param[in] image_size (list): Image size presented as a [width x height]. @param[in] color_segment (list): Image segment that should ...
def __extract_location_coordinates(self, image_size, color_segment): """! @brief Extracts coordinates of specified image segment. @param[in] image_size (list): Image size presented as a [width x height]. @param[in] color_segment (list): Image segment whose coordinates shoul...
def process(self): """! @brief Perform graph coloring using DSATUR algorithm. @see get_colors() """ color_counter = 1; degrees = list(); saturation_degrees = [0] * len(self.__data_pointer); self.__coloring = [0] ...
def __get_amount_color(self, node_indexes, color_number): """! @brief Countes how many nodes has color 'color_number'. @param[in] node_indexes (list): Indexes of graph nodes for checking. @param[in] color_number (uint): Number of color that is searched in nodes. ...
def __get_neighbors(self, node_index): """! @brief Returns indexes of neighbors of the specified node. @param[in] node_index (uint): @return (list) Neighbors of the specified node. """ return [ index for index in range(len(self.__data_p...
def show_blocks(directory): """! @brief Show BANG-blocks (leafs only) in data space. @details BANG-blocks represents grid that was used for clustering process. @param[in] directory (bang_directory): Directory that was created by BANG algorithm during clustering process. ...
def show_dendrogram(dendrogram): """! @brief Display dendrogram of BANG-blocks. @param[in] dendrogram (list): List representation of dendrogram of BANG-blocks. @see bang.get_dendrogram() """ plt.figure() axis = plt.subplot(1, 1, 1) current_...
def __draw_blocks(ax, blocks, pair): """! @brief Display BANG-blocks on specified figure. @param[in] ax (Axis): Axis where bang-blocks should be displayed. @param[in] blocks (list): List of blocks that should be displyed. @param[in] pair (tuple): Pair of coordinate index t...
def __draw_block(ax, pair, block, density_scale): """! @brief Display BANG-block on the specified ax. @param[in] ax (Axis): Axis where block should be displayed. @param[in] pair (tuple): Pair of coordinate index that should be displayed. @param[in] block (bang_block): BANG...
def __get_rectangle_description(block, pair): """! @brief Create rectangle description for block in specific dimension. @param[in] pair (tuple): Pair of coordinate index that should be displayed. @param[in] block (bang_block): BANG-block that should be displayed @return ...
def __increment_block(self): """! @brief Increment BANG block safely by updating block index, level and level block. """ self.__current_block += 1 if self.__current_block >= len(self.__level_blocks): self.__current_block = 0 self.__current_level +...
def __draw_block(self, block, block_alpha=0.0): """! @brief Display single BANG block on axis. @param[in] block (bang_block): BANG block that should be displayed. @param[in] block_alpha (double): Transparency level - value of alpha. """ max_corner, min_corner = ...
def __draw_leaf_density(self): """! @brief Display densities by filling blocks by appropriate colors. """ leafs = self.__directory.get_leafs() density_scale = leafs[-1].get_density() if density_scale == 0.0: density_scale = 1.0 for block in leafs: ...
def __draw_clusters(self): """! @brief Display clusters and outliers using different colors. """ data = self.__directory.get_data() for index_cluster in range(len(self.__clusters)): color = color_list.get_color(index_cluster) self.__draw_cluster(d...
def __draw_cluster(self, data, cluster, color, marker): """! @brief Draw 2-D single cluster on axis using specified color and marker. """ for item in cluster: self.__ax.plot(data[item][0], data[item][1], color=color, marker=marker)
def animate(self, animation_velocity=75, movie_fps=25, movie_filename=None): """! @brief Animates clustering process that is performed by BANG algorithm. @param[in] animation_velocity (uint): Interval between frames in milliseconds (for run-time animation only). @param[in] movie_fp...
def __create_directory(self): """! @brief Create BANG directory as a tree with separate storage for leafs. """ min_corner, max_corner = data_corners(self.__data) data_block = spatial_block(max_corner, min_corner) cache_require = (self.__levels == 1) s...
def __store_level_blocks(self, level_blocks): """! @brief Store level blocks if observing is enabled. @param[in] level_blocks (list): Created blocks on a new level. """ self.__size += len(level_blocks) if self.__observe is True: self.__level_blocks....
def __build_directory_levels(self): """! @brief Build levels of direction if amount of level is greater than one. """ previous_level_blocks = [ self.__root ] for level in range(1, self.__levels): previous_level_blocks = self.__build_level(previous_level_bl...
def __build_level(self, previous_level_blocks, level): """! @brief Build new level of directory. @param[in] previous_level_blocks (list): BANG-blocks on the previous level. @param[in] level (uint): Level number that should be built. @return (list) New block on the specif...
def __split_block(self, block, split_dimension, cache_require, current_level_blocks): """! @brief Split specific block in specified dimension. @details Split is not performed for block whose density is lower than threshold value, such blocks are putted to leafs. ...
def split(self, dimension): """! @brief Split current block into two spatial blocks in specified dimension. @param[in] dimension (uint): Dimension where current block should be split. @return (tuple) Pair of new split blocks from current block. """ first_max_c...
def is_neighbor(self, block): """! @brief Performs calculation to identify whether specified block is neighbor of current block. @details It also considers diagonal blocks as neighbors. @param[in] block (spatial_block): Another block that is check whether it is neighbor. ...
def __calculate_neighborhood(self, block_max_corner): """! @brief Calculates neighborhood score that defined whether blocks are neighbors. @param[in] block_max_corner (list): Maximum coordinates of other block. @return (uint) Neighborhood score. """ dimension ...
def __calculate_volume(self): """! @brief Calculates volume of current spatial block. @details If empty dimension is detected (where all points has the same value) then such dimension is ignored during calculation of volume. @return (double) Volume of current spa...
def split(self, split_dimension, cache_points): """! @brief Split BANG-block into two new blocks in specified dimension. @param[in] split_dimension (uint): Dimension where block should be split. @param[in] cache_points (bool): If True then covered points are cached. Used for leaf b...
def __calculate_density(self, amount_points): """! @brief Calculates BANG-block density. @param[in] amount_points (uint): Amount of points in block. @return (double) BANG-block density. """ volume = self.__spatial_block.get_volume() if volume != 0.0: ...
def __get_amount_points(self): """! @brief Count covered points by the BANG-block and if cache is enable then covered points are stored. @return (uint) Amount of covered points. """ amount = 0 for index in range(len(self.__data)): if self.__data[ind...
def __cache_covered_data(self): """! @brief Cache covered data. """ self.__cache_points = True self.__points = [] for index_point in range(len(self.__data)): if self.__data[index_point] in self.__spatial_block: self.__cache_point(in...
def __cache_point(self, index): """! @brief Store index points. @param[in] index (uint): Index point that should be stored. """ if self.__cache_points: if self.__points is None: self.__points = [] self.__points.append(index)
def process(self): """! @brief Performs clustering process in line with rules of BANG clustering algorithm. @return (bang) Returns itself (BANG instance). @see get_clusters() @see get_noise() @see get_directory() @see get_dendrogram() """ ...
def __validate_arguments(self): """! @brief Check input arguments of BANG algorithm and if one of them is not correct then appropriate exception is thrown. """ if self.__levels <= 0: raise ValueError("Incorrect amount of levels '%d'. Level value should...
def __allocate_clusters(self): """! @brief Performs cluster allocation using leafs of tree in BANG directory (the smallest cells). """ leaf_blocks = self.__directory.get_leafs() unhandled_block_indexes = set([i for i in range(len(leaf_blocks)) if leaf_blocks[i].get_density...
def __expand_cluster_block(self, block, cluster_index, leaf_blocks, unhandled_block_indexes): """! @brief Expand cluster from specific block that is considered as a central block. @param[in] block (bang_block): Block that is considered as a central block for cluster. @param[in] clu...
def __store_clustering_results(self, amount_clusters, leaf_blocks): """! @brief Stores clustering results in a convenient way. @param[in] amount_clusters (uint): Amount of cluster that was allocated during processing. @param[in] leaf_blocks (list): Leaf BANG-blocks (the smallest ce...
def __find_block_center(self, level_blocks, unhandled_block_indexes): """! @brief Search block that is cluster center for new cluster. @return (bang_block) Central block for new cluster, if cluster is not found then None value is returned. """ for i in reversed(range(len...
def __find_block_neighbors(self, block, level_blocks, unhandled_block_indexes): """! @brief Search block neighbors that are parts of new clusters (density is greater than threshold and that are not cluster members yet), other neighbors are ignored. @param[in] block (bang_bl...
def __update_cluster_dendrogram(self, index_cluster, blocks): """! @brief Append clustered blocks to dendrogram. @param[in] index_cluster (uint): Cluster index that was assigned to blocks. @param[in] blocks (list): Blocks that were clustered. """ if len(self.__d...
def allocate_map_coloring(self, tolerance, threshold_steps = 10): """! @brief Returns list of color indexes that are assigned to each object from input data space accordingly. @param[in] tolerance (double): Tolerance level that define maximal difference between outputs of oscillators in...
def process(self, steps, time, collect_dynamic=True): """! @brief Peforms graph coloring analysis using simulation of the oscillatory network. @param[in] steps (uint): Number steps of simulations during simulation. @param[in] time (double): Time of simulation. @param[in]...
def process(self): """! @brief Performs cluster analysis in line with rules of ROCK algorithm. @remark Results of clustering can be obtained using corresponding get methods. @see get_clusters() """ # TODO: (Not related to spec...
def __find_pair_clusters(self, clusters): """! @brief Returns pair of clusters that are best candidates for merging in line with goodness measure. The pair of clusters for which the above goodness measure is maximum is the best pair of clusters to be merged. @...
def __calculate_links(self, cluster1, cluster2): """! @brief Returns number of link between two clusters. @details Link between objects (points) exists only if distance between them less than connectivity radius. @param[in] cluster1 (list): The first cluster. @par...
def __create_adjacency_matrix(self): """! @brief Creates 2D adjacency matrix (list of lists) where each element described existence of link between points (means that points are neighbors). """ size_data = len(self.__pointer_data); self.__adjace...
def __calculate_goodness(self, cluster1, cluster2): """! @brief Calculates coefficient 'goodness measurement' between two clusters. The coefficient defines level of suitability of clusters for merging. @param[in] cluster1 (list): The first cluster. @param[in] cluster2 (list...
def __process_by_ccore(self): """! @brief Performs processing using CCORE (C/C++ part of pyclustering library). """ ccore_metric = metric_wrapper.create_instance(self.__metric) self.__score = wrapper.silhoeutte(self.__data, self.__clusters, ccore_metric.get_pointer())
def __process_by_python(self): """! @brief Performs processing using python code. """ for index_cluster in range(len(self.__clusters)): for index_point in self.__clusters[index_cluster]: self.__score[index_point] = self.__calculate_score(index_point, i...
def __calculate_score(self, index_point, index_cluster): """! @brief Calculates Silhouette score for the specific object defined by index_point. @param[in] index_point (uint): Index point from input data for which Silhouette score should be calculated. @param[in] index_cluster (uin...
def __calculate_within_cluster_score(self, index_cluster, difference): """! @brief Calculates 'A' score for the specific object in cluster to which it belongs to. @param[in] index_point (uint): Index point from input data for which 'A' score should be calculated. @param[in] index_c...
def __calculate_cluster_score(self, index_cluster, difference): """! @brief Calculates 'B*' score for the specific object for specific cluster. @param[in] index_point (uint): Index point from input data for which 'B*' score should be calculated. @param[in] index_cluster (uint): Ind...
def __caclulate_optimal_neighbor_cluster_score(self, index_cluster, difference): """! @brief Calculates 'B' score for the specific object for the nearest cluster. @param[in] index_point (uint): Index point from input data for which 'B' score should be calculated. @param[in] index_c...
def __calculate_cluster_difference(self, index_cluster, difference): """! @brief Calculates distance from each object in specified cluster to specified object. @param[in] index_point (uint): Index point for which difference is calculated. @return (list) Distance from specified ob...
def __calculate_dataset_difference(self, index_point): """! @brief Calculate distance from each object to specified object. @param[in] index_point (uint): Index point for which difference with other points is calculated. @return (list) Distance to each object from input data from...
def get_type(self): """! @brief Returns algorithm type that corresponds to specified enumeration value. @return (type) Algorithm type for cluster analysis. """ if self == silhouette_ksearch_type.KMEANS: return kmeans elif self == silhouette_ksearch_...
def __process_by_ccore(self): """! @brief Performs processing using CCORE (C/C++ part of pyclustering library). """ results = wrapper.silhoeutte_ksearch(self.__data, self.__kmin, self.__kmax, self.__algorithm) self.__amount = results[0] self.__score = results[1]...
def __process_by_python(self): """! @brief Performs processing using python code. """ self.__scores = {} for k in range(self.__kmin, self.__kmax): clusters = self.__calculate_clusters(k) if len(clusters) != k: self.__scores[k] =...
def __calculate_clusters(self, k): """! @brief Performs cluster analysis using specified K value. @param[in] k (uint): Amount of clusters that should be allocated. @return (array_like) Allocated clusters. """ initial_values = kmeans_plusplus_initializer(self._...
def __verify_arguments(self): """! @brief Checks algorithm's arguments and if some of them is incorrect then exception is thrown. """ if self.__kmax > len(self.__data): raise ValueError("K max value '" + str(self.__kmax) + "' is bigger than amount of objects '" + ...
def notify(self, clusters, centers): """! @brief This method is called by K-Means algorithm to notify about changes. @param[in] clusters (array_like): Allocated clusters by K-Means algorithm. @param[in] centers (array_like): Allocated centers by K-Means algorithm. ...
def show_clusters(sample, clusters, centers, initial_centers = None, **kwargs): """! @brief Display K-Means clustering results. @param[in] sample (list): Dataset that was used for clustering. @param[in] clusters (array_like): Clusters that were allocated by the algorithm. ...
def animate_cluster_allocation(data, observer, animation_velocity = 500, movie_fps = 1, save_movie = None): """! @brief Animates clustering process that is performed by K-Means algorithm. @param[in] data (list): Dataset that is used for clustering. @param[in] observer (kmeans_obser...
def process(self): """! @brief Performs cluster analysis in line with rules of K-Means algorithm. @return (kmeans) Returns itself (K-Means instance). @remark Results of clustering can be obtained using corresponding get methods. @see get_clusters() @se...
def __process_by_ccore(self): """! @brief Performs cluster analysis using CCORE (C/C++ part of pyclustering library). """ ccore_metric = metric_wrapper.create_instance(self.__metric) results = wrapper.kmeans(self.__pointer_data, self.__centers, self.__tolerance, self.__i...
def __process_by_python(self): """! @brief Performs cluster analysis using python code. """ maximum_change = float('inf') iteration = 0 if self.__observer is not None: initial_clusters = self.__update_clusters() self.__observer.notify...
def get_centers(self): """! @brief Returns list of centers of allocated clusters. @see process() @see get_clusters() """ if isinstance(self.__centers, list): return self.__centers return self.__centers.tolist()
def __update_clusters(self): """! @brief Calculate distance (in line with specified metric) to each point from the each cluster. Nearest points are captured by according clusters and as a result clusters are updated. @return (list) Updated clusters as list of cluste...