Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
In a data frame with 1000 texts, after doing preprocessing lemmatization, how can I find out how many words have been lemmatized in each text?
Why did you run your model for just 3 epochs? I would suggest you to run it for about 20 epochs, and then see if the validation accuracy is not reducing. And the thing, I can tell you is that You need to change your this line of code:
model.add(Embedding(300000,60,input_length=300))
To this:
model.add(Embedding(k, 60,input_length=300))
Where you can set k as 256 or 512 or a number close to them. But 300000 would be just too much. By that, your network would focus more on the embedding layer, when the main job is of encoder and decoder.
Another thing, you should increase your LSTM units (maybe to a number like 128 or 256) in both encoder and decoder, and remove the recurrent_dropout parameter (since, you are dropping out using the dropout layer after encoder). If that still doesn't help then you can even add Batch Normalization layers to your model.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
I try to use Keras library in python. Definitely this example https://www.tensorflow.org/tutorials/keras/classification.
What is best loss,hyper parameters and optimizer for this example?
You can look up any standard example such as MNIST classification for reference.
Usually for classification cross entropy loss is used. The optimizer is subjective and depends on the problem. SGD and Adam are common.
For LR you can start with 10^(-3) and keep reducing if the validation loss doesn't decrease after a certain number of iterations.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have an excel file with 1000 different values, I am trying to train my artificial intelligence with these values. While the Test Size is 0.33, artificial intelligence should be trained with 670 values, but only 21 values are trained. What is the source of the problem?
You probably mean a number of batches trained using fit. Every batch comprises 32 items by default
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I'm trying to build a deep-learning model in Keras. In this model, I want to insert some copies of a "pre-trained unit". This unit corresponds to a Keras model model_1, whose parameters I optimazed at an earlier stage.
Now I want to properly define model_2 (to train) such that it includes some copies of model_1. The final layout of model_2 will be something like this, where each box contains a copy of model_1
and the red connections correspond to parameters extracted from pre-training.
Thus, the weights and biases associated with the red connections are known numbers.
I want to train model_2 by keeping fixed these parameters and optimizing the other parameters (i.e. weights and biases associated with the black connections).
I have not found any similar example in literature. Is it possible to realize such a Neural Network architecture by using Keras? How can I properly define model_2?
Of course, I can manually extract the pre-trained parameters par (as a numpy.array) from model_1 and put them into model_2, by using something like model_2.set_weights(par). The problem is that I have very large numbers of neurons/parameters. This means that Python is unable to allocate memory for a numpy.array of such dimensions.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I am using pytorch and need to implement this as a part of a neural network. Is there a particular way to code the layers shown in purple (s
def forward(self, images: torch.Tensor) -> torch.Tensor:
x= self.fc1(x)
return x
Combining all my comments into the answer.
To split the output vector from the first layer, which has a shape [batch_size, 4608], you can use torch.split function as follows
batch = torch.zeros((10, 4608))
sub_batch_1, sub_batch_2 = torch.split(batch, 2304, dim=1)
print(sub_batch_1.shape, sub_batch_2.shape)
This code results in two tensors
(torch.Size([10, 2304]), torch.Size([10, 2304]))
I am not sure about MAX logic you need. If it is about getting the maximum element in a given position from two tensors obtained during split, then torch.maximum function can be used to do so.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am using an autoencoder,Is that okey if reconstructed image are like this because the input image has lost a lot of quality
reconstructed image
what should i do to have an image that looks more like the input because ,i will use the output image for face recognition.
should i edit epochs,batch size ..?.
One of the go-to ways to improve performance is to change the learning rate. You can do this by creating your own optimizer with a different learning rate. The RMSProp optimizer defaults to a learning rate of 0.001. If your images are in [0, 1] then I suggest trying a higher learning rate, maybe 0.1. If they are in [0, 255], maybe 0.0001. Experiment!
Another issue might be that you have too many max pooling layers in the encoder, decimating spatial information. When I use max pooling, I try to keep it at less than 1 pooling layer per 2 convolutional layers. You could replace the max pooling with stride 2 convolutions.