A biderectional lstm with RNNSharp - c#

I am almost new in recurrent neural network. Recurrent neural networks like rnn, lstm, bi-lstm etc. are almost all implemented in python. I want a C# tool of recurrent neural network and found RNNSharp. The inputs of this framework are complex. Is it possible to implement a bidirectional lstm with RNNSharp. If possible, then please help me to create the model with minimal Snippet Code or a link. Thank you.

The input of RNNSharp is compatible with CRFSharp, which supports templates. In addition, RNNSharp won't get updated for any new feature, you could try Seq2SeqSharp which supports both bi-LSTM and transformer models. It's tensor based and support CPU and multi-GPUs. Here is the link: https://github.com/zhongkaifu/Seq2SeqSharp
You can get input/config examples on that page.

Related

How to convert batch_normalization from python to c#

In the last few months, I worked through Python and Tensorflow, building a neural network. The network performs pretty well on a large amount of data (the precision of my prediction is 85% after training on a data-set of 120000 records).
My neural network makes use of batch-normalization, learning-rate decay, dropout.. It uses an Adam-Optimizer to minimize the loss. After training I store my model by a saver to store the mean/variance-variables of batch_normalization:
saver = tf.compat.v1.train.Saver(tf.global_variables())
saver.save(sess, "sessionSave")
After searching for a proper way to convert this model to c#, I found a Tensorflow- implementation for .NET (SciSharp). But I cannot find an implementation of batch_normalization. In this specific case it would be the following python code call which I need to convert:
Z_BN = tf.contrib.layers.batch_norm(Z, is_training=train,updates_collections=ops.GraphKeys.UPDATE_OPS, scope="scope"+str(i), reuse=True)
If there is a way to convert this call, I would need to solve the problem of the saved mean/variance-variables differently as well. I think, I am not able to implement batch_normalization myself. Is there someone who can provide an implementation for this requirement?
If you only need your model to work in .NET for inference, it should be sufficient to convert it to some widely used format such as ONNX, which you can later use with ML.NET: https://learn.microsoft.com/en-us/dotnet/machine-learning/tutorials/object-detection-onnx
You may also try to use the model directly via ML.NET, but your mileage may vary: https://learn.microsoft.com/en-us/dotnet/machine-learning/tutorials/image-classification
If neither of these approaches work for you, or you need to fine-tune/train the model from C# too, you can try a commercial solution: Gradient, which exposes the entire TensorFlow 1.15 APIs to .NET. Though in that case you would have to use the supported BatchNormalization class from either tensorflow.keras.layers or tensorflow.layers (the later one is deprecated) instead of the one from contrib. The later is a wrapper anyway.
Disclaimer: I am the author of Gradient.

Is GPU-based binary classification using C# and LightGBM possible (yet?)

I am rather new to ML and started using ML.NET early this year. Perhaps I am not educated enough on it, but I am attempting to find information on implementing GPU-based binary classification using C# and LightGBM. Despite numerous searches I cannot find any documentation or examples. I would very much appreciate any assistance anyone can offer.
B., I am on the ML.NET team at Microsoft. We do not currently support GPU for LightGBM, but this is something we are considering implementing over the next few months. If you would like, please make an issue on our GitHub repository and provide more detail about your use case.

Can an SVM learn incrementally?

I am using a multi-dimensional SVM classifier (SVM.NET, a wrapper for libSVM) to classify a set of features.
Given an SVM model, is it possible to incorporate new training data without having to recalculate on all previous data? I guess another way of putting it would be: is an SVM mutable?
Actually, it's usually called incremental learning. The question has come up before and is pretty well answered here : A few implementation details for a Support-Vector Machine (SVM).
In brief, it's possible but not easy, you would have to change the library you are using or implement the training algorithm yourself.
I found two possible solutions, SVMHeavy and LaSVM, that supports incremental training. But I haven't used either and don't know anything about them.
Online and incremental although similar but differ slightly. In online, its generally a single pass(epoch=1) or number of epochs could be configured. Where as, incremental would mean that you already have a model; no matter how it is built, but then model can be mutable by new examples. Also, a combination of online and incremental is often what is required.
Here is a list of tools with some remarks on the online and/or incremental SVM : https://stats.stackexchange.com/questions/30834/is-it-possible-to-append-training-data-to-existing-svm-models/51989#51989

Kim and Pearl's Message passing algorithm in Bayesian Network

Can you give me a good link/resource where i could find a good implementation of Bayesian network ,I'm specially interested in Conditional Probability Table generation and how to pass messages/update nodes .
Thanks!
Have a look at
Example of Bayesian network
and
A Brief Introduction to Graphical Models and Bayesian Networks
Also, have a look at Online Tutorials

How to determine subject, object and other words in a Context

Im trying to implement NLP in my project,
I need to Tag the words as Person,Location ,Organix=sation etc..If any body knows the logic please let me know..
Regards,
Stack
The task you want to perform is known as Named Entity Recognition (NER).
The majority of software for doing NER is in Java. For example, the Stanford NER system and the OpenNLP NER system. There are far fewer similar libraries written in C#, however I found SharpNLP through a Google search. I have not used it personally so I have no idea how well it works.
There is a nice web-service by Reuters: http://www.opencalais.com/.
You can access it via an API.
I thought that the demo was impressive http://viewer.opencalais.com/.
I did not pursue it further, as I want to create a German application. Calais is only supporting English.

Categories

Resources