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

hex.genmodel.easy.EigenEncoderDomainMapConstructor 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 EigenEncoderDomainMapConstructor extends DomainMapConstructor {
  
  public EigenEncoderDomainMapConstructor(GenModel m, Map columnNameToIndex) {
    super(m, columnNameToIndex);
  }

  @Override
  public Map create() {
    Map domainMap = new HashMap<>();
    String[] columnNames = _m.getOrigNames();
    int pos = 0;
    for (int i = 0; i < _m.getOrigNumCols(); i++) {
      String colName = columnNames[i];
      Integer colIndex = _columnNameToIndex.get(colName);
      String[] domainValues = _m.getOrigDomainValues()[i];
      if (domainValues != null) {
        double[] targetProjectionArray = new double[domainValues.length];
        System.arraycopy(_m.getOrigProjectionArray() , pos, targetProjectionArray, 0, domainValues.length);
        pos += domainValues.length;
        domainMap.put(colIndex, new EigenEncoder(colName, colIndex, domainValues, targetProjectionArray));
      }
    }
    return domainMap;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy