• Advertisement
Sign in to follow this  

c++ class design help

This topic is 4586 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I need to have 3 classes, 'InputLayer', 'HiddenLayer', 'OutputLayer' all inheriting from the same 'Layer' class. But my problem is the overlapping of variables required by each class. eg InputLayer -weights, outputs, learningRate HiddenLayer -weights, outputs, learningRate, inputs, biases OutputLayer -outputs, inputs, biases I thought that I should be inheriting weights, outputs, learning rate for the input and hidden layer classes, but then the hidden and output layer classes have outputs, biases, inputs in common, how should I be inheriting the variables? should I be using the virtual call or something in front of some of these variables? Thanks

Share this post


Link to post
Share on other sites
Advertisement
To determine what variables are contained in each class, you must first decide on what the public member functions of each class will be and what they will do on each of the classes. Once you know what you want to do, it's an easy matter to decide how to do it (including private helper functions and member variables).

From the outlooks of your problem, though, I would create OutputSublayer (weights, learningRate) and InputSublayer ( inputs, biases) types.

InputLayer contains a generic data-collection system that plugs data into an OutputSublayer.

HiddenLayer contains an InputSublayer that plugs data into an OutputSublayer.

OutputLayer contains an InputSublayer that plugs data into a generic data-display system.

Or, if you prefer, your layer system will look like this:

[(Data-Collection)=>(OutputSubLayer)]==>[(InputSubLayer)=>(OutputSubLayer)]==>...==>[(InputSublayer)=>(Data-Display)]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement