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
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.
- Login to your cPanel account.
- Click on “Setup Python App”
Step 2.
Tried with different Python versions but finally, TensorBoard was running properly with Python 3.6 version for me.
- Click on “CREATE APPLICATION” button.
- Select Python 3.6 version from the drop-down list.
- Specify your Application root (eg.
tensorboard ). - Specify your Application URL (eg.
tensorboard ). Do not leave it empty! - 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.
- 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
- Install
tensorflow package$ pip install tensorflow
The result should be that the
Step 4.
Launching the Tensorboard app. You must specify a log directory with the directory path where Moodle placed the evaluation output.
- Login to your cPanel account.
- Launch Terminal.
- 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
- 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/(.*) http://127.0.0.1:6006/$1 [P,L] - Click on “Save changes”.
- Navigate to
http (s)://yoursite/tensorboard/#scalars.
All done.
Cheers,