CAR Classic predictor - Regressor

ATT hit predictor.

This notebook shows how the hit predictor works.
The Hit predictor aim is to guess (x,y) coords from serial port readings. There are two steps: Train and Predict.

Set modules path first:

In [1]:
import sys
#sys.path.insert(0, 'I:/git/att/src/python/')
sys.path.insert(0, 'i:/dev/workspaces/python/att-workspace/att/src/python/')

Build a processor.
This is required by the regressor in order to parse the input raw data.
A ATTMatrixHitProcessor is needed here.

In [2]:
from hit.process.processor import ATTMatrixHitProcessor

matProcessor = ATTMatrixHitProcessor()

We build the regressor now, injecting the processor

In [3]:
from hit.train.regressor import ATTClassicHitRegressor
regressor = ATTClassicHitRegressor(matProcessor)

We define the training data source file

In [4]:
TRAIN_VALUES_FILE_LEFT = "train_data/train_points_20160129_left.txt"

And load the dataset

In [5]:
import numpy as np

(training_values, Y) = regressor.collect_train_hits_from_file(TRAIN_VALUES_FILE_LEFT)
print "Train Values: ", np.shape(training_values), np.shape(Y)

Train Values:  (324L, 8L, 8L) (324L, 2L)

Now, train

In [6]:
regressor.train(training_values, Y)

And finally test

In [7]:
hit = "hit: {1568:6 1416:5 3230:6 787:8 2757:4 0:13 980:4 3116:4 l}"
print '(6,30)'
print regressor.predict(hit)

(4.4648323908724468, 33.669119912752038)

In [ ]:

In [ ]: