Machine Learning-A Problem or Solution
Tags: machinelearning, classification
Published: 2017-08-17 17:39:30

---
title: Machine Learning-A Problem or Solution
published: true
description: An introduction of machine learning. Some basic concept and getting started with classification. 
tags: #ML, #MachineLearning, #Classification
canonical_url: http://techscouter.blogspot.in/2017/06/machine-learning-solution-or-problem.html
cover_image: https://thepracticaldev.s3.amazonaws.com/i/ri6p8ktrxazce72u8j53.jpg
---
<div dir="ltr" style="text-align: left;" trbidi="on">
<h3 style="text-align: left;">
The article will be divided into different sections as follows:</h3>
<ul style="text-align: left;">
<li>Introduction to Machine Learning
</li>
<li>Types of Solutions</li>
<li>Classification using Naive Bayes</li>
</ul>

<h2 style="text-align: left;">
<span id="intro"><b>A brief about Machine Learning</b></span></h2>

<div style="text-align: left;">
According to the definition by Wikipedia,<b style="font-family: sans-serif; font-size: 14px;">&nbsp;Machine learning</b><span style="font-family: sans-serif; font-size: 14px;">&nbsp;is the subfield of&nbsp;</span><a href="https://en.wikipedia.org/wiki/Computer_science" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: sans-serif; font-size: 14px;" title="Computer science">computer science</a><span style="font-family: sans-serif; font-size: 14px;">&nbsp;that, according to&nbsp;</span><a href="https://en.wikipedia.org/wiki/Arthur_Samuel" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; font-family: sans-serif; font-size: 14px;" title="Arthur Samuel">Arthur Samuel</a><span style="font-family: sans-serif; font-size: 14px;">&nbsp;in 1959, gives "computers the ability to learn without being explicitly programmed."&nbsp;</span></div>
<div style="text-align: left;">
<span style="font-family: sans-serif; font-size: 14px;">Machine Learning defines a set of problems that have to be evolved through the data by implying some algorithm.</span></div>
<span style="font-family: sans-serif; font-size: 14px;"> One factor that has to be kept in mind while defining a solution through ML is accuracy. Accuracy is very critical in case you are developing a solution in medical domain(cancer detection).There should be a threshold set for every solution which can be based on risk %age that is acceptable.</span>

<h3 style="text-align: left;">
<span style="font-family: sans-serif; font-size: 14px;">A useful cheatsheet from Microsoft's site to sum up the use of different ML algorithms for the different type of problems.</span></h3>


<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-xf-9_wVJzc0/WUZw8z43-NI/AAAAAAAABlQ/bvC5rZblonUuwBrS36gE7NCikZ2etcu8gCLcBGAs/s1600/ML_problems.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="675" data-original-width="1049" src="https://2.bp.blogspot.com/-xf-9_wVJzc0/WUZw8z43-NI/AAAAAAAABlQ/bvC5rZblonUuwBrS36gE7NCikZ2etcu8gCLcBGAs/s1600/ML_problems.png" /></a></div>
<h2 style="text-align: left;">
Types of solution</h2>
<div style="text-align: left;">
Machine&nbsp;Learning solutions can be broadly classified into three types&nbsp;</div>
<div>
<h3>
<ul style="text-align: left;">
<li>Supervised Learning</li>
<li>Unsupervised Learning</li>
<li>Reinforcement Learning</li>
</ul>
<div>
Supervised Learning<span style="font-weight: normal;"> is a category in which a machine is given training on some labelled data and is informed about the problem that is to be solved.The learnt model then uses its knowledge to solve the future similar problems.In this type of learner, a major requirement is the availability of labelled data.An Example of this kind of problems can be an object identification problem.</span></div>
<div>
<span style="font-weight: normal;">First, a model is trained and told about the different types of objects, and then it is asked to identify the objects.</span></div>
<div>

