Tuesday, March 6, 2012

AdomdClient: Which sequence belongs to which cluster?

Hi,

We are using Microsoft Sequence Clustering both "manually" via Visual Studio (SQL Server Business Intelligence Development Studio) and "programatically" via AMO and ADOMD.NET (using C#). We use AMO to build and process the MiningModel, and ADOMD.NET (Microsoft.AnalysisServices.AdomdClient) to browse through results.

Everything is working fine except for a very important detail: we can't find where the MiningModel stores cluster membership. The MiningModel.Content contains a column NODE_SUPPORT which shows how many sequences there are in each cluster, but we can't find which sequence belongs to which cluster.

In Visual Studio, the Microsoft Sequence Cluster Viewer is able to show this in Cluster Profiles (a right-click on a cluster followed by Show Legend lists the sequences that belong to that cluster).

Question is: where does the Viewer get this information, and how can we get it via ADOMD? Or via AMO, if that's the case?

Would appreciate your assistance.

Kind Regards,

Diogo

You can use the Cluster() function in a prediction query to get this information. As you probably know by now, you should construct the query and set it as the CommandText of an AdomdCommand object.

Alternatively, you may find it easier to navigate the results by using Cluster() as a column reference in PredictHistogram() and flatten the result set:

SELECT FLATTENED (PredictHistogram(Cluster() ...)

|||

It seems that in order to determine cluster membership we must write a prediction query over the same data that served as training input. Is it easy to write such a query? Can you provide us with an example? Or the general form of such query?

Also while creating the mining model I haven't marked any column as "predictable". I guess I should do that, right?

Thanks!

|||

The query is indeed very simple, here is the general form:

SELECT Cluster(), t.caseid FROM MyMiningModel
NATURAL PREDICTION JOIN (SELECT * FROM MyMiningModel.CASES) as t
ORDER BY Cluster()

The posts from Jamie in this thread were particularly useful:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1035151&SiteID=1

Problem solved! Thanks for the hint!

No comments:

Post a Comment