Showing posts with label prediction. Show all posts
Showing posts with label prediction. Show all posts

Sunday, March 11, 2012

Error in Prediction query

Hi,

I have the following association model Structure

Where I am trying to find out the associations between various service activities so that when a customer buys a service activity we can recommend him/her others

CaseTable

CustomerId à Key

IncidentId

Nested Table

ServiceId à Key

ServiceName à Input, Predict

IncidentId à Link to the case table

Firstly is the above structure correct?

Secondly

I have the following prediction query

SELECT

t.[ServiceId],

Predict ([ServicerossSell].[ServiceCross-SellRecommend],3)

From

[ServicerossSell]

PREDICTIONJOIN

SHAPE

{OPENQUERY([Adventure Works Cycle MSCRM],

'SELECT DISTINCT ServiceId FROM Service ORDER BY ServiceId]')

}

APPEND

( {OPENQUERY([Adventure Works Cycle MSCRM],

'SELECT DISTINCT ServiceId FROM Service ORDER BY ServiceId]')

}

RELATE [ServiceId]To [ServiceId]

)

AS [Service]

AS t

ON

[ServicerossSell].[ ServiceCross-SellRecommend].[ServiceId] = t.[Service].[ServiceId]

It throws the following error

“The DMX column was not found in the context”

I am not able to figure out why, any help would be most appretaiated

The SHAPE clause is wrong - it should be joining the customer/incident table with the incident/service table, not doing a self-join.

Given that your case is a customer with the nested table being the services purchased by them (across multiple incidents), I recommend simplifying the input data as well as the modeling by using a named query in the DSV as follows:

SELECT a.CustomerId, b.ServiceName
FROM CustomerIncident a INNER JOIN IncidentService b
ON a.IncidentId = b.IncidentId
ORDER BY CustomerId

The mining structure can then look like this:

CREATE MINING MODEL CustomerServiceAssociations

(

CustomerId TEXT KEY,

CustomerServices TABLE PREDICT

(

ServiceName TEXT KEY

)

)

USING Microsoft_Association_Rules

|||

Hi Raman,

I took your suggestion and modified the dsv and the mining model as mentioned by you.

And I also modified the prediction query as follows.

SELECT

t.[ServiceId],

PredictAssociation([Association].[Services],3)

From

[Association]

PREDICTIONJOIN

