Visual Neural Network Designer in ANNdotNET


Brief Introduction to ANNdotNET

ANNdotNET – is an open source project for deep learning on .NET platform (.NET Framework and .NET Core). The project is hosted at http://github.com/bhrnjica/anndotnet with more information at the https://bhrnjica.net/anndotnet.

The project comes in two versions: GUI and CMD tool. The main purpose of the project is focus on building deep learning models without to be distracted with debugging the source code and installing/updating missing packages and environments. The user should no worry which version of ML Engine the application is using. In other words, the ANNdotNET is ideal in several scenarios:

  1. more focus on network development and training process using classic desktop approach, instead of focusing on coding,
  2. less time spending on debugging source code, more focusing on different configuration and parameter variants,
  3. ideal for engineers/users who are not familiar with supported programming languages,
  4. in case the problem requires coding more advanced custom models, or training process, ANNdotNET CMD provides high level of API for such implementation,
  5. all ml configurations files generated with GUI tool, can be handled with CMD tool and vice versa.

With ANNdotNET GUI Tool the user can prepare data for training, by performing several actions: data cleaning, feature selection, category encoding, missing values handling, and create training and validation dataset prior to start building deep neural network. Once the data is prepared, the user can create Machine Learning Configuration (mlconfig) file in order to start building and training deep neural network. All previous actions user can handle using GUI tool implemented in the application.

For persisting information about data preparation and transformation actions, the application uses annproject file type which consists information about raw dataset, metadata information and information about mlconfig files.

The machine learning configurations are stored in separated files with mlconfig file extension. For more information about files in ANNdotNET the reader may open this link. The following image shows how ANNdotNET handles annproject and corresponded machine learning configurations within the annproject:

As can be seen the annproject can be consisted of arbitrary number of mlconfigs, which is typical scenario when working on ML Project. User can switch between mlconfigs any time except when the application is in training or evaluation mode.

ANNdotNET ML Engine

ANNdotNET introduces the ANNdotNET Machine Learning Engine (MLEngine) which is responsible for training and evaluation models defined in the mlconfig files.The ML Engine relies on Microsoft Cognitive Toolkit, CNTK open source library which is proved to be one of the best open source library for deep learning. Through all application ML Engine exposed all great features of the CNTK e.g. GPU support for training and evaluation, different kind of learners, but also extends CNTK features with more Evaluation functions (RMSE, MSE, Classification Accuracy, Coefficient of Determination, etc.), Extended Mini-batch Sources, Trainer and Evaluaton models.

ML Engine also contains the implementation of neural network layers which supposed to be high level CNTK API very similar as layer implementation in Keras and other python based deep learning APIs. With this implementation the ANNdotNET implements the Visual Neural Network Designer called ANNdotNET NNDesigner which allows the user to design neural network configuration of any size with any type of the layers. In the first release the following layers are implemented:

  • Normalization Layer – takes the numerical features and normalizes its values before getting to the network. More information can be found here.
  • Dense – classic neural network layer with activation function
  • LSTM – LSTM layer with option for peephole and self-stabilization.
  • Embedding – Embedding layer,
  • Drop – drop layer.

More layer types will be added in the future release.

Designing the neural network can be simplify by using pre-defined layer. So on this way we can implement almost any network we usually implement through the source code.

How to use ANNdotNET NNDesigner

Once the MLConfig is created user can open it and start building neural network. NNDesigner is placed in the Network Setting tab page. The following image shows the Network Setting tab page.

NNetwork Designer contains combo box with supported NN layers, and two action buttons for adding and removing layers in/from the network. Adding and removing layers is simple as adding and removing items in/from the list box. In order to add a layer, select the item from the combo box, and press Add button. In order to remove the layer form the network, click the layer in the listbox and press Remove button, then confirm deletion. In order to successfully create the network, the last layer in the list must be created with the same output dimension as the Output layer shown on the left side of the window, otherwise the warning messages will appear about this information once the training is stared.

Once the layer is added to the list it must be configured. The layer configuration depends of its type . The main parameter for each layer is output dimension and activation function, except the drop and normalization layer. The following text explains parameters for all supported layers:

Normalization layer – does not require any parameter. The following image shows the normalization item in the NNDesigner. You can insert only one normalization layer, and it is positioned at the first place.

Drop layer – requires percentage drop value which is integer value. The following image shows how drop layer looks in the NNDesigner. There is no any constrains for this layer.

Embedding layer – requires only output dimension to be configured. There is no any constrains for the layer. The following image shows how it looks in the NNDesigner:

Dense layer – requires output dimension and activation function to be configured. There is no any constrains for the layer.

LSTM layer – requires: output and cell dimension, activation function, and two Boolean parameters to enable peephole and self-stabilization variant in the layer. The following image shows how LSTM item looks in the NNDesigner.

