Groups | Blog | Home
all groups > sql server data mining > december 2003 >

sql server data mining : how to get the PMML xml content?


XP
12/30/2003 5:53:13 PM
I want to read the pmml xml about model,show the decision tree in my UI =
control.
how to do? =20
Alan Yiin
1/2/2004 7:43:57 AM
you can use my sample code



Dim cn
Dim rs

Set cn = wscript.CreateObject("adodb.connection")
Set rs = wscript.CreateObject("adodb.recordset")

cn.Provider = "msolap.2"
cn.ConnectionString = _
"data source=localhost;initial
catalog=SQL2000Demo"
cn.open

Const DMSCHEMA_MODEL_CONTENT_PMML = _
"{4290B2D5-0E9C-4AA7-9369-98C95CFD9D13}"
Const adSchemaProviderSpecific = -1

set rs = cn.OpenSchema(adSchemaProviderSpecific,_
,DMSCHEMA_MODEL_CONTENT_PMML)

While rs.eof=0

For j = 0 To rs.Fields.Count - 1
wscript.echo CStr(j+1) & ": " &_
rs.Fields(j).name &" - "& rs.Fields(j).value
Next

wscript.echo "****************"
rs.movenext


wend

rs.Close
cn.Close



[quoted text, click to view]
Jamie MacLennan (MS)
1/4/2004 7:54:07 PM
You can also use the query "SELECT * FROM <model>.PMML" (it could be
".XML" - I don't remember off the top of my head). You will retrieve one
row with one field containing the PMML string
[quoted text, click to view]

Allan Yiin
1/4/2004 9:08:24 PM
Select MODEL_PMML from [model name].pmml



[quoted text, click to view]
Peter Kim [MS]
1/8/2004 1:26:37 PM
MSDMine is our undocumented provider, which may not be available in the
future.
You should use MSOLAP as the provider. Please search "connection string"
from the Analysis Services Books On-Line to see complete details of how to
specify the connection string including data source and location.
Here is one example.

Dim MyCon as ADODB.Connection
Set MyCon = new ADODB.Connection
MyCon.Open("provider=msolap; Datasource=<your host>; Initial
Catalog=FoodMart 2000")

--
Peter Kim
This posting is provided "AS IS" with no warranties, and confers no rights.

[quoted text, click to view]
Thanks!
btw: how to use the datamining ole db( provider: MSDMine )??
I can't connect to remote Server,how to set the "data source" and "location
" values? what's different bettween this two items?

XP
1/8/2004 1:46:19 PM
Thanks!
btw: how to use the datamining ole db( provider: MSDMine )??=20
I can't connect to remote Server,how to set the "data source" and =
Jamie MacLennan (MS)
1/9/2004 2:36:30 AM
To be more specific, MSDMine is loaded by the MSOLAP provider to handle data
mining activities. It is only a coincidence that it is possible to directly
connect to it. However, it is the MSOLAP provider that knows how to connect
tot he server - MSDMine only works on local files. So to connect to a remote
server use MSOLAP. To correctly work on local files ("local mining models")
connect to MSOLAP and set the "Mining Location" connrection string parameter
to the directory where your mining models are (or where you want them saved)

[quoted text, click to view]

XP
1/17/2004 10:48:38 AM
I really appreciate it. Thanks a million.

There still have several question puzzle me!Please help me !

1.There are little differents between ms model'PMML and DMG'PMML(The Data
Mining Group).For example:
DMG'PMML define :We can use the "score" attribute of leaf node of the
tree model to predict or score.
But i found that decisionTree model'PMML always set
leafnode score'value equal 0. Why?

2.How to draw the lift curve without angoss's lift chart ActiveX control?



Peter Kim [MS]
1/17/2004 9:43:31 PM
Microsoft Analysis Services 2000 DM component was written using PMML 1.0,
which was very incomplete and required many "extensions" just to make the
format usable for us. The "score" attribute in our implementation means
"the split score gain of the node". Together with split attribute, this
information can be used to derive predict-dependency among the attributes
(just as in our dependency network - see FAQ,
http://groups.msn.com/AnalysisServicesDataMining/faq.msnw). The DMG
definition of score can be instead obtained from <data-distribution> of each
leaf node, where we store support of each states. The DMX functions,
Predict(), PredictHistogram(), PredictProbability(), PredictSupport() are
implemented on top of these information.

We don't support lift-chart functionality directly out of the box in SQL
2000. I'm not sure how Angoss Lift Chart control is written, but you can
certainly write your own control using your favorite language (say, C#) and
ADO/DMX. Let me know if need more info.

--
Peter Kim
This posting is provided "AS IS" with no warranties, and confers no rights.

[quoted text, click to view]

XP
1/19/2004 10:31:15 AM
Thanks.

Now I really want to write control using VB OR C.But I have no ideas about
lift theory.
for example: We only got the list:
userId actual predicted charted value
certainty
1 yes yes do something
0.555555
2 no no do something
0.777777
3 .... .. do something
0.222222
.. ..... ... .........
........

If i random pick 10,20,30,...100 percent population and draw the response's
point. so next time do than again,i will get another curve.
How should we do?

Peter Kim [MS]
1/20/2004 11:54:23 AM
There are multiple variations, but one way you could do is as follows:
- Suppose you have 10K test data, say, Customers.
- Perform the following DMX
SELECT t.userId, t.Response AS actual, dmm.Response as predicted,
PredictProbability(dmm.Response) AS certainty
FROM dmm PREDICTION JOIN <your input from Customer table> AS t ON =
.....
- Sort the DMX result by certainty
- Draw a graph, where X-axis is percentage of test population, Y-axis is =
percentage of correct population.
For instance if you have 3K correct cases from the first 5K of the =
sorted result, the graph would contain a point, <X=3D50%, Y=3D30%>. The =
ideal model would have Y =3D X line.

--=20
Peter Kim
This posting is provided "AS IS" with no warranties, and confers no =
rights.
=20
[quoted text, click to view]
AddThis Social Bookmark Button