</div>
<div>
Unsupervised Learning<span style="font-weight: normal;">, on the other hand, is a category in which a learner is not provided with any input i.e labelled data. They use their algorithm and start working with problem and make some sense out of the problem on their own.&nbsp;Initially they may not provide much accuracy but they will eventually learn to provide accurate results.We can think about this learner as a person who went to some foreign country without any prior knowledge of the language spoken there.He learns from his experience how people greet each other, how to say hi etc.</span></div>
<div>
<span style="font-weight: normal;">
</span></div>
<div>
Reinforcement Learning <span style="font-weight: normal;">is a category in which a machine learns by making some predictions and is penalised for making a wrong prediction, due to this penalty machine learns not to make this mistake again.Take an example of a driverless robot that crawls on a road with obstacles, every time it see's an object and bumps into the object, it is penalised for its prediction of not taking appropriate action. Next time robot see's the same kind of obstacle it knows from the past experience and avoids&nbsp;the same mistake again.</span></div>
<div>
<span style="font-weight: normal;">
</span></div>
</h3>
<h2 style="text-align: left;">
<span style="font-weight: normal;">Machine Learning for Classification problem</span></h2>
<div>
<span style="font-weight: normal;">Classification is set of&nbsp;machine&nbsp;learning problems in which an input is classified into different classes which can be either supervised or unsupervised.</span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-bFNOwGlrJLI/WUaVHAfs15I/AAAAAAAABlg/-S2D8WFACOQEmwF9z-DoJYtUHSuUDWtvwCLcBGAs/s1600/classification.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="399" data-original-width="726" src="https://1.bp.blogspot.com/-bFNOwGlrJLI/WUaVHAfs15I/AAAAAAAABlg/-S2D8WFACOQEmwF9z-DoJYtUHSuUDWtvwCLcBGAs/s1600/classification.png" /></a></div>
<div>
</div>
<div>
<span style="font-weight: normal;">Examples of classification problems:</span></div>
<div>
<ul style="text-align: left;">
<li><span style="font-weight: normal;">Sentiment Analysis</span></li>
<li><span style="font-weight: normal;">Product Categorization</span></li>
<li><span style="font-weight: normal;">Binary Classification on reviews(pos, neg) and much more</span></li>
</ul>
<h2 style="text-align: left;">
Movie Review Classification using Naive Bayes Algorithm</h2>
</div>
<div style="text-align: left;">
<span style="font-weight: normal;">I will be using nltk i.e is Natural Language Processing Toolkit available in python and movie review corpus that has labelled data for movie reviews classified as positive and negative.</span>
<span style="font-weight: normal;">
</span> <span style="font-weight: normal;"></span>
<pre style="background-color: lightgrey; border-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.15); line-height: 20px; margin-bottom: 10px; overflow-x: auto; overflow-y: hidden; padding: 9.5px; word-break: break-all; word-wrap: break-word;"><div class="line number1 index0 alt2" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #2b2b2b; direction: ltr; float: none; font-family: monaco, consolas, &quot;bitstream vera sans mono&quot;, &quot;courier new&quot;, courier, monospace; font-size: 16px; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px 1em; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">
<code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">import</code> <code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">nltk.classify.util</code></div>
<div class="line number2 index1 alt1" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #2b2b2b; direction: ltr; float: none; font-family: monaco, consolas, &quot;bitstream vera sans mono&quot;, &quot;courier new&quot;, courier, monospace; font-size: 16px; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px 1em; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">
<code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">from</code> <code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">nltk.classify </code><code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">import</code> <code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">NaiveBayesClassifier</code></div>
<div class="line number3 index2 alt2" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #2b2b2b; direction: ltr; float: none; font-family: monaco, consolas, &quot;bitstream vera sans mono&quot;, &quot;courier new&quot;, courier, monospace; font-size: 16px; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px 1em; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">
<code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">from</code> <code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">nltk.corpus </code><code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">import</code> <code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">movie_reviews</code></div>
<div class="line number5 index4 alt2" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #2b2b2b; direction: ltr; float: none; font-family: monaco, consolas, &quot;bitstream vera sans mono&quot;, &quot;courier new&quot;, courier, monospace; font-size: 16px; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px 1em; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">
</div>
<div class="line number5 index4 alt2" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; direction: ltr; float: none; font-family: monaco, consolas, &quot;bitstream vera sans mono&quot;, &quot;courier new&quot;, courier, monospace; font-size: 16px; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px 1em; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">
<span style="color: #6aa84f;">#word_feats will convert the sentence into features</span></div>
<div class="line number5 index4 alt2" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #2b2b2b; direction: ltr; float: none; font-family: monaco, consolas, &quot;bitstream vera sans mono&quot;, &quot;courier new&quot;, courier, monospace; font-size: 16px; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px 1em; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">
<code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">def</code> <code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">word_feats(words):</code></div>
<div class="line number6 index5 alt1" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #2b2b2b; direction: ltr; float: none; font-family: monaco, consolas, &quot;bitstream vera sans mono&quot;, &quot;courier new&quot;, courier, monospace; font-size: 16px; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px 1em; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">
<code class="python spaces" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">return</code> <code class="python functions" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: deeppink; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">dict</code><code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">([(word, </code><code class="python color1" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: grey; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">True</code><code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">) </code><code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">for</code> <code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">word </code><code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">in</code> <code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">words])</code></div>
<div class="line number7 index6 alt2" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #2b2b2b; direction: ltr; float: none; font-family: monaco, consolas, &quot;bitstream vera sans mono&quot;, &quot;courier new&quot;, courier, monospace; font-size: 16px; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px 1em; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">
</div>
<div class="line number8 index7 alt1" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #2b2b2b; direction: ltr; float: none; font-family: monaco, consolas, &quot;bitstream vera sans mono&quot;, &quot;courier new&quot;, courier, monospace; font-size: 16px; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px 1em; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">
<code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">negids </code><code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">=</code> <code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">movie_reviews.fileids(</code><code class="python string" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: blue; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">'neg'</code><code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">)</code></div>
<div class="line number9 index8 alt2" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #2b2b2b; direction: ltr; float: none; font-family: monaco, consolas, &quot;bitstream vera sans mono&quot;, &quot;courier new&quot;, courier, monospace; font-size: 16px; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px 1em; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">
<code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">posids </code><code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">=</code> <code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">movie_reviews.fileids(</code><code class="python string" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: blue; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">'pos'</code><code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">)</code></div>
<div class="line number9 index8 alt2" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; direction: ltr; float: none; font-family: monaco, consolas, &quot;bitstream vera sans mono&quot;, &quot;courier new&quot;, courier, monospace; font-size: 16px; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px 1em; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">
<code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;"><span style="color: #6aa84f;">
</span></code></div>
<div class="line number10 index9 alt1" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; direction: ltr; float: none; font-family: monaco, consolas, &quot;bitstream vera sans mono&quot;, &quot;courier new&quot;, courier, monospace; font-size: 16px; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px 1em; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">
<span style="color: #6aa84f;">#training data is converted into features</span></div>
<div class="line number11 index10 alt2" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #2b2b2b; direction: ltr; float: none; font-family: monaco, consolas, &quot;bitstream vera sans mono&quot;, &quot;courier new&quot;, courier, monospace; font-size: 16px; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px 1em; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">
<code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">negfeats </code><code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">=</code> <code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">[(word_feats(movie_reviews.words(fileids</code><code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">=</code><code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">[f])), </code><code class="python string" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: blue; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">'neg'</code><code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">) </code><code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">for</code> <code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">f </code><code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">in</code> <code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">negids]</code></div>
<div class="line number12 index11 alt1" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #2b2b2b; direction: ltr; float: none; font-family: monaco, consolas, &quot;bitstream vera sans mono&quot;, &quot;courier new&quot;, courier, monospace; font-size: 16px; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px 1em; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">
<code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">posfeats </code><code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">=</code> <code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">[(word_feats(movie_reviews.words(fileids</code><code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">=</code><code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">[f])), </code><code class="python string" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: blue; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">'pos'</code><code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">) </code><code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">for</code> <code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">f </code><code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">in</code> <code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">posids]</code></div>
<div class="line number13 index12 alt2" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; direction: ltr; float: none; font-family: monaco, consolas, &quot;bitstream vera sans mono&quot;, &quot;courier new&quot;, courier, monospace; font-size: 16px; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px 1em; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">
<span style="color: #6aa84f;">
</span></div>
<div class="line number13 index12 alt2" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; direction: ltr; float: none; font-family: monaco, consolas, &quot;bitstream vera sans mono&quot;, &quot;courier new&quot;, courier, monospace; font-size: 16px; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px 1em; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">
<span style="color: #6aa84f;">#data is divided into training and testing data</span></div>
<div class="line number14 index13 alt1" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #2b2b2b; direction: ltr; float: none; font-family: monaco, consolas, &quot;bitstream vera sans mono&quot;, &quot;courier new&quot;, courier, monospace; font-size: 16px; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px 1em; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">
<code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">negcutoff </code><code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">=</code> <code class="python functions" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: deeppink; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">len</code><code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">(negfeats)</code><code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">*</code><code class="python value" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #009900; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">3</code><code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">/</code><code class="python value" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #009900; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">4</code></div>
<div class="line number15 index14 alt2" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #2b2b2b; direction: ltr; float: none; font-family: monaco, consolas, &quot;bitstream vera sans mono&quot;, &quot;courier new&quot;, courier, monospace; font-size: 16px; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px 1em; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">
<code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">poscutoff </code><code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">=</code> <code class="python functions" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: deeppink; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">len</code><code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">(posfeats)</code><code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">*</code><code class="python value" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #009900; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">3</code><code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">/</code><code class="python value" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #009900; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">4</code></div>
<div class="line number16 index15 alt1" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #2b2b2b; direction: ltr; float: none; font-family: monaco, consolas, &quot;bitstream vera sans mono&quot;, &quot;courier new&quot;, courier, monospace; font-size: 16px; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px 1em; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">
</div>
<div class="line number17 index16 alt2" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #2b2b2b; direction: ltr; float: none; font-family: monaco, consolas, &quot;bitstream vera sans mono&quot;, &quot;courier new&quot;, courier, monospace; font-size: 16px; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px 1em; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">
<code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">trainfeats </code><code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">=</code> <code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">negfeats[:negcutoff] </code><code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">+</code> <code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">posfeats[:poscutoff]</code></div>
<div class="line number18 index17 alt1" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #2b2b2b; direction: ltr; float: none; font-family: monaco, consolas, &quot;bitstream vera sans mono&quot;, &quot;courier new&quot;, courier, monospace; font-size: 16px; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px 1em; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">
<code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">testfeats </code><code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">=</code> <code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">negfeats[negcutoff:] </code><code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">+</code> <code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">posfeats[poscutoff:]</code></div>
<div class="line number19 index18 alt2" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #2b2b2b; direction: ltr; float: none; font-family: monaco, consolas, &quot;bitstream vera sans mono&quot;, &quot;courier new&quot;, courier, monospace; font-size: 16px; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px 1em; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">
<code class="python functions" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: deeppink; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">print</code> <code class="python string" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: blue; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">'train on %d instances, test on %d instances'</code> <code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">%</code> <code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">(</code><code class="python functions" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: deeppink; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">len</code><code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">(trainfeats), </code><code class="python functions" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: deeppink; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">len</code><code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">(testfeats))</code></div>
<div class="line number19 index18 alt2" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; direction: ltr; float: none; font-family: monaco, consolas, &quot;bitstream vera sans mono&quot;, &quot;courier new&quot;, courier, monospace; font-size: 16px; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px 1em; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">
<code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;"><span style="color: #6aa84f;">
</span></code></div>
<div class="line number20 index19 alt1" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; direction: ltr; float: none; font-family: monaco, consolas, &quot;bitstream vera sans mono&quot;, &quot;courier new&quot;, courier, monospace; font-size: 16px; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px 1em; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">
<span style="color: #6aa84f;"><b>#naivebayes classifier used for training on training data</b></span></div>
<div class="line number21 index20 alt2" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #2b2b2b; direction: ltr; float: none; font-family: monaco, consolas, &quot;bitstream vera sans mono&quot;, &quot;courier new&quot;, courier, monospace; font-size: 16px; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px 1em; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">
<code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">classifier </code><code class="python keyword" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #006699; direction: ltr; display: inline; float: none; font-size: 1em; font-weight: bold; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">=</code> <code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">NaiveBayesClassifier.train(trainfeats)</code></div>
<div class="line number22 index21 alt1" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #2b2b2b; direction: ltr; float: none; font-family: monaco, consolas, &quot;bitstream vera sans mono&quot;, &quot;courier new&quot;, courier, monospace; font-size: 16px; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px 1em; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">
<code class="python functions" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: deeppink; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">print</code> <code class="python string" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: blue; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">'accuracy:'</code><code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">, nltk.classify.util.accuracy(classifier, testfeats)</code></div>
<div class="line number23 index22 alt2" style="background-image: none; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; direction: ltr; float: none; font-family: monaco, consolas, &quot;bitstream vera sans mono&quot;, &quot;courier new&quot;, courier, monospace; font-size: 16px; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px 1em; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">
<div style="color: #2b2b2b;">
<code class="python plain" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: black; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">classifier.show_most_informative_features()</code></div>
<code class="python functions" style="background-image: none; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: deeppink; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">print</code><span style="color: #2b2b2b;"> </span><code class="python string" style="background-image: none; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: blue; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">'classified as:'</code><code class="python plain" style="background-image: none; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; direction: ltr; display: inline; float: none; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">,classifier.classify("The plot was good,but the characters were not compelling")</code></div>
</pre>
</div>
<div>
<div class="line number1 index0 alt2" style="background-attachment: initial; background-clip: initial; background-image: none; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 0px; border: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; color: #2b2b2b; direction: ltr; float: none; font-family: monaco, consolas, &quot;bitstream vera sans mono&quot;, &quot;courier new&quot;, courier, monospace; font-size: 16px; font-weight: normal; height: auto; left: auto; line-height: 1.1em; margin: 0px; outline: 0px; overflow: visible; padding: 0px 1em; position: static; right: auto; top: auto; vertical-align: baseline; white-space: pre; width: auto;">

</div>
</div>
</div>
</div>