code--
import numpy as np
def __init__(self, k = 3, eps = 0.0001):
self.k = k ## number of clusters
self.eps = eps ## threshold to stop `epsilon`
X=np.genfromtxt('D:\\M Tech\\ctech\\my_courses\\ELL784\\Assignment-3\\train_data.csv',delimiter=' ') #loading test data
print(X)
n, d = X.shape
print("n=",n ,"d=",d)
clus=3
mu = X[np.random.choice(n, self.k, False), :]
print(mu)
output--
[[ 1.09222171 1.89465052]
[ 1.25575788 -1.59750016]
[ 1.2305203 3.6342979 ]
[ 0.69251878 -0.12405407]]
n= 4 d= 2
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-20-7bd596b4f068> in <module>()
12 print("n=",n ,"d=",d)
13 clus=3
---> 14 mu = X[np.random.choice(n, self.k, False), :]
15 print(mu)
NameError: name 'self' is not defined
What I have tried:
not able to find error,
I think something need to be corrected in _init_ function, but what is that ??
plz help.