View source: R/visualisation.R
density_plot | R Documentation |
Create 2d dimensionality reduction of sample fit to Bayesian network clusters
density_plot(cluster_results, var_selection = NULL, colourys = NULL)
cluster_results |
Cluster results from function get_clusters |
var_selection |
Selected variables to consider, e.g. c(1:5) for first five only |
colourys |
A vector specifying the colors of each cluster (optional) |
A density plot of class recordedplot.
# Simulate data
sampled_data <- sampleData(n_vars = 15, n_samples = c(200,200,200))$sampled_data
# Learn clusters
cluster_results <- get_clusters(sampled_data)
# Load additional pacakges to create a 2d dimensionality reduction
library(car)
library(ks)
library(ggplot2)
library(graphics)
library(stats)
# Plot a 2d dimensionality reduction
density_plot(cluster_results)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.