# Tag Info

## New answers tagged tensorflow

2

You only need such a projection if you are using only dense layers for your model (i.e. a multilayer perception (MLP)). You can simply have a convolutional autoencoder, where the layers are convolutions and max pooling, and therefore the number of parameters is drastically reduced with respect to an MLP. You can check Keras' tutorial on autoencoders, ...

1

It’s not wrong. NN training is inherently stochastic. As an optimisation problem, the tuning of a NN depends on the initialisation (initialisation of the weights). So the result (the local minimum you end up in) depends on the initialisation too. There are mainly two ways to go : if this is not a problem for your use case (if only the global performance ...

1

There's nothing "wrong" with your model or code. Your model is just trained using a stochastic method. Meaning that your model will converge on the optimal values in a different way each time.

0

You can frame your problem as reinforcement learning (RL). Reinforcement learning (RL) is sequential decision-making under uncertainty. "The value of the loss" could be framed as maximizing rewards. The output is the sequence that maximizes reward for n-steps ahead. The "triangular' array of arrays" is the history. Reinforcement learning (...

0

it seems like scaling my data helped. I refer to the following thread on GitHub: https://github.com/keras-team/keras/issues/1727

0

Not sure what it meant -> rather than using [CLS] token for classification? The Authoer did use [CLS] for classification tasks. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding The first token of every sequence is always a special classification token ([CLS]). The final hidden state corresponding to this token is used as ...

0

The computational graph is created for the complex function. So, all the steps are just elementary steps. For example - Below function -. $\hspace{5cm}$ Becomes - $\hspace{4cm}$Image Credit - leonardoaraujosantos.gitbook.io/artificial-inteligence/ For further knowledge - Hands-on ML by Aurelien Geron - Appendix-D Wikipedia Automatic differentiation

0

It is very common to use sklearn for cross validation. The most known methods are KFold and cross_val_score imported from sklearn.model_selection. You can then use tf.keras.wrappers.scikit_learn.KerasClassifier to implement the scikit-learn classifier with Keras model.

0

There are several reasons for that. Try increasing your training dataset or begin with smaller initial learning rate.

0

There are many options to spend this up: Get a better CPU. Distribute the process across a cluster since each document is independent. Reduce the size of the vocabulary. If only the top-n most popular words are used, it greats reduces the size of the data. Reduce the size of the embedding space. Switch to doc2vec so the document themselves are a learned ...

0

The CLS token helps with the NSP task on which BERT is trained (apart from MLM). The authors found it convenient to create a new hidden state at the start of a sentence, rather than taking the sentence average or other types of pooling. However this does not mean that the BERT authors recommend using the CLS token as a sentence embedding. It 'could' be used ...

0

Try to change your data augmentation techniques , ssd_random_crop is making the problem I believe. Try using the one below: data_augmentation_options { random_horizontal_flip { } } data_augmentation_options { random_rotation90 { } } data_augmentation_options { random_rgb_to_gray { } } ...

0

LSTM (and GRUs, and Recurrent Neural Networks more generally) predict the next item $x_n$ in a sequence X of items $[x_1, ..., x_{n-1}]$, as you mentionned. However, you can combine them with a feed forward network (as simple as a perceptron), either as a separate layer or a new network, to take the prediction at each set (the $x_i$) and from this $x_i$ ...

0

I had the same problem and I couldn't understand why they were different. The problem is that the ProgbarLogger prints an average of the values (loss, regularization loss, other metrics), which are the values shown in the stdout like this: 45/1 - 0s - loss: 1.2592 - mae: 0.7602 While the values inside the History for the fit, or the scalar or list of ...

1

If you're getting 95% accuracy on training set, but only 75% on test set, this points to serious overfitting, which none of the measures you've listed are likely to address. It's also suspicious that validation result are so close to training, but far from test. This often happens when you change validation set during training, meaning there's effectively no ...

2

A possible cause of the problem is that you are using the mean-squared error (MSE) as loss function for a classification problem. Normally, for classification you would use categorical cross-entropy.

2

I suggest to apply a nonrandom weight initialisation in order to see the impact of random initialization. For instance, you can use the Nguyen-Widrow weight initialization. def initnw(layer): """ Nguyen-Widrow initialization function :Parameters: layer: core.Layer object Initialization layer """ ci = layer.ci cn = ...

0

You seem to believe that early stopping involves some type of comparison between the training & validation loss, which (belief) in turn leads you to incorrect and invalid paths. But this is not the case. Consider the documentation of early stopping in Tensorflow Keras: Stop training when a monitored metric has stopped improving. tf.keras.callbacks....

0

The thing about neural networks is that they are uninterpretable. I bet there might be some techniques that tackle this issue. You can try google scholar for that. But yeah, neural networks are basically black boxes. You can extract the convolutional filters and see the results of each layer on the image, but you will just come up with ,,When this shape is ...

0

As defined in the Keras documentation: "Approximates the AUC (Area under the curve) of the ROC or PR curves", it gives you the option to get the Area Under the Curve for both ROC curve or Precission-Recall curve (specially useful for highly unbalanced datasets). The choice of your desired curve can be done vía the 'curve' parameter below: tf.keras....

0

Problem solved. It was a dumb and silly mistake after all. I was being naive - maybe I need to sleep, I don't know. The problem was just the last layer of the network: model.add(tf.keras.layers.Dense(10, activation = 'softmax')) It was supposed to be model.add(tf.keras.layers.Dense(num_classes, activation = 'softmax')) I could not build a network with an ...

-1

I haven't used tensorflow much lately (more of a pytorch guy), but my interpretation of that error is that your X tensor has two dimensions and your y tensor only has 1, so it's not clear which dimension of X is supposed to align with y. Try adding an empty dimension to your labels and see if that fixes the issue: train_1d_y = tf.expand_dims(train_1d_y, 1)

1

You can not feed your network with two inputs with different number of samples, and this also does not make sense. You have 2 inputs with shape (502,) and (1002,) (You have said you want to extract features also from your second dataset). Let's consider the batch size is 1 for the sake of simplicity. So the model takes one sample each time to move it through ...

0

Adding this bit of info for people around.. Tensorflow can be now activated on Intel-gpus as well.. For this, just create a new environment on anaconda , and do pip install intel-tensorflow Now, when the needed libararies are installed, we can do sanity test by a sample program. import tensorflow as tf import os def get_mkl_enabled_flag(): mkl_enabled =...

0

Fine-tuning, consists of unfreezing the entire model you obtained (or part of it), and re-training it on the new data with a very low learning rate. This can potentially achieve meaningful improvements, by incrementally adapting the pre-trained features to the new data. So, simply it means, you can not retrain these models (unfreeze layers), but of course ...

0

Another way of doing this is to use CHITRA. It can rescale your bounding box automatically based on the new image size.(chitra uses imgaug internally) image = Chitra(img_path, box, label) image.resize_image_with_bbox((224, 224)) print('rescaled bbox:', image.bounding_boxes) plt.imshow(image.draw_boxes()) https://chitra.readthedocs.io/en/latest/ pip ...

0

The predict function in Keras expects batches of inputs. If your input is a single text, you need to add an axis at the beginning of the tensor.

Top 50 recent answers are included