Extending rrecsys (prototyping)

Download binaries from GitHub and load the “rrecsys.RProject” file in RStudio. Install devtools package in R (install.packages("devtools")) Rename “yourAlgorithm.R” file in "rrecsys-master\R\" folder (if it isn't renamed it won't be build).

Extending rrecsys is a 5 step procedure. On, your renamed, “yourAlgorithm.R” file:

  1. Edit “yourAlgorithm” function by setting the arguments that the algorithm requires (line 20).

  2. Start writing your algorithm (line 34).

  3. You need to define an class that will be fed to the predict() method, since every algorithm has its specific prediction methodology. Define the output class (line 8) by: setting the name of the class, complete the representation by adding any necessary slot names and their classes (you can use the command class() on an object to get the class name). Don’t change the slots alg, data and parameters. Once you have setup the class create the new object correspondingly (line 51).

  4. Add the new entry to the registry by completing the field on line 56 to 60.

  5. Complete the prediction algorithm by adding predicted values on model@data. When you want to try out your implementation use devtools::load_all(".") or on RStudio’s toolbar menu Build>Load All, so that you can start using rrecsys’s methods. If you need to use another library that is not on base R, you may use the library("requiredpackage") on your code but it is better if you include properly the used method in the NAMESPACE file.

Tip: Use as much as you can the browser() function to single step through the execution of your function. It will allow you to view the changed objects during the execution.

After step 5 your algorithm may be used with all the other methods available in rrecsys.



ludovikcoba/rrecsys documentation built on May 17, 2022, 2:33 a.m.