hengzhe-zhang / EvolutionaryForest

An open source python library for automated feature engineering based on Genetic Programming
GNU Lesser General Public License v3.0
134 stars 23 forks source link

Cannot Pickle the final model #77

Closed arashag closed 2 years ago

arashag commented 2 years ago

Description

I tried to pickle the final model, and save it into the disk using Colab. However, I received the following error. Furthermore, I tried joblib and dill packages but received the same error.

What I Did

with open('test.pkl', 'wb') as file:  
    pickle.dump(r, file)

Exception:

PicklingError Traceback (most recent call last) in () 1 with open(f'{curr}.pkl', 'wb') as file: ----> 2 pickle.dump(r, file)

PicklingError: Can't pickle <function cxOnePoint_multiple_gene at 0x7f7adbcde320>: it's not the same object as evolutionary_forest.multigene_gp.cxOnePoint_multiple_gene

hengzhe-zhang commented 2 years ago

Sorry, I'm not sure what is the reason for this error. Maybe you can see my codes about how to pickle the final model to find the reason.

arashag commented 2 years ago

It worked for me. I think the issue might be due to the pool attribute that should be deleted. Thanks.