After evaluating a model you will get the following message in Moodle:

Launch TensorBoard from command line by typing: tensorboard --logdir='/path_to_your_moodledata/models/4/1566208427/evaluation/coreanalyticstime_splittingquarters/logs/1566583192278/tensor'

Installing moodlemlbackend is a prerequisite to view the model results. Read this quick guide on how to setup the prerequisites.

The moodlemlbackend package comes with an older version of TensorFlow package which contains a TensorBoard application where I had problems to view the result. Therefore a new Python virtual environment was installed for running Tensorboard only. With cPanel the Python environment can be set up quickly.

Here is a quick guide on how to launch TensorBoard in cPanel and view the results of the Moodle Analytics models evaluation.

Step 1.

  1. Login to your cPanel account.
  2. Click on “Setup Python App”
cPanel Software selection
cPanel Software selection

Step 2.

Tried with different Python versions but finally, TensorBoard was running properly with Python 3.6 version for me.

  1. Click on “CREATE APPLICATION” button.
  2. Select Python 3.6 version from the drop-down list.
  3. Specify your Application root (eg. tensorboard).
  4. Specify your Application URL (eg. tensorboard). Do not leave it empty!
  5. Click “CREATE” button.

Step 3.

In old cPanel version, Python modules can be added on the Setup Python App / Existing applications settings dialog but in the new version, modules need to be installed manually. You may use Terminal or you can connect to your server with SSH.

Let’s install the TensorFlow package which contains the TensorBoard app.

  1. enter to your Python virtual environment, run the command but change the directories:
    $ source /home/your_home/virtualenv/tensorboard/3.6/bin/activate && cd /home/your_home/tensorboard
  2. Install tensorflow package
    $ pip install tensorflow

The result should be that the tensorflow 1.14.0 has been successfully installed.

Step 4.

Launching the Tensorboard app. You must specify a log directory with the directory path where Moodle placed the evaluation output.

  1. Login to your cPanel account.
  2. Launch Terminal.
  3. Start the Python shell by running the following command with changing the directories:
    $ source /home/your_home/virtualenv/tensorboard/3.6/bin/activate && cd /home/your_home/tensorboard
  4. Launch TensorBoard app and change the log directory with your model output directory:
    tensorboard --logdir /path_to_your_moodledata/models/4/1566208427/evaluation/coreanalyticstime_splittingquarters/logs/1566290352556/tensor

Step 5.

TensorBoard runs on 6006 by default. In our case, the service provider closed all non-used ports so an Apache rewrite rule has to be set.

  • Login to your cPanel account.
  • Launch the File Manger.
  • In File Manager go to your www root directory (eg: public_html)
  • Open the settings dialog by clicking on the “Settings” button.
  • Tick “Show Hidden Files (dotfiles)” option.
  • Click Save.
  • Edit the .htaccess file
  • Add the following lines:
    RewriteEngine On
    RewriteRule ^/?tensorboard/(.*)$1 [P,L]
  • Click on “Save changes”.
  • Navigate to http(s)://yoursite/tensorboard/#scalars.
cPanel File Manager Preferences – Show Hidden Files
Moodle Analytics Result in TensorBoard
Moodle Analytics Result in TensorBoard

All done.


Leave a comment

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.