Print predicted column content for Naive Bayes
<pre><code>import warnings
from sklearn.naive_bayes import GaussianNB  
import numpy as np
import csv

    with open('/home/kk/Neha/demo1.csv', 'rb') as csvfile:
        lines = csv.reader(csvfile)
    for row in lines:
        print ', '.join(row)
    x = dataset[:,0:1]
    y = dataset[:,1]  
        model = GaussianNB()
    model.fit(x, y)
    predicted= model.predict([43])
    DeprecationWarning("ignore")
        print predicted
</code></pre>

<p>now i want to print the predicted value as a content which ever y is containing.</p>

<p>i am getting index value as 1,2,3,4,5</p>

<p>but i want the value.</p>

<p>you need a map//list of the index to the associated values, and then </p>

<pre><code>print "\n".join([index_to_value for marg_pred to predictions])
</code></pre>

python algorithm classification