code: public static void writeClassifier(LinearClassifier<?, ?> classifier, String writePath) {
      try {
        IOUtils.writeObjectToFile(classifier, writePath);
      } catch (Exception e) {
        throw new RuntimeException("Serialization failed: "+e.getMessage(), e);
      }
    }
docs: Convenience wrapper for IOUtils.writeObjectToFile