Skip to content
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

Packaging all the featurizers within a single library #1

Open
pierrelux opened this issue Feb 12, 2016 · 6 comments
Open

Packaging all the featurizers within a single library #1

pierrelux opened this issue Feb 12, 2016 · 6 comments

Comments

@pierrelux
Copy link

In order to avoid code duplication, it might be useful if you could package all of you existing featurizers within a single library.

For the moment, I copied all of the following files within the source directory of the Python wrapper that I wrote:

$ ls src/
Background.cpp  Background.hpp  BasicFeatures.cpp  BasicFeatures.hpp  BASSFeatures.cpp  BASSFeatures.hpp  BlobTimeFeatures.cpp  BlobTimeFeatures.hpp  Features.cpp  Features.hpp  Parameters.cpp  Parameters.hpp

which I then compile as a library:

$(CXX) -shared -Wl,-soname,libshallowale.so -o [...]

It'd be cleaner if your code would be maintained in its own repo and library, and the Python wrapper would simply link to it.

@mcmachado
Copy link
Owner

@pierrelux I am planning to refactor the whole code during this summer. I'll let you know when I'm done with it. Thanks for the suggestion!

@pum-purum-pum-pum
Copy link

Is there Python wrapper for this code you can share with me?

@mcmachado
Copy link
Owner

I wrote a wrapper in the other branch. It is quite fast, there is just a small performance drop when compared to C++. However, I never managed to be able to obtain an equally fast implementation of Sarsa. I guess I was never able to use the representation sparseness properly in Python.

If you are interested, let me know. I can help you with the Python wrapper and maybe you are able to properly use sparsity in Python.

@xkianteb
Copy link

@mcmachado Does the current sarsa implementation work? I can help implement sparsity properly in python if you need help.

@mcmachado
Copy link
Owner

mcmachado commented Jul 25, 2019 via email

@pierrelux
Copy link
Author

pierrelux commented Aug 5, 2019

When I wrote this issue more than two years ago, it was in the context of this wrapper that I had written: https://bitbucket.org/rllabmcgill/shallowpy/src/master/

It may still be useful for you. I was able to get Sarsa(0) to work by relying on the memory over-commitment feature in Linux which lets you "np.zero" huge arrays without actually using that memory until you write to it. It means that if you write your sarsa(0) with sparse updates through indexing methods only, it should run pretty fast. The problem is when you want to implement sarsa(lambda) with eligibility traces and need to decay your trace. You then end up writing a lot and the memory usage just explodes. That's when @mcmachado and I started discussing about porting their special "merging" logic from the C code into Python. It never quite happened, but it would be great if someone can do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants