New answers tagged

0

Deep Learning models try to learn different unique properties of a class from training samples. With enough training samples the model learns which feature corresponds to which class. So without any training samples, there is no chance that a model will learn to classify to that class. But you can use pretrained models that requires little to no training ...


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, ...


0

The biggest difference is the scikit-learn version are meant to work with scikit-learn Estimator API. Other deep learning models might not be consistent with that API. If you try to instantiate the class, it will not work. It is better to use the options designed for the ecosystem. When doing hyperparameter optimization in scikit-learn, use that packages ...


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.


1

LSTM and AutoML might be unnecessarily complex to find patterns of integers. More established options are: Kolmogorov Complexity Deterministic finite automaton Markov chains


0

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


1

One solution is to think of the 0s and 1s as characters (or words if you like), thus the problem becomes predicting the next letter given previous text. This is exactly what this Keras example is about. You can experiment with some parameters settings (e.g. # of dimensions of the LSTM) to find the sweet spot. I am not familiar with ML.NET nor how it ...


0

You should select a model based on GridSearchCV result. You should not select based on the test dataset score. Selecting model based on test score lowers the chance the model with generalize to unseen data. Test datasets should only be looked at once. For the specific cases, you list, case 1 has the highest GridSearchCV result and that is the better model. ...


2

I don't see why not- it's the loss you wish to minimize. I'm using the following as my loss function and it works well when sMAPE is my metric for prediction accuracy. import tensorflow.keras.backend as K def smape_loss(y_true, y_pred): epsilon = 0.1 summ = K.maximum(K.abs(y_true) + K.abs(y_pred) + epsilon, 0.5 + epsilon) smape = K.abs(y_pred - ...


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

Your model is overfitting to the training data. You are adding more data to training data but the model is overfitting to that additional data. To reduce overfitting, you need to increase regularization. Common options: Keep adding data to the training dataset until you cover all possible scenarios. Add data augmentation. Increase dropout.


0

You can use a pre-trained ResNet as you mentioned, and then fine tune it as part of an encoder in a Siamese network architecture. You don't need to update the weights after all combinations, you can use mini batches. This works quite well! Good luck!


0

In my experience the most common cause for NaN loss is when a validation batch contains 0 instances. It's possible that you have some calculation based for example on averaging loss over several time stamps, but one of the time stamps has 0 instances causing a cascade of NaN values. Check carefully your validation set and how the loss is calculated on it.


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 ...


0

Are you using some data augmentation with random crops / rotations / zooms ? If you do, you might have some images with only background labels and if so I would suggest you to add a condition to only retain the patches with a ratio of non-background pixels above a certain threshold value.


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

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 ...


0

Dataset flower_photos.tgz label count daisy 633 dandelion 898 roses 641 sunflowers 699 tulips 799 Count the number of images in different categories import numpy as np import tensorflow as tf directory = 'flower_photos' datagen = tf.keras.preprocessing.image.ImageDataGenerator() data = datagen.flow_from_directory(directory) unique = np.unique(data....


0

Just a small correction from the accepted answer , the input shape indices are named as follows: (n_images, x_shape, y_shape, channels)


0

if y_hat>=0: weight = K.sigmoid(error100)+1 cond = _verify_tf_condition(cond, 'if statement') verify_tf_condition '; {}'.format(tag, cond, extra_hint)) ValueError: condition of if statement expected to be tf.bool scalar, got Tensor* If we observe the above logs (trimmed), We are assuming y_hat to be a scaler. Hence the code will work for batch_size=1 and ...


0

Binarization might not be possible in Keras. In TensorFlow, it can be by tensorflow.clip_by_value(x, 0.0, 1.0) Papers With Code website has many implementations of the Binarized Neural Networks paper.


0

There is not a lot information to go on. One possibility is that you are the old PIL package. You should switch to the newer Pillow package.


-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

A Gaussian Mixture Model can be seen as a generalization of k-means, with soft (probabilistic) cluster assignments rather than hard ones. It can be, and often is, used in a one-class setting. It allows for multiple Gaussian components and for non-spherical shapes of clusters, which can be an advantage with many datasets. But if one restricts to single ...


Top 50 recent answers are included