A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cran.r-project.org/web/packages/rms/../rmsb/../RcppParallel/../tglkmeans/readme/README.html below:

tglkmeans - efficient implementation of kmeans++ algorithm

tglkmeans - efficient implementation of kmeans++ algorithm

This package provides R binding to a cpp implementation of the kmeans++ algorithm.

Installation

You can install the released version of tglkmeans using the following command:

Or install the development version using:

Basic usage

Create 5 clusters normally distributed around 1 to 5, with sd of 0.3:

data <- rbind(
    matrix(rnorm(100, mean = 1, sd = 0.3), ncol = 2),
    matrix(rnorm(100, mean = 2, sd = 0.3), ncol = 2),
    matrix(rnorm(100, mean = 3, sd = 0.3), ncol = 2),
    matrix(rnorm(100, mean = 4, sd = 0.3), ncol = 2),
    matrix(rnorm(100, mean = 5, sd = 0.3), ncol = 2)
)
colnames(data) <- c("x", "y")
head(data)
#>              x         y
#> [1,] 0.9399229 0.8845469
#> [2,] 1.3150523 0.8857986
#> [3,] 1.0690177 1.1334614
#> [4,] 0.7128039 0.7431859
#> [5,] 0.4193698 1.1405633
#> [6,] 1.2876690 0.9883643

Cluster using kmeans++:

Plot the results:

Vignette

Please refer to the package vignettes for usage and workflow, or look at the usage section in the site.

A note regarding random number generation

From version 0.4.0 onward, the package uses R random number generation functions instead of the C++11 random number generation functions. Note that this may result in different results from previous versions. To get the same results as previous versions, set the use_cpp_random argument to TRUE in the TGL_kmeans function.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4