Wednesday, March 21, 2012

dmx query probablity ?

CREATE MINING MODEL mortgage
(
[id] long key,
Edu_Status long DISCRETE,
Work_Status long DISCRETE,
age long CONTINUOUS,
asset_value long CONTINUOUS,
Net_income long CONTINUOUS,
paid_Status long DISCRETE PREDICT
)USING MICROSOFT_DECISION_TREES

i have a mining model above and i am designing a web cross ablication to see probablity of the a costumers' paid status.can you write for me dmx command for selecting paid status that have same criteria(ex;age=30 net income=2000,Edu_status=college) and when i write dxm window(select * from [paid_Status] ) it only shows "4" one row one column why ? as you see i dont know

dmx and datamining well..:)

string dxmcommand = "";

private AdomdCommand ascommand = new AdomdCommand();

private AdomdConnection asconnection=new AdomdConnection();

private AdomdDataReader asreader=new AdomdDataReader();

ascommand.CommandText = dmxcommand;

if I understand your question correctly, then the query would be something like:

SELECT Paid_Status, PredictProbability(Paid_Status)

FROM mortgage NATURAL PREDICTION JOIN

(SELECT 30 AS Age, 2000 as Net_Income ) AS T

This query will return the predicted value for Paid_Status as well as the proability for that prediction. Note that I did not include "College" as Edu_status. The reason is that the Edu_status column of the mining model is defined as "LONG DISCRETE" and "College" is a string, so it cannot be mapped to a long. You will have to convert "College" to the numeric code which I suppose it is used in describing this string, then add "<Numeric_Code_For_College> AS Edu_Status" to the query

Also, in C#, the sequence of operations should be along this line:

AdomdConnection cn = new AdomdConnection();

cn.ConnectionString = "Data Source=localhost; Initial Catalog=<Your Database>";

cn.Open(); // open the connection

AdomdCommand cmd = new AdomdCommand();

cmd.Connection = cn; // associate the command with the current connection

cmd.CommandText = dmxcommand;

AdomdDataReader rdr = cmd.ExecuteReader(); // obtain the reader from the command execution instead of creating it with new

Hope this helps

No comments:

Post a Comment