|
-
November 25th, 2009, 03:12 PM
#5
Re: Using an undefined class?
I was missing '#include "Ganglion.h" ' like VladamirF had said. Thanks guys.... I feel more noobish then ever LOL. This has been quite the brain fart on my part.
 Originally Posted by Kheun
There's nothing wrong in writing neutral network code in OOP....
True true... I was thinking (and agreeing with this individual that said) avoiding the overhead of objects by using arrays instead would produce faster code. Of course I don't have a super understanding of what happens underneath the hood during compilation. I do know virtual functions add overhead.... as for the rest I'm not sure. Perhaps he was referring to calling one function to act on one array instead of calling essentially the same function x times where x = number of neurons.
Not a big deal for small networks but I want to try some things based on what my flat panel is displaying at any given time so that's 1280*800*3 nodes in the input layer alone!!! That said I like OOP just because it separates each unit and it's easier for me to see how things are working.
 Originally Posted by Russco
The use of the keyword class in the attach declaration is superfluous.
memset should be avoided as a way to initialise class types. You might get away with it here but its not recommended at all. Use the constructor initialiser list to set each member to zero or its default value. memset can only be used on POD types.
Never bring a whole namespace into the global namespace in a header file. In headers explicitly qualify where needed.
The 'class' was there in my attempts to get it working. It wasn't there originally.
I like using memset on structures. Perhaps it's a bad habit developed because I didn't want to type. It works okay as long as the class doesn't have any virtual functions anywhere (methods, part of attributes, parent classes, etc). Perhaps I should convert it to a struct so the possibility of mistakes down the road are smaller. When I code I usually find my structs contain only POD types.
I'm pretty new to namespaces and their best practices. I just wanted a way to group all the activation functions together.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|