OPENQUERY([Adventure Works Cycle MSCRM],

'SELECT DISTINCT

[ProductId]

FROM

(SELECT ServiceId FROM ServiceBase) as [Service]

')AS t

ON

[Association].[Service Id] = t.[ServiceId]

I am facing a new problem now.

The model is predicting the same set of services for every case. Even changes in the algorithm parameter value do not have any impact on the result.

What is the reason for this and how can u rectify it?

I am facing this problem with other association based mining models also.

Error in Prediction query

Hi,

I have the following

association model Structure

Where I am trying to find out

the associations between various service activities so that when a customer

buys a service activity we can recommend him/her others

CaseTable

CustomerId à Key

IncidentId

Nested Table

ServiceId à Key

ServiceName à Input, Predict

IncidentId à Link to the case table

Firstly is the above

structure correct?

Secondly

I have the following prediction

query

SELECT

t.[ServiceId],

Predict

([ServicerossSell].[ServiceCross-SellRecommend],3)

From

[ServicerossSell]

PREDICTION JOIN

SHAPE

{OPENQUERY([Adventure

Works Cycle MSCRM],

'SELECT DISTINCT ServiceId

FROM Service ORDER BY ServiceId]')

}

APPEND

( {OPENQUERY([Adventure Works Cycle MSCRM],

'SELECT DISTINCT ServiceId

FROM Service ORDER BY ServiceId]')

}

RELATE

[ServiceId] To [ServiceId]

)

AS

[Service]

AS t

ON

[ServicerossSell].[ ServiceCross-SellRecommend].[ServiceId]

= t.[Service].[ServiceId]

It throws the following error

“The DMX column was not found in the context”

I am not able to figure out why, any help would be most

appretaiated

The SHAPE clause is wrong - it should be joining the customer/incident table with the incident/service table, not doing a self-join.

Given that your case is a customer with the nested table being the services purchased by them (across multiple incidents), I recommend simplifying the input data as well as the modeling by using a named query in the DSV as follows:

SELECT a.CustomerId, b.ServiceName
FROM CustomerIncident a INNER JOIN IncidentService b
ON a.IncidentId = b.IncidentId
ORDER BY CustomerId

The mining structure can then look like this:

CREATE MINING MODEL CustomerServiceAssociations

(

CustomerId TEXT KEY,

CustomerServices TABLE PREDICT

(

ServiceName TEXT KEY

)

)

USING Microsoft_Association_Rules

|||

Hi Raman,

I took your suggestion and modified the dsv and the mining

model as mentioned by you.

And I also modified the prediction query as follows.

SELECT

t.[ServiceId],

PredictAssociation([Association].[Services],3)

From

[Association]

PREDICTION JOIN

OPENQUERY([Adventure

Works Cycle MSCRM],

'SELECT DISTINCT

[ProductId]

FROM

(SELECT ServiceId FROM ServiceBase)

as [Service]

') AS

t

ON

[Association].[Service

Id] = t.[ServiceId]

I am facing a new problem now.

The model is predicting the same set of services for every case.

Even changes in the algorithm parameter value do not have any impact on the

result.

What is the reason for this and how can u rectify it?

I am facing this problem with other association based mining

models also.

Sunday, February 26, 2012

Error in DMX query

Hi

I have the following query used to predict the values in 2006 based on cluster model built using 2004 and 2005 data. I'm using a prediction join on a cube containing the data. I can join a single dimension from the cube to a column in a the data mining model. However when I try to join to a column in a nested table I get this error:

Executing the query ...

Obtained object of type: Microsoft.AnalysisServices.AdomdClient.AdomdDataReader

Internal error: An unexpected exception occured.

Execution complete

The query I'm running is this

select t.*

, Predict([Time].[Deal Count])as predicted_deal_count

, Predict([Time].[Deal Revenue])as predicted_deal_revenue

, Cluster()

From

[Time]

prediction join

(

select {[Measures].[Deal Count], [Measures].[Deal Revenue]} on 0,

non empty {{[Time].[Month Number Of Year].[Month Number Of Year].members} *

{[Country].[KeyCountry].[KeyCountry].members} * {[Country].[Region].[Region].members}} on 1

from [DM]

where ([Time].[Year].&[2006-01-01T00:00:00])) as t

on

[Time].[Month Number Of Year] = t.[[Time]].[Month Number Of Year]].[Month Number Of Year]].[MEMBER_CAPTION]]]

and [Time].[Country].[KeyCountry] = t.[[Country]].[KeyCountry]].[KeyCountry]].[MEMBER_CAPTION]]]

and [Time].[Country].[Region] = t.[[Country]].[Region]].[Region]].[MEMBER_CAPTION]]]

I'm running SQL Server 2005 with SP2 CTP2.

Thanks

Sanjay

Given the limited error message - we need to try additional queries to see if we can narrow the problem down. Alternatively, you could send us a backup of your database - let me know if this is an option.

Can you see if this query works? Does it return what you expect?

select t.*

From

[Time]

NATURAL prediction join

(

select {[Measures].[Deal Count], [Measures].[Deal Revenue]} on 0,

non empty {{[Time].[Month Number Of Year].[Month Number Of Year].members} *

{[Country].[KeyCountry].[KeyCountry].members} * {[Country].[Region].[Region].members}} on 1

from [DM]

where ([Time].[Year].&[2006-01-01T00:00:00])) as t

|||

Hi,

Your query works as expected, all the selected data from the cube is return. It would be possible to send you the cube offline, do you need the just the cube or the relational db as well?

Thanks

Sanjay

|||

A backup of AS database with the cube and model is enough. Please remove any additional objects (e.g. cubes or mining structures) to reduce the database size. You can also do a process clear structure only on the Mining Structure to reduce the size even further. Try compressing it as well (although it should be compressed already).

You can send the data to jamie "at" sqlserverdatamining.com and we'll look into the issue

Thanks!

|||We are still looking into this issue - thanks for your patience.