hex.genmodel.algos.targetencoder.EncodingMaps Maven / Gradle / Ivy
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();
}
}