Commit 0e68f99e authored by Tags's avatar Tags

Method Cross validation

parent 5dd6300d
......@@ -329,10 +329,8 @@ def cross_validation():
sql = " SELECT tag_id FROM wp_esi_tag_news WHERE news_id =" + str(id_news)
results = tags_classif.db.query(sql)
tags_in_article = {tag for (tag, ) in tags_classif.db.store_result().fetch_row(maxrows=0)}
print(rez_accordance, tags_in_article,len(rez_accordance & tags_in_article))
tags_in_article = {int(tag) for (tag, ) in tags_classif.db.store_result().fetch_row(maxrows=0)}
if len(rez_accordance & tags_in_article) != 0:
total_score += 1
else:
print("\n#", str(i))
......@@ -341,7 +339,7 @@ def cross_validation():
print(set(rez_accordance))
print("User classified tags for news:", set(tags_in_article))
print("\n\nThe Model was tasted on ", len(news_results), " news. ")
print(" The total result is:", total_score / len(news_results))
print("The total result is:", total_score / len(news_results))
# exit(0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment