Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-30122

Flink ML KMeans getting model data throws TypeError

    XMLWordPrintableJSON

Details

    Description

      When the following test case is added to flink-ml-python/pyflink/ml/lib/clustering/tests/test_kmeans.py,

      def test_get_model_data(self):
      kmeans = KMeans().set_max_iter(2).set_k(2)
      model = kmeans.fit(self.data_table)
      model_data = model.get_model_data()[0]
      expected_field_names = ['centroids', 'weights']
      self.assertEqual(expected_field_names, model_data.get_schema().get_field_names())self.t_env.to_data_stream(model_data).execute_and_collect().next()

      The following exception would be thrown.

      data = 0, field_type = DenseVectorTypeInfo
      def pickled_bytes_to_python_converter(data, field_type):
      if isinstance(field_type, RowTypeInfo):
      row_kind = RowKind(int.from_bytes(data[0], 'little'))
      data = zip(list(data[1:]), field_type.get_field_types())
      fields = []
      for d, d_type in data:
      fields.append(pickled_bytes_to_python_converter(d, d_type))
      row = Row.of_kind(row_kind, *fields)
      return row
      else:
      > data = pickle.loads(data)
      E TypeError: a bytes-like object is required, not 'int'

      Attachments

        Activity

          People

            yunfengzhou Yunfeng Zhou
            yunfengzhou Yunfeng Zhou
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: