Q:

Simple classification in TensorFlow

I have the following problem:

I have a raspberry pi robot which uses four sensors (left, front, right, back). 
The robot can do the following moves: Run forward, turn left, turn right, move back.
Based on the sensor data, i will "train" the robot to do the moves.

So a basic input to train the robot will look like:

if sensor data = [2, 1, 0, 1] => move left 
if sensor data = [4, 0, 1,1] => move left 
if sensor data = [0, 2, 0, 0] => move forward
if sensor data = [0, 0, 0, 1] => move backward
.. feed more data here ..

Now after the training the robot should be possible to predict the next move like:
if sensor data = [3, 3, 2, 1] => do predicted move.
My first idea was to use TensorFlow to solve this problem, but I couldn't find out what the best way would be to implement this (kind of simple) prediction algorhitm since most of the tutorials are about image and speech recognition.
It would be really great if someone could show me a short example in Python on how this could be done using TensorFlow.
So the main question is:
How can I implement a algorithm which takes a list of arrays with four values as input and then predicts the given output (one variable which can have four states).

Solution:
I managed to find a solution (it uses Python 3 with TensorFlow and Pandas):
import tensorflow as tf
import pandas as pd

# Path to the directory where model data should be saved.
MODEL_PATH = "model"
# Path to the training data file.
TRAIN_DATA_PATH = "movement_training_data.csv"

# The csv column names
CSV_COLUMN_NAMES = ['Front', 'Back', 'Left', 'Right', 'Move']
# The moves (results) of the estimation
MOVES = ['Forward', 'Back', 'Left', 'Right']

# Defines the batch size of data taken for each training step.
batch_size = 100

# Defines how many training steps should be done.
# Weights and biases wll be adjusted after each step.
train_steps = 1000

def main(argv):
    # Reads the csv data and assigns column names. The first line is the header line.
    train_data = pd.read_csv(TRAIN_DATA_PATH, names=CSV_COLUMN_NAMES, header=0)

    # Generates a train_features and a train_label data frame.
    train_features, train_labels = train_data, train_data.pop('Move')

    # Add feature columns (all numeric).
    feature_columns = []
    for key in train_features.keys():
        feature_columns.append(tf.feature_column.numeric_column(key=key))

    # Create classifier for a deep neural network (DNN)
    classifier = tf.estimator.DNNClassifier(
            # Set the model directory.
            model_dir=MODEL_PATH,
            # Set the feature columns.
            feature_columns=feature_columns,
            # Two hidden layers of 10 nodes each.
            hidden_units=[10, 10],
            # The model must choose between 5 classes (which in this case consist of one label each).
            n_classes=4)

    # Train the Model.
    classifier.train(
        input_fn=lambda: train_input(train_features, train_labels),
        steps=train_steps)

    # Test prediction data.
    data_to_predict = {
        'Front': [115, 42, 30, 21],
        'Back': [142, 151, 120, 121],
        'Left': [145, 23, 81, 15],
        'Right': [155, 25, 43, 192],
    }

    predictions = classifier.predict(
        input_fn=lambda: eval_input(data_to_predict, labels=None))

    for prediction_dict in predictions:
        # 0 = Forward, 1 = Back, 2 = Left, 3 = Right
        class_id = prediction_dict['class_ids'][0]
        probability = prediction_dict['probabilities'][class_id]

        print(str(class_id) + ": " + str(probability))

def train_input(features, labels):
    # Convert the inputs to a data set.
    ds = tf.data.Dataset.from_tensor_slices((dict(features), labels))

    # Shuffle, repeat, and batch the examples.
    ds = ds.shuffle(1000).repeat().batch(batch_size)

    # Return the data set.
    return ds

def eval_input(features, labels):
    features = dict(features)

    if labels is None:
        # No labels, use only features.
        inputs = features
    else:
        inputs = (features, labels)

    # Convert the inputs to a data set.
    ds = tf.data.Dataset.from_tensor_slices(inputs)

    # Batch the examples
    ds = ds.batch(batch_size)

    # Return the data set.
    return ds

# Execute TensorFlow program if started directly from script
if __name__ == '__main__':
    tf.logging.set_verbosity(tf.logging.INFO)
    tf.app.run(main)

CSV looks like
Front,Back,Left,Right,Move
100,100,100,100,0
150,150,150,150,0
100,200,100,200,0
110,110,200,200,0
200,100,200,100,0
140,150,200,140,0
120,120,120,170,0
140,170,170,120,0
170,150,130,140,0
190,190,100,130,0
110,150,160,110,0
160,170,110,100,0
170,140,160,110,0
180,160,110,120,0
130,200,110,190,0
120,150,160,110,0
160,180,120,100,0
170,140,140,110,0
180,110,110,120,0
110,200,140,190,0
10,100,10,10,1
40,150,40,40,1
10,200,10,20,1
20,110,20,20,1
10,100,20,10,1
10,150,20,40,1
20,120,10,10,1
30,170,40,20,1
40,150,30,40,1
40,190,30,30,1
30,150,40,10,1
10,170,30,40,1
20,140,20,10,1
30,160,20,20,1
20,200,10,40,1
10,150,40,10,1
20,120,30,40,1
20,120,20,20,1
30,160,20,10,1
10,100,10,10,1
10,100,100,10,2
40,150,140,40,2
10,200,160,20,2
20,110,120,20,2
10,100,120,10,2
10,150,180,40,2
20,120,110,10,2
30,170,140,20,2
40,150,130,40,2
40,190,130,30,2
30,150,140,10,2
10,170,150,40,2
20,140,120,10,2
30,160,120,20,2
20,200,170,40,2
10,160,50,20,2
40,100,70,40,2
20,160,60,10,2
20,100,90,20,2
10,100,10,10,3
40,150,40,100,3
10,200,30,120,3
20,110,20,120,3
10,100,20,110,3
10,150,20,140,3
20,120,10,110,3
30,170,40,120,3
40,150,30,140,3
40,190,30,130,3
30,150,40,110,3
10,170,50,140,3
20,140,20,110,3
30,160,20,120,3
20,200,40,140,3
30,150,40,70,3
10,150,40,60,3
10,140,10,90,3
30,140,30,80,3
20,200,40,70,3

A:

Take a look at the iris example for Tensorflow:
https://www.tensorflow.org/versions/r1.5/get_started/get_started_for_beginners
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/learn/iris.py
It's not training based on the images of an Iris, it is trained based on an input csv file that takes 4 values and 1 expected output value. 

