/**
   * 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;
  }
  /**
   * Gets the point in record excluding ID and Class
   *
   * @param attrb header
   * @param recCluster
   * @return array of points
   */
  public String[] getPoints(List<AttributeCluster> attrb, RecordCluster recCluster) {
    List<String> strlist = new ArrayList<String>();

    for (int i = 0; i < attrb.size(); i++) {
      if (attrb.get(i).getType() == TypeAttribute.continuous) {
        strlist.add(recCluster.getValueat(i));
      }
    }

    return (String[]) strlist.toArray(new String[0]);
  }