<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Jamie's Junk</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/jamiemac/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/jamiemac/feed.xml</link>
    <description>Whatever comes to mind
&amp;quot;The official blog of the  SQL Server Analysis Services Data Mining Architect&amp;quot; (tm)</description>
    <lastBuildDate>Wed, 17 Apr 2019 04:02:11 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Happy New Year with a big bang!</title>
      <link>https://docs.microsoft.com/archive/blogs/jamiemac/happy-new-year-with-a-big-bang</link>
      <pubDate>Fri, 01 Jan 2010 12:05:00 GMT</pubDate>
      <dc:creator><![CDATA[MSDN Archive]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jamiemac/2010/01/01/happy-new-year-with-a-big-bang/</guid>
      <description><![CDATA[It's been over 10 years that I've been working on data mining for SQL Server and the new year brings...]]></description>
      <content:encoded><![CDATA[<P>It's been over 10 years that I've been working on data mining for SQL Server and the new year brings big changes for me.&nbsp; It's been a very exciting time for me to learn this technology and industry, and with the new year, I'm leaving Microsoft to become the founding CTO of Predixion Software.&nbsp; It's too early for me to say exactly what we will be creating over there at Predixion, but it's safe to say that SQL Server Data Mining will feature prominently in our business.&nbsp; I don't have an "official" landing page at the moment, but when there's news to be delivered, I'll post either here - if possible - &nbsp;or at <A href="https://sqldataminingbook.com/" mce_href="https://sqldataminingbook.com/">https://sqldataminingbook.com</A>.&nbsp;&nbsp; My contact info on this blog has been updated as well, so if you write me from here, I'll get it at my new location.</P>
<P>&nbsp;Cheers and a happy new year to all!</P>
<P mce_keep="true">&nbsp;</P>
<P>-Jamie</P>]]></content:encoded>
    </item>
    <item>
      <title>The amazing flexibility of DMX Table Valued Parameters</title>
      <link>https://docs.microsoft.com/archive/blogs/jamiemac/the-amazing-flexibility-of-dmx-table-valued-parameters</link>
      <pubDate>Thu, 24 Sep 2009 18:58:57 GMT</pubDate>
      <dc:creator><![CDATA[MSDN Archive]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jamiemac/2009/09/24/the-amazing-flexibility-of-dmx-table-valued-parameters/</guid>
      <description><![CDATA[When most people think of “Table Valued Parameters” they think of “possibly the most anticipated...]]></description>
      <content:encoded><![CDATA[<p>When most people think of “Table Valued Parameters” they think of “<a href="https://www.sqlteam.com/article/sql-server-2008-table-valued-parameters">possibly the most anticipated T-SQL feature of SQL Server 2008</a>.”&#160; However, little may you know, that the Data Mining team added table valued parameters and table valued functions to DMX in SQL Server <em>2005</em>.&#160; Not only has this feature been in shipping code for more than four years as of this writing, the DMX implementation is considerably easier to use as well.</p>  <p>This blog entry is one of those that has been requested so many times, I look back on my past posts and am simply amazed that I haven’t written it yet.&#160; The thing is, we made the feature so easy to use, that, as the development team, we didn’t think it needed more explanation.&#160; Of course, as the development team we think <strong>all</strong> our features our so easy to use, so it may not say much.&#160; Since last week the question came up yet again and since I’m working from home this morning prior to a parent-teacher conference, I decided to buck down and knock this topic out.</p>  <p><strong>SQL Server Data Mining – use data from anywhere</strong></p>  <p>When we set out to make data mining accessible from anywhere on any data we really meant it.&#160; Independent of where the data resides you should always be able to use that data with SQL Server Data Mining to train models or perform predictions on already existing models.&#160; And it should be hard.&#160; One part of this functionality is XML for Analysis (XMLA) which allows you to connect to and communicate with a SQL Server Analysis Services server using SOAP.&#160; I’m not going to get into that now, but it means that everything that can be done using any API can be done from any platform using raw XML, if need be.</p>  <p>But it needn’t be, because we thought it should be easier, so we added Table Valued Parameters to DMX in SQL Server 2005 – we didn’t call it that, but it is what it is.&#160; It means that you can write a query like this:</p>  <pre class="csharpcode"><font color="#0000ff">INSERT</font> <span class="kwrd">INTO</span> (&lt;columns&gt;) @InputRowset</pre>

<p><style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>And pass the training data as the rowset parameter.&#160; So, this begs the question, how do you send a rowset as a parameter?&#160; Well, unlike other implementations we tried to make this as easy as possible using the API’s you are currently using.&#160; Of one thing we made sure – there is no “preparatory” work that is necessary for you to make this happen.&#160; For example, you <strong>do not</strong> need to make any user-defined types or do any work on the server to get this to work.&#160; Another thing we made happen, is that if you think that the object you have in your application is logically a rowset, you should be able to send it to us the way you have it.&#160; This means that if you use our OLE DB provider and you have a pointer to an <strong>IRowset</strong>, you can pass the <strong>IRowset </strong>as the query parameter.&#160; If you use our <strong>ADOMD.Net</strong> provider you can pass a <strong>DataTable</strong> or an <strong>IDataReader </strong>as the parameter.&#160; Our providers do the work of converting the contents of the objects into the formats required by the protocol so you don’t have to.&#160; Anyway that probably sounds more simple to me than it does, so let’s just go ahead with an example.</p>

<p><strong>The Example</strong></p>

<p>First, lets just create an arbitrary <strong>DataTable</strong> in memory like this:</p>

<pre class="csharpcode">DataTable table = <span class="kwrd">new</span> DataTable();
DataColumn column;
column = table.Columns.Add(<span class="str">&quot;Column1&quot;</span>);
column.DataType = System.Type.GetType(<span class="str">&quot;System.Int32&quot;</span>);
column = table.Columns.Add(<span class="str">&quot;Column2&quot;</span>);
column.DataType = System.Type.GetType(<span class="str">&quot;System.String&quot;</span>);
column = table.Columns.Add(<span class="str">&quot;Column3&quot;</span>);
column.DataType = System.Type.GetType(<span class="str">&quot;System.String&quot;</span>);

table.Rows.Add(1, <span class="str">&quot;A&quot;</span>, <span class="str">&quot;B&quot;</span>);
table.Rows.Add(2, <span class="str">&quot;A&quot;</span>, <span class="str">&quot;B&quot;</span>);
table.Rows.Add(3, <span class="str">&quot;B&quot;</span>, <span class="str">&quot;C&quot;</span>);
table.Rows.Add(4, <span class="str">&quot;B&quot;</span>, <span class="str">&quot;C&quot;</span>);</pre>

<p><style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>See – nothing special.&#160; Of course, in your case you would populate the table with meaningful values, but that’s besides the point of the example.&#160; Next I’ll use ADOMD.Net to create and train a model using DMX.&#160; I’m using <strong>CREATE MINING MODEL</strong> just to shorten the number of steps.&#160; Of course you can use <strong>CREATE MINING STRUCTURE</strong> followed by an <strong>ALTER MINING STRUCTURE</strong> statement, but, again, the point of the example is the table valued parameter.&#160; Anyway, this is the code for creating the model.</p>

<pre class="csharpcode"> AdomdConnection conn = <span class="kwrd">new</span> AdomdConnection(<span class="str">&quot;DataSource=localhost&quot;</span>);
AdomdCommand cmd = <span class="kwrd">new</span> AdomdCommand();
conn.Open();
cmd.Connection = conn;
<span class="rem">// Create mining model</span>
String createMiningModel =
                <span class="str">&quot;CREATE MINING MODEL foo &quot;</span> +
                <span class="str">&quot;( &quot;</span> +
                <span class="str">&quot;   [rowid] LONG KEY, &quot;</span> +
                <span class="str">&quot;   [A] TEXT DISCRETE, &quot;</span> +
                <span class="str">&quot;   [B] TEXT DISCRETE &quot;</span> +
                <span class="str">&quot;) USING Microsoft_Clustering &quot;</span> +
                <span class="str">&quot;WITH DRILLTHROUGH&quot;</span>;
cmd.CommandText = createMiningModel;
cmd.ExecuteNonQuery();</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>This creates a simple cluster model with three columns that match those in my table.&#160; I added drillthrough so I can retrieve the cases for later, but other than that – totally straightforward.

<p>Next, let’s look at the code that lets me take the table and use that data to train the model.</p>

<pre class="csharpcode">String insertInto =
                <span class="str">&quot;INSERT INTO foo([rowid],[A],[B]) &quot;</span> +
                <span class="str">&quot;@TrainingRowset&quot;</span>;
cmd.CommandText = insertInto;
cmd.Parameters.Add(<span class="str">&quot;TrainingRowset&quot;</span>, table);
cmd.ExecuteNonQuery();</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>See!&#160; It really is that simple.&#160; Just create your query, load your data into a table, add the table as a parameter and voila!&#160; Table valued parameters sent to the server to process a model.

<p>So I wanted to show an example of how to do this with a prediction query, but it’s just so easy it didn’t make sense.&#160; However, you may ask “What if my data is external?&#160; Do I have to load it into a data table before I can send it to the server?”&#160; The answer is a profound <strong>NO</strong>.&#160; If you can get any sort of <strong>IDataReader</strong> on the data, the ADOMD.Net provider will consume the data reader and stream the data to the server.</p>

<p>Let’s take another example using a data reader.&#160; In this example I’m going to pull the cases out of the model using a &lt;model&gt;.CASES, since it’s convenient (and I added DRILLTHROUGH to the model definition), but any implementation of IDataReader will do.&#160; In fact, this is kind of silly as DMX allows me to directly join against the model cases, but hey, it’s just for example’s sake.</p>

<p>Here’s the code to get the reader – I put it in a function just to exemplify that the calling code is simply getting an IDataReader and has nothing to do with ADOMD.Net:</p>

<pre class="csharpcode"><span class="kwrd">private</span> IDataReader GetReader()
{
    AdomdConnection conn = <span class="kwrd">new</span> AdomdConnection(<span class="str">&quot;DataSource=localhost&quot;</span>);
    AdomdCommand cmd = <span class="kwrd">new</span> AdomdCommand();
    conn.Open();
    cmd.Connection = conn;
    cmd.CommandText = <span class="str">&quot;SELECT [A],[B] FROM foo.CASES&quot;</span>;
    <span class="kwrd">return</span> cmd.ExecuteReader();
}</pre>

<p>And here’s the how you would take that reader and perform an arbitrary prediction join against the model.<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style></p>

<pre class="csharpcode">cmd.Parameters.Clear();  <span class="rem">// clear parameters from previous usage</span>
String queryModel =
                <span class="str">&quot;SELECT Cluster(), t.[A], t.[B] &quot;</span> +
                <span class="str">&quot;FROM foo &quot;</span> +
                <span class="str">&quot;NATURAL PREDICTION JOIN &quot;</span> +
                <span class="str">&quot;@InputRowset AS t&quot;</span>;
cmd.CommandText = queryModel;
cmd.Parameters.Add(<span class="str">&quot;InputRowset&quot;</span>,GetReader());
AdomdDataReader reader = cmd.ExecuteReader();
<span class="kwrd">while</span> (reader.Read())
{
    Console.WriteLine(String.Format(<span class="str">&quot;Cluster {0}, Input Values {1}, {2}&quot;</span>,
            reader[0], reader[1], reader[2]));
}</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<p>Again, virtually no work on your part to accomplish pushing data from an arbitrary data provider on the client to the server to perform, in this case, predictions on data.</p>

<p><strong>Summary</strong></p>

<p>Table Valued Parameters in SQL Server Data Mining give you pretty much unlimited flexibility in the data sources you can use to perform data mining.&#160; Even if appropriate data providers are not available on the server to use traditional data access methods such as OPENQUERY or model development in BI Dev Studio – or even if appropriate data providers don’t exist at all – you can still perform data mining operations on any data that you yourself can access or generate.</p>

<p>I hope this article opens some doors to some great new data mining applications!</p>]]></content:encoded>
    </item>
    <item>
      <title>More Data Mining in the Cloud?</title>
      <link>https://docs.microsoft.com/archive/blogs/jamiemac/more-data-mining-in-the-cloud</link>
      <pubDate>Tue, 12 May 2009 15:46:00 GMT</pubDate>
      <dc:creator><![CDATA[MSDN Archive]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jamiemac/2009/05/12/more-data-mining-in-the-cloud/</guid>
      <description><![CDATA[Since we released the Tech Preview of the Cloud Data Mining Addins last year, I've heard about and...]]></description>
      <content:encoded><![CDATA[<P>Since we released the Tech Preview of the Cloud Data Mining Addins last year, I've heard about and talked with Michael Zeller of Zementis.&nbsp; Zementis has been very active in shaping the PMML (Predictive Modeling Markup Language) standard for representing learned knowledge in XML format.&nbsp; They have a product called ADAPA that allows you to score, or predict from, arbitrary data sets using arbitrary PMML models.</P>
<P>Recently they released a version of ADAPA for the Amazon Cloud service and it has been very popular for them.&nbsp; I just recieved a note from Michael showing how you can <A href="https://adapasupport.zementis.com/2009/04/scoring-data-in-adapa-via-web-services.html" mce_href="https://adapasupport.zementis.com/2009/04/scoring-data-in-adapa-via-web-services.html">integrate ADAPA with SQL Server Integration Services</A>.&nbsp; Basically ADAPA exposes each model as a web mothod that you can call from the SSIS Web Services task.&nbsp; It's up to you to populate SSIS variables from data and subsequently take the results from a variable and archive them, but it does give you the ability to take models generated in other data mining tools, such as<STRONG> SAS</STRONG> and <STRONG>SPSS</STRONG> and integrate them into your SQL Server workflows.</P>
<P>Hopefully Zementis will release an SSIS transform version of their service to make the usage more natural with SQL Server Integration Services, or better yet, offer a SQL Server Data Mining PlugIn version of their PMML reader so that you can use DMX against your SAS or SPSS models for integration into applications/reporting services/Excel Addins/etc.</P>
<P>&nbsp;Let me know what you think and I'll pass the info on to Michael, or if you happen to be going to Paris this summer, you can catch him at the <A href="https://www.sigkdd.org/kdd2009/" mce_href="https://www.sigkdd.org/kdd2009/">SIG KDD Data Mining Conference</A>&nbsp;at the end of June where he'll be running a panel on Emerging Trends in Open Standards and Cloud Computing&nbsp;for Data Mining</P>
<P mce_keep="true">&nbsp;</P>]]></content:encoded>
    </item>
    <item>
      <title>New Cloud Data Mining Addin Usability Feature (well kind of)</title>
      <link>https://docs.microsoft.com/archive/blogs/jamiemac/new-cloud-data-mining-addin-usability-feature-well-kind-of</link>
      <pubDate>Thu, 07 May 2009 19:11:00 GMT</pubDate>
      <dc:creator><![CDATA[MSDN Archive]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jamiemac/2009/05/07/new-cloud-data-mining-addin-usability-feature-well-kind-of/</guid>
      <description><![CDATA[Bogdan did an awesome job putting together the modified Data Mining Addin for the cloud.&nbsp; We...]]></description>
      <content:encoded><![CDATA[<P>Bogdan did an awesome job putting together the modified Data Mining Addin for the cloud.&nbsp; We saw quite a few downloads of his new addin, but surprisingly and unfortunately, didn't see a lot of usage!&nbsp; Strange?&nbsp; Maybe.&nbsp; Bogdan thought about the issue for a while and&nbsp;from a few anecdotal comments determined that once installed, the addin can be pretty hard to find.</P>
<P>So, the new usability feature is a full page writeup on how to find the addin at <A href="https://www.sqlserverdatamining.com/cloud/">https://www.sqlserverdatamining.com/cloud/</A>&nbsp;once you click on the Download link.&nbsp; (Basically, you have to make a table to get the table tools!)</P>
<P>&nbsp;If you've downloaded the addin and "lost" it - go try again!&nbsp; If you haven't yet, here's your chance!</P>]]></content:encoded>
    </item>
    <item>
      <title>In Germany this April?</title>
      <link>https://docs.microsoft.com/archive/blogs/jamiemac/in-germany-this-april</link>
      <pubDate>Thu, 05 Feb 2009 13:26:06 GMT</pubDate>
      <dc:creator><![CDATA[MSDN Archive]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jamiemac/2009/02/05/in-germany-this-april/</guid>
      <description><![CDATA[If so – check out the European PASS Conference, if not – maybe you should be!  This conference will...]]></description>
      <content:encoded><![CDATA[<p>If so – check out the <a href="https://www.european-pass-conference.com/">European PASS Conference</a>, if not – maybe you should be!</p>  <p>This conference will have a great BI focus including a pre-conference session on using SQL Server BI tools to monitor SQL Server BI tools and at least two data mining sessions, including one from Steve Simon of <a href="https://www.statestreet.com/">State Street Corporation</a> talking about how they personally leverage SQL Server Data Mining to manage their risk exposure.&#160; Not another talking head from the product team (aka “me”) spouting the general awesomeness of the product, but user solving real-world user problems with the (imHo) best data mining product in the world.</p>  <p>If you can, check it out it will be a great chance to network with other users and see real-world implementations rather than MSFT demos!</p>]]></content:encoded>
    </item>
    <item>
      <title>Querying the Dependency Net</title>
      <link>https://docs.microsoft.com/archive/blogs/jamiemac/querying-the-dependency-net</link>
      <pubDate>Fri, 12 Dec 2008 16:42:22 GMT</pubDate>
      <dc:creator><![CDATA[MSDN Archive]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jamiemac/2008/12/12/querying-the-dependency-net/</guid>
      <description><![CDATA[OK, ok, so just yesterday I posted that it was easy to determine what queries were being used by the...]]></description>
      <content:encoded><![CDATA[<p>OK, ok, so just <em>yesterday</em> I posted that it was easy to determine what queries were being used by the browsers to get the data underlying the view.&#160; Of course it’s easy to get them, but without a teensy weensy bit of documentation, it’s not necessarily easy to understand what the parameters mean or possibly what the results mean.</p>  <p>For instance, take the dependency net – everybody loves the dependency net – it’s cool and shows that “high-level information” that everybody craves.&#160; For example, this picture showing how “Die Hard” is the nexus linking Beverly Hills Cop with the Lethal Weapon family of movies.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/QueryingtheDependencyNet_C0B4/image_2.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/QueryingtheDependencyNet_C0B4/image_2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/QueryingtheDependencyNet_C0B4/image_thumb.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/QueryingtheDependencyNet_C0B4/image_thumb.png" width="244" height="150" /></a> </p>  <p>Whatever.</p>  <p>Anyway, to get this information we call the deceptively simple ARGetNodeGraph function, that is, for Association Rules models, like this:</p>  <div>   <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">CALL</span> System.ARGetNodeGraph(<span style="color: #006080">'Associate Movies'</span>, 60)</pre>
</div>

<p>With the first parameter being the name of the model and the second being the number of nodes to return.&#160; The function chooses nodes using a heuristic that considers the popularity of the node and balances between inputs and outputs in order to produce a nice result.</p>

<p>That’s easy enough – let’s take a look at the output (truncated for space)</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/QueryingtheDependencyNet_C0B4/image_4.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/QueryingtheDependencyNet_C0B4/image_4.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/QueryingtheDependencyNet_C0B4/image_thumb_1.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/QueryingtheDependencyNet_C0B4/image_thumb_1.png" width="556" height="139" /></a> </p>

<p>Whoa!&#160; That’s a bit more complex.</p>

<p>Basically the output is divided into two sections indicated by the &quot;NODE_TYPE” column.&#160; The “NODE_TYPE” column actually has <em>nothing to do</em>&#160; with a node type and (if I had to guess, which I don’t) I would say that NODE_TYPE was used to reuse names from the MINING_CONTENT schema rowset rather than be the most accurate moniker for the column itself.&#160; NODE_TYPE is actually the ROW type, and has the values 1 or 2.&#160; If the NODE_TYPE is 1, then the row represents a NODE in the graph.&#160; If the NODE_TYPE is 2, the row represents an EDGE in the graph.&#160; All of the other column interpretations depend on the type of row.</p>

<p>For NODE rows (NODE_TYPE=1, for those readers with serious short-term memory issues), the columns describe a node like this:</p>

<ul>
  <li><strong>NODE_UNIQUE_NAME_1</strong> – This is an ID used to identify the node in the edges section.</li>

  <li><strong>NODE_UNIQUE_NAME_2</strong> – The default label for the node</li>

  <li><strong>MSOLAP_NODE_SCORE</strong> – Unused</li>

  <li><strong>ATTRIBUTE_NAME</strong> – The attribute name part of the default label, used to compose and decompose different options for node displays</li>

  <li><strong>ATTRIBUTE_LONG_NAME</strong> – The full attribute name – i.e. if the attribute came from a nested table, it has the name of the nested table, plus the specific attribute name in parenthesis.&#160; Again used for label composition.</li>

  <li><strong>ATTRIBUTE_VALUE</strong> – The value name part of the default label, again used for label composition.</li>
</ul>

<p>For EDGE rows (NODE_TYPE=2) the columns describe a directed edge like this:</p>

<ul>
  <li><strong>NODE_UNIQUE_NAME_1</strong> – The ID (from the NODE rows) of the <em>source</em> of the edge</li>

  <li><strong>NODE_UNIQUE_NAME_2</strong> – The ID (from the NODE rows) of the <em>destination</em> of the edge</li>

  <li><strong>MSOLAP_NODE_SCORE</strong> – The strength of the edge – I don’t believe there is any specific range</li>

  <li>Other columns - unused</li>
</ul>

<p>So, that’s how the dependency net gets created – <em>initially</em>.&#160; There are actually many additional functions used by the dependency net to, as you may say, fill out the graph.</p>

<p>For example, if you click the “Find Node” button in the dependency net browser, the browser issues this call:</p>

<div>
  <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">CALL</span> System.ARGetNodes(<span style="color: #006080">'Associate Movies'</span>)</pre>
</div>

<p>This call returns a result set like the NODE section of the ARGetNodeGraph, except without the NODE_TYPE column, with a row for <em>every possible</em> node – not just the top 60.&#160; The only parameter is the name of the model.</p>

<p>If you select a node that is not already in the graph, this is where it gets a bit interesting.&#160; The browser issues a call like this:</p>

<div>
  <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">CALL</span> System.ARAddNodes(<span style="color: #006080">'Associate Movies'</span>, <span style="color: #006080">'600'</span>, 
     <span style="color: #006080">'604;726;648;733;630;700;719;718;130;387;386;712;621;727;670;154;337'</span>)</pre>
</div>

<div>&#160;</div>

<p></p>

<p>ARAddNodes has the following parameters:</p>

<ul>
  <li>strModel – the model name, but you already new this</li>

  <li>strNodesToAdd – a semi-colon delimited list of node ids to add to the graph</li>

  <li>strNodesInGraph – a semi-colon delimited list of node ids already in the graph</li>
</ul>

<p>The result set looks like the EDGE section of the result of ARGetNodeGraph without the unused columns and contains only the edges between the nodes identified in strNodesToAdd and those identified in strNodesInGraph.&#160; Note that the node id’s that are used are <em>only</em> those returned from ARGetNodeGraph or ARGetNodes and are not node id’s from the model content schema rowset.</p>

<p><strong><em>NB</em> </strong>When you see the function calls in SQLProfiler, you will get the fully qualified function name, e.g. System.Microsoft.AnalysisServices.System.DataMining.AssociationRules.ARAddNodes.&#160; You can eliminate all the intermediate namespaces and just call System.&lt;function name&gt;.</p>

<p><strong><em>NB2</em></strong> There are a set of equivalent stored procedures for Decision Trees, that you can probe by browsing a tree model’s dependency network</p>

<p><strong><em>NB3</em></strong> Nope, you won’t find a Naive Bayes version by browsing a NB model’s dep net – that browser was never “updated” to use stored procedures to get dependency network information.&#160; You can use the Visio Data Mining Template and see what functions are called….but their different…..</p>]]></content:encoded>
    </item>
    <item>
      <title>Data Mining in SQL Server 2008 Book Review</title>
      <link>https://docs.microsoft.com/archive/blogs/jamiemac/data-mining-in-sql-server-2008-book-review</link>
      <pubDate>Thu, 11 Dec 2008 13:12:45 GMT</pubDate>
      <dc:creator><![CDATA[MSDN Archive]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jamiemac/2008/12/11/data-mining-in-sql-server-2008-book-review/</guid>
      <description><![CDATA[I just read a great review of our book from Richard Lees in Australia.&#160; Richard is one of the...]]></description>
      <content:encoded><![CDATA[<p>I just read a <a href="https://richardlees.blogspot.com/2008/12/book-review-data-mining-with-sql-server.html">great review</a> of <a href="https://www.amazon.com/gp/product/0470277742?ie=UTF8&amp;tag=sqlserverda09-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0470277742">our book</a> from Richard Lees in Australia.&#160; Richard is one of the early adopters of Analysis Service and Data Mining, so he has a lot of experience in this area (we actually reference some of his samples in the book!).&#160; You should check out <a href="https://richardlees.blogspot.com/">his blog</a> anyway, just to learn from a master and expand your BI expertise!</p>]]></content:encoded>
    </item>
    <item>
      <title>Querying like the Data Mining viewers do</title>
      <link>https://docs.microsoft.com/archive/blogs/jamiemac/querying-like-the-data-mining-viewers-do</link>
      <pubDate>Wed, 10 Dec 2008 18:11:57 GMT</pubDate>
      <dc:creator><![CDATA[MSDN Archive]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jamiemac/2008/12/10/querying-like-the-data-mining-viewers-do/</guid>
      <description><![CDATA[It happens all the time.&#160; You see some cool user interface trick and think “how can I do...]]></description>
      <content:encoded><![CDATA[<p>It happens all the time.&#160; You see some cool user interface trick and think “how can I do that?”&#160; Or, maybe more likely, you think “gee, that’s useful, where’s that documented?”&#160; In any case, if you have ever wondered about how the DM viewers get the data to display on the screen, then this is the post for you.</p>  <p>In many cases, what is displayed in the data mining viewers is the result of built-in stored procedures which allow the processing required for the view to be done on the server without requiring all of the model content to be brought to the server.&#160; In this post, I’ll give one example of those stored procedures, and then I’ll add some information on how you con figure out the rest.&#160; Not everything in the viewers is calculated on the server, but many of them are, and getting access directly to the data is useful (I presume, since everyone always asks…. :) )</p>  <p>Let’s start with an easy one – the Naive Bayes attribute discrimination view.&#160; This view shows how the differences in the input attributes across the states of an output attribute.&#160; It generally looks like this:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/QueryingliketheDataMiningviewersdo_E1BD/image_2.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/QueryingliketheDataMiningviewersdo_E1BD/image_2.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/QueryingliketheDataMiningviewersdo_E1BD/image_thumb.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/QueryingliketheDataMiningviewersdo_E1BD/image_thumb.png" width="244" height="109" /></a> </p>  <p>The viewer doesn’t download all of the correlations in the Naive Bayes content, rather it calls the stored procedure GetAttributeDiscrimination like this:</p>  <p>&#160;</p>  <div>   <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">CALL</span> System.GetAttributeDiscrimination
  (<span style="color: #006080">'Classify CollegePlans NB'</span>, 
   <span style="color: #006080">'100000005'</span>, 
   <span style="color: #006080">'Plans to attend'</span>, 
   1, 
   <span style="color: #006080">'All other states'</span>, 
   2, 
   0.0005, 
   <span style="color: #0000ff">true</span>)</pre>
</div>

<p>The not-so-obvious parameters are, in order strModel, strPredictableNode, strValue1, iValType1, strValue2, iValType2, dThreshold, and bNormalize.&#160; Let’s go through these parameters…</p>

<p><strong>strModel</strong> – the name of the model, of course!</p>

<p><strong>strPredictableNode</strong> – this one is a bit difficult, as it takes the <strong><em>Node Unique Name </em></strong>of the target attribute instead of just the string you see in the viewer.&#160; The Node Unique Name identifies the attribute in the content rowset generated by the model.&#160; You can get the list of predictable attributes and their Node Unique Names by calling another stored procedure – like this<strong><font face="Courier New"> </font><font face="Courier New">CALL System.GetPredictableAttributes('ModelName').</font>&#160; </strong>This stored procedure returns two columns – one for the attribute name and one for the Node Unique Name.</p>

<p><strong>strValue1</strong> – The name of the value you want to compare on the left hand side.&#160; The usage of this parameter depends on the value of the next parameter, which is….</p>

<p><strong>iValType1</strong> – This parameter indicates how to treat strValue1.&#160; It can have values 0,1, or 2.&#160; If this parameter is a 1, the value in strValue1 is the actual state of the attribute.&#160; However, if this parameter is a 0 or 2, the value in strValue1 is ignored.&#160; If the value is 0, the left-hand value is considered to be the “missing state”.&#160; If the value is 2, the left hand value is considered to be “all other states.”&#160; In the example above, “All other states” is specified only because it looks nice (and it’s easier to just drop the combo box value into the function call even if it will just be ignored….)</p>

<p><strong>strValue2</strong> – Like strValue1, but for the right hand side.</p>

<p><strong>iValType2</strong> – Like iValType2, but for the right hand side.</p>

<p><strong>dThreshold – </strong>A threshold value used to filter results, such that small correlations don’t come back in the results.&#160;&#160;&#160; Usually you set it to a really small number like 0.0005 in the example above.</p>

<p><strong>bNormalize</strong>&#160; - Whether or not the result is normalized.&#160; If this value is true, the results are normalized to a maximum absolute value of 100, giving a possible range of –100 to 100.&#160; All this does is take the largest absolute value in the result and divide that into 100, and then multiple all the other numbers by that amount.&#160; If set to false, the numbers are whatever they are and you can figure it out yourself – it’s up to you, but we always set this to <strong>true</strong>.</p>

<h1><strong>The results</strong></h1>

<p>Calling this routine returns a row for every differentiating attribute/value pair with a score higher than the specified threshold.&#160; The row contains the differentiating pair along with the score and some other columns and looks somewhat like this:</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/QueryingliketheDataMiningviewersdo_E1BD/image_4.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/QueryingliketheDataMiningviewersdo_E1BD/image_4.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/QueryingliketheDataMiningviewersdo_E1BD/image_thumb_1.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/QueryingliketheDataMiningviewersdo_E1BD/image_thumb_1.png" width="244" height="83" /></a> </p>

<p>The <strong>score</strong> column is the “important” one and is best explained as if you did something like a c language compare routine e.g <font face="Courier New"><strong>int Compare(int v1,int v2) { return v1-v2; }</strong></font> .&#160; That is, if the value is positive it favors value1 and if the value is negative it favors value2.&#160; I’m not going to go in depth on the other columns other than to say that they are the actual counts of the correlations of the discriminator against the inputs.&#160; The best way to understand them is to look at the Mining Legend as you browse the model and click on rows.&#160; For example if you clicked on the first row of the result above (in either picture), the Mining Legend would look like this:</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/QueryingliketheDataMiningviewersdo_E1BD/image_6.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/QueryingliketheDataMiningviewersdo_E1BD/image_6.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/QueryingliketheDataMiningviewersdo_E1BD/image_thumb_2.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/QueryingliketheDataMiningviewersdo_E1BD/image_thumb_2.png" width="244" height="60" /></a> </p>

<p>Of course, once you have the result set you can use it wherever you want – in Reporting Services, Integration Services, or in you custom program.</p>

<h1>How to get the function calls</h1>

<p>So, how do you find this laundry list of undocumented stored procedures.&#160; Well, some are documented in <a href="https://www.amazon.com/gp/product/0470277742?ie=UTF8&amp;tag=sqlserverda09-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0470277742">my book</a>, but you can get them all for free just by looking in the right place.&#160; You can run the <strong>SQL Server Profiler</strong> to see what functions are being called by the viewers.&#160; Here’s how you do it.</p>

<p>First, run SQL Server Profiler:</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/QueryingliketheDataMiningviewersdo_E1BD/image_8.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/QueryingliketheDataMiningviewersdo_E1BD/image_8.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/QueryingliketheDataMiningviewersdo_E1BD/image_thumb_3.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/QueryingliketheDataMiningviewersdo_E1BD/image_thumb_3.png" width="167" height="244" /></a> </p>

<p>Then, start a New Trace from the File Menu and connect to Analysis Services</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/QueryingliketheDataMiningviewersdo_E1BD/image_10.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/QueryingliketheDataMiningviewersdo_E1BD/image_10.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/QueryingliketheDataMiningviewersdo_E1BD/image_thumb_4.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/QueryingliketheDataMiningviewersdo_E1BD/image_thumb_4.png" width="244" height="183" /></a> </p>

<p>You can leave all the defaults on for the Trace Properties dialog that appears</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/QueryingliketheDataMiningviewersdo_E1BD/image_12.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/QueryingliketheDataMiningviewersdo_E1BD/image_12.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/QueryingliketheDataMiningviewersdo_E1BD/image_thumb_5.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/QueryingliketheDataMiningviewersdo_E1BD/image_thumb_5.png" width="244" height="157" /></a> </p>

<p>Then go to any data mining viewer and browse a model!&#160; That’s it!&#160; You will get trace output that looks like this:</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/QueryingliketheDataMiningviewersdo_E1BD/image_14.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/QueryingliketheDataMiningviewersdo_E1BD/image_14.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/QueryingliketheDataMiningviewersdo_E1BD/image_thumb_6.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/QueryingliketheDataMiningviewersdo_E1BD/image_thumb_6.png" width="244" height="140" /></a> </p>

<p>You can get the query text in the bottom pane of the trace window by finding and selecting rows with event types of ‘Query Begin’ or ‘Query End’.</p>

<p>Oh, and make sure you stop the trace before you shut down SQL Profiler - ‘cuz it will keep going.</p>

<p>Let me know if you find any particularly tricky stored procedures that you need help with – best place to ask is in the <a href="https://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=81&amp;SiteID=1">MSDN forums</a>!</p>]]></content:encoded>
    </item>
    <item>
      <title>Those kids won't eat anything!</title>
      <link>https://docs.microsoft.com/archive/blogs/jamiemac/those-kids-wont-eat-anything</link>
      <pubDate>Thu, 20 Nov 2008 16:15:53 GMT</pubDate>
      <dc:creator><![CDATA[MSDN Archive]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jamiemac/2008/11/20/those-kids-wont-eat-anything/</guid>
      <description><![CDATA[I did my BI Power Hour demo at PASS 2008 yesterday and it featured my twin boys Bowen and Logan....]]></description>
      <content:encoded><![CDATA[<p>I did my BI Power Hour demo at PASS 2008 yesterday and it featured my twin boys Bowen and Logan. <a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/IMG_0450sm_2.jpg" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/IMG_0450sm_2.jpg"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="184" alt="IMG_0450sm" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/IMG_0450sm_thumb.jpg" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/IMG_0450sm_thumb.jpg" width="244" border="0" /></a> </p>  <p>Logan (right) has an ASD (Autism Spectrum Disorder) that limits his diet (no milk products, gluten, or soy) and Bowen has some sensory issues, but that doesn't explain their <em>extreme </em>pickiness with food.&#160; For example, I made a rice-yogurt-blueberry smoothie for Logan and he just looked at it and said &quot;yucky!&quot;.&#160; Ugh.</p>  <p>So, I decided to make a worksheet listing foods they these kids will eat and won't eat.&#160; I used attributes of Color, Type, and Processed, along with a column indicating whether or not they will actually eat the food.&#160; Of course, I had to answer to myself disturbing questions such as &quot;what color are hot dogs?&quot;, but I got through it.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_2.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_2.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="176" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_thumb.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_thumb.png" width="244" border="0" /></a> </p>  <p>Then I used the Prediction Calculator from the new Table Analysis Tools Excel addin for SQL Server 2008.&#160; The Prediction Calculator creates a little widget in Excel that allows you to enter in input values and based on your costs.&#160; Running the Prediction Calculator is as simple as selecting your table, clicking the Prediction Calculator button on the Table Analyze ribbon, and then choosing the column and value you want to predict.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_4.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_4.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="79" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_thumb_1.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_thumb_1.png" width="67" border="0" /></a><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_6.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_6.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="214" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_thumb_2.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_thumb_2.png" width="244" border="0" /></a> </p>  <p>There's actually a <em>little</em> more work to do after you run the tool, and that is specifying your <em>costs</em> and <em>profits</em>.&#160; Your costs are the cost you incur for getting the answer wrong, and a profit is the profit you make when you get the answer right.&#160; The grid below is in Prediction Calculator Report that is created after running the tool.&#160; In this case, I figured that if I guessed that my kids would eat some food and was wrong, it would cost me the 5 bucks for the food which would be wasted, therefore I set the <strong>False Positive Cost</strong> to 5.&#160; Furthermore, I figured that if I guessed correctly that they <em>wouldn't</em> eat a food, I saved the money and the 5 bucks would still be in my pocket, so I set the <strong>True Negative Profit</strong> to 5 as well.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_8.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_8.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="89" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_thumb_3.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_thumb_3.png" width="244" border="0" /></a> </p>  <p>Doing so, gave me a profit chart that looks like below - which is a problem.&#160; Basically, what a &quot;always rising&quot; chart says is that you should always say &quot;no&quot; to achieve the highest profit - which makes sense since I can only lose money by saying &quot;yes&quot; and only gain money by saying &quot;no&quot;.&#160; Essentially my laptop analysis tells me that my kids are simply too picky and I should just make them starve!&#160; Hah!&#160; My laptop apparently has never had kids!</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_10.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_10.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="110" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_thumb_4.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_thumb_4.png" width="244" border="0" /></a> </p>  <p>Anyway, I decided that there's some nominal value for my kids eating, so I changed the parameters a bit.&#160; I figured that my kids complaining that I didn't get a food that they wanted causes me the psychological cost of 1 dollar (or maybe the real cost of going back to the store of a dollar, however you want to see it), and I set the <strong>False Negative Cost</strong> to 1.&#160; Also I decided the value of my kids not getting a sugar imbalance and (literally) bouncing off the walls is a &quot;peace of mind&quot; profit of a dollar, so I set the <strong>True Positive Profit</strong> to 1 as well.&#160; This gives me a better behaved profit chart with a peak like below.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_12.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_12.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="79" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_thumb_5.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_thumb_5.png" width="244" border="0" /></a> </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_14.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_14.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="112" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_thumb_6.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_thumb_6.png" width="244" border="0" /></a> </p>  <p>Once I've set my costs, I can go to the Prediction Calculator sheet that was created and select my inputs and see if my kids will actually eat the food.&#160; In this case, &quot;Yellow, unprocessed, grains and nuts&quot; doesn't exceed the threshold of 642, so the answer is no.&#160; Yay!&#160; I saved 5 bucks because my kids won't eat corn :(.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_16.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_16.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="90" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_thumb_7.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_thumb_7.png" width="244" border="0" /></a> </p>  <p>Of course, this isn't very useful for me in this format - it's not like I'm going to lug my laptop around the grocery store plugging in values for every product I see on the shelf.&#160; So to get around this I use the new, experimental <a href="https://www.sqlserverdatamining.com/cloud" target="_blank"><strong>Cloud Data Mining Service</strong></a><strong>.&#160; </strong>The web interface contains many of the Table Analysis Tools, including the Prediction Calculator, and you can access data from CSV files, SQL Data Services, or another way which is not entirely obvious and not documented by simply pasting your data from Excel to the web.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_18.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_18.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="244" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_thumb_8.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_thumb_8.png" width="185" border="0" /></a> </p>  <p>Once you've pasted your data, I run the Prediction Calculator just like I did in Excel.&#160; There's one small difference, however, in the result is that I have the HTML fragment for the calculator itself.&#160; Therefore I can make my own web site with the calculator embedded inside.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_20.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_20.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="188" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_thumb_9.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/image_thumb_9.png" width="244" border="0" /></a></p>  <p>Once I have my website (which in this case is at&#160; </p>  <p><a href="https://www.sqlserverdatamining.com/PASS2008BIPowerHourDemo.htm">https://www.sqlserverdatamining.com/PASS2008BIPowerHourDemo.htm</a>) I can access the Prediction Calculator from any web-enabled device - <strong>like my phone</strong>, which I <em>can </em>carry around the grocery store and determine that my kids will eat .... brown.....processed.....meat.... oh yay....</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/Untitled%203_2.jpg" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/Untitled%203_2.jpg"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="184" alt="Untitled 3" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/Untitled%203_thumb.jpg" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/Thosekidswonteatanything_BA64/Untitled%203_thumb.jpg" width="244" border="0" /></a></p>]]></content:encoded>
    </item>
    <item>
      <title>Time's running out for your free data mining book!</title>
      <link>https://docs.microsoft.com/archive/blogs/jamiemac/times-running-out-for-your-free-data-mining-book</link>
      <pubDate>Thu, 20 Nov 2008 14:52:00 GMT</pubDate>
      <dc:creator><![CDATA[MSDN Archive]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jamiemac/2008/11/20/times-running-out-for-your-free-data-mining-book/</guid>
      <description><![CDATA[The survey is now closed.&nbsp; Thank you.&nbsp;
Tomorrow is the last day you can fill out this...]]></description>
      <content:encoded><![CDATA[<P><STRONG>The survey is now closed.&nbsp; Thank you.</STRONG>&nbsp;</P>
<P>Tomorrow is the last day you can fill out <A class="" target=_blank>this survey</A> for a chance to win one of ten copies of <A href="https://www.amazon.com/gp/product/0470277742?ie=UTF8&amp;tag=sqlserverda09-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0470277742" target=_blank mce_href="https://www.amazon.com/gp/product/0470277742?ie=UTF8&amp;tag=sqlserverda09-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0470277742">Data Mining with SQL Server 2008</A>.&nbsp; I used the the Data Exploration tool in the SQL Server 2008 Data Mining Client for Excel, and saw that it takes most people less than 15 minutes to fill it out. </P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/Timesrunningoutforyourfreedataminingbook_A68B/image_2.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/Timesrunningoutforyourfreedataminingbook_A68B/image_2.png" mce_href="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/Timesrunningoutforyourfreedataminingbook_A68B/image_2.png"><IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=244 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/jamiemac/WindowsLiveWriter/Timesrunningoutforyourfreedataminingbook_A68B/image_thumb.png" original-url="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/Timesrunningoutforyourfreedataminingbook_A68B/image_thumb.png" width=223 border=0 mce_src="https://blogs.msdn.com/blogfiles/jamiemac/WindowsLiveWriter/Timesrunningoutforyourfreedataminingbook_A68B/image_thumb.png"></A> </P>
<P>(time to take survey in seconds)</P>
<P>Regarding the book, just today I received my sample copies and I was surprised at how much bigger it is than the 2005 book!&nbsp; It rounds out at 636 pages - I remember last version we were running up against publisher defined page limits and we cut back material to make it fit.&nbsp; This time, we just wrote what needed to be written and the publisher agreed to let us, the authors, make the decisions on how long the book should be.&nbsp; I'm really happy about how the text turned out this time - we still don't have a review on Amazon, so hopefully the public will agree!</P>]]></content:encoded>
    </item>
  </channel>
</rss>