Comments (12)
What's happening here is that you're probably also shuffling the batches of your test set iterator (batch_iterator_test
). When you run net.predict() it'll also use an iterator to go over the samples, so in your case they'll come out in this random order.
from nolearn.
Daniel
I am unaware of batch_iterator_test. Like I said I only changed those three lines in BatchIterator. And I am not sure I understand what you mean. Why would that cause extremely bad test performance when the validation errors are less. Why would the prediction have dependency on the order of the batches ?
from nolearn.
@run2 So if you're running the version that doesn't have batch_iterator_test
(which was added three weeks ago), then put a if self.test
around your shuffling logic, so it won't shuffle if it's in test mode.
Why would the prediction depend on the order of the batches? Because that order defines the order of predictions on the way out. So imagine you want to predict for values A, B, and C. After your batch iterator's shuffle (assume batch size of 1), the predictions might come out as b, c, and a. If this doesn't make sense, then I suggest you take a closer look at the predict_proba method.
from nolearn.
Ah! I see. Very interesting. Thanks - let me try that out.
from nolearn.
Wow! That makes a big difference now. Much much better prediction results. You might want to try out what I did and see if that gives you much faster learning and lower val errors. It will be great if you can let me know.
from nolearn.
I am closing this issue but waiting to hear from you.
from nolearn.
I think this is a fine idea. FTR, here's some code that I use in another project:
def shuffle(*arrays):
p = np.random.permutation(len(arrays[0]))
return [array[p] for array in arrays]
class ShufflingBatchIteratorMixin(object):
def __iter__(self):
self.X, self.y = shuffle(self.X, self.y)
for res in super(ShufflingBatchIteratorMixin, self).__iter__():
yield res
from nolearn.
@dnouri For the reasons listed here: #36, there are limitations to this approach.
from nolearn.
@cancan101 Not sure I get it. Is nn.enc_
relevant for shuffling?
from nolearn.
I am using is not for shuffling, but rather for subsampling one of the classes.
from nolearn.
So you suggest #36 as an alternative to the code in #13, is that right?
from nolearn.
Ah, yes, #36 instead of #13 (specifically cancan101@00c2ce9). In looking at your code above, I think that is a much cleaner solution and doesn't require the change in #13 and subclassing of NeuralNet
. I would be happy to use change/ subclass the Iterator but currently I do need a reference to the NeuralNet
.
from nolearn.
Related Issues (20)
- RememberBestWeights does not honor the verbose parameter HOT 2
- A replayable fit() method - diff/patch attached HOT 1
- remove('trainable') Lasagne's command doesn't work in nolearn HOT 6
- flip_filters and pad parameter not used by NeuralNet's class HOT 5
- OSError: could not read bytes when trying to fetch mldata HOT 2
- CUDA error, possibly related to network size? HOT 2
- Trained on GPU, inference on CPU doesn't make sense
- Install nolearn with Lasagne dependance not working HOT 2
- Bug in calculating average scores
- nolearn is not installing
- Bug when using Lasagne `mask_input` parameter
- 'NeuralNet' object has no attribute 'layers_' HOT 1
- Weights sum up to zero
- Future issue with sklearn.cross_validation
- Dependency on both backends in requirements.txt switches off GPU support HOT 3
- Enable to reproduce the last value of trainning when predicting CNN
- enable to reproduce loss value of training when predicting CNN HOT 1
- python 3 support not working with Lasagne? HOT 12
- TypeError: Failed to instantiate <class 'lasagne.layers.pool.MaxPool2DLayer'> with args {'name': 'pool1', 'ds': (2, 2), 'incoming': <lasagne.layers.conv.Conv2DLayer object at 0x7ff765fa29e8>}. Maybe parameter names have changed?
- nolearn now on conda-forge HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nolearn.