"r") as dataFile: #dataset of mall_customers for line in dataFile: row = line.split(",") row[-1] = row[-1][:-2] data.append(row) line = dataFile.readline features = data[0][2:] #for row in data: #uncomment this to see raw dataset # print(row) data = prepareData(data) x = input("enter number of clusters: " ) #this dataset can be effectively devided only into 2 clusters fcm = FCM(data, x, 100) #create the fcm model fcm.initializeCenters() #initialize the centers of clusters current = 0 while ((current < fcm.max_iter) and (not fcm.membershipConvergence()) ): #while the membership values not converging fcm.updateMembershipDegrees() fcm.updateCenters() current += 1 """temporaryClusters=fcm.makeClusters() for item in temporaryClusters: if len(item)==0: maxrand=len(data) randomIndex=random.randint(10,maxrand)-11 row = data[randomIndex] item.append(row)""" #print(fcm.membershipMatrix[0][0]) #plotData(temporaryClusters,fcm.data) #plotCenters(fcm.centers)