Skip to content

Commit

Permalink
Update developerdocumentation.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
MStarmans91 committed Feb 22, 2024
1 parent c0a036e commit b4a2d0b
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions WORC/doc/static/developerdocumentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,30 @@ Adding methods to hyperoptimization
5. If you want your new method to be used by the ``SimpleWORC`` or a child
facade, check :py:mod:`WORC.facade.SimpleWORC` to see if you need to add it,
e.g. whitelist a classifier.

Adding a (plotting) tool to the WORC evaluation pipeline
----------------------------------------------------------
We illustrate here how plotting the ROC curves is embedded in ``WORC``, and
to follow or even copy-paste this example to add your own tools.

1. Write a script to perform the actual analysis, preferably stored in the
plotting subfolder. See for example the one of the
`ROC curves <https://github.com/MStarmans91/WORC/blob/master/WORC/plotting/plot_ROC.py/>`_.
2. Make it command-line executable and able to parse input arguments. For the ROC curves, we did this
in the above script as well, but that is optional. It should be stored in
`the WORC fastr_tools folder <https://github.com/MStarmans91/WORC/tree/master/WORC/resources/fastr_tools/worc/bin/>`_,
see also the `ROC script in that folder <https://github.com/MStarmans91/WORC/blob/master/WORC/resources/fastr_tools/worc/bin/PlotROC.py/>`_,
for step 3. Make sure it both is able to take in input arguments (parameters, file names) and output arguments (file names)
to store the results in.
3. Make a fastr tool, i.e., a wrapper around your ``main`` function that fastr can call. See
`the general fastr documentation on creating your own tool <https://fastr.readthedocs.io/en/stable/static/user_manual.html#create-your-own-tool/>`_,
and the `WORC tool for the ROC curve plotting< https://github.com/MStarmans91/WORC/blob/master/WORC/resources/fastr_tools/worc/PlotROC.xml/``>_.
You can see we call the script from step 2 for this. For the input and output files, you can run ``fastr.types`` to see which
datatypes are in your current ``fastr`` installation. You an see we added
several in ``WORC``, see also `the WORC fastr_types folder <https://github.com/MStarmans91/WORC/tree/master/WORC/resources/fastr_types/>`_.
4. Now add it the the `Evaluation part of WORC <https://github.com/MStarmans91/WORC/blob/master/WORC/tools/Evaluate.py/>`_.
If you are new to creating fastr networks, you may want to check out
`the fastr documentation <https://fastr.readthedocs.io/en/stable/static/quick_start.html#creating-a-simple-network/>`_,
but in principle you can just copy paste again the parts of the plotting of the ROC curve. Make sure you add: the
additional sources (inputs) your tool requires if they are not already in the rest of WORC, the actual tool you made,
and sinks (outputs) so the output is also actually stored when your tool is done in an output folder.

0 comments on commit b4a2d0b

Please sign in to comment.