Comments (6)
My $2-e2: stick with the sklearn model because it generalizes gracefully to multi-dimensional examples. It's annoying to be inconsistent with the literature, but it does make for simpler code.
from lasagne.
Ah I see, because when data points are n-dimensional, we would have to repeat :
for each dimension to retrieve the first data point (e.g. A[:, :, 0]
for 2-d) in my representation, right? As opposed to A[0]
regardless of the number of dimensions.
from lasagne.
Exactly. In memory, it makes sense to have the data index be the least-frequently varying index, so that data for one example is contiguous in memory.
It also generalizes better to ragged data, so that A could actually be a list (not an ndarray), and each A[i] can be a $whatever.
from lasagne.
OK, that's convincing enough.
from lasagne.
Another reason is that it's pretty much the theano default (for the softmax function for example).
Cuda-convnet unfortunately puts the batch size last, but I have some ideas about how to deal with that (also talked to @f0k about it). I'll try to get that done soon.
By the way, you can technically do A[..., 0] to always get example 0 if the batch size is last :) It's not a very commonly used feature though.
from lasagne.
+1 for data points in rows!
To elaborate on one of the arguments, as @bmcfee said, memory layout is an important point. Fortran and Matlab use column-major layout, so it makes sense to have data vectors as columns. C and numpy use row-major layout by default, so it makes sense to have data vectors as rows -- you will waste a lot of performance due to frequent cache misses when putting data vectors in columns in numpy, unless you take special care to keep your matrices in column-major layout throughout your code. (Always assuming that you mostly want to iterate over the data points, not over the features.)
On the GPU, things look a little different again... leaning towards Fortran, cuBLAS assumes column-major layout, but Theano prefers to have matrices in row-major layout and just tells cuBLAS to transpose matrices as needed (every BLAS function involving matrices takes a flag for each matrix argument specifying whether it's to be transposed).
from lasagne.
Related Issues (20)
- ThinPlateSpline is bugged, proposed fix HOT 2
- Update Lasagne installation doc to new gpuarray backend HOT 3
- AttributeError: 'Conv2DLayer' object has no attribute 'flip_filters' HOT 1
- Theano discontinuation HOT 5
- Where is the GlobalMaxPool2D?? HOT 1
- How to save layer l_out as lasagne layer to network in json or h5 format to be imported from Matlab HOT 1
- how to get the exact value of the tensor variable and its type. HOT 2
- The tremendous different time consuming on mnist between cnn and mlp architecture. HOT 6
- How to put constraint on the weights in each layer. HOT 1
- How to put the constraint on parameters
- AttributeError: 'Conv2DLayer' object has no attribute 'num_groups' HOT 2
- Why the `bcast` is needed in `create_param()`? HOT 2
- rules in setting weights in the combination of conv2d layer and batch norm layer HOT 1
- updates.py HOT 2
- Hi! There are some problems about creating a new layer! HOT 1
- lasagne\layers\base.py HOT 1
- LocallyConnected2DLayer params not initialized correctly HOT 1
- Center Loss as an Objective Function?
- Error with mock in Python 3.8.3 and 3.9 HOT 3
- lasagne isn't running on CUDA (Windows 10) .theanorc setup HOT 2
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 lasagne.