Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

vivekpadia70 vivekpadia70

🏠
Working from home
Block or report user

Report or block vivekpadia70

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View imdb_lstm.py
history = model.fit(padded_train, train_label, epochs=4, validation_data=(padded_test, test_label))
View imdb_lstm.py
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
View imdb_lstm.py
model = tf.keras.Sequential()
model.add(tf.keras.layers.Embedding(13000, 16, input_length=max_len_text))
model.add(tf.keras.layers.Bidirectional(tf.keras.layers.LSTM(64, dropout=0.2)))
model.add(tf.keras.layers.Dense(1, activation='sigmoid'))
model.summary()
View imdb_lstm.py
padded_train = pad_sequences(train_data, maxlen=max_len_text)
padded_test = pad_sequences(test_data, maxlen=max_len_text)
View imdb_lstm.py
train_data = np.array(vector)[:train_set]
train_label = (np.array(df['sentiment'])[:train_set])
test_data = np.array(vector)[train_set:]
test_label = (np.array(df['sentiment'])[train_set:])
View imdb_lstm.py
tokenizer = Tokenizer(num_words=10000)
tokenizer.fit_on_texts(df['review'])
vector = tokenizer.texts_to_sequences(df['review'])
View imdb_lstm.py
df = pd.read_csv("/home/aubergine/Downloads/imdb-dataset-of-50k-movie-reviews/IMDB Dataset.csv")
train_set = 45000
max_len_text = 2000
df['sentiment'] = df['sentiment'].replace('positive', 1)
df['sentiment'] = df['sentiment'].replace('negative', 0)
View imdb_lstm.py
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow.keras.preprocessing.text import Tokenizer
from keras.utils import to_categorical
from tensorflow.keras.preprocessing.sequence import pad_sequences
View malaria_cell_CNN.py
model.fit(x_train,Y_train,batch_size=50,epochs=20,verbose=2)
View malaria_cell_CNN.py
model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
You can’t perform that action at this time.