## Archimedes: a simple exercise with Keras and Scikit-Fuzzy

This is a simple exercise, not a real, complete implementation. However I think it’s a good starting point if you want to use Keras in order to learn time sequences and Scikit-Fuzzy, to extract probabilistic rules (which descrive the evolution) from them. First of all, you need both packages: Keras (http://keras.io/) Theano (http://deeplearning.net/software/theano/) Scikit-Fuzzy (https://github.com/scikit-fuzzy/scikit-fuzzy) Moreover you need Numpy (I do suggest to use Anaconda as Python distribution, because it contains more or less everything you need) I start creating a sample sequence (in this case, very simple and reasonably predictable): import numpy as np class SampleGenerator(object): def __init__(self, num_samples, num_tests): self.num_samples = num_samples self.num_tests = num_tests def generate_discrete_sequence(self): symbols = (0, 1, 2, 3, 4, 5) data = [] data.append(np.random.randint(0, high=len(symbols))) for i in range(1, self.num_samples + self.num_tests): # Apply “probabilistic-logic” rules if data[i-1] == symbols[0]: if self.uniform_threshold(): data.append(symbols[2]) continue else: data.append(symbols[3]) continue if data[i-1] == symbols[1]: if self.uniform_threshold(): […]