Reputation: 47
I am trying to implement fuzzy c means algorithm in Python..I have used the builtin function to do the same in Matlab.I would like to know whether there is any such simple method in Python also.I tried
http://peach.googlecode.com/hg/doc/build/html/tutorial/fuzzy-c-means.html
I have tried this :
from numpy import *
import peach as p
x = array( [
[ 0., 0. ], [ 0., 1. ], [ 0., 2. ], [ 1., 0. ], [ 1., 1. ], [ 1., 2. ],
[ 2., 0. ], [ 2., 1. ], [ 2., 2. ], [ 5., 5. ], [ 5., 6. ], [ 5., 7. ],
[ 6., 5. ], [ 6., 6. ], [ 6., 7. ], [ 7., 5. ], [ 7., 6. ], [ 7., 7. ] ] )
mu = array( [
[ 0.7, 0.3 ], [ 0.7, 0.3 ], [ 0.7, 0.3 ], [ 0.7, 0.3 ], [ 0.7, 0.3 ],
[ 0.7, 0.3 ], [ 0.7, 0.3 ], [ 0.7, 0.3 ], [ 0.7, 0.3 ], [ 0.3, 0.7 ],
[ 0.3, 0.7 ], [ 0.3, 0.7 ], [ 0.3, 0.7 ], [ 0.3, 0.7 ], [ 0.3, 0.7 ],
[ 0.3, 0.7 ], [ 0.3, 0.7 ], [ 0.3, 0.7 ] ] )
m = 2.0
fcm = p.FuzzyCMeans(x, mu, m)
print "After 20 iterations, the algorithm converged to the centers:"
print fcm(emax=0)
print "The membership values for the examples are given below:"
print fcm.mu
but getting * ImportError: No module named bitarray *
Can anyone help?
Upvotes: 0
Views: 14008
Reputation: 31
I had this problem. Forgot the sudo
when doing pip install bitarray
Upvotes: 3
Reputation: 31
Sometimes it is just because you are in the installed folder of the package so that you could not import it. Try to go somewhere else and rerun it.
Upvotes: 1