AttributeError: 'KmeansModel' object has no attribute 'predict'

User 2978 | 1/28/2016, 1:02:57 PM

I want to use the KmeansModel.predict method for my new data:

 km = gl.load_model('/foo/bar/saved_kmeans_models')
 km.predict(sf_new, output_type='cluster_id')

However, I got this error:

 AttributeError: 'KmeansModel' object has no attribute 'predict'

Comments

User 12 | 1/28/2016, 7:48:24 PM

Hi @JonBaker, The predict method for Kmeans is new in GL Create version 1.8. The first thing to check is that you're running this latest version. What do you see with gl.version?

Thanks, Brian


User 2978 | 1/28/2016, 11:34:55 PM

@brian Thanks, upgrading to the latest version solved the problem.