Repository: piskvorky/gensim

Issue:
sklearn_api.d2vmodel.D2VTransformer uses deprecated arguments size and iter
#### Description
The D2VTransformer in `sklearn_api.d2vmodel` uses the deprecated arguments `size` instead of `vector_size` and `iter` instead of `epochs`. According to the warnings this will be breaking in version 4.0.0.

#### Code to Reproduce
```
from gensim.sklearn_api.d2vmodel import D2VTransformer
from gensim.models.doc2vec import TaggedDocument
d2v = D2VTransformer(size=1, iter=1).fit([TaggedDocument(['a','a','a','a','a'], [0])]) # gives warnings
d2v = D2VTransformer(vector_size=1, epochs=1).fit([TaggedDocument(['a','a','a','a','a'], [0])]) #gives errors
```

#### Resulting warnings and errors:
```
/lib/python3.6/site-packages/gensim/models/doc2vec.py:355: UserWarning: The parameter `iter` is deprecated, will be removed in 4.0.0, use `epochs` instead.
  warnings.warn("The parameter `iter` is deprecated, will be removed in 4.0.0, use `epochs` instead.")
/lib/python3.6/site-packages/gensim/models/doc2vec.py:359: UserWarning: The parameter `size` is deprecated, will be removed in 4.0.0, use `vector_size` instead.
  warnings.warn("The parameter `size` is deprecated, will be removed in 4.0.0, use `vector_size` instead.")
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-108-561949d569bd> in <module>()
      2 from gensim.models.doc2vec import TaggedDocument
      3 d2v = D2VTransformer(size=1, iter=1).fit([TaggedDocument(['a','a','a','a','a'], [0])])
----> 4 d2v = D2VTransformer(vector_size=1, epochs=1).fit([TaggedDocument(['a','a','a','a','a'], [0])])

TypeError: __init__() got an unexpected keyword argument 'vector_size'
```

#### Versions
```
Linux-4.13.0-36-generic-x86_64-with-Ubuntu-17.10-artful
Python 3.6.3 (default, Oct  3 2017, 21:45:48) 
[GCC 7.2.0]
NumPy 1.14.1
SciPy 1.0.0
gensim 3.3.0
FAST_VERSION 1
```



Discussion:
Thanks for the report @swierh, the problem here with wrappers at all (deprecation works in the original model, but we didn't update wrappers)

Need to check wrappers at all (especially d2v, w2v) and add missing arguments.
hey, what's the progress here? Can I take this up?
I think I might have fixed it here: https://github.com/RaRe-Technologies/gensim/pull/1939

It works for me locally, but it seems to fail on a lot of tests, so it would be great if someone else could have a look at it too.

Edit: I think some of the sklearn_api unit tests require updating as well: https://github.com/RaRe-Technologies/gensim/blob/develop/gensim/test/test_sklearn_api.py#L649

Resolving patch:
diff --git a/gensim/sklearn_api/d2vmodel.py b/gensim/sklearn_api/d2vmodel.py
--- a/gensim/sklearn_api/d2vmodel.py
+++ b/gensim/sklearn_api/d2vmodel.py
@@ -72,11 +72,11 @@ def fit(self, X, y=None):
             documents=d2v_sentences, dm_mean=self.dm_mean, dm=self.dm,
             dbow_words=self.dbow_words, dm_concat=self.dm_concat, dm_tag_count=self.dm_tag_count,
             docvecs=self.docvecs, docvecs_mapfile=self.docvecs_mapfile, comment=self.comment,
-            trim_rule=self.trim_rule, size=self.size, alpha=self.alpha, window=self.window,
+            trim_rule=self.trim_rule, vector_size=self.size, alpha=self.alpha, window=self.window,
             min_count=self.min_count, max_vocab_size=self.max_vocab_size, sample=self.sample,
             seed=self.seed, workers=self.workers, min_alpha=self.min_alpha, hs=self.hs,
             negative=self.negative, cbow_mean=self.cbow_mean, hashfxn=self.hashfxn,
-            iter=self.iter, sorted_vocab=self.sorted_vocab, batch_words=self.batch_words
+            epochs=self.iter, sorted_vocab=self.sorted_vocab, batch_words=self.batch_words
         )
         return self
 


Test patch: