Registered Member
|
Hi all. This is my first post, so feel free to ignore if it doesn't make sense.
I wrote some neural network code with Eigen. I used MatrixXd for storing dataset and weights of network. After about 2 minutes of training, it can classify mnist dataset with accuracy of 90 percent. The problem is, if I replace MatrixXd with MatrixXf and VectorXd with VectorXf, it takes more than 10 minutes two achieve 90 percent accuracy. Is this just due to the difference between double and float? Here is my code https://gist.github.com/1972897 I use ubuntu and g++ v4.6. Compiler option is -O2 and -msse2. Please tell me if you need further information. Thanks, masa |
Moderator
|
hm, I did not check your code but this could be explained by some inappropriate threshold factors and/or overflows when using floats.
|
Registered Member
|
Hi ggael. Thank you for your reply.
I divided each image pixel value by 255 so that every value lies in the range [0.0, 1.0]. Then everything works fine. What's more, it is much faster than MatrixXd version. I don't know why raw integer pixel value causes a problem, but sometimes exp() takes very small value and I guess this may be causing underflow. Thanks, masa |
Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]