Skip to content

Commit

Permalink
Update GuacaMol binding to work single threaded with default GuacaMol…
Browse files Browse the repository at this point in the history
… implementation
  • Loading branch information
jleguy committed Feb 6, 2021
1 parent 6b0a2f0 commit f5346cf
Show file tree
Hide file tree
Showing 28 changed files with 690 additions and 740 deletions.
16 changes: 8 additions & 8 deletions evomol/guacamol_binding.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,23 +138,23 @@ def _get_benchmark_name(self, curr_benchmark_id):
return benchmark_names_list[curr_benchmark_id]

def generate_optimized_molecules(self, scoring_function: ScoringFunction, number_molecules: int,
starting_population: Optional[List[str]] = None, name=None) -> List[str]:
starting_population: Optional[List[str]] = None) -> List[str]:

instance = self.pop_alg.copy_instance_with_parameters()

# Updating benchmark id
self.curr_benchmark_id += 1

# Extracting benchmark name
# curr_benchmark_name = self._get_benchmark_name(self.curr_benchmark_id)
curr_benchmark_name = self._get_benchmark_name(self.curr_benchmark_id)

# Setting folder to save the results
# instance.output_folder_path = join(self.output_save_path, curr_benchmark_name)
instance.output_folder_path = join(self.output_save_path, name)
instance.output_folder_path = join(self.output_save_path, curr_benchmark_name)
# instance.output_folder_path = join(self.output_save_path, name)

# Extracting GuacaMol evaluation function
guacamol_evaluation_strategy = GuacamolEvaluationStrategy(scoring_function, name)
# guacamol_evaluation_strategy = GuacamolEvaluationStrategy(scoring_function, curr_benchmark_name)
# guacamol_evaluation_strategy = GuacamolEvaluationStrategy(scoring_function, name)
guacamol_evaluation_strategy = GuacamolEvaluationStrategy(scoring_function, curr_benchmark_name)

# Merging the evaluation strategy of the PopAlg instance to the GuacaMol objective
if isinstance(instance.evaluation_strategy, UndefinedGuacaMolEvaluationStrategy):
Expand All @@ -166,8 +166,8 @@ def generate_optimized_molecules(self, scoring_function: ScoringFunction, number
instance.mutation_strategy.evaluation_strategy = instance.evaluation_strategy

# Setting additional stop criterion, stopping the execution when best possible score is obtained
# instance.kth_score_to_record_key = curr_benchmark_name
instance.kth_score_to_record_key = name
instance.kth_score_to_record_key = curr_benchmark_name
# instance.kth_score_to_record_key = name
additional_stop_criterion = KthScoreMaxValue(1, round=3)
instance.stop_criterion_strategy.set_additional_strategy(additional_stop_criterion)
instance.stop_criterion_strategy.set_pop_alg_instance(instance)
Expand Down
13 changes: 12 additions & 1 deletion evomol/test/1_test_evaluation_functions/0_qed/errors.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
step,error
0,No more individual to be mutated
7,No improver found
8,No improver found
8,No improver found
8,No improver found
8,No improver found
9,No improver found
9,No improver found
9,No improver found
9,No improver found
9,No improver found
9,No improver found
Expand All @@ -12,9 +19,13 @@ step,error
10,No improver found
10,No improver found
10,No improver found
10,No improver found
11,No improver found
11,No improver found
11,No improver found
11,No improver found
11,No improver found
11,No improver found
12,No improver found
12,No improver found
12,No improver found
13,No improver found
Expand Down
20 changes: 10 additions & 10 deletions evomol/test/1_test_evaluation_functions/0_qed/pop.csv
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
smiles,n_success_mut,n_failures_mut,qed,total,history_data
CC(P)CC1(P)CCNCC(P)OC1C(F)P,0,0,0.8041986616768374,0.8041986616768374,C
CC(P)CC1(P)C(C(F)P)CCNN1P,0,0,0.7991116063365711,0.7991116063365711,
CC(P)CC1(P)C(P)NCCCC1C(F)P,3,0,0.7902886802816198,0.7902886802816198,
CC(P)CC1(C(F)PP)CCCNN(P)C1,0,0,0.8034416419846797,0.8034416419846797,
CC(P)CC1(C(F)P)CCCNN(P)C1P,2,0,0.8054178782221852,0.8054178782221852,
CC(P)CC1C(C(F)PP)CCCNN1P,0,0,0.803440939217587,0.803440939217587,
CC(P)CC1(C(P)CF)CCCNN(P)C1P,0,0,0.8016037613062327,0.8016037613062327,
CC(P)CC1(P)CNCC(P)OC1C(F)P,1,0,0.8000467663981665,0.8000467663981665,
CC(P)CC1(P)C(C(F)CP)CCCNN1P,0,0,0.8016037613062327,0.8016037613062327,
CC(P)CC1(P)C(C(F)P)CCCNN1P,4,0,0.8054178782221852,0.8054178782221852,
CC1CC2COCC1C2C1(CC(O)CP)PC1F,3,0,0.8054397332661329,0.8054397332661329,C
OCCC1(C(CP)C2CCCCOC2)PC1F,4,0,0.7836245688754945,0.7836245688754945,
CC1COCCC(C2(CC(O)CP)CP2)C1,0,0,0.7862322704733017,0.7862322704733017,
CC1(C2(CC(O)CP)PC2F)C2CCC1COC2,0,0,0.8063275495325761,0.8063275495325761,
OC(CP)CC1(C2CC3CCC2COC3)PC1F,1,0,0.806327549532576,0.806327549532576,
CC(O)C1(C2C3COCC2C(C)(P)C3)PC1F,0,0,0.7829783965622259,0.7829783965622259,
OCCC1(C(CP)C2CCCCCOC2)PC1F,1,0,0.7901287439413213,0.7901287439413213,
OC(CP)CC1(C2C3CCC2COC3)PC1F,3,0,0.7971491942494499,0.7971491942494499,
OCCC1CCCCOCC1C(OP)C1PC1F,0,0,0.7914549818740849,0.7914549818740849,
OCCC1CC(F)CCOCC1C(CP)C1PC1F,1,0,0.7908670554197845,0.7908670554197845,
Loading

0 comments on commit f5346cf

Please sign in to comment.