You would have to look at the resultant model - the data might not support
your hypothesis. Another thing to try is to play with the other
This posting is provided "AS IS" with no warranties, and confers no rights.
<anonymous_user@sqlserverdatamining.com> wrote in message
news:20c953a0-a82e-4341-b0b2-cab660773dd2@msnews.microsoft.com...
> That makees sense, thanks!
>
> I tried implementing as you suggested but these two DMX statements return
> the same results to me. Notice in one I specify the customer has 1 radio
> in their basket, adn in the next statement I specify the customer has
> 1,000 radios in their basket. What I'd expect to see is that the number
> of batteries they purchase should be 1,000x higher in the second example.
> The result I get appears to be closer to the average number of batteries
> that customers who purchase radios purchase, rather than varying based on
> the number of radios purcahsed.
>
>
> SELECT (SELECT * FROM Predict(Products) WHERE Item='Batteries') FROM
> QuantityPredict
> NATURAL PREDICTION JOIN
> (SELECT (SELECT 'Radio' AS Item, 1 AS Quantity) as Products) as t
>
> SELECT (SELECT * FROM Predict(Products) WHERE Item='Batteries') FROM
> QuantityPredict
> NATURAL PREDICTION JOIN
> (SELECT (SELECT 'Radio' AS Item, 1000 AS Quantity) as Products) as t
>
>
> So, the quantity of the items in the basket (the ones in the nested table,
> in this case the radio) do not appear to be affecting the quantity of each
> additional item begin predicted, which is really what I need for it to do.
> In this case I'd want the first statement to predict 2 batteries and the
> second statement to predict 2,000 batteries.
>
> Any ideas on what I'm missing here?
>
> Thanks,
> Tom
>
>
>>
>> You're close, but you have a little ways to go yet.
>>
>> First - MAXIMUM_INPUT_ATTRIBUTES sets the number of inputs that are
>> considered by the algorithm, not how many can be in a single case. For
>> example, if you use the default - 255 and you have 1000 products, only
>> 255
>> of those products will be considered by the algorithm - the others won't
>> have any impact.
>>
>> Next you have Item and Quantity as independent case level attributes.
>> This
>> means that you have _one_ quantity attribute for all products. What you
>> likely meant to do is to have the quantity tied to the customer/item
>> pair.
>> You could create a composite key which is Customer/Item, however, you are
>> still looking at a single Quantity measure for all products.
>>
>> What you want to do is to simply make the quantity attributes in the
>> nested
>> table predictable. For example, using DMX to describe the model, it
>> would
>> look like this:
>>
>> CREATE MINING MODEL QuantityPredict
>> (
>> CustomerID LONG KEY,
>> Products TABLE,
>> (
>> Item TEXT KEY,
>> Quantity LONG REGRESSOR PREDICT // Input and Predictable
>> )
>> ) USING
>> Microsoft_Decision_Trees(MAXIMUM_INPUT_ATTRIBUTES=0,MAXIMUM_OUTPUT_ATTRIBUTES=0)
>>
>> Then to get the quantity of a particular item you would issue a query
>> like
>> this:
>>
>> SELECT (SELECT * FROM Predict(Products) WHERE Item='Batteries') FROM
>> QuantityPredict
>> NATURAL PREDICTION JOIN
>> (SELECT (SELECT 'Radio' AS Item, 1 AS Quantity) as Products) as t
>>
>> --
>>
>> -Jamie MacLennan
>> SQL Server Data Mining
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> PLEASE POST NEW QUESTIONS AT
>>
http://forums.microsoft.com/msdn/showforum.aspx?forumid=81&siteid=1 >> <anonymous_user@sqlserverdatamining.com> wrote in message
>> news:319c7157-d70b-4c0a-a4ef-6df0d00fdadf@msnews.microsoft.com...
>> > Jamie,
>> >
>> > Thanks for the response. I am trying, as you suggested, to create a
>> > second model which will predict the quantity of a particular item that
>> > someone may purchase. I'm trying to do this with nested tables again,
>> > and
>> > am coming up with the following model:
>> >
>> > Sales table is treated as both a nested and case table:
>> > Case Table:
>> > Customer = Key
>> > Item = Input
>> > Quantity = PredictOnly
>> > Nested Table:
>> > Item = Key, Input
>> > Quantity = Input
>> >
>> > The predictions I'm getting don't seem to change based on the quantity
>> > of
>> > items in the nested table.
>> >
>> > Is this the right way to answer the question? In the example I gave,
>> > the
>> > business question would be:
>> >
>> > A customer currently has 2 clock radios in their basket. Our cross
>> > selling model (seperate model) tells us that their is a high liklihood
>> > they will want to buy batteries. How many batteries are they likely
>> > to
>> > buy given that we know how many clock radios they've got in their
>> > basket?
>> >
>> > In this case I would run a prediction query which looks like:
>> >
>> > Select FLATTENED
>> > T.[Item],
>> > PredictHistogram([Quantity])
>> > FROM [Model]
>> > NATURAL PREDICTION JOIN
>> > ( SELECT
>> > 'Batteries' as [Item],
>> > ( SELECT 'Clock Radio' AS [Item], 2 as Quantity
>> > ) AS [Basket])
>> > AS t
>> >
>> > What I would expect is for this to return that it expects 4 batteries
>> > to
>> > be purchased, since I know people who buy clock radio's normally buy 2x
>> > as
>> > many batteries as they do radios.
>> >
>> > Am I writing this query incorrectly, or is my model wrong, or both?
>> > I'm
>> > fairly new to using nested tables in analysis.
>> >
>> > Maximum Inputs is defaulted to 255, so as long as I don't have more
>> > than
>> > that many items in my basked none of them will be feature selected
>> > away,
>> > right?
>> >
>> > Thanks,
>> > Tom
>> >>
>> >> You need to make the quantity column predictable and not the nested
>> >> table
>> >> (or nested key). Also make it input if you want to use it that way.
>> >>
>> >> I would recommend creating one model to predict what's likely and
>> >> another
>> >> model to predict quantities though. For quantities, you are going to
>> >> want
>> >> to use Decision Trees - be sure to set your feature selection
>> >> parameters
>> >> (MAXIMUM_INPUT ... etc) or many things will be feature selected away.
>> >>
>> >> --
>> >>
>> >> -Jamie MacLennan
>> >> SQL Server Data Mining
>> >> This posting is provided "AS IS" with no warranties, and confers no
>> >> rights.
>> >> PLEASE POST NEW QUESTIONS AT
>> >>
http://forums.microsoft.com/msdn/showforum.aspx?forumid=81&siteid=1 >> >> <anonymous_user@sqlserverdatamining.com> wrote in message
>> >> news:7923333e-64e9-49ce-a3c2-2297f7b38d25@msnews.microsoft.com...