@Override public void configure(Configuration jobConf) { if (parameters == null) { ParameteredGeneralizations.configureParameters(this, jobConf); } try { if (weightsFile.get() != null) { FileSystem fs = FileSystem.get(weightsFile.get().toUri(), jobConf); VectorWritable weights = ClassUtils.instantiateAs((Class<? extends VectorWritable>) vectorClass.get(), VectorWritable.class); if (!fs.exists(weightsFile.get())) { throw new FileNotFoundException(weightsFile.get().toString()); } DataInputStream in = fs.open(weightsFile.get()); try { weights.readFields(in); } finally { Closeables.close(in, true); } this.weights = weights.get(); } } catch (IOException e) { throw new IllegalStateException(e); } }
@Override public void configure(Configuration jobConf) { if (parameters == null) { ParameteredGeneralizations.configureParameters(this, jobConf); } try { if (weightsFile.get() != null) { FileSystem fs = FileSystem.get(weightsFile.get().toUri(), jobConf); VectorWritable weights = ClassUtils.instantiateAs((Class<? extends VectorWritable>) vectorClass.get(), VectorWritable.class); if (!fs.exists(weightsFile.get())) { throw new FileNotFoundException(weightsFile.get().toString()); } try (DataInputStream in = fs.open(weightsFile.get())){ weights.readFields(in); } this.weights = weights.get(); } } catch (IOException e) { throw new IllegalStateException(e); } }
FileSystem fs = FileSystem.get(inverseCovarianceFile.get().toUri(), jobConf); MatrixWritable inverseCovarianceMatrix = ClassUtils.instantiateAs((Class<? extends MatrixWritable>) matrixClass.get(), MatrixWritable.class); if (!fs.exists(inverseCovarianceFile.get())) { throw new FileNotFoundException(inverseCovarianceFile.get().toString()); FileSystem fs = FileSystem.get(meanVectorFile.get().toUri(), jobConf); VectorWritable meanVector = ClassUtils.instantiateAs((Class<? extends VectorWritable>) vectorClass.get(), VectorWritable.class); if (!fs.exists(meanVectorFile.get())) { throw new FileNotFoundException(meanVectorFile.get().toString());
FileSystem fs = FileSystem.get(inverseCovarianceFile.get().toUri(), jobConf); MatrixWritable inverseCovarianceMatrix = ClassUtils.instantiateAs((Class<? extends MatrixWritable>) matrixClass.get(), MatrixWritable.class); if (!fs.exists(inverseCovarianceFile.get())) { throw new FileNotFoundException(inverseCovarianceFile.get().toString()); FileSystem fs = FileSystem.get(meanVectorFile.get().toUri(), jobConf); VectorWritable meanVector = ClassUtils.instantiateAs((Class<? extends VectorWritable>) vectorClass.get(), VectorWritable.class); if (!fs.exists(meanVectorFile.get())) { throw new FileNotFoundException(meanVectorFile.get().toString());