def train_student(dataset, nb_teachers):
 assert input.create_dir_if_needed(FLAGS.train_dir)
 stdnt_dataset = prepare_student_data(dataset, nb_teachers, save=True)
 (stdnt_data, stdnt_labels, stdnt_test_data, stdnt_test_labels) = stdnt_dataset
 if FLAGS.deeper:
  ckpt_path = (((((FLAGS.train_dir + '/') + str(dataset)) + '_') + str(nb_teachers)) + '_student_deeper.ckpt')
 else:
  ckpt_path = (((((FLAGS.train_dir + '/') + str(dataset)) + '_') + str(nb_teachers)) + '_student.ckpt')
 assert deep_cnn.train(stdnt_data, stdnt_labels, ckpt_path)
 ckpt_path_final = ((ckpt_path + '-') + str((FLAGS.max_steps - 1)))
 student_preds = deep_cnn.softmax_preds(stdnt_test_data, ckpt_path_final)
 precision = metrics.accuracy(student_preds, stdnt_test_labels)
 print(('Precision of student after training: ' + str(precision)))
 return True

def train_student ( dataset , nb_teachers ) : assert input . create_dir_if_needed ( FLAGS . train_dir ) stdnt_dataset = prepare_student_data ( dataset , nb_teachers , save = True ) ( stdnt_data , stdnt_labels , stdnt_test_data , stdnt_test_labels ) = stdnt_dataset if FLAGS . deeper : ckpt_path = ( ( ( ( ( FLAGS . train_dir + '/' ) + str ( dataset ) ) + '_' ) + str ( nb_teachers ) ) + '_student_deeper.ckpt' ) else : ckpt_path = ( ( ( ( ( FLAGS . train_dir + '/' ) + str ( dataset ) ) + '_' ) + str ( nb_teachers ) ) + '_student.ckpt' ) assert deep_cnn . train ( stdnt_data , stdnt_labels , ckpt_path ) ckpt_path_final = ( ( ckpt_path + '-' ) + str ( ( FLAGS . max_steps - 1 ) ) ) student_preds = deep_cnn . softmax_preds ( stdnt_test_data , ckpt_path_final ) precision = metrics . accuracy ( student_preds , stdnt_test_labels ) print ( ( 'Precision of student after training: ' + str ( precision ) ) ) return True
this function trains a student using predictions made by an ensemble of teachers .