Created
June 24, 2019 06:22
-
-
Save ayushoriginal/8a9e08405dcb012c1272392c6488fac2 to your computer and use it in GitHub Desktop.
CNN
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def CNN(self): | |
model = Sequential() | |
model.add(Embedding(self.vocab_length, 30, input_length=self.max_len)) # Max Length of Tweet | |
model.add(Convolution1D(64,5,activation="relu")) | |
model.add(Dropout(0.5)) | |
model.add(Convolution1D(32,3,activation="relu")) | |
model.add(Dropout(0.5)) | |
model.add(Convolution1D(16,3,activation="sigmoid")) | |
model.add(MaxPooling1D(5)) | |
model.add(Flatten()) | |
model.add(Dense(self.tr_labels.shape[1],activation='softmax')) | |
model.compile(loss='categorical_crossentropy', optimizer='adam',metrics=['accuracy']) | |
model.summary() | |
self.model = model |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment