类 KBinsDiscretizer
- java.lang.Object
-
- org.apache.flink.ml.feature.kbinsdiscretizer.KBinsDiscretizer
-
- 所有已实现的接口:
Serializable,org.apache.flink.ml.api.Estimator<KBinsDiscretizer,KBinsDiscretizerModel>,org.apache.flink.ml.api.Stage<KBinsDiscretizer>,org.apache.flink.ml.common.param.HasInputCol<KBinsDiscretizer>,org.apache.flink.ml.common.param.HasOutputCol<KBinsDiscretizer>,KBinsDiscretizerModelParams<KBinsDiscretizer>,KBinsDiscretizerParams<KBinsDiscretizer>,org.apache.flink.ml.param.WithParams<KBinsDiscretizer>
public class KBinsDiscretizer extends Object implements org.apache.flink.ml.api.Estimator<KBinsDiscretizer,KBinsDiscretizerModel>, KBinsDiscretizerParams<KBinsDiscretizer>
An Estimator which implements discretization (also known as quantization or binning) to transform continuous features into discrete ones. The output values are in [0, numBins).KBinsDiscretizer implements three different binning strategies, and it can be set by
KBinsDiscretizerParams.STRATEGY. If the strategy is set asKBinsDiscretizerParams.KMEANSorKBinsDiscretizerParams.QUANTILE, users should further setKBinsDiscretizerParams.SUB_SAMPLESfor better performance.There are several corner cases for different inputs as listed below:
- When the input values of one column are all the same, then they should be mapped to the same bin (i.e., the zero-th bin). Thus the corresponding bin edges are `{Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY}`.
- When the number of distinct values of one column is less than the specified number of bins
and the
KBinsDiscretizerParams.STRATEGYis set asKBinsDiscretizerParams.KMEANS, we switch toKBinsDiscretizerParams.UNIFORM. - When the width of one output bin is zero, i.e., the left edge equals to the right edge of the bin, we replace the right edge as the average value of its two neighbors. One exception is that the last two edges are the same --- in this case, the left edge is updated as the average of its two neighbors. For example, the bin edges {0, 1, 1, 2, 2} are transformed into {0, 1, 1.5, 1.75, 2}.
- 另请参阅:
- 序列化表格
-
-
字段概要
-
从接口继承的字段 org.apache.flink.ml.feature.kbinsdiscretizer.KBinsDiscretizerParams
KMEANS, NUM_BINS, QUANTILE, STRATEGY, SUB_SAMPLES, UNIFORM
-
-
构造器概要
构造器 构造器 说明 KBinsDiscretizer()
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 KBinsDiscretizerModelfit(org.apache.flink.table.api.Table... inputs)Map<org.apache.flink.ml.param.Param<?>,Object>getParamMap()static KBinsDiscretizerload(org.apache.flink.table.api.bridge.java.StreamTableEnvironment tEnv, String path)voidsave(String path)-
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
从接口继承的方法 org.apache.flink.ml.feature.kbinsdiscretizer.KBinsDiscretizerParams
getNumBins, getStrategy, getSubSamples, setNumBins, setStrategy, setSubSamples
-
-
-
-
方法详细资料
-
fit
public KBinsDiscretizerModel fit(org.apache.flink.table.api.Table... inputs)
- 指定者:
fit在接口中org.apache.flink.ml.api.Estimator<KBinsDiscretizer,KBinsDiscretizerModel>
-
getParamMap
public Map<org.apache.flink.ml.param.Param<?>,Object> getParamMap()
- 指定者:
getParamMap在接口中org.apache.flink.ml.param.WithParams<KBinsDiscretizer>
-
save
public void save(String path) throws IOException
- 指定者:
save在接口中org.apache.flink.ml.api.Stage<KBinsDiscretizer>- 抛出:
IOException
-
load
public static KBinsDiscretizer load(org.apache.flink.table.api.bridge.java.StreamTableEnvironment tEnv, String path) throws IOException
- 抛出:
IOException
-
-