generate_n_arms_star_data: Generate a multi-dimensional star tree data

Description Usage Arguments Value Examples

View source: R/generate.R

Description

Generate a multi-dimensional star tree data that contain n_samples data points and fit a star tree with n_arms arms.

Usage

1
generate_n_arms_star_data(n_features, n_samples, n_arms, fatness)

Arguments

n_features

The number of features (dimensions) to be generated.

n_samples

The number of samples to be generated.

n_arms

The number of arms to be generated.

fatness

How fat from the based star tree. [0.0, 1.0] is available value range.

Value

A generated martix. The rows and columns correspond to samples and features.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Generate a 100-dimensional star tree data that contain 500 data points
# and fit a star tree with 3 arms. The generated data are a bit noisy but
# tree-like.
star100.tree_like <- treefit::generate_n_arms_star_data(100, 500, 3, 0.1)
# Reduce dimension to visualize.
star3.tree_like = prcomp(star100.tree_like, rank.=3)$x
plotly::plot_ly(data.frame(star3.tree_like),
                x=~PC1,
                y=~PC2,
                z=~PC3,
                type="scatter3d",
                mode="markers",
                marker=list(size=1))

treefit documentation built on Jan. 18, 2022, 9:06 a.m.