generate_n_arms_star_data {treefit} | R Documentation |
Generate a multi-dimensional star tree data
Description
Generate a multi-dimensional star tree data that contain
n_samples
data points and fit a star tree with n_arms
arms.
Usage
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. |
Value
A generated martix
. The rows and columns correspond to
samples and features.
Examples
# 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))
[Package treefit version 1.0.2 Index]