Train text classification model using vectors.tsv and metadata.tsv

Open
#1,148 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
20/100
Issue type
Documentation
Clarity
Needs clarification
Activity status
Stale
Tech stack
python, tensorflow

Research direction

Start with the Keras pretrained word embeddings guide linked in the issue and inspect how vectors.tsv and metadata.tsv are generated. Determine whether those files are intended as inputs for an embedding layer and document the required conversion and vocabulary mapping. Done means a clear guide or example shows how to use these files for text classification.

Written by the indexing model from the issue text.

Description

Hi,

I have trained a text classification model that uses pre-trained word embeddings as per this guide https://keras.io/examples/nlp/pretrained_word_embeddings/

Next, I would like to take use the vectors.tsv and metadata.tsv generated by your code, to train a new text classification model.

The Keras guide in the link above has the following code:
from tensorflow.keras.layers import Embedding embedding_layer = Embedding( num_tokens, embedding_dim, embeddings_initializer=keras.initializers.Constant(**embedding_matrix**), trainable=False, )

I think the vectors.tsv file needs to be coverted into an array of floats to be used as embeddings_initializer. But I'm not sure what else needs to be done.

Do you have an additional guide on how to train text classification model using a new word embedding?

Dominant language
C++
Stars
1.3k
Forks
379
Avg merge
3h 30m
Merged PRs (30d)
8

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tensorflow/text

All issues in tensorflow/text

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.