3. Naive Bayes Algorithm<br />The Microsoft Naive Bayes algorithm is a classification algorithm provided by Microsoft SQL Server Analysis Services for use in predictive modeling. <br />The name Naive Bayes derives from the fact that the algorithm uses Bayes theorem but does not take into account dependencies that may exist, and therefore its assumptions are said to be naive.<br />
4. How to use the Naive Bayes algorithm in SQL server?<br />This algorithm is less computationally intense than other Microsoft algorithms<br />It is therefore is useful for quickly generating mining models to discover relationships between input columns and predictable columns. <br />The algorithm considers each pair of input attribute values and output attribute values.<br />Exploring a Naive Bayes model will tell you how your attributes are related to each other. <br />
5. DMX <br />When you create a query against a data mining model<br />you can create either a content query, which provides details about the patterns discovered in analysis, or you can create a prediction query, which uses the patterns in the model to make predictions for new data<br /> You can also retrieve metadata about the model by using a query against the data mining schema rowset.<br />
6. DMX Queries<br />SELECT MODEL_CATALOG, MODEL_NAME, DATE_CREATED, LAST_PROCESSED, SERVICE_NAME, PREDICTION_ENTITY, FILTER <br />FROM <br />$system.DMSCHEMA_MINING_MODELS WHERE MODEL_NAME = 'TM_NaiveBayes_Filtered‘<br />Getting Model Metadata by Using DMX<br />you can find metadata for the model, by querying the data mining schema rowset.<br />This might include when the model was created, when the model was last processed, the name of the mining structure that the model is based on, and the name of the columns used as the predictable attribute. <br />
7. DMX Queries<br />Retrieving a Summary of Training Data<br />Query to retrieve the data from the node specified.<br />Because the statistics are stored in a nested table, the FLATTENED keyword is used to make the results easier to view.<br /> SELECT FLATTENED MODEL_NAME, <br />(SELECT ATTRIBUTE_NAME, <br />ATTRIBUTE_VALUE, [SUPPORT], <br />[PROBABILITY], VALUETYPE<br /> FROM <br />NODE_DISTRIBUTION) AS t FROM <br />TM_NaiveBayes.CONTENT WHERE <br />NODE_TYPE = 26<br />
8. DMX Queries<br />Finding More Information about Attributes<br />Example to show how to return information from the model about a particular attribute( here ”Region”)<br /> The Result of this query is shown in the next slide.<br />SELECT NODE_TYPE, NODE_CAPTION, MSOLAP_NODE_SCORE FROM TM_NaiveBayes.CONTENT WHERE ATTRIBUTE_NAME = 'Region'<br />
9. DMX Queries<br />Sample Resultto showing<br />information from the model about a particular attribute ”Region”<br />
10. DMX Queries<br />SELECT NODE_CAPTION, MSOLAP_NODE_SCORE<br /> FROM <br />TM_NaiveBayes.CONTENT WHERE NODE_TYPE = 10 ORDER BY MSOLAP_NODE_SCORE DESC<br />Query returns the<br />importance scores of<br />all attributes in the<br />Model.<br /> The Result of this query is shown in the next slide.<br />
12. Exploring a Naive Bayes Model<br />The convenient way to start analyzing a new data set is to create a Naive Bayes model and mark all the non-key columns as both input and predictive.<br />The content of each model is presented as a series of nodes.<br /> A node is an object within a mining model that contains metadata and information about a portion of the model.<br /> Nodes are arranged in a hierarchy. <br />
13. Naive Bayes Model Content<br />
14. Exploring a Naive Bayes Model<br />The Naive Bayes viewer is accessed through either the BI Development Studio or SQL Management Studio by right-clicking on the model and selecting Browse.<br />SQL Server Data Mining provides four different views on Naive Bayes models :<br /><ul><li>Dependency Network: </li></ul>Provides a quick display of how all of the attributes in your model are related. <br />Each node in the graph represents an attribute, whereas each edge represents a relationship. <br />outgoing edge (it is predictive of the attribute in the node at the end of the edge)<br />Incoming edge( it is predicted by the other node)<br />
15. Exploring a Naive Bayes Model<br /><ul><li>Attribute Profiles:</li></ul>provides you with an exhaustive report of how each input attribute corresponds to each output attribute, one attribute at a time.<br /> At the top of the Attribute Profiles view, you select which output you want to look at, and the rest of the view shows how all of the input attributes are correlated to the states of the selected output attribute.<br />
16. Exploring a Naive Bayes Model<br /><ul><li>Attribute Characteristics:</li></ul>This tab allows you to select an output attribute and value and shows you a description of the cases where that attribute and value occur.<br /><ul><li>Attribute Discrimination:</li></ul> Provides the answers to the most interesting question: <br />What is the difference between X and Y? <br />With this viewer, you choose the attribute you are interested in, and select the states you want to compare. <br />
17. Naive Bayes Principles<br />Bayes mathematical methods use a combination of conditional and unconditional probabilities.<br />The Naive part of Naive Bayes tells you to treat all of your input attributes as independent of each other with respect to the target variable. <br />This may be a faulty assumption, but it allows you to multiply your probabilities to determine the likelihood of each state.<br />
18. Naive Bayes Principles<br />The Bayes rule states that if you have a hypothesis Hand evidence about that hypothesis E, then the probability of H is calculated using the following formula:<br />P(H | E) = P(E | H) × P(H)<br /> P(E)<br />This simply states that the probability of your hypothesis given the evidence is equal to the probability of the evidence given the hypothesis multiplied by the probability of the hypothesis, and then normalized. <br />
19. Naive Bayes Parameters<br />MAXIMUM _INPUT _ATTRIBUTES determines the number of attributes that will be considered as inputs for training.<br /> If there is more than this number of inputs, the algorithm will select the most important inputs and ignore the rest.<br /> Setting this parameter to 0 causes the algorithm to consider all attributes.<br />The default value is 255.<br />MAXIMUM _OUTPUT _ATTRIBUTES determines the number of attributes that will be considered as outputs for training. <br />If there is more than this number of outputs, the algorithm will select the most important outputs and ignore the rest. <br />Setting this parameter to 0 causes the algorithm to consider all attributes.<br />The default value is 255.<br />
20. Naive Bayes Parameters<br />MAXIMUM _STATES controls how many states of an attribute are considered. If an attribute has more than this number of states, only the most popular states will be used. <br />States that are not selected will be considered to be missing data. This parameter is useful when an attribute has a high cardinality<br />
22. Visit more self help tutorials<br />Pick a tutorial of your choice and browse through it at your own pace.<br />The tutorials section is free, self-guiding and will not involve any additional support.<br />Visit us at www.dataminingtools.net<br />
Be the first to comment