GithubHelp home page GithubHelp logo

ibradje / pfcm Goto Github PK

View Code? Open in Web Editor NEW
11.0 1.0 2.0 198 KB

Possiblistic Fuzzy C-Means Algorithm in Python

License: Other

Python 5.14% Jupyter Notebook 94.86%
machine-learning-algorithms pattern-recognition color-segmentation clustering-algorithm fuzzy-clustering

pfcm's Introduction

PFCM

Possiblistic Fuzzy C-Means Algorithm in Python

  • Algorithm explanation : https://www.researchgate.net/publication/3336300_A_Possibilistic_Fuzzy_C-Means_Clustering_Algorithm

  • Implementation of the algorithm MATLAB : https://www.ijser.org/researchpaper/implementation-of-possibilistic-fuzzy-cmeans-clustering-algorithm-in-matlab.pdf

    Parameters for the main function (pfcm):

    • data: Dataset to be clustered, with size M-by-N, where M is the number of data points and N is the number of coordinates for each data point.
    • c : Number of clusters
    • expo : exponent for the U matrix (default = 2)
    • max_iter : Maximum number of iterations (default = 1000)
    • min_impor : Minimum amount of imporvement (default = 0.005)
    • a : User-defined constant a (default = 1)
    • b : User-defined constant b that should be greater than a (default = 4)
    • nc : User-defined constant nc (default = 2)

    The clustering process stops when the maximum number of iterations is reached, or when objective function improvement or the maximum centers imporvement between two consecutive iterations is less than the minimum amount specified.

    Return values :

    • cntr : The clusters centers
    • U : The C-Partionned Matrix (used in FCM)
    • T : The Typicality Matrix (used in PCM)
    • obj_fcn : The objective function for U and T

    Parameters of the PFCM Prediction function (pfcm_predict)

    • data: Dataset to be clustered, with size M-by-N, where M is the number of data points and N is the number of coordinates for each data point.
    • cntr : centers of the dataset previoulsy calculated
    • expo : exponent for the U matrix (default = 2)
    • a : User-defined constant a (default = 1)
    • b : User-defined constant b that should be greater than a (default = 4)
    • nc : User-defined constant nc (default = 2)
    The algortihm predicts which clusters the new dataset belongs to

    Return values :
    • new_cntr : The new clusters centers
    • U : The C-Partionned Matrix (used in FCM)
    • T : The Typicality Matrix (used in PCM)
    • obj_fcn : The objective function for U and T

pfcm's People

Contributors

ibradje avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

lzl4525 sinhmd

pfcm's Issues

Add epsilon to avoid divide by 0

It would be good to add a small number like epsilon = 0.000000001 or something to the pdistfcm function and whenever you have a denominator that could be 0.

def pdistfcm(cntr, data):
    out = np.zeros(shape=(cntr.shape[0], data.shape[0]))
    for k in range(cntr.shape[0]):
        out[k] = np.sqrt(np.sum((np.power(data-cntr[k], 2)).T, axis=0)) + 0.000000000001 #add eps to avoid divide by 0
    return out

Typo in equation for U update

Equation 21 in the PFCM paper has an exponent of 2/(m-1) which SHOULD correspond to 2/(expo-1), but you have 2/(nc-1) in the code. I believe this is a typo in both the predict and pfcm functions.

gpu acceleration

Hello,

First of all, thank you very much for sharing this project. Just one suggestion: could you transform your project to large scale kmeans with GPU capacity? I think it will be quicker when we choose a big number of clusters. What do you think?

Reference:
https://github.com/src-d/kmcuda

Brain MRI Segmentation

Hi, thank you for sharing. What should I change with these codes if I want to segment such a brain MRI (181*217, bmp)which is shown as follow? Looking forward to your reply. Thanks.

781

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.