spkit.data
.sinusoidal¶
- spkit.data.sinusoidal(N=[100, 100], s=0.1, return_para=False, **kwargs)¶
Generate a 2-class dataset separated by a sinusoidal line
Sample a dataset from a dataset separated by a sinusoidal line
- Parameters:
- N: list or two int, default =[100,100]
vector that fix the number of samples from each class
example N = [100,100], 100 samples for each class
- s: scalar, default=0.1
standard deviation of the gaussian noise.
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, )
- s: scalar
parameter, if return_para=True
See also
Examples
#sp.data.sinusoidal import numpy as np import matplotlib.pyplot as plt import spkit as sp np.random.seed(2) X, y = sp.data.sinusoidal(N =[100, 100],s=0.1) 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.xlabel('x1') plt.ylabel('x2') plt.title('Sinusodal Data') plt.show()