Skip to main content
Share Your Experience: Take the 2024 Developer Survey
104 votes

Training an RNN with examples of different lengths in Keras

This suggests that all the training examples have a fixed sequence length, namely timesteps. That is not quite correct, since that dimension can be ...
kbrose's user avatar
  • 1,932
59 votes
Accepted

What is the advantage of keeping batch size a power of 2?

This is a problem of alignment of the virtual processors (VP) onto the physical processors (PP) of the GPU. Since the number of PP is often a power of 2, using a number of VP different from a power of ...
jcm69's user avatar
  • 706
42 votes

Why is it wrong to train and test a model on the same dataset?

Yes, you put it quite correctly. As a teacher, you wouldn’t give your students an exam that’s got the exact same exercises you have provided as homework: you want to find out whether they (a) have ...
hH1sG0n3's user avatar
  • 2,058
40 votes

Should a model be re-trained if new observations are available?

When new observations are available, there are three ways to retrain your model: Online: each time a new observation is available, you use this single data point to further train your model (e.g. ...
tombarti's user avatar
  • 501
37 votes

In the context of Deep Learning, what is training warmup steps

As the other answers already state: Warmup steps are just a few updates with low learning rate before / at the beginning of training. After this warmup, you use the regular learning rate (schedule) to ...
Mr Tsjolder from codidact's user avatar
33 votes
Accepted

Should a model be re-trained if new observations are available?

Once a model is trained and you get new data which can be used for training, you can load the previous model and train onto it. For example, you can save your model as a ...
Hima Varsha's user avatar
  • 2,346
33 votes

Is it always better to use the whole dataset to train the final model?

A point that needs to be emphasized about statistical machine learning is that there are no guarantees. When you estimate performance using a held-out set, that is just an estimate. Estimates can be ...
D.W.'s user avatar
  • 3,371
31 votes
Accepted

In the context of Deep Learning, what is training warmup steps

This usually means that you use a very low learning rate for a set number of training steps (warmup steps). After your warmup steps you use your "regular" learning rate or learning rate scheduler. You ...
Ron Schwessinger's user avatar
24 votes
Accepted

Train, test split of unbalanced dataset classification

Best way is to collect more data, if you can. Sampling should always be done on train dataset. If you are using python, scikit-learn has some really cool packages to help you with this. Random ...
aathiraks's user avatar
  • 704
23 votes

Is it always better to use the whole dataset to train the final model?

I personally haven't seen that for products going into production, but understand the logic. Theoretically, the more data your deployed model has seen, the better is should generalise. So if you ...
n1k31t4's user avatar
  • 14.9k
21 votes

What would I prefer - an over-fitted model or a less accurate model?

There are a couple of nuances here. Complexity question very important - ocams razor CV - is this trully the case 84%/83% (test it for train+test with CV) Given this, personal opinion: Second one. ...
Noah Weber's user avatar
  • 5,679
19 votes

Is it always better to use the whole dataset to train the final model?

Once you have obtained optimal hyperparamters for your model, after training and cross validating etc., in theory it is ok to train the model on the entire dataset to deploy to production. This will, ...
PyRsquared's user avatar
  • 1,604
15 votes

What would I prefer - an over-fitted model or a less accurate model?

It depends mostly on the problem context. If predictive performance is all you care about, and you believe the test set to be representative of future unseen data, then the first model is better. (...
Ben Reiniger's user avatar
  • 11.9k
14 votes

Is stratified sampling necessary (random forest, Python)?

If the number of values belonging to each class are unbalanced, using stratified sampling is a good thing. You are basically asking the model to take the training and test set such that the class ...
Kiritee Gak's user avatar
  • 1,799
13 votes

Why is it wrong to train and test a model on the same dataset?

It is wrong because: it is fundamentally incorrect (a theoretical concern) it leads to bad results (a practical concern) It is fundamentally incorrect because usually the objective of testing a ...
loopbackbee's user avatar
12 votes

Training an RNN with examples of different lengths in Keras

@kbrose seems to have a better solution I suppose the obvious thing to do would be to find the max length of any sequence in the training set and zero pad it. This is usually a good solution. ...
aneesh joshi's user avatar
12 votes

Oversampling/Undersampling only train set only or both train and validation set

Oversample the train data and NOT the validation data since if train data is unbalanced, your test data will most likely show the same trait and be unbalanced. If you don't know if test data will be ...
Rishabh Sharma's user avatar
12 votes
Accepted

Understanding how convolutional layers work

What are the filters? A filter/kernel is a set of learnable weights which are learned using the backpropagation algorithm. You can think of each filter as storing a single template/pattern. When you ...
Akshay Sehgal's user avatar
11 votes
Accepted

Meaning of stratify parameter

stratify parameter will preserve the proportion of target as in original dataset, in the train and test datasets as well. So if your original dataset ...
karthiks's user avatar
  • 342
9 votes
Accepted

Tool to label images for classification

I just hacked together a very basic helper in python it requires that all images are stored in a pyton list allImages. ...
jlarsch's user avatar
  • 401
9 votes
Accepted

How to train data by batch from disk?

As you are working on image classification and would also like to implement some data augmentation, you can combine the two AND load the batches directly from a folder using the mighty '...
n1k31t4's user avatar
  • 14.9k
9 votes
Accepted

May the training set and validation set overlap?

Definitions, so we are on the same page: Training set: the data points used to train the model. Validation set: the data points to keep checking the performance of your model in order to know when to ...
Bruno Lubascher's user avatar
9 votes

What would I prefer - an over-fitted model or a less accurate model?

The first has an accuracy of 100% on training set and 84% on test set. Clearly over-fitted. Maybe not. It's true that 100% training accuracy is usually a strong indicator of overfitting, but it's ...
Ray's user avatar
  • 191
8 votes

How to deal with large training data?

I do something similar with keras and GPU training, where i also have only a small memory amount available. The idea would be split the numpy files into smaller ones, let's say 64 samples per file and ...
hh32's user avatar
  • 2,762
8 votes
Accepted

What knowledge do I need in order to write a simple AI program to play a game?

There are multiple ways to approach solving game playing problems. Some games can be solved by search algorithms for example. This works well for card and board games up to some level of complexity. ...
Neil Slater's user avatar
8 votes
Accepted

Train object detection without annotated data/bounding boxes

Yes, there are models that do this. This link points to one of the first papers I believe. The main idea is called weakly supervised object detection. The paper essentially makes three modifications. ...
Leonard Strnad's user avatar
8 votes

99% validation accuracy but 0% prediction results (UNET Architecture)

There is no "mismatch" of accuracy. Your problem is that you have an image segmentation problem where 99% of the pixels should be zero. So getting 99% accuracy is trivially easy. A model that predicts ...
Neil Slater's user avatar
8 votes
Accepted

Number of features of the model must match the input. Model n_features is `N` and input n_features is `X`.

You are supposed to pass numpy arrays and not lists as arguments to the DecisionTree, since your input was a list it gets ...
tenshi's user avatar
  • 626
8 votes
Accepted

Does increasing kernel size in a CNN result in higher accuracy on the training set?

I'd say there is no direct relation between the kernel size and the accuracy. If you start using larger kernel you may start loosing details in some smaller features (where 3x3 would detect them ...
stan0's user avatar
  • 216
8 votes

Why is it wrong to train and test a model on the same dataset?

It can happen that the model you train learns "too much" or memorizes the training data, and then it performs poorly on unseen data. This is called "overfitting". The problem of ...
noe's user avatar
  • 26.9k

Only top scored, non community-wiki answers of a minimum length are eligible