def first_expansion(self):
        """ Training linear regression model for the first time."""

        # Read pre-trained word embedding h5 file
        logging.info("Loading pretrained word embeddings")
        pretrained_embeddings = h5py.File(self.pretrained_emb)
        pretrained_embedding_matrix = pretrained_embeddings["embedding"].value
        pretrain_vocab = pretrained_embeddings["words_flatten"].value.split(
            "\n"
        )
        pretrain_word2id = {
            word: ind for ind, word in enumerate(pretrain_vocab)
        }

        # Set up training data for vocabulary expansion
        model_train = []
        pretrain_train = []

        for word in pretrain_word2id:
            if word in self.word2id:
                model_train.append(
                    self.model_embedding_matrix[self.word2id[word]]
                )
                pretrain_train.append(
                    pretrained_embedding_matrix[pretrain_word2id[word]]
                )

        logging.info("Training vocab expansion on model")
        lreg = LinearRegression()
        lreg.fit(pretrain_train, model_train)
        self.lreg = lreg
        self.pretrain_word2id = pretrain_word2id
        self.pretrained_embedding_matrix = pretrained_embedding_matrix
 Training linear regression model for the first time.
utils_nlp/models/gensen/gensen.py