• Stars
    star
    11
  • Rank 1,637,233 (Top 34 %)
  • Language
    Elixir
  • License
    MIT License
  • Created almost 7 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Elixir implementation of ROCK: A Robust Clustering Algorithm for Categorical Attributes

ROCK

ROCK: A Robust Clustering Algorithm for Categorical Attributes

The algorithm's description http://theory.stanford.edu/~sudipto/mypapers/categorical.pdf

Installation

The easiest way to add Rock to your project is by using Mix.

Add :rock as a dependency to your project's mix.exs:

defp deps do
  [
    {:rock, "~> 0.1.2"}
  ]
end

And run:

$ mix deps.get

Basic Usage

To clusterize points using the Rock algorithm you should use Rock.clusterize/4 with the arguments:

  • points, points that will be clusterized
  • number_of_clusters, the number of desired clusters.
  • theta, neighborhood parameter in the range [0,1). Default value is 0.5.
  • similarity_function, distance function to use. Jaccard Coefficient is used by default.
  ## Examples

      points =
      [
        {"point1", ["1", "2", "3"]},
        {"point2", ["1", "2", "4"]},
        {"point3", ["1", "2", "5"]},
        {"point4", ["1", "3", "4"]},
        {"point5", ["1", "3", "5"]},
        {"point6", ["1", "4", "5"]},
        {"point7", ["2", "3", "4"]},
        {"point8", ["2", "3", "5"]},
        {"point9", ["2", "4", "5"]},
        {"point10", ["3", "4", "5"]},
        {"point11", ["1", "2", "6"]},
        {"point12", ["1", "2", "7"]},
        {"point13", ["1", "6", "7"]},
        {"point14", ["2", "6", "7"]}
      ]

      # Example 1

      Rock.clusterize(points, 5, 0.4)
      [
        [
          {"point4", ["1", "3", "4"]},
          {"point5", ["1", "3", "5"]},
          {"point6", ["1", "4", "5"]},
          {"point10", ["3", "4", "5"]},
          {"point7", ["2", "3", "4"]},
          {"point8", ["2", "3", "5"]}
        ],
        [
          {"point11", ["1", "2", "6"]},
          {"point12", ["1", "2", "7"]},
          {"point1", ["1", "2", "3"]},
          {"point2", ["1", "2", "4"]},
          {"point3", ["1", "2", "5"]}
        ],
        [
          {"point9", ["2", "4", "5"]}
        ],
        [
          {"point13", ["1", "6", "7"]}
        ],
        [
          {"point14", ["2", "6", "7"]}
        ]
      ]

      # Example 2 (with custom similarity function)

      similarity_function = fn(
          %Rock.Struct.Point{attributes: attributes1},
          %Rock.Struct.Point{attributes: attributes2}) ->

        count1 = Enum.count(attributes1)
        count2 = Enum.count(attributes2)

        if count1 >= count2, do: (count2 - 1) / count1, else: (count1 - 1) / count2
      end

      Rock.clusterize(points, 4, 0.5, similarity_function)
      [
        [
          {"point1", ["1", "2", "3"]},
          {"point2", ["1", "2", "4"]},
          {"point3", ["1", "2", "5"]},
          {"point4", ["1", "3", "4"]},
          {"point5", ["1", "3", "5"]},
          {"point6", ["1", "4", "5"]},
          {"point7", ["2", "3", "4"]},
          {"point8", ["2", "3", "5"]},
          {"point9", ["2", "4", "5"]},
          {"point10", ["3", "4", "5"]},
          {"point11", ["1", "2", "6"]}
        ],
        [
          {"point12", ["1", "2", "7"]}
        ],
        [
          {"point13", ["1", "6", "7"]}
        ],
        [
          {"point14", ["2", "6", "7"]}
        ]
      ]

Contributing

  1. Fork it!
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Author

Ayrat Badykov (@ayrat555)

License

Rock is released under the MIT License. See the LICENSE file for further details.

More Repositories

1

fang

Background processing for Rust
Rust
566
star
2

frankenstein

Telegram bot API client for Rust
Rust
207
star
3

el_monitorro

๐Ÿ‚ El Monitorro is a high-performance feed reader as a Telegram bot. It supports RSS, Atom and JSON feeds
Rust
193
star
4

hornet

Hornet is a simple library for stress testing
Elixir
33
star
5

mix.el

Emacs Minor Mode for Mix, a build tool that ships with Elixir
Emacs Lisp
32
star
6

cryptopunk

Hierarchical deterministic wallet for Elixir
Elixir
26
star
7

ton

TON (The Open Network) SDK
Elixir
24
star
8

clope

Elixir implementation of CLOPE: A Fast and Effective Clustering Algorithm for Transactional Data
Elixir
20
star
9

treasure_hunter

The project for hacking your crypto wallet
Elixir
19
star
10

cargo-mode

Emacs minor mode which allows to dynamically select cargo command
Emacs Lisp
17
star
11

dot-emacs

My Emacs configuration
Emacs Lisp
15
star
12

ex_secp256k1

Rust Nif that wraps a couple functions from the libsecp256k1 rust library
Elixir
13
star
13

company-elixir

company-mode completion backend for Elixir.
Emacs Lisp
12
star
14

cronenberg

Simple cron command entry parser
Rust
11
star
15

braindump

WIP braindump
Emacs Lisp
10
star
16

eth_bloom

Ethereum's bloom filter implementation in elixir
Elixir
6
star
17

ex_riak_cs

Riak CS API wrapper for Elixir
Elixir
5
star
18

cortex-dark

Dark theme for Braindump (Hugo)
SCSS
5
star
19

ex_pbkdf2

Password-Based Key Derivation Function v2 (PBKDF2) for Elixir by a Rust-based NIF
Elixir
4
star
20

foogold

A tool for trying your luck with random bitcoin mnemonics
Rust
4
star
21

cafezinho

Rust NIF for Ed25519 curve functions.
Elixir
2
star
22

geth_reorg_sim

Dockerfile
2
star
23

ayrat555.github.io

Personal blog
HTML
2
star
24

mnemoniac

Implementation of BIP-39 which describes generation of mnemonic codes or mnemonic sentences
Elixir
2
star
25

ex_keccak

Elixir
1
star
26

evil_crc32c

"Evil" version of the crc32c algorithm
Elixir
1
star
27

tiny_evm

Tiny EVM - test assignment for the Mana project (https://github.com/poanetwork/mana) candidates
Elixir
1
star
28

ex_base58

Rust NIF for Base58 encoding and decoding with support of Bitcoin, Ripple, Monero and Flickr alphabets.
Elixir
1
star