# Buggy code
def fit(self, X, y=None):
    """
    Fit the model according to the given training data.
    Calls gensim.models.Doc2Vec
    """
    if isinstance(X[0], doc2vec.TaggedDocument):
        d2v_sentences = X
    else:
        d2v_sentences = [
            doc2vec.TaggedDocument(words, [i]) for i, words in enumerate(X)
        ]
    self.gensim_model = models.Doc2Vec(
        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,
        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,
    )
    return self


# Traceback (TypeError)
/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'

# Fixed code
def fit(self, X, y=None):
    """
    Fit the model according to the given training data.
    Calls gensim.models.Doc2Vec
    """
    if isinstance(X[0], doc2vec.TaggedDocument):
        d2v_sentences = X
    else:
        d2v_sentences = [
            doc2vec.TaggedDocument(words, [i]) for i, words in enumerate(X)
        ]
    self.gensim_model = models.Doc2Vec(
        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,
        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,
        epochs=self.iter,
        sorted_vocab=self.sorted_vocab,
        batch_words=self.batch_words,
    )
    return self