class_docstr: Test creation of the Kmeans model with various parameter and dataset
  configurations.
docstr: Test that the features are selected and screened correctly.
code: def test_features_param(self):
      """
      Test that the features are selected and screened correctly.
      """
  
      ## Default is to get all features from the SFrame.
      m = tc.kmeans.create(self.sf, num_clusters=self.K, verbose=False)
      self.assertItemsEqual(
          m.features,
          [
              "int0",
              "int1",
              "int2",
              "float0",
              "float1",
              "float2",
              "dict0",
          ],
      )
  
      ## The features parameter should be reflected correctly in the model.
      test_ftrs = ["int0", "int1", "int2"]
      m = tc.kmeans.create(
          self.sf,
          num_clusters=self.K,
          features=test_ftrs,
          verbose=False,
      )
      self.assertItemsEqual(m.features, test_ftrs)
  
      ## Missing features are pruned
      m = tc.kmeans.create(
          self.sf,
          num_clusters=self.K,
          features=["int0", "int1", "fossa"],
          verbose=False,
      )
      self.assertItemsEqual(m.features, ["int0", "int1"])
  
      ## Duplicate features are pruned
      test_ftrs = ["int0", "int0", "int1", "int2"]
      m = tc.kmeans.create(
          self.sf,
          num_clusters=self.K,
          features=test_ftrs,
          verbose=False,
      )
      self.assertItemsEqual(m.features, ["int0", "int1", "int2"])
  
      ## Features not specified by a string are pruned.
      test_ftrs = [2.71, "int0", "int1", "int2"]
      m = tc.kmeans.create(
          self.sf,
          num_clusters=self.K,
          features=test_ftrs,
          verbose=False,
      )
      self.assertItemsEqual(m.features, ["int0", "int1", "int2"])
  
      ## Features with non-valid types are pruned.
      sf = copy.copy(self.sf)
      sf["list0"] = sf["dict0"].dict_keys()
  
      test_ftrs = ["list0", "int0", "int1", "int2"]
      m = tc.kmeans.create(
          sf, num_clusters=self.K, features=test_ftrs, verbose=False
      )
      self.assertItemsEqual(m.features, ["int0", "int1", "int2"])
  
      ## Row label is pruned from the feature list.
      sf = sf.add_row_number("row_id")
      test_ftrs = ["row_id", "int0", "int1", "int2"]
      m = tc.kmeans.create(
          sf,
          label="row_id",
          num_clusters=self.K,
          features=test_ftrs,
          verbose=False,
      )
      self.assertItemsEqual(m.features, ["int0", "int1", "int2"])
  
      ## Empty list of features raises an error.
      with self.assertRaises(ValueError):
          m = tc.kmeans.create(
              self.sf, features=[], num_clusters=self.K, verbose=False
          )
  
      ## All features pruned raises an error.
      test_ftrs = ["row_id", "list0"]
      with self.assertRaises(ToolkitError):
          m = tc.kmeans.create(
              sf,
              features=test_ftrs,
              label="row_id",
              num_clusters=self.K,
              verbose=False,
          )
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import unittest
  import copy
  import numpy
  from numpy.testing import assert_allclose
  import turicreate
  from .None import util
  from turicreate.util import _assert_sframe_equal
  from turicreate.toolkits._main import ToolkitError
  import sys
label_desc: Use image node_id 6 for calling the KmeansCreateTest obj's underlying member method code with example usage: obj.test_features_param() without return types