Description Usage Arguments Value Author(s) Examples

On the assumption that the two samples are already normalized to have L2 norm as 1, cosine distance is defined as 1 - inner product of the two samples.

1 | ```
norm.sim.ksc(A, k, init.cen = NULL, init.mem = NULL, iter.max = 100)
``` |

`A` |
n by p matrix, each row is a sample |

`k` |
the number of clusters |

`init.cen` |
initial cluster centers |

`init.mem` |
initial cluster member assignment |

`iter.max` |
the maximum number of iteration |

A list will be returned with components : cluster: A vector of integers indicating the cluster to which each point is allocated. centers: A matrix of cluster centres size: The number of points in each cluster

Jungsuk Kwac

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ```
###############
## test code
## 4 classes: a1,a2,a3,a4
## for each class, 20 samples
###############
n = 20; p = 32
a1 = 10*sin(0.1*(1:p))
a2 = 10*cos(0.1*(1:p))+10
a3 = c(1:(p/2),(p/2):1)
a4 = c((p/2):1,1:(p/2))
A = c()
for (i in 1:n){
A = rbind(A,a1+rnorm(p),a2+rnorm(p),a3+rnorm(p),a4+rnorm(p))
}
res = norm.sim.ksc(quick.norm(A,1),4)
``` |

```
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.