On Wed, Dec 26, 2018 at 11:07:48AM +0800, problemset wrote: > Hi Ryan and fellow Mlpack contributors, > > Great to know this awesome community. I am Xiaohong Ji, undergraduate > student from Wuhan University. My research interest is machine > learning and deep reinforcement learning, so I am interested in > project reinforcement learning. Currently, I am going to implement the > prioritized experience replay and open a > [PR](https://github.com/mlpack/mlpack/pull/1614) in github.
Hi Xiaohong, I saw the PR that you opened. Looking forward to watching it come together. :) > Due to a little bit unfamiliar with the codebase with this project, > here is some dumps question. Hope someone can help me to go though > them and thank you in advance. No problem---it can always be challenging to approach a new codebase, so I hope that the answers below are helpful. > 1: how to design class inherited from base class in mlpack ? > I'd like to implement PER inherited from RandomReplay, but most of > part attributes are private, should I redesign the structure? Actually there is no base class in mlpack. So there is no need for inheritance. Part of the reason for this is speed: the use of virtual functions in some cases can cause slowdowns. For your case where you want to reuse functionality in RandomReplay, my suggestion might be to further templatize RandomReplay so that you can then have some template class that handles the PER-specific functionality. That can reduce code duplication. The formal idea for this is called "policy-based design"; you can read more here: https://en.wikipedia.org/wiki/Policy-based_design In your case with PrioritizedReplay it might be simple enough (even though there is some code duplication) to just provide a new class unrelated to RandomReplay with the same API. > 2: how to build part of module, such as the reinforcement learning > part which I implement right now? > Test and build all the module maybe take a little bit long time. Right, mlpack_test can take a long time to build. There are two ideas: 1. Once you compile mlpack_test for the first time, then modify a little code and rebuild, make should automatically only rebuild those files that are needed. So the second rebuild should be much faster. 2. You could also comment out all the tests you don't care to build in src/mlpack/tests/CMakeLists.txt, but that is a less pretty solution. Sometimes that is what I do on my really underpowered ARM Chromebook since the mlpack tests can take an hour or more to compile. :) > 3: how to make specific unit test, which I mean test the part which I > implement? > The reason is the same above. I'm not sure I understand this part; do you mean how to run a single unit test? If you had a unit test suite named "MyTestSuite" you could run $ bin/mlpack_test -t MyTestSuite and that will only run the tests in that suite. > Finally, Merry Christmas and Happy New Year. Thanks! I hope your year end is going well and is relaxing also. :) -- Ryan Curtin | "She fell..." [email protected] | - Ludvig _______________________________________________ mlpack mailing list [email protected] http://knife.lugatgt.org/cgi-bin/mailman/listinfo/mlpack
