Pattern recogniser library for C# programs

I'm a regular user of the StackOverflow forum, but as this question is about a recommendation for libraries, which is supported at StackOverflow, and as my question is about data science libraries, I've decided to take my chance here (my original question has been kicked from the Artificial Intelligence forum).

I'm developping a program that takes a table of a database and predicts the next (limited list of) tupple(s), e.g. for the following table:

A    B    C    D
================
1   12    0    A
2   14    0    A
3   16    0    A
4   18    0    A
5   20    0    A

I would like to predict the following tupple:

A    B    C    D
================
6   22    0    A

For that, I have created two SQL queries:

  1. SELECT COUNT DISTINCT ...

    = if the result is 1, then all values are equal, easy peasy :-)
  2. SELECT MAX(col1-lag_col1) FROM ( SELECT Col1, LAG(Col1) ... (take the difference between subsequent tupples)

    = If both maximum and minimum are equal and not zero, there's an arithmetic progression (more information here). I thought I was on a good track, but then the first problems started arising:

In a list of +800 tupples, the arithmetic progression was disturbed by one single erroneous entry, messing up my prediction. I have seen values like AB123, AB124, AB125, ...: although this is easy for a person to predict, it's not that straightforward for a computer (and what in case of ABC12x or AB12, AC12, AD12, ...?). In both cases, the key solution is pattern recognition: if I can feed the values to a pattern recogniser, it might find the pattern (and maybe the values, messing it up) and I might use that for predicting the next tupple(s). What's the programmers term for pattern recognition? Right: it's A.I., artificial intelligence, more exactly data science. But as most of you know, that's an enormously broad term.

Therefore I'm risking my chances here: does anybody know about a library (or whatever) I might use in my C# program in order to find patterns and predict values (numbers, strings and their combinations)?

Topic prediction library .net

Category Data Science


So in the example that you have given it looks like a linear regression can just be mad between "a" and "b", but if the entire tuple is being predicted, assuming varying values of "c" and "d", you could attempt to simply use "a" as the independent value and the values you want to predict as "b", "c" ,"d". Then you could attempt to create a linear regression based on this, but you would have experiment with results to see if this or another model would work. The only thing I would have to ask is, "Do we know in advance if "a" is going to keep on increasing at the same increment"?

EDIT

So I found an article using stock price data that could be relevant to your example. This article uses a LSTM model to predict the price of an asset and, when it comes to sequences of numbers that change patterns frequently, I can't think of a better example than the financial markets.

Here is a more general introduction to a LSTM models.

Give it a try and let me know what you think.

Second Edit

I found the following links. The first one is an actual library that implements LSTM and other neural networks. The second one is of a gui tool that implements it as well with the third one being the code used for LSTM in this gui project. The fourth link is more of an explanation of the code in the third link.

  1. https://github.com/zhongkaifu/Seq2SeqSharp
  2. https://github.com/bhrnjica/anndotnet
  3. https://github.com/bhrnjica/anndotnet/blob/master/src/core/nnetwork.core/network/Recurrence.cs
  4. https://www.codeproject.com/Articles/5165357/In-Depth-LSTM-Implementation-using-CNTK-on-NET-Pla

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.