Can anyone explain me what c(i) is actually representing? and What is its significance?

Hi @Ashutosh_Bharti ,

Please refer to the **K-means Algorithm** lecture video, Prof Ng has explained the algorithm in details. Below is a screen shot of the first step of the algorithm.

Hi @Ashutosh_Bharti,

**‘c’** array maps each training example with its closest centroid **‘K’**. The **‘i’** in **‘c(i)’** represents index of **‘ith’** training example in **‘x’** . For example, if the value of **‘c[5]’** is 3, then it represents 5th training example is assigned to the centroid 3 (K=3). it is used to track which centroid each training example assigned to which will helps to peform clustering.

I kindly recommend referring to the video for a more detailed explanation, as @Kic has mentioned earlier.

Best,

Mujassim

Thank you Mujassim. Got it