spkit.data
.mclass_gauss¶
- spkit.data.mclass_gauss(N=100, nClasses=2, var=0.1, ShowPlot=False, return_para=False)¶
Generate Multi-class gaussian samples
- Parameters:
- N: int, deafult=100
number of samples from each class
example N = 100, 100 samples for each class
- nClasses: int, default=0.5
number of classes
- var: scalar, str, default=0.1
variance - noise
- ShowPlot: bool, default=False
Plot the data,
New in version 0.0.9.7: Added to return parameters
- return_para: bool, default=False
if True, return the parameters
- Returns:
- X: 2d-array
data matrix with a sample for each row
shape (n, 2)
Changed in version 0.0.9.7: shape is changed to (n, 2)
- y: 1d-array
vector with the labels
Changed in version 0.0.9.7: shape is changed to (n, )
See also
Examples
#sp.data.mclass_gauss import numpy as np import matplotlib.pyplot as plt import spkit as sp np.random.seed(4) X, y = sp.data.mclass_gauss(N=100,nClasses=3,var=0.3) np.random.seed(None) plt.figure() plt.plot(X[y==0,0],X[y==0,1],'o') plt.plot(X[y==1,0],X[y==1,1],'o') plt.plot(X[y==2,0],X[y==2,1],'o') plt.xlabel('x1') plt.ylabel('x2') plt.title('Multi-Class Gaussian Data') plt.show()