Skip to content

Commit

Permalink
document similarity notebook: Remove unneeded imports, fix set_option…
Browse files Browse the repository at this point in the history
… call, remove unneeded list construction
  • Loading branch information
dwvisser committed Jun 20, 2024
1 parent 59c876a commit 329a2bb
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions examples/text/20newsgroups-document_similarity_scorer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
"%reload_ext autoreload\n",
"%autoreload 2\n",
"%matplotlib inline\n",
"import os\n",
"import numpy as np\n",
"import pandas as pd\n",
"pd.set_option('display.max_colwidth', -1)"
"pd.set_option('display.max_colwidth', None)"
]
},
{
Expand Down Expand Up @@ -402,7 +400,7 @@
"source": [
"# display results in Pandas dataframe\n",
"other_preds = [int(score > 0) for score in other_scores]\n",
"data = sorted(list(zip(other_preds, other_scores, other_texts)), key=lambda item:item[1], reverse=True)\n",
"data = sorted(zip(other_preds, other_scores, other_texts), key=lambda item:item[1], reverse=True)\n",
"print('Top Inliers (or Most Similar to Our Technology-Related Topics')\n",
"print('\\t\\tNumber of Predicted Inliners: %s' % sum(other_preds))\n",
"df = pd.DataFrame(data, columns=['Prediction', 'Score', 'Text'])\n",
Expand Down Expand Up @@ -841,7 +839,7 @@
"\n",
"# display results in Pandas dataframe\n",
"other_preds = [int(score > 0) for score in other_scores]\n",
"data = sorted(list(zip(other_preds, other_scores, other_texts)), key=lambda item:item[1], reverse=True)\n",
"data = sorted(zip(other_preds, other_scores, other_texts), key=lambda item:item[1], reverse=True)\n",
"print('Top Inliers (or Most Similar to Our Technology-Related Topics')\n",
"print('\\t\\tNumber of Predicted Inliners: %s' % sum(other_preds))\n",
"df = pd.DataFrame(data, columns=['Prediction', 'Score', 'Text'])\n",
Expand Down

0 comments on commit 329a2bb

Please sign in to comment.