All Downloads are FREE. Search and download functionalities are using the official Maven repository.

hex.genmodel.easy.EnumEncoderDomainMapConstructor Maven / Gradle / Ivy

There is a newer version: 3.46.0.6
Show newest version
package hex.genmodel.easy;

import hex.genmodel.GenModel;

import java.util.HashMap;
import java.util.Map;

public class EnumEncoderDomainMapConstructor extends DomainMapConstructor {
  
  public EnumEncoderDomainMapConstructor(GenModel m, Map columnNameToIndex) {
    super(m, columnNameToIndex);
  }

  @Override
  public Map create() {
    Map domainMap = new HashMap<>();
    String[] columnNames = _m.getNames();
    for (int i = 0; i < _m.getNumCols(); i++) {
      String colName = columnNames[i];
      Integer colIndex = _columnNameToIndex.get(colName);
      String[] domainValues = _m.getDomainValues(i);
      if (domainValues != null) {
        domainMap.put(colIndex, new EnumEncoder(colName, colIndex, domainValues));
      }
    }
    return domainMap;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy