class_docstr: !
  @brief Class represents Fuzzy C-means (FCM) clustering algorithm.
  @details Fuzzy clustering is a form of clustering in which each data point can belong to more than one cluster.
  
  Fuzzy C-Means algorithm uses two general formulas for cluster analysis. The first is to updated membership of each
  point:
  [w_{ij}=rac{1}{\sum_{k=0}^{c}\left ( rac{\left \| x_{i}-c_{j} 
  ight \|}{\left \| x_{i}-c_{k} 
  ight \|} 
  ight )^{rac{2}{m-1}}}]
  
  The second formula is used to update centers in line with obtained centers:
  [c_{k}=rac{\sum_{i=0}^{N}w_{k}\left ( x_{i} 
  ight )^{m}x_{i}}{\sum_{i=0}^{N}w_{k}\left ( x_{i} 
  ight )^{m}}]
  
  Fuzzy C-Means clustering results depend on initial centers. Algorithm K-Means++ can used for center initialization
  from module 'pyclustering.cluster.center_initializer'.
  
  CCORE implementation of the algorithm uses thread pool to parallelize the clustering process.
  
  Here is an example how to perform cluster analysis using Fuzzy C-Means algorithm:
  @code
      from pyclustering.samples.definitions import FAMOUS_SAMPLES
      from pyclustering.cluster import cluster_visualizer
      from pyclustering.cluster.center_initializer import kmeans_plusplus_initializer
      from pyclustering.cluster.fcm import fcm
      from pyclustering.utils import read_sample
  
      # load list of points for cluster analysis
      sample = read_sample(FAMOUS_SAMPLES.SAMPLE_OLD_FAITHFUL)
  
      # initialize
      initial_centers = kmeans_plusplus_initializer(sample, 2, kmeans_plusplus_initializer.FARTHEST_CENTER_CANDIDATE).initialize()
  
      # create instance of Fuzzy C-Means algorithm
      fcm_instance = fcm(sample, initial_centers)
  
      # run cluster analysis and obtain results
      fcm_instance.process()
      clusters = fcm_instance.get_clusters()
      centers = fcm_instance.get_centers()
  
      # visualize clustering results
      visualizer = cluster_visualizer()
      visualizer.append_clusters(clusters, sample)
      visualizer.append_cluster(centers, marker='*', markersize=10)
      visualizer.show()
  @endcode
  
  The next example shows how to perform image segmentation using Fuzzy C-Means algorithm:
  @code
      from pyclustering.cluster.center_initializer import kmeans_plusplus_initializer
      from pyclustering.cluster.fcm import fcm
      from pyclustering.utils import read_image, draw_image_mask_segments
  
      # load list of points for cluster analysis
      data = read_image("stpetersburg_admiral.jpg")
  
      # initialize
      initial_centers = kmeans_plusplus_initializer(data, 3, kmeans_plusplus_initializer.FARTHEST_CENTER_CANDIDATE).initialize()
  
      # create instance of Fuzzy C-Means algorithm
      fcm_instance = fcm(data, initial_centers)
  
      # run cluster analysis and obtain results
      fcm_instance.process()
      clusters = fcm_instance.get_clusters()
  
      # visualize segmentation results
      draw_image_mask_segments("stpetersburg_admiral.jpg", clusters)
  @endcode
  
  @image html fcm_segmentation_stpetersburg.png "Image segmentation using Fuzzy C-Means algorithm."
docstr: !
  @brief Initialize Fuzzy C-Means algorithm.
  
  @param[in] data (array_like): Input data that is presented as array of points (objects), each point should be represented by array_like data structure.
  @param[in] initial_centers (array_like): Initial coordinates of centers of clusters that are represented by array_like data structure: [center1, center2, ...].
  @param[in] **kwargs: Arbitrary keyword arguments (available arguments: 'tolerance', 'itermax', 'm').
  
  <b>Keyword Args:</b><br>
      - ccore (bool): Defines should be CCORE library (C++ pyclustering library) used instead of Python code or not.
      - tolerance (float): Stop condition: if maximum value of change of centers of clusters is less than tolerance then algorithm stops processing.
      - itermax (uint): Maximum number of iterations that is used for clustering process (by default: 200).
      - m (float): Hyper-parameter that controls how fuzzy the cluster will be. The higher it is, the fuzzier the cluster will be in the end.
         This parameter should be greater than 1 (by default: 2).
docstr_tok: ["!","@","brief","Initialize","Fuzzy","C-Means","algorithm",".","@","param","[","in","]","data","(","array_like",")",":","Input","data","that","is","presented","as","array","of","points","(","objects",")",",","each","point","should","be","represented","by","array_like","data","structure",".","@","param","[","in","]","initial_centers","(","array_like",")",":","Initial","coordinates","of","centers","of","clusters","that","are","represented","by","array_like","data","structure",":","[","center1",",","center2",",","...","]",".","@","param","[","in","]","*","*","kwargs",":","Arbitrary","keyword","arguments","(","available","arguments",":","'tolerance","'",",","'itermax","'",",","'m","'",")",".","<","b",">","Keyword","Args",":","<","\/b",">","<","br",">","-","ccore","(","bool",")",":","Defines","should","be","CCORE","library","(","C++","pyclustering","library",")","used","instead","of","Python","code","or","not",".","-","tolerance","(","float",")",":","Stop","condition",":","if","maximum","value","of","change","of","centers","of","clusters","is","less","than","tolerance","then","algorithm","stops","processing",".","-","itermax","(","uint",")",":","Maximum","number","of","iterations","that","is","used","for","clustering","process","(","by","default",":","200",")",".","-","m","(","float",")",":","Hyper-parameter","that","controls","how","fuzzy","the","cluster","will","be",".","The","higher","it","is",",","the","fuzzier","the","cluster","will","be","in","the","end",".","This","parameter","should","be","greater","than","1","(","by","default",":","2",")","."]
code: def __init__(self, data, initial_centers, **kwargs):
      """!
      @brief Initialize Fuzzy C-Means algorithm.
  
      @param[in] data (array_like): Input data that is presented as array of points (objects), each point should be represented by array_like data structure.
      @param[in] initial_centers (array_like): Initial coordinates of centers of clusters that are represented by array_like data structure: [center1, center2, ...].
      @param[in] **kwargs: Arbitrary keyword arguments (available arguments: 'tolerance', 'itermax', 'm').
  
      <b>Keyword Args:</b><br>
          - ccore (bool): Defines should be CCORE library (C++ pyclustering library) used instead of Python code or not.
          - tolerance (float): Stop condition: if maximum value of change of centers of clusters is less than tolerance then algorithm stops processing.
          - itermax (uint): Maximum number of iterations that is used for clustering process (by default: 200).
          - m (float): Hyper-parameter that controls how fuzzy the cluster will be. The higher it is, the fuzzier the cluster will be in the end.
             This parameter should be greater than 1 (by default: 2).
  
      """
  
      self.__data = data
      self.__clusters = []
      self.__centers = initial_centers
      self.__membership = []
  
      self.__tolerance = kwargs.get("tolerance", 0.001)
      self.__itermax = kwargs.get("itermax", 200)
      self.__m = kwargs.get("m", 2)
  
      self.__degree = 2.0 / (self.__m - 1)
  
      self.__ccore = kwargs.get("ccore", True)
      if self.__ccore is True:
          self.__ccore = ccore_library.workable()
  
      self.__verify_arguments()
  
file_path: pyclustering/pyclustering/cluster/fcm.py
imports: import numpy
  import pyclustering.core.fcm_wrapper
  from pyclustering.core.wrapper import ccore_library
label_desc: Use image node_id 1 to create a new fcm object  with example: obj = fcm(data, initial_centers)