<s> import numpy <EOL> import sys <EOL> import os <EOL> import cPickle , gzip <EOL> pred_file = sys . argv [ <NUM_LIT:1> ] <EOL> if '<STR_LIT>' in pred_file : <EOL> pred_mat = cPickle . load ( gzip . open ( pred_file , '<STR_LIT:rb>' ) ) <EOL> else : <EOL> pred_mat = cPickle . load ( open ( pred_file , '<STR_LIT:rb>' ) ) <EOL> test_data , test_labels = cPickle . load ( gzip . open ( '<STR_LIT>' , '<STR_LIT:rb>' ) ) <EOL> test_labels = test_labels . astype ( numpy . int32 ) <EOL> correct_number = <NUM_LIT:0.0> <EOL> for i in xrange ( pred_mat . shape [ <NUM_LIT:0> ] ) : <EOL> p = pred_mat [ i , : ] <EOL> p_sorted = ( - p ) . argsort ( ) <EOL> if p_sorted [ <NUM_LIT:0> ] == test_labels [ i ] : <EOL> correct_number += <NUM_LIT:1> <EOL> error_rate = <NUM_LIT:100> * ( <NUM_LIT:1.0> - correct_number / pred_mat . shape [ <NUM_LIT:0> ] ) <EOL> print '<STR_LIT>' + str ( error_rate ) + '<STR_LIT>' </s>
