I’m working in a multi-label image classification problem in Keras and I am doing data augmentation to increase the amount of images. The labels are imbalanced and they are one hot encoded ([0 1 0 0 1] [0 0 0 1 1], etc) So I thought that maybe it could be balanced with class_weights or ..
The following code works without the attention thing, however when I add it as seen below I get the following error: 61 62 decoder1 = layers.Reshape(target_shape=(4,512))(decoder1) —> 63 attention = layers.Attention()([encoder,decoder1])(decoder1) 64 attention = layers.Concatenate()([encoder, decoder1])(attention) 65 TypeError: ‘KerasTensor’ object is not callable The code: encoder = layers.Reshape(target_shape=(4,512))(encoder) decoder1 = layers.LSTM(2048)(encoder) decoder1 = layers.Reshape(target_shape=(4,512))(decoder1) attention ..
So as the title says, if I the following Python code on Spyder my machine freezes on the first epoch. What happens is: RAM usage goes to ~94%, after a while Spyder spits out a problem window but I get no error message in the console. The code just freezes. I am doing this with ..
I’m new to Tensorflow and Python and I have been following this tutorial, specifically along Titanic section. However, the data I was using was data of XYZ position of 20 joints captured from Kinect. I have saved my model with model.save but when I tried to load the model, I got the following error: ValueError ..
I have a question on how to load models weight if the .h5 file is inside the zip file. I am intended to load my machine learning model without extracting the zip file. I have a zip file called ‘model.zip’ now, and inside has ‘model.json’ and ‘model.h5’ I first use the below method to call ..
I have a multidimensional input (None, 8, 105) I need to access the value – i[-1:][-1:][:1] and make comparisons between y_py_actual, y_predicted and input_tensor This is more or less what I got, but the function doesn’t work def custon_loss(self, input_tensor): def loss(y_actual, y_predicted): i = input_tensor[-1:][:1] mse = K.mean(K.sum(K.square(y_actual – y_predicted))) return K.switch((K.greater(i, y_predicted) & ..
I am trying to do a stock market price forecasting using LSTM. Now, for univariate it is fairly straightforward but my issue come when I have to do it multivariate inputs. My dataset is below: It has 5 features and I split it into the following sets: x_train = (2147, 10, 5) y_train = (2147,) ..
The aim is to run a Semantic analysis using BERT. I checked most Q/As here but could not find an answer to my question. Data is in a dataframe. Training data is: id review name label 1 it is a great product for turning lights on. Ashley 1 2 plays music and have a good ..
I came across this code for BERT sentiment analysis where the unused layers are removed, Update trainable vars/trainable weights are added and I am looking for a documentation which shows what are the different layers in bert, how can we remove the unused layers, add weights etc. However, I am unable to find any documentation ..
I want to do SGD linear regression with tf.GradientTape() for the following data: from sklearn.datasets import make_regression from sklearn.linear_model import LinearRegression np.random.seed(42) x, y = make_regression(1000, 1, bias=10.0, noise=30.0) y = y/y.std() plt.scatter(x, y) lr = LinearRegression() lr.fit(x, y) a, b = lr.coef_, lr.intercept_ print("Bias:", b, "Coef:", a) y_true = b + a * x ..