79310986

Date: 2024-12-27 05:39:39
Score: 0.5
Natty:
Report link

How I got it to work for me after I got this error was by recreating the environment used to save it.

Example save:

creator.create("FitnessMax", base.Fitness, weights=(1.0,))
creator.create("Individual", list, fitness=creator.FitnessMax)
# ...
# ...
top_individual = tools.selBest(population, 1)[0]

with open(file_location, 'wb') as file:
    pickle.dump(top_individual, file)

Example Load:

creator.create("FitnessMax", base.Fitness, weights=(1.0,))
creator.create("Individual", list, fitness=creator.FitnessMax)

with open(file_location, 'rb') as file:
    top_individual = pickle.load(file)

Hopefully this helps someone that has this problem. However in the future maybe try saving it more accessibly or just use it in the same environment

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Starts with a question (0.5): How I
  • Low reputation (1):
Posted by: Kevin