gregversteeg / bio_corex

A flexible version of CorEx developed for bio-data challenges that handles missing data, continuous/discrete variables, multi-CPU, overlapping structure, and includes visualizations
Apache License 2.0
137 stars 30 forks source link

Model serialization problem: AttributeError: 'Corex' object has no attribute 'pool' #23

Closed cbpaw closed 3 years ago

cbpaw commented 3 years ago

I am trying to use the model created with corex. However when loading the serialized object using pickle, I get the following error message when I am trying to use the transform method.

AttributeError: 'Corex' object has no attribute 'pool'

Could you help me using this model? I get great results using it in experiments!

gregversteeg commented 3 years ago

Hi, yes I remember having some issue with this too. I think is to set the class variable "pool" to None. Like this I think:

corex_object = pickle.load(open(filename, 'rb')) corex_object.pool = None

It has to do with the option for multi-threading that comes from this import: from multiprocessing.dummy import Pool

But it's only useful for training, for transforming new data you don't usually need multiple CPUs.

cbpaw commented 3 years ago

Hi greg,

This fixed the issue in my code! Thanks alot!