### Install Doxygen and Texlive Source: https://github.com/annoviko/pyclustering/wiki/Release-PyPi-Instruction Installs necessary packages for generating Doxygen documentation. ```bash $ sudo apt-get install graphviz $ sudo apt-get install texlive ``` -------------------------------- ### Manual Installation using Visual Studio Source: https://github.com/annoviko/pyclustering/blob/master/PKG-INFO.rst Build the pyclustering-shared project in Visual Studio after cloning the repository and opening the solution. Install the library using setup.py. ```bash # install pyclustering library $ python3 setup.py install # optionally - test the library $ python3 setup.py test ``` -------------------------------- ### Manual Installation using CMake Source: https://github.com/annoviko/pyclustering/blob/master/PKG-INFO.rst Generate build files with CMake, build the pyclustering-shared target, and then install the library. ```bash # get sources of the pyclustering library, for example, from repository $ mkdir pyclustering $ cd pyclustering/ $ git clone https://github.com/annoviko/pyclustering.git . # generate build files. $ mkdir build $ cmake .. # build pyclustering-shared target depending on what was generated (Makefile or MSVC solution) # if Makefile has been generated then $ make pyclustering-shared # return to parent folder of the pyclustering library $ cd ../ # install pyclustering library $ python3 setup.py install # optionally - test the library $ python3 setup.py test ``` -------------------------------- ### Manual Installation using Makefile (64-bit) Source: https://github.com/annoviko/pyclustering/blob/master/PKG-INFO.rst Compile the CCORE library for a 64-bit operating system using make, then install the pyclustering library. ```bash # get sources of the pyclustering library, for example, from repository $ mkdir pyclustering $ cd pyclustering/ $ git clone https://github.com/annoviko/pyclustering.git . # compile CCORE library (core of the pyclustering library). $ cd ccore/ $ make ccore_64bit # build for 64-bit OS # $ make ccore_32bit # build for 32-bit OS # return to parent folder of the pyclustering library $ cd ../ # install pyclustering library $ python3 setup.py install # optionally - test the library $ python3 setup.py test ``` -------------------------------- ### Check Setup File Source: https://github.com/annoviko/pyclustering/wiki/Release-PyPi-Instruction Validates the setup.py file for release readiness. ```bash $ python3 setup.py check -r -s ``` -------------------------------- ### Install pyclustering from PyPI Source: https://github.com/annoviko/pyclustering/wiki/Installing Use this command to install the pyclustering library using pip, the Python package installer. ```bash $ pip3 install pyclustering ``` -------------------------------- ### Log Example of ccore Compilation Source: https://github.com/annoviko/pyclustering/wiki/Working-Copy-Preparation This is an example log output from the 'ccore' compilation process, showing the compilation of various source files and the final linking step. ```bash andrei@linuxmachine:~/workspace/pyclustering/ccore$ make ccore make -f ccore.mk ccore make[1]: Entering directory `/home/andrei/workspace/pyclustering/ccore' mkdir -p obj/ccore/. mkdir -p obj/ccore/cluster mkdir -p obj/ccore/container mkdir -p obj/ccore/differential mkdir -p obj/ccore/interface mkdir -p obj/ccore/nnet mkdir -p obj/ccore/tsp g++ -c -O3 -MMD -MP -std=c++1y -fPIC -Isrc src/./ccore.cpp -o obj/ccore/./ccore.o g++ -c -O3 -MMD -MP -std=c++1y -fPIC -Isrc src/./utils.cpp -o obj/ccore/./utils.o g++ -c -O3 -MMD -MP -std=c++1y -fPIC -Isrc src/cluster/agglomerative.cpp -o obj/ccore/cluster/agglomerative.o ... ... ... # Code compilation ... ... ... g++ -c -O3 -MMD -MP -std=c++1y -fPIC -Isrc src/tsp/distance_matrix.cpp -o obj/ccore/tsp/distance_matrix.o g++ -static-libstdc++ -shared obj/ccore/./ccore.o obj/ccore/./utils.o obj/ccore/cluster/agglomerative.o obj/ccore/cluster/ant_clustering_mean.o obj/ccore/cluster/cluster_algorithm.o obj/ccore/cluster/cluster_data.o obj/ccore/cluster/cure.o obj/ccore/cluster/dbscan.o obj/ccore/cluster/hsyncnet.o obj/ccore/cluster/kmeans.o obj/ccore/cluster/kmedians.o obj/ccore/cluster/kmedoids.o obj/ccore/cluster/optics.o obj/ccore/cluster/ordering_analyser.o obj/ccore/cluster/rock.o obj/ccore/cluster/somsc.o obj/ccore/cluster/syncnet.o obj/ccore/cluster/xmeans.o obj/ccore/container/adjacency_bit_matrix.o obj/ccore/container/adjacency_connector.o obj/ccore/container/adjacency_factory.o obj/ccore/container/adjacency_list.o obj/ccore/container/adjacency_matrix.o obj/ccore/container/adjacency_weight_list.o obj/ccore/container/kdtree.o obj/ccore/differential/differ_factor.o obj/ccore/interface/agglomerative_interface.o obj/ccore/interface/cure_interface.o obj/ccore/interface/dbscan_interface.o obj/ccore/interface/kmeans_interface.o obj/ccore/interface/kmedians_interface.o obj/ccore/interface/kmedoids_interface.o obj/ccore/interface/optics_interface.o obj/ccore/interface/pcnn_interface.o obj/ccore/interface/pyclustering_package.o obj/ccore/interface/rock_interface.o obj/ccore/interface/som_interface.o obj/ccore/nnet/legion.o obj/ccore/nnet/pcnn.o obj/ccore/nnet/som.o obj/ccore/nnet/sync.o obj/ccore/nnet/syncpr.o obj/ccore/tsp/ant_colony.o obj/ccore/tsp/distance_matrix.o -o ../pyclustering/core/x64/linux/ccore.so make[1]: Leaving directory `/home/andrei/workspace/pyclustering/ccore' ``` -------------------------------- ### Commit Message Format Example Source: https://github.com/annoviko/pyclustering/wiki/Commit-Policy Example of a commit message adhering to the specified format, including an issue number and a description of changes. ```bash $ git commit . -m "#490: Silhouette C++ implementation." ``` -------------------------------- ### Configure PyPI Upload Servers Source: https://github.com/annoviko/pyclustering/wiki/Release-PyPi-Instruction Sets up configuration for uploading packages to TestPyPI and PyPI. ```bash $ touch ~/.pypirc $ nano ~/.pypirc ``` ```ini [distutils] index-servers= testpypi pypi [testpypi] repository = https://test.pypi.org/legacy/ username = password = [pypi] repository = https://upload.pypi.org/legacy/ username = password = ``` -------------------------------- ### Download Core Binaries from Cloud Source: https://github.com/annoviko/pyclustering/wiki/Release-PyPi-Instruction Downloads core binaries for different platforms and architectures using a cloud token. ```bash $ python3 ci/cloud $CLOUD_TOKEN get_bin windows 64-bit $ python3 ci/cloud $CLOUD_TOKEN get_bin windows 32-bit $ python3 ci/cloud $CLOUD_TOKEN get_bin macos 64-bit $ python3 ci/cloud $CLOUD_TOKEN get_bin linux 32-bit $ python3 ci/cloud $CLOUD_TOKEN get_bin linux 64-bit ``` -------------------------------- ### Data Clustering with K-Means Algorithm Source: https://github.com/annoviko/pyclustering/blob/master/README.rst Shows how to perform data clustering using the K-Means algorithm with K-Means++ initialization for centers. Loads sample data and prepares initial centers. ```python from pyclustering.cluster.kmeans import kmeans, kmeans_visualizer from pyclustering.cluster.center_initializer import kmeans_plusplus_initializer from pyclustering.samples.definitions import FCPS_SAMPLES from pyclustering.utils import read_sample # Load list of points for cluster analysis. sample = read_sample(FCPS_SAMPLES.SAMPLE_TWO_DIAMONDS) # Prepare initial centers using K-Means++ method. initial_centers = kmeans_plusplus_initializer(sample, 2).initialize() # Create instance of K-Means algorithm with prepared centers. kmeans_instance = kmeans(sample, initial_centers) ``` -------------------------------- ### Build core library for Linux (64-bit) Source: https://github.com/annoviko/pyclustering/wiki/Installing Build the 'ccore.so' shared library for 64-bit Linux systems using the provided makefile. ```bash cd pyclustering/ccore $ make ccore_x64 ``` -------------------------------- ### Build core library for Linux (32-bit) Source: https://github.com/annoviko/pyclustering/wiki/Installing Build the 'ccore.so' shared library for 32-bit Linux systems using the provided makefile. ```bash cd pyclustering/ccore $ make ccore_x86 ``` -------------------------------- ### Build and Run CCORE Unit Tests with Make Source: https://github.com/annoviko/pyclustering/wiki/Unit-Testing-CCORE Use these makefile targets to build and execute the unit tests for the CCORE module. Ensure you are in the correct directory. ```bash cd pyclustering/ccore/ make ut make utrun ``` -------------------------------- ### Data Clustering with CURE Algorithm Source: https://github.com/annoviko/pyclustering/blob/master/README.rst Demonstrates how to use the CURE algorithm for data clustering and visualize the results. Requires sample data and the cluster_visualizer. ```python from pyclustering.cluster import cluster_visualizer; from pyclustering.cluster.cure import cure; from pyclustering.utils import read_sample; from pyclustering.samples.definitions import FCPS_SAMPLES; # Input data in following format [ [0.1, 0.5], [0.3, 0.1], ... ]. input_data = read_sample(FCPS_SAMPLES.SAMPLE_LSUN); # Allocate three clusters. cure_instance = cure(input_data, 3); cure_instance.process(); clusters = cure_instance.get_clusters(); # Visualize allocated clusters. visualizer = cluster_visualizer(); visualizer.append_clusters(clusters, input_data); visualizer.show(); ``` -------------------------------- ### Create Distribution Archive Source: https://github.com/annoviko/pyclustering/wiki/Release-PyPi-Instruction Generates the source distribution archive for the package. ```bash $ python3 setup.py sdist ``` -------------------------------- ### Run OPTICS Cluster Analysis and Visualize Results Source: https://github.com/annoviko/pyclustering/blob/master/README.rst Performs cluster analysis using the OPTICS algorithm and visualizes the ordering diagram and clustering results. Requires sample data, radius, and neighbor count. ```python from pyclustering.cluster import cluster_visualizer from pyclustering.cluster.optics import optics, ordering_analyser, ordering_visualizer from pyclustering.samples.definitions import FCPS_SAMPLES from pyclustering.utils import read_sample # Read sample for clustering from some file sample = read_sample(FCPS_SAMPLES.SAMPLE_LSUN) # Run cluster analysis where connectivity radius is bigger than real radius = 2.0 neighbors = 3 amount_of_clusters = 3 optics_instance = optics(sample, radius, neighbors, amount_of_clusters) # Performs cluster analysis optics_instance.process() # Obtain results of clustering clusters = optics_instance.get_clusters() noise = optics_instance.get_noise() ordering = optics_instance.get_ordering() # Visualize ordering diagram analyser = ordering_analyser(ordering) ordering_visualizer.show_ordering_diagram(analyser, amount_of_clusters) # Visualize clustering results visualizer = cluster_visualizer() visualizer.append_clusters(clusters, sample) visualizer.show() ``` -------------------------------- ### Build ccore.dll for Windows using Visual Studio Source: https://github.com/annoviko/pyclustering/wiki/Cpp-PyClustering Steps to build the dynamic-link library for Windows using Visual Studio. This involves opening the solution file and building the 'ccore' project with the desired configuration (x64 or x86). ```plaintext 1. Open folder **pyclustering/ccore**; 2. Open MSVS solution **ccore.sln**; 3. Choose **ccore** project; 4. Specify configuration of library (x64 or x86). 5. Build **ccore** library; ``` -------------------------------- ### Build ccore.so for Linux (64-bit) Source: https://github.com/annoviko/pyclustering/wiki/Cpp-PyClustering Use this command to build the 64-bit shared library for Linux. Ensure you are in the 'pyclustering/ccore' directory. ```bash $ cd pyclustering/ccore $ make ccore_x64 ``` -------------------------------- ### Generate and Deploy Doxygen Documentation Source: https://github.com/annoviko/pyclustering/wiki/Release-PyPi-Instruction Generates Doxygen documentation and deploys it to GitHub Pages. ```bash $ doxygen docs/doxygen_conf_pyclustering $ cd ../ $ mkdir pyclustering-website $ cd pyclustering-website $ git clone https://github.com/pyclustering/pyclustering.github.io.git . $ cp -r ../pyclustering/doxygen_python_docs docs/ $ git add docs// $ git commit . -m "[docs] Upload documentation for library version ." $ git push ``` -------------------------------- ### Build Static Library (Windows) Source: https://github.com/annoviko/pyclustering/blob/master/docs/page/cpp_pyclustering_intro.md Build the static library for the C++ pyclustering library on Windows using Visual Studio. Open the 'ccore.sln' solution and build the 'ccore' project with the 'Release Static Library' configuration. ```text Release Static Library ``` -------------------------------- ### Build Static Library (Linux/MacOS) Source: https://github.com/annoviko/pyclustering/blob/master/docs/page/cpp_pyclustering_intro.md Build the 64-bit static library for the C++ pyclustering library on Linux or MacOS using the 'make' command. Ensure you are in the 'pyclustering/ccore' directory. ```bash make ccore_64bit_statis ``` -------------------------------- ### View All Make Targets (Linux/MacOS) Source: https://github.com/annoviko/pyclustering/blob/master/docs/page/cpp_pyclustering_intro.md View all available build targets for the C++ pyclustering library on Linux or MacOS by executing the 'make' command without arguments in the 'pyclustering/ccore' directory. ```bash make ``` -------------------------------- ### Build ccore.so for Linux (32-bit) Source: https://github.com/annoviko/pyclustering/wiki/Cpp-PyClustering Use this command to build the 32-bit shared library for Linux. Ensure you are in the 'pyclustering/ccore' directory. ```bash $ cd pyclustering/ccore $ make ccore_x86 ``` -------------------------------- ### Build Dynamic Library (Windows) Source: https://github.com/annoviko/pyclustering/blob/master/docs/page/cpp_pyclustering_intro.md Build the dynamic (Release) library for the C++ pyclustering library on Windows using Visual Studio. Open the 'ccore.sln' solution and build the 'ccore' project with the 'Release' configuration. ```text Release ``` -------------------------------- ### Build gtest Library Source: https://github.com/annoviko/pyclustering/blob/master/ccore/external/CMakeLists.txt Creates a static library named 'gtest' using the discovered Google Test source files. ```cmake add_library(gtest STATIC ${GTEST_SOURCES}) ``` -------------------------------- ### Upload to PyPI Source: https://github.com/annoviko/pyclustering/wiki/Release-PyPi-Instruction Uploads the distribution archive to the production PyPI repository. ```bash $ twine upload dist/* -r pypi ``` -------------------------------- ### Create PyClustering Directory Source: https://github.com/annoviko/pyclustering/wiki/Working-Copy-Preparation Use this command to create a new directory for storing PyClustering sources. ```bash $ mkdir pyclustering ``` -------------------------------- ### Run Unit Tests for a Specific Algorithm (cluster.dbscan) Source: https://github.com/annoviko/pyclustering/wiki/Testing-PyClustering Execute unit tests for a specific algorithm, like 'pyclustering.cluster.dbscan'. This is useful for isolating and testing the behavior of individual clustering algorithms. ```bash python3 pyclustering/cluster/tests/ut/dbscan_tests.py ``` -------------------------------- ### Run Integration Tests for a Specific Algorithm (cluster.dbscan) Source: https://github.com/annoviko/pyclustering/wiki/Testing-PyClustering Execute integration tests for a specific algorithm, such as 'pyclustering.cluster.dbscan'. This verifies the algorithm's integration within the broader library context. ```bash python3 pyclustering/cluster/tests/it/dbscan_tests.py ``` -------------------------------- ### Locate CCORE Solution File for Visual Studio Source: https://github.com/annoviko/pyclustering/wiki/Unit-Testing-CCORE This command lists the CCORE solution file, which is used to open the unit-test MSVS 2015 project. It helps in locating the project file for development. ```bash ls pyclustering/ccore/ccore.sln ``` -------------------------------- ### Upload to TestPyPI Source: https://github.com/annoviko/pyclustering/wiki/Release-PyPi-Instruction Uploads the distribution archive to the TestPyPI repository for testing. ```bash $ twine upload dist/* -r testpypi ``` -------------------------------- ### Build Shared Library (Linux/MacOS) Source: https://github.com/annoviko/pyclustering/blob/master/docs/page/cpp_pyclustering_intro.md Build the 64-bit shared library for the C++ pyclustering library on Linux or MacOS using the 'make' command. Ensure you are in the 'pyclustering/ccore' directory. ```bash make ccore_64bit ``` -------------------------------- ### Navigate to pyclustering/ccore Directory Source: https://github.com/annoviko/pyclustering/blob/master/docs/page/cpp_pyclustering_intro.md Navigate to the 'ccore' directory within the pyclustering project. This is a prerequisite for building the library on Linux and MacOS. ```bash cd pyclustering/ccore ``` -------------------------------- ### Debug CCORE Unit Tests with Make Source: https://github.com/annoviko/pyclustering/wiki/Unit-Testing-CCORE This makefile target is used to build and prepare the CCORE unit tests for debugging. Navigate to the ccore directory before running. ```bash cd pyclustering/ccore/ make utdbg ``` -------------------------------- ### Compile ccore Library Source: https://github.com/annoviko/pyclustering/wiki/Working-Copy-Preparation Compile the 'ccore' library, ensuring you have a C++14 compliant compiler. Options are available to build 64-bit, 32-bit, or both versions. ```bash $ cd ccore/ $ make ccore_x64 # build 64-bit version # make ccore_x86 # build 32-bit version # make ccore # build both versions ``` -------------------------------- ### Select C/C++ or Python Implementation Source: https://github.com/annoviko/pyclustering/blob/master/PKG-INFO.rst Control whether the C/C++ core or the Python implementation is used by setting the 'ccore' flag. By default, the C/C++ core is utilized if available. ```python # As by default - C/C++ part of the library is used xmeans_instance_1 = xmeans(data_points, start_centers, 20, ccore=True); # The same - C/C++ part of the library is used by default xmeans_instance_2 = xmeans(data_points, start_centers, 20); # Switch off core - Python is used xmeans_instance_3 = xmeans(data_points, start_centers, 20, ccore=False); ``` -------------------------------- ### Run All Unit Tests in PyClustering Source: https://github.com/annoviko/pyclustering/wiki/Testing-PyClustering Execute all unit tests for the pyclustering library. This command initiates the comprehensive testing suite for the library's core functionalities. ```bash python3 pyclustering/tests/tests_runner.py --unit ``` -------------------------------- ### Run Unit Tests for a Specific Module (nnet.syncpr) Source: https://github.com/annoviko/pyclustering/wiki/Testing-PyClustering Execute unit tests for a specific module within pyclustering, such as 'pyclustering.nnet.syncpr'. This allows for targeted testing of individual components. ```bash python3 pyclustering/pyclustering/nnet/tests/ut/__init__.py ``` -------------------------------- ### Include Project Headers Source: https://github.com/annoviko/pyclustering/blob/master/ccore/external/CMakeLists.txt Adds the 'include' directory to the list of directories where CMake will search for header files. ```cmake include_directories(include) ``` -------------------------------- ### Run All Integration Tests in PyClustering Source: https://github.com/annoviko/pyclustering/wiki/Testing-PyClustering Execute all integration tests for the pyclustering library. This command is used to verify the interaction between different components and the core library. ```bash python3 pyclustering/tests/tests_runner.py --integration ``` -------------------------------- ### Discover Google Test Sources Source: https://github.com/annoviko/pyclustering/blob/master/ccore/external/CMakeLists.txt Recursively finds all .cpp files within the src/gtest directory for the Google Test framework. ```cmake file(GLOB_RECURSE GTEST_SOURCES src/gtest "*.cpp") ``` -------------------------------- ### Clean ccore target on Linux Source: https://github.com/annoviko/pyclustering/wiki/Cpp-PyClustering Commands to clean previously built ccore targets on Linux. Use the appropriate command for the architecture you wish to clean. ```bash $ make ccore_x64_clean $ make ccore_x86_clean ``` -------------------------------- ### Set C++ Standard Source: https://github.com/annoviko/pyclustering/blob/master/ccore/external/CMakeLists.txt Sets the C++ standard to C++14 and enforces its requirement for the project. ```cmake set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED True) ``` -------------------------------- ### Check CCORE Unit Tests for Memory Leaks with Valgrind Source: https://github.com/annoviko/pyclustering/wiki/Unit-Testing-CCORE Utilize this makefile target to run CCORE unit tests under Valgrind for memory leak detection. Ensure you are in the ccore directory. ```bash cd pyclustering/ccore/ make valgrind ``` -------------------------------- ### Simulate Chaotic Neural Network CNN Source: https://github.com/annoviko/pyclustering/blob/master/README.rst Simulates a chaotic neural network (CNN) using provided stimulus and visualizes the output dynamic, dynamic matrix, observation matrix, and clustering results. The number of neurons must match the stimulus length. ```python from pyclustering.cluster import cluster_visualizer from pyclustering.samples.definitions import SIMPLE_SAMPLES from pyclustering.utils import read_sample from pyclustering.nnet.cnn import cnn_network, cnn_visualizer # Load stimulus from file. stimulus = read_sample(SIMPLE_SAMPLES.SAMPLE_SIMPLE3) # Create chaotic neural network, amount of neurons should be equal to amount of stimulus. network_instance = cnn_network(len(stimulus)) # Perform simulation during 100 steps. steps = 100 output_dynamic = network_instance.simulate(steps, stimulus) # Display output dynamic of the network. cnn_visualizer.show_output_dynamic(output_dynamic) # Display dynamic matrix and observation matrix to show clustering phenomenon. cnn_visualizer.show_dynamic_matrix(output_dynamic) cnn_visualizer.show_observation_matrix(output_dynamic) # Visualize clustering results. clusters = output_dynamic.allocate_sync_ensembles(10) visualizer = cluster_visualizer() visualizer.append_clusters(clusters, stimulus) visualizer.show() ``` -------------------------------- ### Clone pyclustering repository Source: https://github.com/annoviko/pyclustering/wiki/Installing Clone the pyclustering library source code from the GitHub repository to your local machine. ```bash # get sources of the pyclustering library, for example, from repository $ mkdir pyclustering $ cd pyclustering/ $ git clone https://github.com/annoviko/pyclustering.git . ``` -------------------------------- ### Obtain Cloud Token Source: https://github.com/annoviko/pyclustering/wiki/Release-PyPi-Instruction Requests an authorization token for accessing Yandex cloud services. ```http https://oauth.yandex.ru/authorize?response_type=token&client_id=ID_YANDEX_APPLICATION ``` -------------------------------- ### Simulate Oscillatory Network PCNN Source: https://github.com/annoviko/pyclustering/blob/master/README.rst Simulates a Pulse-Coupled neural network (PCNN) with a specified number of oscillators and performs simulation using a binary external stimulus. It then allocates synchronous ensembles and visualizes the output dynamic. ```python from pyclustering.nnet.pcnn import pcnn_network, pcnn_visualizer # Create Pulse-Coupled neural network with 10 oscillators. net = pcnn_network(10) # Perform simulation during 100 steps using binary external stimulus. dynamic = net.simulate(50, [1, 1, 1, 0, 0, 0, 0, 1, 1, 1]) # Allocate synchronous ensembles from the output dynamic. ensembles = dynamic.allocate_sync_ensembles() # Show output dynamic. pcnn_visualizer.show_output_dynamic(dynamic, ensembles) ``` -------------------------------- ### BibTeX Citation for PyClustering Source: https://github.com/annoviko/pyclustering/blob/master/docs/page/cpp_pyclustering_intro.md BibTeX entry for citing the PyClustering library in scientific publications. Includes DOI, URL, year, author, and journal information. ```bibtex @article{Novikov2019, doi = {10.21105/joss.01230}, url = {https://doi.org/10.21105/joss.01230}, year = 2019, month = {apr}, publisher = {The Open Journal}, volume = {4}, number = {36}, pages = {1230}, author = {Andrei Novikov}, title = {{PyClustering}: Data Mining Library}, journal = {Journal of Open Source Software} } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.