| 117 | |
| 118 | |
| 119 | public boolean score(final double[] x, final Path pathOut) throws IOException, InterruptedException, ClassNotFoundException { |
| 120 | final JobStateDescr conf = new JobStateDescr(); |
| 121 | conf.underlying = underlying; |
| 122 | conf.defs = defs; |
| 123 | conf.x = x; |
| 124 | conf.useIntercept = useIntercept; |
| 125 | conf.wantGrad = false; |
| 126 | conf.wantHessian = false; |
| 127 | mrConfig.set(MRFIELDNAME,conf.toString()); // prepare config for distribution |
| 128 | // run the job |
| 129 | final Job job = WritableUtils.newJob(mrConfig); |
| 130 | job.setJarByClass(MapRedScore.class); |
| 131 | job.setJobName("MapRedScoreStep"); |
| 132 | FileInputFormat.setMaxInputSplitSize(job,4*1024*1024L); |
| 133 | FileInputFormat.setMinInputSplitSize(job,4*1024L); |
| 134 | FileInputFormat.addInputPath(job, pathIn); |
| 135 | FileOutputFormat.setOutputPath(job, pathOut); |
| 136 | job.setMapperClass(ScoreMapper.class); |
| 137 | job.setNumReduceTasks(1); |
| 138 | job.setOutputKeyClass(Text.class); |
| 139 | job.setOutputValueClass(Text.class); |
| 140 | job.setReducerClass(ScoreReducer.class); |
| 141 | job.setInputFormatClass(TextInputFormat.class); |
| 142 | job.setOutputFormatClass(TextOutputFormat.class); |
| 143 | return job.waitForCompletion(false); |
| 144 | } |
| 145 | } |