Need help with Decision Tree

Discussion in 'microsoft.public.sqlserver.datamining' started by waleed, Jan 28, 2004.

  1. waleed

    waleed Guest

    Hello everyone,

    I've created a mining model using MS Decision Tree and
    trained it
    Now, i need to query it, the only codes i found was using
    an openrowset or Model Content, simply i need to check the
    category of certain conditions, as:
    SELECT <<prediction>> from MiningModel>>
    WHERE <<MiningModel_Columns = values i have>>
    Running this query generates errors, i can't understand
    why!! i simply need to know type for certain conditions,
    isn't that the purpose of data mining after all
    Please, can any body help me!!
     
    waleed, Jan 28, 2004
    #1
    1. Advertisements

  2. You need to use a prediction join statement in order to perform predictions
    using a trained model.
    The syntax of the prediction join looks like this:

    ==>using OPENROWSET (where your source data is in a table):

    SELECT t.Age, MyModel.Gender FROM MyModel PREDICTION JOIN
    OPENROWSET('Microsoft.Jet.OLEDB.4.0',
    'data source=c:\People.mdb',
    'SELECT [Key], Age, CarColor FROM People') AS t
    ON
    MyModel.TheKey = t.[Key] AND
    MyModel.Age = t.Age AND
    MyModel.CarColor = t.CarColor'

    ==>using singleton prediction (where you want to provide your data inline):

    SELECT MyModel.Gender FROM MyModel PREDICTION JOIN
    (SELECT 25 AS Age, 'Silver' AS CarColor) as t
    ON
    MyModel.Age = t.Age AND
    MyModel.CarColor = t.CarColor'


    Please refer to the FAQ at
    http://groups.msn.com/AnalysisServicesDataMining/faq.msnw for more
    information (you will need to join the group to access the FAQ).

    --
    Raman Iyer
    SQL Server Data Mining
    [Please do not send email directly to this alias. This alias is for
    newsgroup purposes and is intended to prevent automated spam. This posting
    is provided "AS IS" with no warranties, and confers no rights.]
    ..
     
    Raman Iyer [MS], Jan 29, 2004
    #2
    1. Advertisements

  3. waleed

    waleed Guest

    Thank you
     
    waleed, Jan 29, 2004
    #3
  4. You can also do predictions agains values that are not in a database using
    what we call a "singleton" prediction. The syntax looks like this:

    SELECT t.Age, MyModel.Gender FROM MyModel PREDICTION JOIN
    (SELECT 25 AS Age, 'White' AS CarColor) as t
    ON
    MyModel.Age = t.Age AND
    MyModel.CarColor = t.CarColor

    multiple input rows can also be handled using UNION, e.g.

    SELECT t.Age, MyModel.Gender FROM MyModel PREDICTION JOIN
    (SELECT 25 AS Age, 'White' AS CarColor UNION
    SELECT 45 AS Age, 'Red' AS CarColor ) as t
    ON
    MyModel.Age = t.Age AND
    MyModel.CarColor = t.CarColor


     
    Jamie MacLennan \(MS\), Jan 29, 2004
    #4
  5. If you haven't, check out FAQ and DMSample application that are available
    from the same MSN DM group site
    (http://groups.msn.com/AnalysisServicesDataMining). Using DMSample, you can
    issue SELECT stmt and get the prediction result rowset interactively. This
    will be very helpful to learn our DM query language (DMX).
    Thanks.
    --
    Peter Kim
    This posting is provided "AS IS" with no warranties, and confers no rights.

     
    Peter Kim [MS], Jan 30, 2004
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.