GithubHelp home page GithubHelp logo

smallpokonyan / snndpc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from liurui39660/snndpc

0.0 0.0 0.0 6.5 MB

Shared Nearest Neighbor-based Clustering by Fast Search and Find of Density Peaks

License: Apache License 2.0

C++ 65.35% Python 31.60% CMake 3.05%

snndpc's Introduction

Shared-Nearest-Neighbor-Based Clustering by Fast Search and Find of Density Peaks

C++ and Python implementation of SNNDPC algorithm.

The Matlab version is moved to the branch MatlabImplementation.

Demo

If you use Windows:

  1. Open a Visual Studio developer command prompt
    • Because of the toolchain paths
  2. cd to project root SNNDPC/
  3. cmake -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" -S . -B build\release
  4. cmake --build build\release --target Demo
  5. build\release\Demo.exe

The demo runs on the S2 dataset.

If CMake complains about its version, modify SNNDPC/CMakeLists.txt:1 to fit your CMake version.

To use other datasets, see Customization

Environment

Some highlighted requirements.

  • Python: 3.8, because of := syntax
  • IntelTBB: Optional, for parallelization
  • OpenMP: Optional, for parallelization

Customization

Provided Dataset

To use other provided datasets in demo:

  1. Modify variable pathData at SNNDPC/Demo.cpp:11.

    • Macro SOLUTION_DIR is the absolute path to SNNDPC/.
  2. Modify variables k, n, d, and nc according to the paper

    Variable Reference
    k Table 4, column Arg-
    n Table 2, column No. of records
    d Table 2, column No. of attributes
    nc Table 2, column No. of clusters

External Dataset + Demo.cpp

To use external datasets in Demo.cpp:

  1. Make sure your dataset has exactly 3 columns: x, y, and label.
    • If you want to use more attributes, you need to edit the fscanf call at Demo.cpp:24.

External Dataset + Custom Runner

To use external datasets in a custom runner:

  1. Load your dataset into a (flattened) 1D C-style array data, shape [n×d].
    • For the logical 2D array, each row is a record, and each column is an attribute.
  2. Include SNNDPC.hpp.
  3. Call the SNNDPC() with parameters k, n, d, nc, and data.
  4. The function will return two pointers, the centroids and the assignment.
    • Both are a 1D array.
    • Both are created by new, you need to manually delete them to prevent memory leak.

Contact

If you have any inquiries, please open an issue instead of sending emails directly to me. My email address on the paper is no longer frequently checked.

snndpc's People

Contributors

liurui39660 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.