How I can do binary classfication using CNN and RNN LSTM - python-3.x

I am new to deep learning and machine learning techniques. I am learning doing some examples in Python and also watching Youtube videos.
Now I am want to do binary classification of two datasets with CNN model and RNN model to compare their performance.
The criteria is: length of data in a column is 16 then it is Class:0 otherwise class:1.
The Datasets image are attached herewith.Class: 1 If plaintext length is 16 otherwise class: 0

Related

Best Keras/TF model output layer for predict a 32 bits output?

I want to train a Keras model with a dataset of X which have a shape of :
(N,128) N (about millions) is the number of samples and 128 is the features (binary value 0 or 1)
y (output) is a normally distributed binary sequence of 32 bits (0 or 1).
What is the best model or/and output layer for this kind of prediction?
I tried MLP, CNN and LSTM seq2seq models, but learning of my data is very difficult (always predict the same output or loss value don't change)...
I think some of my problems is the output layer (I choose a
Dense(32,activation='sigmoid')),
and the losse function is a classical
'binary_crossentropy'
```.

multiclass-segemenratation using pytorch and unet

I am doing landuse classification with 4 classes and as an output from softmax function of unet model i gained output of [8,4,128,128] and my mask image is [8,1,128,128] so to calculate loss I used nn.cross entropy function should i have to make any modification for good results as I find the output of testing image was 4 channels images which are not like mask image.``

Multi input & output CNN

I have the following problem:
Input: a set of 6 images
Output: a probability for each image determining whether the image is the correct one out of the 6 images
I know how to create a CNN with keras, but not how to have multiple images as an input.
How would one solve this problem?
One way I can think of is to use a pre-trained model (VGG16 etc.) and extract out the vectors from some intermediate layer, then concat 6 vectors together then feed it into a neural network (or some other classification model) and train it as a multiclass classification task.
You can also use an Autoencoder and take the anomaly detection approach.

Is there a better approach for personality detection from twitter data?

I have tried different approaches like multinomialNB, SVM, MLPClassifier, CNN as well as LSTM network to train the dataset that consists of tweets and labels (big 5 classes - openness, conscientiousness, extraversion, agreeable, neuroticism). But the accuracy is at around 60% even after using word2vec, NRC features & MRC features. Is there something that I can do to improve the accuracy?
Would you please add few more details about the dataset you are using?
For example I would add:
Dataset size (number of samples)
Classes distribution (are they balanced or not)
Do you do any preprocessing?
Without the above information I would just guess but if I were you would try:
clean the tweets from noise e.g usernames,garbage symbols etc.
If the dataset is small
try random search on models (Naive Bayes ,SVM, Logistic regression) using various vectorizations strategies e.g bag of words, tf-idf and do hyper-parameter search
try applying transfer learning from a model trained on tweets, for example for sentiment analysis.
If the dataset is large enough
try neural network approach
Embedding(Glove, word2vec, fasttext) + RNN(LSTM, GRU) + Attention
try training own embedding
use pretrained ones such as those
Embedding + CNN + RNN
Bag of words + FNN
If classes are not balanced
use weighted loss
try to balance them
try stacking multiple models (ensemble)
Hope it helps!
Is the main premise of your project to do personality detection? If not, I would recommend using the Google Sentiment API to calculate sentiment of Twitter data.

how to make the image_shape dynamic in the convolution in Theano

I tried to process the tweets dataset using CNN in Theano. Different from images, the lenght of different tweets (corresponding to the image shape) is variable. So the shape of each tweet is different. However, in Theano, the convolution need that the shape information are constant values. So my question is that is there some way to make the image_shape dynamic?
Kalchbrenner et. al (2015) implemented an CNN that accepts dynamic length input and pools them into k elements. If there are less than k elements to begin with, the remaining are zero-padded. Their experiments with sentence classification show that such networks successfully represent grammatical structures.
For details check out:
the paper (http://arxiv.org/pdf/1404.2188v1.pdf)
Matlab code (link on page 2 of the paper)
suggestion for DCNNs for Theano/Keras (https://github.com/fchollet/keras/issues/373)
Convolutional neural networks are really better suited to processing images.
For processing tweets, you might want to read about recursive neural networks.
http://nlp.stanford.edu/~socherr/EMNLP2013_RNTN.pdf

Resources