1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | import tensorflow as tf import keras import numpy as np from keras.datasets import imdb (train_data, train_labels), (test_data, test_labels) = imdb.load_data(num_words=10000) #print("train_data[0] : ") #print(train_data[0]) print(max([max(sequence) for sequence in train_data])) word_index = imdb.get_word_index() reverse_word_index = dict([value, key] for(key, value) in word_index.items()) decoded_review = ''.join([reverse_word_index.get(i-3, '?') for i in train_data[0]]) print(decoded_review) def vectorize_sequences(sequences, dimension=10000): results = np.zeros((len(sequences), dimension)) for i, sequence in enumerate(sequences): results[i, sequence] = 1. return results x_train = vectorize_sequences(train_data) x_test = vectorize_sequences(test_data) print(x_train) |
Labels
Programming
(16)
Algorithm
(15)
Java
(15)
ASP .NET
(4)
Enterprise Architecture
(4)
PHP and MySQL
(4)
Software Engineering
(2)
C#
(1)
Data Mining
(1)
Deep Learning
(1)
Java Script
(1)
Python
(1)
Thursday, January 16, 2020
Binary Classifiation
Binary Classification
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment