/**
   * Adds cluster points from data table
   *
   * @param list of clusters
   * @param data
   */
  public void addClusterPoints(CluseterList list, DataCluster data) {
    list.clearsClusterPoints();
    for (int i = 0; i < data.sizeOfRecords(); i++) {
      int temp =
          findClosestClusterAndAddPoint(list, getPoints(data.getAttributes(), data.getRecordAt(i)));

      list.getClusterAt(temp).addPoints(data.getRecordAt(i));
    }
  }
  /**
   * Returns the list of only points excluding the class label and point ID
   *
   * @param data
   * @return
   */
  public List<String[]> findPoints(DataCluster data) {
    List<String[]> list = new ArrayList<String[]>();
    for (int i = 0; i < data.sizeOfRecords(); i++) {
      list.add(getPoints(data.getAttributes(), data.getRecordAt(i)));
    }

    return list;
  }
  /**
   * Normalizes data in a cluster
   *
   * @param data
   * @return
   */
  public DataCluster normalizeData(DataCluster data) {
    DataCluster temp = new DataCluster();

    temp.setAttributes(data.getAttributes());

    List<Double> max = new ArrayList<Double>();
    List<Double> min = new ArrayList<Double>();

    for (int i = 0; i < data.getAttributes().size(); i++) {
      if (data.getAttributesat(i).getType() == TypeAttribute.continuous) {
        List<Double> listDouble = data.getColumnAt(i);
        max.add(Collections.max(listDouble));

        min.add(Collections.min(listDouble));
      }
    }

    for (int k = 0; k < data.sizeOfRecords(); k++) {
      RecordCluster rec = new RecordCluster();
      //			List<String> str = new ArrayList<>();
      int mark = 0;

      for (int i = 0; i < data.numberOfAttributes(); i++) {
        if (data.getAttributes().get(i).getType() == TypeAttribute.continuous) {
          rec.addValue(
              new ErrorsAndGain()
                  .roundOff(
                      ((Double.parseDouble(data.getRecordAt(k).getValueat(i)) - min.get(mark))
                          / (max.get(mark) - min.get(mark))),
                      4));
          mark++;

        } else {
          rec.addValue(data.getRecordAt(k).getValueat(i));
        }
      }

      temp.addRecord(rec);
    }

    return temp;
  }