mydata: Data Generator

Description Usage Arguments Value Author(s) Examples

View source: R/mydata.R

Description

Generate random data from mixture Gaussian distribution.

Usage

1
mydata(n, d, mu = 0.8, portion = 1/2)

Arguments

n

The number of observations (sample size).

d

The number of variables (dimension).

mu

In the Gaussian mixture model, the first Gaussian is generated with zero mean and identity covariance matrix. The second Gaussian is generated with mean a d-dimensional vector with all mu and identity covariance matrix.

portion

The prior probability for the first Gaussian component.

Value

Return the data matrix with n rows and d + 1 columns. Each row represents a sample generated from the mixture Gaussian distribution. The first d columns are features and the last column is the class label of the corresponding sample.

Author(s)

Wei Sun, Xingye Qiao, and Guang Cheng

Examples

1
2
3
4
5
6
7
8
	set.seed(1)
	n = 100
	d = 10
	DATA = mydata(n, d)
	
	DATA.x = DATA[,1:d]
	DATA.y = DATA[,d+1]
	

snn documentation built on May 1, 2019, 7:05 p.m.