예제 #1
0
 public static LogisticClassifier<String, String> getSingletonPredictorFromSerializedFile(
     String serializedFile) {
   try {
     ObjectInputStream ois = IOUtils.readStreamFromString(serializedFile);
     Object o = ois.readObject();
     if (o instanceof LogisticClassifier<?, ?>) {
       return (LogisticClassifier<String, String>) o;
     }
     throw new ClassCastException("Wanted SingletonPredictor, got " + o.getClass());
   } catch (IOException e) {
     throw new RuntimeIOException(e);
   } catch (ClassNotFoundException e) {
     throw new RuntimeException(e);
   }
 }