Skip to content

Commit

Permalink
Updated researcher doc
Browse files Browse the repository at this point in the history
  • Loading branch information
darrylong committed Nov 3, 2023
1 parent acbc050 commit fbcc165
Showing 1 changed file with 37 additions and 18 deletions.
55 changes: 37 additions & 18 deletions docs/source/user/iamaresearcher.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ In this guide, we will cover the following topics:
- Adding your own metric
- Adding your own dataset
- Development Workflow
- Analyze results
- Using additional packages

What can you do with Cornac?
-----------------------------
Expand Down Expand Up @@ -289,6 +289,9 @@ Adding your own model on Cornac is easy. Cornac is designed to be flexible and
extensible, allowing researchers to easily add their own models into the
framework.

Files to add
^^^^^^^^^^^^

Below is an example of the ``PMF`` model which was already added into Cornac.
We will use this as a reference to add our own model.

Expand Down Expand Up @@ -769,6 +772,9 @@ We will use this as a reference to add our own model.
user_based=True,
).run()
Files to edit
^^^^^^^^^^^^^

To add your model to the overall Cornac package, you need to edit the following
file:

Expand Down Expand Up @@ -800,36 +806,49 @@ Development Workflow
Before we move on to the section of building a new model, let's take a look at
the development workflow of Cornac.

The main workflow of developing a new model will be to:

``Create an example, Create model files --> Build --> Run Example``
First time setup
^^^^^^^^^^^^^^^^

Whenever a new change is done to your model files, you are required to rebuild
Cornac using the ``setup.py`` script. This will ensure that the changes you have
made to your model files are reflected in the Cornac package.
As Cornac contains models which uses Cython, compilation is required before
testing could be done. In order to do so, you need to run the following command:

.. code-block:: bash
Rebuilding Cornac
^^^^^^^^^^^^^^^^^
python setup.py build_ext —inplace
1. To build Cornac on your environment:
This will compile the Cython files and place the compiled files in the
``cornac/models`` folder.

.. code-block:: bash

python3 setup.py install
The main workflow of developing a new model will be to:

1. Code model files
2. Code example
3. Run Example

.. note::
Folder structure for testing
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The following packages are required for building Cornac on your environment: ``Cython``, ``numpy``, ``scipy``.
.. code-block:: bash
If you do not have them, install by using the following commands:
cornac
|-- cornac
| |-- models
| |-- mymodel
| | |-- __init__.py
| | |-- recom_mymodel.py
| |-- requirements.txt
|-- mymodel_example.py <-- not in the examples folder
.. code-block:: bash
To run the example, ensure that your current working directory is in the top
``cornac`` folder. Then, run the following command:

.. code-block:: bash
pip3 install Cython numpy scipy
python mymodel_example.py
2. Run an example utilising your new model.
Whenever a new change is done to your model files, just run the example for
testing and debugging.

Analyze Results
---------------
Expand Down

0 comments on commit fbcc165

Please sign in to comment.