New answers tagged

1

How to add more class to trained model without complete training for other classes: Transfer Learning Twice Continual learning approaches Regularization Expansion Rehearsal


1

It looks like your indices for the predicted data are off by one. You could try to fix it with predicted = predicted[1:]


0

One solution I found was saving the model in HD5 format. That seems to bypass the serialization of the regularizer: vae.save("./VAE.h5") You can also try saving the weights only: vae.save_weights("./VAE-weights")


1

From Keras docs: https://keras.io/api/layers/core_layers/dense/ Input shape N-D tensor with shape: (batch_size, ..., input_dim). The most common situation would be a 2D input with shape (batch_size, input_dim). Output shape N-D tensor with shape: (batch_size, ..., units). For instance, for a 2D input with shape (batch_size, input_dim), the output would have ...


0

I had a similar error and was extremely puzzled ValueError: Shapes (32,) and (3, 3, 32, 64) are incompatible I eventually figured out that I had modified the trainable attribute of the model. (I was doing transfer learning for the final few layers, and then switching to training the full model.) @Supratim's suggestion of checking the summary was what tipped ...


1

There is no "Right" answer to this question , but you should take in mind the following guidelines: Embedding layer is a compression of the input, when the layer is smaller , you compress more and lose more data. When the layer is bigger you compress less and potentially overfit your input dataset to this layer making it useless. The larger ...


0

You can forecast using spatio-temporal data by combining Graph Convolution Networks with LSTM models! The idea comes from a paper by Zhao et al. called "T-GCN: A Temporal Graph Convolutional Network for Traffic Prediction" (https://ieeexplore.ieee.org/document/8809901), and is implemented in the StellarGraph module in Python (https://stellargraph....


2

Here are the docs for the Model.compile method. The loss parameter is the objective function whereas the metrics parameter is a "list of metrics to be evaluated by the model during training and testing". So your second interpretation is correct.


0

A couple of papers have been published showing – and conventional wisdom in 2020 seems to still be persuaded— that, as Yann LeCun put, large batches are bad for your health. Two relevant papers are Revisiting Small Batch Training For Deep Neural Networks, Dominic Masters and Carlo Luschi which implies that anything over 32 may degrade training in SGD. and ...


1

build is called by the __call__ function which is implemented in the parent Layer class. From the TF docs: https://www.tensorflow.org/api_docs/python/tf/keras/layers/Layer "build(self, input_shape): This method can be used to create weights that depend on the shape(s) of the input(s), using add_weight(). __call__() will automatically build the layer (if ...


2

Your input is not standardized The learning rate is way too high, start with the Default i.e. 0.001 Other suggested changes - Use "relu" in the hidden/input layer OHE the target If the target is multi-class, the output layer should have same number of Neurons with softmax as activation Data points are very less, Neural Net might not be the best ...


0

I faced a similar problem and the quick solution I came up with was iterate through the main data set, create an instance of TimeseriesGenerator for each of the subsets and feed it to the model. So in your case that would be: go through the collection of articles, instantiate TimeseriesGenerator for each article and feed the windowed samples to your model, ...


0

Considering your model recevie an image as input and has two outputs age and gender, and that you have generated a TFRecord with them. You can decode and use your TFRecord through tf.data this way: decode_features = { 'image' : tf.io.FixedLenFeature([], tf.string), 'age' : tf.io.FixedLenFeature([1], tf.int64), 'gender' : tf.io.FixedLenFeature([1], ...


0

model = LSTM(100, return_sequences=True, input_shape(timesteps, n_features)) model = LSTM(50, return_sequences=True)(model) ... Documenntation says: this LSTM implementation defaultly has activation="tanh", recurrent_activation="sigmoid", So you should select another activation function if you want a different one.


0

Check out the docs on TensorFlow GPU usage If you wanted data parallelism where you run a copy of your model on multiple GPUs and split the data between them, you could use the tf.distribute.MirroredStrategy. The tf.distribute.Strategy docs are also a good source to read. Also, you should also profile your application; adding a second GPU has the potential ...


1

As far as I'm aware, deep learning on hypergraphs is still a relatively new area, so I don't think there's any ready-made solution for hypergraphs. I did find this repo, which implements some models in keras to accompany a recent paper on hypergraph learning, but it is hardly a library. You may also check out this paper, which cites a pair of techniques for ...


1

You can do it creating a custom training function. I have created a whole set of TensorFlow 2 tutorials about it. It's simpler than it looks like. This is the code of some generic training function: import tensorflow as tf # This loss and optimizer are just examples, use the one you need loss = tf.keras.losses.MeanSquaredError() optimizer = tf.keras....


Top 50 recent answers are included