Skip to content
Snippets Groups Projects
Commit 164fc16b authored by aastorg2's avatar aastorg2
Browse files

merging

parent f25aadeb
No related branches found
No related tags found
No related merge requests found
...@@ -22,6 +22,7 @@ def load_positive_examples(file_name: str) -> List[Tuple[float, ...]]: ...@@ -22,6 +22,7 @@ def load_positive_examples(file_name: str) -> List[Tuple[float, ...]]:
truth_samples_seq = [(t, [s for s in raw_samples if not any(np.isnan(s))]) truth_samples_seq = [(t, [s for s in raw_samples if not any(np.isnan(s))])
for t, raw_samples in truth_samples_seq] for t, raw_samples in truth_samples_seq]
# Convert from sampled states and percepts to positive examples for learning # Convert from sampled states and percepts to positive examples for learning
return [ return [
s for _, samples in truth_samples_seq for s in samples s for _, samples in truth_samples_seq for s in samples
] ]
...@@ -82,6 +83,7 @@ def synth_dtree(positive_examples, teacher, num_max_iterations: int = 10): ...@@ -82,6 +83,7 @@ def synth_dtree(positive_examples, teacher, num_max_iterations: int = 10):
past_candidate_list.append(candidate_dnf) past_candidate_list.append(candidate_dnf)
# QUERYING TEACHER IF THERE ARE NEGATIVE EXAMPLES # QUERYING TEACHER IF THERE ARE NEGATIVE EXAMPLES
print(f"number of paths: {len(candidate_dnf)}") print(f"number of paths: {len(candidate_dnf)}")
negative_examples = [] negative_examples = []
for candidate in candidate_dnf: for candidate in candidate_dnf:
result = teacher.check(candidate) result = teacher.check(candidate)
...@@ -112,7 +114,10 @@ def synth_dtree(positive_examples, teacher, num_max_iterations: int = 10): ...@@ -112,7 +114,10 @@ def synth_dtree(positive_examples, teacher, num_max_iterations: int = 10):
print("we are done!") print("we are done!")
return past_candidate_list return past_candidate_list
#if k == 2:
# exit(0)
print("Reached max iteration %d." % num_max_iterations) print("Reached max iteration %d." % num_max_iterations)
return [] return []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment