Git Product home page Git Product logo

clevr's Introduction

clevr: Clustering and Link Prediction Evaluation in R

clevr implements functions for evaluating link prediction and clustering algorithms in R. It includes efficient implementations of common performance measures, such as: * pairwise precision, recall, F-measure; * homogeneity, completeness and V-measure; * (adjusted) Rand index; * variation of information; and * mutual information. While the current focus is on supervised (a.k.a. external) performance measures, unsupervised (internal) measures are also in scope for future releases.

Installation

You can install the latest release from CRAN by entering:

install.packages("clevr")

The development version can be installed from GitHub using devtools:

# install.packages("devtools")
devtools::install_github("cleanzr/clevr")

Example

Several functions are included which transform between different clustering representations.

library(clevr)
# A clustering of four records represented as a membership vector
pred_membership <- c("Record1" = 1, "Record2" = 1, "Record3" = 1, "Record 4" = 2)

# Represent as a set of record pairs that appear in the same cluster
pred_pairs <- membership_to_pairs(pred_membership)
print(pred_pairs)
#>      [,1]      [,2]     
#> [1,] "Record1" "Record2"
#> [2,] "Record1" "Record3"
#> [3,] "Record2" "Record3"

# Represent as a list of record clusters
pred_clusters <- membership_to_clusters(pred_membership)
print(pred_clusters)
#> $`1`
#> [1] "Record1" "Record2" "Record3"
#> 
#> $`2`
#> [1] "Record 4"

Performance measures are available for evaluating linked pairs:

true_pairs <- rbind(c("Record1", "Record2"), c("Record3", "Record4"))

pr <- precision_pairs(true_pairs, pred_pairs)
print(pr)
#> [1] 0.3333333

re <- recall_pairs(true_pairs, pred_pairs)
print(re)
#> [1] 0.5

and for evaluating clusterings:

true_membership <- c("Record1" = 1, "Record2" = 1, "Record3" = 2, "Record 4" = 2)

ari <- adj_rand_index(true_membership, pred_membership)
print(ari)
#> [1] 0

vi <- variation_info(true_membership, pred_membership)
print(vi)
#> [1] 0.8239592

clevr's People

Contributors

ngmarchant avatar

Stargazers

Olivier Binette avatar Rebecca Steorts 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.