Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolving Issue # 23 Unary ops #25

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Conversation

rll2021
Copy link

@rll2021 rll2021 commented Feb 10, 2021

Sorry, my local repo. got confused. I have now placed the modified files in the correct locations.

@kstaats
Copy link
Owner

kstaats commented Feb 10, 2021 via email

@rll2021
Copy link
Author

rll2021 commented Feb 10, 2021

I also promised a look at the .pdf documentation.

  1. p. 4 "$ python karoo_gp..." everywhere --> "$ python karoo-gp..."
  2. p. 4 Furthermore, there is no file named "karoo_gp_main.py", or anything similar.
  3. p. 10 Diagram at bottom shows arity 3. This case is known to fail, although it is still in the code.
  4. p. 11 Paragraph 3 through end of page needs to be reworked, removing all discussion about binarizing unary operators.
  5. p. 14 "population_final.csv" --> "population_f.csv"

@kstaats
Copy link
Owner

kstaats commented Feb 11, 2021 via email

@rll2021
Copy link
Author

rll2021 commented Apr 1, 2021

Since these changes touch a lot of code, I am holding further pull requests pending merge of this #25.

@kstaats
Copy link
Owner

kstaats commented Apr 2, 2021 via email

@@ -1048,16 +1051,17 @@ def fx_eval_label(self, tree, node_id):
node_id = int(node_id)

if tree[8, node_id] == '0': # arity of 0 for the pattern '[term]'
return '(' + tree[6, node_id] + ')' # 'node_label' (function or terminal)
return tree[6, node_id] # 'node_label' (function or terminal)
Copy link
Owner

@kstaats kstaats Apr 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return tree[6, node_id] # 'node_label' (function or terminal)
return tree[6, node_id] # 'node_label' (function or terminal) # rll 20210201

Thank you for all of the tags! Let's just make certain all of your changes have the same.

@kstaats
Copy link
Owner

kstaats commented Apr 5, 2021

Richard,

Per our prior communications, I truly appreciate all the work and effort you have put into Karoo GP. I cloned your branch and ran it through a number of tests, to determine if the overall behavior had in any way changed, as compared to the prior version. While you were successful in enabling the unary operators (cos, sin, log, etc.), some of the basic, built-in tests can no longer be solved, or best case, are solved with far more complicated, evolved solutions. This is due to the introduction of potentially several new layers of () which both change the result of the mathematical expression, and keep it from being simplified to something human readable.

An example is to use the Matching function set to a min/max depth of 5:

ORIGINAL
The leading Trees and their associated expressions are:
1 : a + b + c
2 : a + b + c
3 : a + b + c
4 : a + b + c
5 : a + b + c
6 : a + b + c
7 : a + b + c
8 : a + b + c
9 : a + b + c
10 : a + b + c
...

for a perfect score of 10.

MODIFIED
Tree 1 yields (sym): c + c/a
Tree 2 yields (sym): a - b + c + c/a
Tree 3 yields (sym): c + c/a
Tree 4 yields (sym): c + c/a
Tree 5 yields (sym): c + c/a
Tree 6 yields (sym): b/a
Tree 7 yields (sym): (a + b)((a + c/a)(-ac - a + c) + (b - c)/(a - c))/((bc + b + c)(ab/(b + c*(b - c)(ac + a)) - a + bc - c))
Tree 8 yields (sym): c + c/a2
Tree 9 yields (sym): a - b + c + c/a
Tree 10 yields (sym): -a - b
2 + b + 2
c + c/a
...

where not a single tree was able to find the correct solution, over multiple runs.

With the Iris Dataset Classification, there is a known, correct solution (see the PDF included in the files/Iris_Dataset PDF).

Also, the NaN and -INF solutions, which are much appreciated may also lead to changed results (in at least one of the tests I ran). Let's take this conversation off-thread and see if we can't find a mutually beneficial solution.

@kstaats
Copy link
Owner

kstaats commented Apr 5, 2021

I have updated and uploaded the revised User Guide. Yes, a number of references to old versions of the code, prior to the prep for PIP install (coming soon!). Thanks Richard!

In fx_data_params_write, mis-initialization of fitness_best prevented
Classify and Match from working.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants