## Python Neural Networks – Tensorflow 2.0 Tutorial – Text Classification P1

This python neural network tutorial introduces the idea of text classification using a neural network and tensorflow 2.0. We will create a fairly simple model that is capable of classifying movie reviews as either positive or negative!

Text-Based Tutorial: https://techwithtim.net/tutorials/python-neural-networks/text-classification-p1/

◾◾◾◾◾
💻 Enroll in The Fundamentals of Programming w/ Python
https://tech-with-tim.teachable.com/p

📸 Instagram: https://www.instagram.com/tech_with_tim
🌎 Website https://techwithtim.net
⭐ Discord: https://discord.gg/pr2k55t
📂 GitHub: https://github.com/techwithtim
🔊 Podcast: https://anchor.fm/tech-with-tim

💵 One-Time Donations: https://www.paypal.com/donate/?token=
💰 Patreon: https://www.patreon.com/techwithtim
◾◾◾◾◾◾

⚡ Please leave a LIKE and SUBSCRIBE for more content! ⚡

Tags:
– Tech With Tim
– Python Neural Networks
– Neural Network Turtorials
– Text Classification Neural Network
– Text Classification tensorflow
– Python Tutorials

Source

### Comment List

• Tech With Tim
November 20, 2020

Sorry for the abrupt ending… Next video will be out tmrw and cover the architecture of the network and talk about what the heck an embedding layer is?! Hope you all enjoy 🙂

• Tech With Tim
November 20, 2020

why v+3? if i don't add 3, print decode seems meaningless. i think digit 1 in array train_data[0] respectively key of 1 in imdb.get_word_index()

• Tech With Tim
November 20, 2020

What does the line {k:(v+3) for …} do?

• Tech With Tim
November 20, 2020

what is the point in the keys unk and unused, their assigned values previusly had keys that did make sense… im guessing that its some kind of standar? if the algorithm dont find a key then returns the key with the value 2?

• Tech With Tim
November 20, 2020

Great work, Tim. Loving your tutorial videos.

If anyone hits this error "TypeError: unhashable type: 'list'" just change this line:

return " ".join([reverse_word_index.get(i, "?") for i in text])

to this:

return " ".join(list(reverse_word_index.get(i, "?") for i in text))

• Tech With Tim
November 20, 2020

in the 4th part when you bumped up the num_words to 88000 you say it would increase our vocab but according to your explanation here there will be lesser words as there will be lesser words that are frequent 88000 times

• Tech With Tim
November 20, 2020

Could someone explain me what this line does ? I'm not very familair with Python "word_index = {k:(v+3) for k, v in word_index.items()}"
Thanks

• Tech With Tim
November 20, 2020

if anyone can help: """UserWarning: h5py is running against HDF5 1.10.5 when it was built against 1.10.4, this may cause problems

'{0}.{1}.{2}'.format(*version.hdf5_built_version_tuple)"""

• Tech With Tim
November 20, 2020
• Tech With Tim
November 20, 2020

Hai! I actually have a doubt on how to change words to numbers

• Tech With Tim
November 20, 2020

If anyone having the error "ValueError: Object arrays cannot be loaded when allow_pickle=False", here is the solution

• Tech With Tim
November 20, 2020

Why do you use Sublime rather then Pycharm or Jupyters Notebook?

• Tech With Tim
November 20, 2020

I really like your tutorials, but I am taking too much time to convert the version 2.0.0-alpha you used to actual 2.0.0. I think many things have changes in this video since then. Maybe it is worth considering an update =D

• Tech With Tim
November 20, 2020

Haha anyone else had a voice in their head screaming "OMG imdb is going to be undefined" the whole time until Tim finds out? 😀 Perfect lessons otherwise though! Love it!

• Tech With Tim
November 20, 2020

Love your videos. But word_index is indeed type dict. tuple has no method items.

• Tech With Tim
November 20, 2020

You earned yourself a subscribe sir.

• Tech With Tim
November 20, 2020

good explanation man

• Tech With Tim
November 20, 2020

Hi, I made everything like you said, but I have this error message:

Traceback (most recent call last):
File "/Users/timco/Desktop/Neural Networks/TextClassification/code.py", line 7, in <module>
(train_data, train_labels), (test_data, test_labels) = data.load_data(num_words=10000)
File "/Users/timco/anaconda3/envs/test1/lib/python3.6/site-packages/tensorflow/python/keras/datasets/imdb.py", line 86, in load_data
x_train, labels_train = f['x_train'], f['y_train']
File "/Users/timco/anaconda3/envs/test1/lib/python3.6/site-packages/numpy/lib/npyio.py", line 262, in _getitem_
pickle_kwargs=self.pickle_kwargs)
File "/Users/timco/anaconda3/envs/test1/lib/python3.6/site-packages/numpy/lib/format.py", line 696, in read_array
raise ValueError("Object arrays cannot be loaded when "
ValueError: Object arrays cannot be loaded when allow_pickle=False

• Tech With Tim
November 20, 2020

thanks.

• Tech With Tim
November 20, 2020

I get a "URL fetch failure error… [SSL: CERTIFICATE_VERSION_FAILED ]", can someone help me out

• Tech With Tim
November 20, 2020

Hello, Why there is no Flatten Layer out there? What if we add Flatten Layer?

• Tech With Tim
November 20, 2020

Where exactly is 1 -> Start added to the review so that the reverse output starts with Start. Same question for Unknown. We only define it at the beginning but why does it appear in a review?

• Tech With Tim
November 20, 2020

Tim, as always, thank you for doing these videos. Keeup up the great work.

Quick question about importing. I have seen you do this many times but did not quite understand it. Why do you import a package or a module, and then you import something specific from that module right after it?

For instance, in this video you imported tensorflow then followed it by importing keras from tensorflow. Wouldn't the first line import keras as well? I mean I would understand it if the second line was something like from tensorflow import keras as ks.

• Tech With Tim
November 20, 2020

please continue with you're opengl seres

• Tech With Tim
November 20, 2020

Bro i m new to this…can you tell me what all library should i know properly to apply machine learning…and how to make algorithms

• Tech With Tim
November 20, 2020

always instantly adding your videos to my playlist so I can come home and start coding!