我正在尝试在 Python 中实现模糊 c 均值算法。我在 Matlab 中使用了内置函数来做同样的事情。我想知道 Python 中是否也有这样简单的方法。我试过了
http://peach.googlecode.com/hg/doc/build/html/tutorial/fuzzy-c-means.html
我试过这个:
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
但得到* ImportError: No module named bitarray *
任何人都可以帮忙吗?