Classifier: Use 'as' instead of explicit cast

Fixes #917.