# -*- coding: utf-8 -*-
import csv_io

def main():
    tr = csv_io.read_data("./training_solutions_rev1.csv")
    ts = csv_io.read_data("./central_pix.csv")
    rmse = 0.0
    count = len(ts)
    for i in range(len(ts)):
        c = 0.0
        for j in range(37):
            c += (ts[i][j]-tr[-(count-i)][j+1])*(ts[i][j]-tr[-(count-i)][j+1])*1.0
        rmse += c/37.0
        
    
    rmse = sqrt((rmse*1.0)/len(ts))
    print "RMSE", rmse

if __name__ == "__main__":
    main()