类 KMeansModelData


  • public class KMeansModelData
    extends Object
    Model data of KMeansModel and OnlineKMeansModel.

    This class also provides methods to convert model data from Table to Datastream, and classes to save/load model data.

    • 字段详细资料

      • centroids

        public org.apache.flink.ml.linalg.DenseVector[] centroids
      • weights

        public org.apache.flink.ml.linalg.DenseVector weights
        The weight of the centroids. It is used when updating the model data in online training process.

        KMeansModelData objects generated during KMeans.fit(Table...) also contains this field, so that it can be used as the initial model data of the online training process.

    • 构造器详细资料

      • KMeansModelData

        public KMeansModelData​(org.apache.flink.ml.linalg.DenseVector[] centroids,
                               org.apache.flink.ml.linalg.DenseVector weights)
      • KMeansModelData

        public KMeansModelData()
    • 方法详细资料

      • generateRandomModelData

        public static org.apache.flink.table.api.Table generateRandomModelData​(org.apache.flink.table.api.bridge.java.StreamTableEnvironment tEnv,
                                                                               int k,
                                                                               int dim,
                                                                               double weight,
                                                                               long seed)
        Generates a Table containing a KMeansModelData instance with randomly generated centroids.
        参数:
        tEnv - The environment where to create the table.
        k - The number of generated centroids.
        dim - The size of generated centroids.
        weight - The weight of the centroids.
        seed - Random seed.
      • getModelDataStream

        public static org.apache.flink.streaming.api.datastream.DataStream<KMeansModelData> getModelDataStream​(org.apache.flink.table.api.Table modelData)
        Converts the table model to a data stream.
        参数:
        modelData - The table model data.
        返回:
        The data stream model data.