Changing the default configuration
What you can do as an admin
DBNsim has two different kinds of user: normal users of the web interface and administrators with access to the configuration of the server. If you are an admin, here's how you can customize your instance of DBNsim for your users:
- you can edit the available training datasets, removing them and/or adding new ones;
- you can set a password that the users have to know in order to use the app;
- you can alter the default values of the hyper-parameters (e.g. you can set a default value of 0.1 for the learning rate, if the user doesn't change it on the form);
- you can change the number of epochs between each automatic update of the receptive fields and histogram;
- you can change the colors of the graph edges (two different colors: one for training and the other for resting).
Keep reading for more details.
Datasets
Adding a new dataset is as easy as dragging a file in a special directory in DBNsim. From inside the DBNsim/
root, this directory is ./DBNsite/DBNlogic/data/
.
Here you can put a dataset in one or more of these 3 formats:
- CSV: a CSV file (with extension
.csv
) where each example is a comma-separated row, and each row is separated from the following by a newline. - Pickle: a Python "pickle" file (with extension
.pkl
and encoded with version 2 of the Pickle protocol) that is the serialization of a Numpy 2D array (matrix) containing each example as a row of the matrix. - MATLAB: a MATLAB file (with extension
.mat
) containing a matrix variable called "data", where each row is a training example.
N.B. if DBNsim doesn't recognize your MATLAB files, try to install scipy. This is because scipy is currently an optional dependency, for compatibility with Windows. Under UNIX, you can install it with pip install --user scipy
.
Note that the training sets are (currently) meant for unsupervised learning, so they cannot contain labels — unless you want the labels to be interpreted as features. Note that an exception to this behaviour is the MATLAB file, where you can put as many variables as you like as long as there is one matrix named "data"; that is, you can actually have the labels in the MATLAB file, but you have to store them in a different variable.
Of course, removing a dataset can be performed by just deleting the corresponding file(s) whose name(s) match the name of the dataset. For example, if you want to remove the Numerosity dataset, make sure to remove Numerosity.csv
, Numerosity.pkl
and Numerosity.mat
.
DBNsim searches for new datasets only at startup: if you want to add a dataset, you must restart the server. The order in which DBNsim searches the data/
directory for an instance of each dataset is:
- Pickle file;
- CSV file;
- MATLAB file.
This is beacause the Pickle file is much faster to load (for the Python interpreter) than the other two. However, the downside is that its size can be much bigger.
Password and hyper-parameters
By editing some Python files, you can change the password and the default values of the hyper-parameters.
In order to change the password, open ./DBNsite/DBNtrain/views.py
and change the value of the variable PASSWORD
to a string of your choice. The default is "user".
For the hyper-parameters, open ./DBNsite/DBNlogic/util.py
and search for the constructor of the Configuration
class. There you will find the default values for the constructor arguments. These values are the default values of the hyper-parameters that the user sees when he load the main page of the app: feel free to change them. Read the comments in the body of the constructor, if you want to know the meaning of each hyper-parameter.
graphical parameters
If you want the receptive fields and the weights histogram to be updated every n epochs, open ./DBNsite/DBNtrain/static/dbntrain.js
and look for the variable chartsUpdateRate
. Set it to a positive value that will be the number of epochs that DBNsim will wait before automatically updating the receptive fields and the histogram during training.
Finally, the edges in the upper-right graph change color according to what they are "doing": if an RBM is learning, its weights will be colored in red; else, they will be blue. If you want to change these colors, open ./DBNsite/DBNtrain/static/dbntrain.js
and change the values of the variables edgesColor
and trainingEdgesColor
.