R H使用起始溶液清洗
我对美国数据进行了细分。如何将类似的集群分配(作为初始解决方案)应用于其他市场?美国和其他市场都有相同的精确输入和调查 这是我的密码:R H使用起始溶液清洗,r,cluster-analysis,R,Cluster Analysis,我对美国数据进行了细分。如何将类似的集群分配(作为初始解决方案)应用于其他市场?美国和其他市场都有相同的精确输入和调查 这是我的密码: TwoStepCluster <-function(xdata, k, method="ward.D2", factor=FALSE) { if (factor==TRUE) { xdata=PCA(xdata,k) } if (method == "mclust") { start = Mclust(xdata,4)$clas
TwoStepCluster <-function(xdata, k, method="ward.D2", factor=FALSE) {
if (factor==TRUE) {
xdata=PCA(xdata,k)
}
if (method == "mclust") {
start = Mclust(xdata,4)$classification
cen = capply(xdata, start)
} else if (method != "none") {
d = dist(xdata)
hcstart = cutree(hclust(d, method = method), k)
cen = capply(xdata, hcstart)
} else {cen=k}
km = kmeans(xdata, cen, iter.max=100)
return(as.matrix(km$cluster))
}
TwoStepCluster是,k-means接受起点
寻找“种子”或“初始中心”选项
至于hclust,您可能最好一次将所有市场进行集群,然后将其投影到不同的市场