How to add code lines when calling a function depending on an iterator on Python

I am trying to test many ML models using keras.models.Sequential. My idea is that once I have an iterator that looks like [num_layers, num_units_per_layers], for example [(1, 64),(2, (64,128))], to …

Neural Network loss is significantly changing for same set of weights – Keras

model = keras.Sequential([ layers.Dense(10, activation = ‘relu’, weights=[zero_weights, zero_bias]), layers.Dense(24, activation = ‘relu’, weights=[one_weights, one_bias]), layers.Dense(12, …

Can a neural network accept an object (i.e. not numerical nor string) as an input? [closed]

I need to build a neural network accepting data from a particular .csv file where most columns’ type is object, i.e. they are neither numerical nor string. My question is: can a neural network accept …

How to add an attention layer to LSTM autoencoder built as sequential keras model in python?

So I want to build an autoencoder model for sequence data. I have started to build a sequential keras model in python and now I want to add an attention layer in the middle, but have no idea how to …

Tensor Flow Conv1D for binary classification CNN

I’m creating a Conv1D layer in a CNN for binary classification, and I’m quite new to Machine Learning and I need some help to figure out the correct values for Conv1D: tf.keras.layers.Conv1D( …

AttributeError: ‘numpy.ndarray’ object has no attribute ‘self’

I started implementing the backend of neural network but got stuck in a code of python. The below is the code for neural Network. While i was making use of the userdefined class in one of the application to be made, i got an error by name attributeError. Please help me out solving it. I tried all the indentation syntax but nothing works. The Below is the error log which was popped as soon as i run used the defined class in a classification problem. Answer According to the Neural Network Back-end theory, the error must be multiplied to the

validation accuracy not improving

No matter how many epochs I use or change learning rate, my validation accuracy only remains in 50’s. Im using 1 dropout layer right now and if I use 2 dropout layers, my max train accuracy is 40% with 59% validation accuracy. And currently with 1 dropout layer, here’s my results: Again max, it can reach is 59%. Here’s the graph obtained: No matter how much changes I make, the validation accuracy reaches max 59%. Here’s my code: Im very confused why only my training accuracy is updating, not the validation accuracy. Here’s the model summary: Answer The size of

In Keras, can I use an arbitrary algorithm as a loss function for a network?

I has been trying to understand this machine learning problem for many days now and it really confuses me, I need some help. I am trying to train a neural network whose input is an image, and which generates another image as output (it is not a very large image, it is 8×8 pixels). And I have an arbitrary fancy_algorithm() “black box” function that receives the input and prediction of the network (the two images) and outputs a float number that tells how good the output of the network was (calculates a loss). My problem is that I want to

PyTorch DataLoader shuffle

I did an experiment and I did not get the result I was expecting. For the first part, I am using trainloader =, batch_size=128, …

Neural Network Results always the same

Edit: For anyone interested. I made it slight better. I used L2 regularizer=0.0001, I added two more dense layers with 3 and 5 nodes with no activation functions. Added doupout=0.1 for the 2nd and 3rd GRU layers.Reduced batch size to 1000 and also set loss function to mae Important note: I discovered that my TEST dataframe wwas extremely small compared to the train one and that is the main Reason it gave me very bad results. I have a GRU model which has 12 features as inputs and I’m trying to predict output power. I really do not understand though