-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shogun base classes #2880
Comments
Could also add another layer that provides all the sg_* fields |
We would have to use multiple inheritance, it could be PITA you know :) |
Why multiple inheritance? That's not my idea. If the base classes are a hierarchy, one could just inherit from a certain stage in there? |
I did add SGReferencedData (or so) at some point that did exactly that. On Wed, 2015-08-05 at 01:43 -0700, Heiko Strathmann wrote:
|
Thats very similar, but for the SGMatrix, SGVector classes. |
What about this:
Where the first one contains only the reference counting, the second adds the parameters/serialisation, and the third adds all the Shogun stuff |
checkout and look at src/shogun/base/SGRefObject.h On Wed, 2015-08-05 at 04:12 -0700, Heiko Strathmann wrote:
|
@karlnapf okay this works. Though we don't really know whether referenced is always serializable or serializable is always referenced :) |
I see now. This is good enough for @yorkerlin s patch. Thanks I did not know |
The idea makes sense to me, and I like it because it would separate in each of the classes Heiko has mentioned above reference counting, serialisation, and rest of Shogun stuff (although I am not sure what this rest would be :-) I am not entirely sure however how much overhead it would reduce. What overhead are we talking about? SWIG or memory footprint per SGObject? Another (very) wild idea somewhat related would be to use smart pointers as they are now part of the default C++ compiler. Then we could get rid of our own reference counting. |
yeah smart pointers would be best. @lisitsyn what s your take on all this?
|
@sonney2k why was the SGRefObject removed? |
Do not remember. Git logs say that Thorsten removed it. "Obsolete ". On August 10, 2015 11:30:21 PM GMT+02:00, Heiko Strathmann notifications@github.com wrote:
Sent from Kaiten Mail. Please excuse my brevity. |
The class was removed during the last summit when we were reducing SWIG overhead, in terms of memory used to compile or, equivalently, the size of the (huge) file SWIG creates. Before it was removed, it looked like this SGRefObject -> CSGObject, and all the classes were inheriting from CSGObject, not from SGRefObject. Although it should be possible to use SGRefOject for what you have mentioned above, it was not used like that. It was just pulling out the reference counting logic from CSGObject. Thoralf removed it to reduce the number of classes (by one, in this case) that are exposed via SWIG. |
I like the principle, although it is not really clear for me what to remove.
I think it should stay as long as we are rare ML library with this feature.
I believe it should be done via shared pointers. |
I dont get the point of removing the class. We could just hide it from SWIG?
|
This is the pr where it was merged #1771. |
@lisitsyn The existing framework only supports:
I want the framework supports In future, I may have to extend the framework in the following ways:
|
Hi @yorkerlin . If we in fact happen to rewrite SGObject, probably quite a few things would change. @lisitsyn proposed having a I am unaware of variational parameters ATM. If they are expected to be optimized differently, maybe we can have a separate class for them and provide its functionality accordingly. |
@lambday For batch inference,
For stochastic inference,We can update
For stochastic inference, variaitonal parameters can be viewed as model parameters. |
ref |
@yorkerlin from the requirements, going by policy based design for the parameters sound reasonable to me, where the policies are different optimization policies. So laying down the requirements
[1] http://www.gotw.ca/publications/mill04.htm |
Thanks @yorkerlin for tagging the related issues. |
Shall we add another one in the layer
CSGObject
that just allows for reference counting and all the basic Shogun stuff.CSerializableObject
that adds all the parameter stuff and inherits from the first?I guess this could minimize Shoguns overhead quite a bit (many classes dont use parameters)
@yorkerlin @lisitsyn @sonney2k @vigsterkr @lambday @iglesias @tklein23 @besser82 what are your thoughts?
The text was updated successfully, but these errors were encountered: