I need to pass a list containing five values from python script to html page.I ran a loop and passed the value one by one to html page.But it is printing only the last value in the browser.My html code is in the format:
<html>
<head></head>
<body>
<p>{{value}}</p>
</body>
</html>
Actually I am calculating probability for each class labels using predict_proba(a) using Decision tree.I took out the index having max probability and using that index I took out the top five class labels.I want to render those top labels to my html page. My python script is following:
Here variable 'a' is the set on input and variable 'event' contains all the distinct class labels.
DTC= DecisionTreeClassifier()
DTC.fit(X_train,y_train)
DTC.predict(pandas.DataFrame([a]))
res=DTC.predict_proba([a])
new=list(chain.from_iterable(res))
index=sorted(range(len(new)), key=lambda i: new[i], reverse=True)[
value=[]
for i in index:
value.append(event[i])
return render_template('output.html',value=value)