-
-
Notifications
You must be signed in to change notification settings - Fork 489
Save PyGAD output #184
Unanswered
zsbeheshti
asked this question in
Q&A
Save PyGAD output
#184
-
Dear all,
I am using PyGAD and I want to save its outputs. How can I do this?
Regards
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 3 replies
-
Hi @zsbeheshti,
You can use the save()
method to save the instance and then use the load()
function to load it back.
This is an example.
import pygad import numpy function_inputs = [4,-2,3.5,5,-11,-4.7] desired_output = 44 def fitness_func(ga_instance, solution, solution_idx): output = numpy.sum(solution*function_inputs) fitness = 1.0 / (numpy.abs(output - desired_output) + 0.000001) return fitness ga_instance = pygad.GA(num_generations=10, num_parents_mating=10, sol_per_pop=20, num_genes=len(function_inputs), fitness_func=fitness_func, suppress_warnings=True) ga_instance.run() # Saving the GA instance. filename = 'genetic' ga_instance.save(filename=filename) # Loading the saved GA instance. loaded_ga_instance = pygad.load(filename=filename) loaded_ga_instance.plot_fitness()
Beta Was this translation helpful? Give feedback.
All reactions
3 replies
-
Is there another way to save the output so that the saved output can be received and checked in the format of numbers, graphs, etc.?
Beta Was this translation helpful? Give feedback.
All reactions
-
Not yet supported.
Beta Was this translation helpful? Give feedback.
All reactions
-
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment