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

hex.genmodel.algos.targetencoder.EncodingMaps Maven / Gradle / Ivy

There is a newer version: 3.46.0.5
Show newest version
package hex.genmodel.algos.targetencoder;

import java.io.Serializable;
import java.util.*;
import java.util.Map.Entry;

public class EncodingMaps implements Iterable>, Serializable {

  /**
   * Outer Map stores encoding maps for each categorical column.
   * 
   *  Example:
   *    Map( "categorical_col_name_1" ->  EncodingMap ( ... )
   *    Map( "categorical_col_name_2" ->  EncodingMap ( ... )
   */                                       
  private Map _encodingMaps;
  
  public EncodingMaps(Map encodingMaps) {
    _encodingMaps = encodingMaps;
  }

  public EncodingMaps() {
    _encodingMaps = new HashMap<>();
  }

  public EncodingMap get(String categoricalCol) {
    return _encodingMaps.get(categoricalCol);
  } 
  
  public EncodingMap put(String categoricalCol, EncodingMap encodingMap) {
    return _encodingMaps.put(categoricalCol, encodingMap);
  } 
  
  public Map encodingMap() {
    return _encodingMaps;
  }
  
  public Set getColumns() {
    return Collections.unmodifiableSet(_encodingMaps.keySet());
  }

  @Override
  public Iterator> iterator() {
    return _encodingMaps.entrySet().iterator();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy