com.flipkart.fdp.ml.adapter.IfZeroVectorModelInfoAdapter Maven / Gradle / Ivy
package com.flipkart.fdp.ml.adapter;
import com.flipkart.fdp.ml.IfZeroVector;
import com.flipkart.fdp.ml.modelinfo.IfZeroVectorModelInfo;
import org.apache.spark.sql.DataFrame;
import java.util.LinkedHashSet;
import java.util.Set;
/**
* Transforms {@link IfZeroVector} to {@link IfZeroVectorModelInfo} object
* that can be exported through {@link com.flipkart.fdp.ml.export.ModelExporter}
*/
public class IfZeroVectorModelInfoAdapter extends AbstractModelInfoAdapter {
@Override
public IfZeroVectorModelInfo getModelInfo(final IfZeroVector from, DataFrame df) {
IfZeroVectorModelInfo modelInfo = new IfZeroVectorModelInfo();
Set inputKeys = new LinkedHashSet();
inputKeys.add(from.getInputCol());
modelInfo.setInputKeys(inputKeys);
Set outputKeys = new LinkedHashSet();
outputKeys.add(from.getOutputCol());
modelInfo.setOutputKeys(outputKeys);
modelInfo.setThenSetValue(from.getThenSetValue());
modelInfo.setElseSetCol(from.getElseSetCol());
return modelInfo;
}
@Override
public Class getSource() {
return IfZeroVector.class;
}
@Override
public Class getTarget() {
return IfZeroVectorModelInfo.class;
}
}