python pattern recognition in data
<p>I have a large (order of 10k) set of data, letâs say in the form of key-value:</p>

<pre><code>A -&gt; 2
B -&gt; 5
C -&gt; 7
D -&gt; 1
E -&gt; 13
F -&gt; 1
G -&gt; 3
. . .
</code></pre>

<p>Also a smaller sample set (order of 10):</p>

<pre><code>X -&gt; 6
Y -&gt; 8
Z -&gt; 14
. . . 
</code></pre>

<p>Although the values are <em>shifted</em>, the pattern can be found in the original data. What would be the best approach to match or do pattern recognition so that the machine recognizes the corresponding keys in the original data:</p>

<pre><code>X -&gt; B
Y -&gt; C
Z -&gt; E
. . . 
</code></pre>

<p>I have been reading about <a href="https://www.tensorflow.org/" rel="nofollow">TensorFlow</a> and have been doing some exercises, but as a total noob I am not quite sure this is the right tool, or if it is, how exactly to go about the problem.</p>

<p>Thanks for any hints.</p>

<p>First, you need to think about a loss function, i.e. why is solution 1 better than solution 2? Can you come up with an objective score function such that lower scores are always better? </p>

<p>E.g. in your example, is this solution any worse:</p>

<pre><code>X -&gt; C
Y -&gt; C
Z -&gt; E
</code></pre>

<p>Once you've defined what you are trying to optimize, we can tell you if tensorflow is the right tool.</p>

python pattern-matching tensorflow