def run_test(args): """ Function for testing a model. :param args: command line arguments """ # Create directories for plots if it doesn't exist if not os.path.exists(args.plots_dir): os.mkdir(args.plots_dir) # Create objects for testing and visualization visualizer = Visualizer(args.font_dir, args.plots_dir) tester = Tester(args) # Test a model that predicts values for both valence and arousal if tester.dimension == 'both': tester.load_model_2d() tester.test_2d() # Test models that separately predict values for valence and arousal, respectively else: tester.load_model_1d() tester.test_1d() if tester.dimension == 'both': title = '2D Model' else: title = '1D Models' # Visualize quadrant predictions visualizer.plot_quadrant_predictions(tester.valence_dict, tester.arousal_dict, tester.quadrants_dict, title) # Visualize valence predictions visualizer.plot_valence_predictions(tester.valence_dict, title) # Visualize arousal predictions visualizer.plot_arousal_predictions(tester.arousal_dict, title)