Subscribe Bookmark RSS Feed

K-Means cluster analysis scripting

I am trying the automate the above analysis. However, I still get the 'Number of Clusters' dialog box for every iteration and I have to click OK every time. How can I script it so I don't have to click the OK button every time. My script format is as follows:

K Means Cluster(
Y( :Week1, :Week2, )
Number of clusters(1),
I think the problem is probably just that "1" isn't a valid number of clusters (though it does actually seem to accept "1" after clicking OK). Try "2" instead - I think that should solve it. The following works for me:

FakeData = NewTable("New Cluster Summary",
New Column("Week1", Numeric, Values([1, 4, 6, 8, 2, 3, 5, 7])),
New Column("Week2", Numeric, Values([3, 1, 8, 5, 4, 9, 0, 2])),
New Column("AttributeX", Numeric, Values([1, 1, 1, 1, 2, 2, 2, 2])),

FakeData << K Means Cluster( Y( :Week1, :Week2, ), By(AttributeX), Number of clusters(2), Go );
Thanks David. It is interesting that even though 1 is accepted, it requires a value >1 for the script to run. I tried with >1 and it works. An alternate I came across was to use Centers that essentially gave me the result I was looking for.