// ----------------------------------------------------------------------------------------------------
  private void _relocateFiles(File baseFolder, List<List<DataPoint>> dpl) throws Exception {

    // Mueve los ficheros a subcarpetas indexadas segun el cluster
    int index = 0;
    for (List<DataPoint> dpl2 : dpl) {
      if (dpl2.size() <= 0) continue;
      VecPaired<DenseVector, File> vp1 =
          (VecPaired<DenseVector, File>) dpl2.get(0).getNumericalValues();
      String dayFolder = _readExifDateStr(vp1.getPair());
      File indexedFolder = new File(baseFolder, dayFolder + "/_INX_" + index);
      indexedFolder.mkdirs();
      for (DataPoint dp : dpl2) {
        VecPaired<DenseVector, File> vp = (VecPaired<DenseVector, File>) dp.getNumericalValues();
        File jpegFile = new File(baseFolder, vp.getPair().getName());
        File newJpegFile = new File(indexedFolder, jpegFile.getName());
        if (!jpegFile.renameTo(newJpegFile)) {
          System.out.println(
              "*** Warning: Error renaming file: '" + jpegFile.getName() + "' to: " + newJpegFile);
        }
      }
      index++;
    }

    // Mueve los ficheros que quedan a subcarpetas indexadas segun la fecha
    File listFiles[] = baseFolder.listFiles();
    if (listFiles != null) {
      for (File f : listFiles) {
        if (f.isDirectory()) continue;
        String dayFolder = _readExifDateStr(f);
        File indexedFolder = new File(baseFolder, dayFolder);
        indexedFolder.mkdirs();
        File newFile = new File(indexedFolder, f.getName());
        if (!f.renameTo(newFile)) {
          System.out.println(
              "*** Warning: Error renaming file: '" + f.getName() + "' to: " + newFile);
        }
      }
    }
  }
Ejemplo n.º 2
0
 public double regress(DataPoint data) {
   if (coefficents == null) throw new UntrainedModelException("Model has not been trained");
   return logitReg(data.getNumericalValues()) * scale + shift;
 }