Project - How to Build a Sentiment Classifier using Python and IMDB Reviews

3 / 11

Loading the Dataset

First, we will load the original IMDb reviews, as text (byte strings), using TensorFlow Datasets.

  • import tensorflow_datasets as tfds.

    import << your code comes here >> as  << your code comes here >>
  • Use load function of tfds.

    • Pass "imdb_reviews" as argument.

    • Set as_supervised=True and with_info=True.

      datasets, info = tfds.<< your code comes here >>("imdb_reviews", as_supervised=True, with_info=True)
  • Use dataset.keys() to see the keys of datasets.

  • Let us see the size of the train data and test data.

    train_size = info.splits["train"].num_examples
    test_size = info.splits["test"].num_examples
    print(train_size , test_size)
Get Hint See Answer

Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...