The LSTM layer has some constrains which is already implemented in the code. In case two LSTM layers are added in the network, the network becomes the Stacked LSTM which should be treated differently. Also all LSTM layers are inserted as stack, and they cannot be inserted on different places in the list. The implementation of the Stacked LSTM layer will be shown later.

Different network configurations

In this section, various network configuration will be listed, in order to show how easy is to use NNDesigner to create very complex neural network configurations. Network examples are implemented in pre-calculated examples which come with default ANNdotNET installation package.

Feed Forward network

This example shows how to implement Feed Forward network, with one hidden and one output layer which is the last layer in the NNDesinger. The example is part of the ANNdotNET installation package.

Feed Forward with Normalization layer

This example shows feed forward network with normalization layer as the first layer. The example of this configuration can be found in the installation package of the ANNdotNET.

Feed Forward Network with Embedding layers

In this example embedding layers are used in order to reduce the dimensions of the input layer. Network is configured with 3 embedding layers, one hidden and output layer. The example is part of the ANNdotNET installation package.

Deep Neural Network

This example shows deep neural network with three kind of layers: Embedding, Drop and Dense layers. The project is part of the ANNdotNET installation package.

LSTM Deep Neural Network

This example shows how to configure LSTM based network. The network consist of normalization, embedding, drop, dense and LSTM layers. The project is part of the ANNdotNET installation package.

Stacked LSTM Neural Network

This is example of Stacked LSTM network, consist of multiple LSTM layers connected into stack. The example is part of the installation package.

The complete list of examples can be seen at the ANNdotNET Start Page. In order to open the example, the user just need to click the link. Hope this project will be useful for many ml scenarios.

Advertisements

Introduction to ANNdotNET v1.0 deep learning tool on .NET Platform


Introduction

In this tutorial we are going to create and train Iris model using ANNdotNET v1.0. ANNdotNET is windows desktop application for creating and training deep learning models. It uses Microsoft CNTK library as Machine Learning Engine, MLE, which makes this project a high performance and industry capable application for deep learning. The project is hosted at http://github.com/bhrnjica/anndotnet.

In ANNdotNET, process of creating, training, evaluating and exporting models is provided from the GUI application and does not require knowledge for supported programming languages. The ANNdotNET is ideal in several scenarios:
  • more focus on network development and training process using on classic desktop approach, instead of focusing on coding,
  • less time spending on debugging source code, more focusing on different configuration and parameter variants,
  • ideal for engineers/users which are not familiar with programming languages, in case the problem requires coding custom models, or training process,
  • ANNdotNET CMD provides high level of API for such implementation, all ml configurations developed with GUI tool,can be handled with CMD tool and vice versa.
There are dozens of pre-calculated projects included in the installer which can be opened from the Start page as well as from CMD tool. The annprojects are based on famous datasets from several categories: regression, binary and multi class classification problems, image classifications, times series, etc.

Iris data set example

In this quick tutorial it 8 steps will be described how to implement iris ml model in ANNdotNET v1.0.

1. Step: Download the data set file from https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data and place it on desktop.

2. Step: Open ANNdotNET GUI Tool, Press New command, and save empty project on disk by entering project name as IrisProject.

3. Step: Select Data Command from Model Preparation ribbon group, Click File button from Import experimental data dialog and select the recently downloaded file. Check Comma check box and press Import Data button.

4. Steps: Double click on Type for the last column, and select Category. Also double click on Variable row for the last column and select Label. This will indicate what is the label of this ml solution. More information how to prepare data for ML you can find at https://bhrnjica.net/2018/03/01/data-preparation-tool-for-machine-learning/

anniris_dataprep

5. Steps: Once the data is prepared Click Create MLConfig Command and select created configuration below the Iris project tree item. Before start the training process we need to setup Neural Network and Learning parameters. ANNdotNET v1.0 introduces the NNetwork Designer. It is visual designer for creation wide range of neural network configuration. From the Combobox the user can select one of several layers. For this example select:

  • Normalization layer from the combobox and press Add button, then
  • Dense layer and press Add button twice.

Setup layer parameters as image shows below. Also for the learning parameters setup values as shown on the image below. At the end press Run button, and switch to Training tab page.

anniris_networkdesin.png

6. Steps: Training process for this data set is very quick and 1000 iterations is achieved very quickly. In training tab page, user can setup training parameters:

  • Epoch,
  • Mini-batch size
  • Randomization of batch
  • Continue training of previous model
  • Saving good model during training.
anniris_training

7. Steps: Once the model is trained you can evaluate model by selecting Evaluate tab page. Depending on the model type (regression, binary or multi class classification) appropriate information is shown. Since this is multi class classification model, the performance parameters for multi class classification are shown. On the left side parameters and chart are related to training data set, while the right side is related to validation data set.

anniris_evaluation.png

8. Steps: For further analysis you can export model to Excel, or CSV or CNTK model. Also you can save the project which can later be opened and retrained again.

Note: Currently ANNdotNET is in release candidate, and feature complete verions. In the next few weeks the application will be stabilized and released.