INNER CODE UNIT · Python

compute

AllAlgorithms/python · classification/fcm.py:38

    def compute(self):
        self.U = self.membership(self.data, self.centers)

        past_U = numpy.copy(self.U)
        begin_time = datetime.datetime.now()
        for i in range(self.max_iter):

            self.centers = self.Centers(self.data, self.U)
            self.U = self.membership(self.data, self.centers)

            if norm(self.U - past_U) < self.error:
                break
            past_U = numpy.copy(self.U)
        x = datetime.datetime.now() - begin_time
        return self.centers, self.U, x

# that's how you run it, data being your data, and the other parameters being the basic FCM parameters such as numbe rof cluseters, degree of fuzziness and so on
# f = FuzzyCMeans(n_clusters=C, initial_centers=Initial_centers,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…