Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate Deprecated exception when using Word2Vec.load_word2vec_format #1165

Merged
merged 6 commits into from
Feb 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 22 additions & 55 deletions docs/notebooks/WMD_tutorial.ipynb

Large diffs are not rendered by default.

78 changes: 27 additions & 51 deletions docs/notebooks/Word2Vec_FastText_Comparison.ipynb

Large diffs are not rendered by default.

92 changes: 31 additions & 61 deletions docs/notebooks/Wordrank_comparisons.ipynb

Large diffs are not rendered by default.

90 changes: 28 additions & 62 deletions docs/notebooks/deepir.ipynb

Large diffs are not rendered by default.

94 changes: 27 additions & 67 deletions docs/notebooks/doc2vec-IMDB.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"import locale\n",
Expand Down Expand Up @@ -120,9 +118,7 @@
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"import os.path\n",
Expand All @@ -139,9 +135,7 @@
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -202,9 +196,7 @@
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -254,9 +246,7 @@
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"from gensim.test.test_doc2vec import ConcatenatedDoc2Vec\n",
Expand All @@ -281,9 +271,7 @@
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
Expand Down Expand Up @@ -330,7 +318,7 @@
" corrects = sum(np.rint(test_predictions) == [doc.sentiment for doc in test_data])\n",
" errors = len(test_predictions) - corrects\n",
" error_rate = float(errors) / len(test_predictions)\n",
" return (error_rate, errors, len(test_predictions), predictor)\n"
" return (error_rate, errors, len(test_predictions), predictor)"
]
},
{
Expand All @@ -356,9 +344,7 @@
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"from collections import defaultdict\n",
Expand All @@ -368,9 +354,7 @@
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -579,9 +563,7 @@
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -630,9 +612,7 @@
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -673,9 +653,7 @@
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -703,7 +681,7 @@
"print(u'TARGET (%d): «%s»\\n' % (doc_id, ' '.join(alldocs[doc_id].words)))\n",
"print(u'SIMILAR/DISSIMILAR DOCS PER MODEL %s:\\n' % model)\n",
"for label, index in [('MOST', 0), ('MEDIAN', len(sims)//2), ('LEAST', len(sims) - 1)]:\n",
" print(u'%s %s: «%s»\\n' % (label, sims[index], ' '.join(alldocs[sims[index][0]].words)))\n"
" print(u'%s %s: «%s»\\n' % (label, sims[index], ' '.join(alldocs[sims[index][0]].words)))"
]
},
{
Expand All @@ -723,9 +701,7 @@
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"word_models = simple_models[:]"
Expand All @@ -734,9 +710,7 @@
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -806,14 +780,10 @@
"('mockumentary', 0.5149033069610596),<br>\n",
"('camp-fest', 0.5122634768486023),<br>\n",
"('mystery/comedy', 0.5020694732666016)]</td></tr></table>"
],
"text/plain": [
"<IPython.core.display.HTML at 0x1535b84d0>"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result",
"metadata": {}
}
],
"source": [
Expand Down Expand Up @@ -855,9 +825,7 @@
{
"cell_type": "code",
"execution_count": 26,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -897,12 +865,10 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"This cell left intentionally erroneous. "
"This cell left intentionally erroneous."
]
},
{
Expand All @@ -915,13 +881,11 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"from gensim.models import Word2Vec\n",
"w2v_g100b = Word2Vec.load_word2vec_format('GoogleNews-vectors-negative300.bin.gz', binary=True)\n",
"from gensim.models import KeyedVectors\n",
"w2v_g100b = KeyedVectors.load_word2vec_format('GoogleNews-vectors-negative300.bin.gz', binary=True)\n",
"w2v_g100b.compact_name = 'w2v_g100b'\n",
"word_models.append(w2v_g100b)"
]
Expand All @@ -936,9 +900,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"import logging\n",
Expand All @@ -957,9 +919,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"%load_ext autoreload\n",
Expand All @@ -976,7 +936,7 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
"version": 3.0
},
"file_extension": ".py",
"mimetype": "text/x-python",
Expand All @@ -988,4 +948,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}
Loading