| 321 | |
| 322 | |
| 323 | public final void run(final Iterable<BurstMap> trainSource, final Formula f, final String weightKey, |
| 324 | final File resultFileSer, final File resultFileTSV) throws IOException, ParseException, ClassNotFoundException { |
| 325 | final Log log = LogFactory.getLog(this.getClass()); |
| 326 | final Model model = train(trainSource,f,weightKey); |
| 327 | LogisticScore.score(model, trainSource, null); |
| 328 | if(resultFileSer!=null) { |
| 329 | log.info("writing " + resultFileSer.getAbsolutePath()); |
| 330 | final ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(resultFileSer)); |
| 331 | oos.writeObject(model); |
| 332 | oos.close(); |
| 333 | } |
| 334 | if(resultFileTSV!=null) { |
| 335 | log.info("writing " + resultFileTSV.getAbsolutePath()); |
| 336 | final PrintStream p = new PrintStream(new FileOutputStream(resultFileTSV)); |
| 337 | p.println(model.config.formatSoln(model.coefs)); |
| 338 | p.close(); |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | } |