August 2018
Intermediate to advanced
438 pages
12h 3m
English
It is now time to put our model to the test, literally. We will use the test dataset to make predictions with our model and then evaluate them against the ground truth labels. For this, we first need to get our model's predictions on the test data and do a reverse mapping from the numeric labels to the actual text labels, using the following snippet:
predictions = model.predict_classes(test_features)
class_map = {'0' : 'air_conditioner', '1' : 'car_horn',
'2' : 'children_playing', '3' : 'dog_bark',
'4' : 'drilling', '5' : 'engine_idling',
'6' : 'gun_shot', '7' : 'jackhammer',
'8' : 'siren', '9' : 'street_music'}
test_labels_categories = [class_map[str(label)]for label in test_labels] prediction_labels_categories ...Read now
Unlock full access