-
Notifications
You must be signed in to change notification settings - Fork 75
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
New YAML parser interface #715
Conversation
@@ -46,7 +45,7 @@ SPRegion::SPRegion(const ValueMap &values, Region *region) | |||
args_.columnCount = values.getScalarT<UInt32>("columnCount", 0); | |||
args_.potentialRadius = values.getScalarT<UInt32>("potentialRadius", 0); | |||
args_.potentialPct = values.getScalarT<Real32>("potentialPct", 0.5); | |||
args_.globalInhibition = values.getScalarT<bool>("globalInhibition", true); | |||
args_.globalInhibition = values.getScalarT<bool>("globalInhibition", false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use True as default, local inh is quite slow, and global is the default in the SP class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use True as default,
Well...the problem is that this PR does change behavior slightly. In the past the defaults from the Spec were incorporated in values
. The default given here was never used. The new behavior is that the defaults in the Spec are NOT included in values
and therefore this default is now being used.
What I did was change these values to be the same as what was given in the Spec so that the default parameters passed on to the SP algorithm are unchanged.
Now, if you want to change the default to True in this case, then you must also change the expected results in the tests. I agree that the default here should be the same as the defaults used by SP but that sounds like a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I did was change these values to be the same as what was given in the Spec so that the default parameters passed on to the SP algorithm are unchanged.
ok, thanks for explanation, this is fine. also for other on the same topic 👍
I agree that the default here should be the same as the defaults used by SP but that sounds like a separate PR.
yep, let's keep that for another pr
@breznak I need your help. I know I must be doing something stupid but I cannot find it. When I run the python unit tests I get 4 errors in NetworkTest.py. lines 164, 244, 264, 328. All three are the same error.
I need someone with more Python experience to take a look at this. It could be something to do with the bindings for addRegion( ) but I made no changes to it. Where I did make changes is in I will appreciate any help I can get on this. |
I gave up too soon...found the problem. |
Do you intend to keep options for both libraries, or we decide for one over another? |
I don't know yet.
At no time will we have both libraries compiled at the same time. |
There are still some things I do not like about the Value class.
At the moment I am working on PyBindRegion.cpp and trying to get it to work with the new Value class. The GridCellLocationRegion.py uses parameters orientation and scale which are arrays of floats. That was not handled correctly. But in general, the Spec limits the complexity of the parameter structure to flat mapped values or one dimensional arrays. I would expect new Regions (or encoders) to need a much richer parameter structure. But for now we are limited to this. |
I want to tighten up the Value class before we merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Big congratulations for making this work, David! 🎉
I'm happy to see the cleanup and the new code has a really helpful docs 👍
- small comments below
- README might need updates as it mentions libyaml-cpp
- I'm looking forward to the simplification with pointers you're mentioning
- are we completely happy with
libayml
, or it too has its pros & cons?
Thank you!
elif(EXISTS ${REPOSITORY_DIR}/build/ThirdParty/share/libyaml.tar.gz) | ||
set(URL ${REPOSITORY_DIR}/build/ThirdParty/share/libyaml.tar.gz) | ||
else() | ||
set(URL "https://github.com/yaml/libyaml/archive/master.zip") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use a fixed release/tag/commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use a fixed release/tag/commit
The current release is 0..2.2 but it did not build.
so as mentioned in the comments, we have to use the master repository until they release again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have to use the master repository until they release again.
yes, but use specific commit that works, so the "version" is fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do I do that? I think I can only have access to whatever is the latest in the archives.
| Value object - a container for data structures that have been parsed | ||
| from a YAML or JSON string. It can hold any structure that can be | ||
| parsed from these but does not implement Alias or reference features. | ||
| YAML is a superset of JSON format but we only use the JSON compatible features. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we use a JSON parser then? (not that we need, if libyaml works good)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we use a JSON parser
Yes, we could. But I would rather handle both JSON and Yaml.
I was able to get rid of the assigned_ feature so this is a little cleaner. Not sure it is much simpler however. The zombies make it difficult to follow the code but I could not think of a better way to have a place to hold the keys and parent from a lookup until an assignment is made. yaml-cpp and rapidyaml used zombies as well. libyaml did not have a tree. While I was at it, I added some thread locks so I think this should be threadsafe. I did not confirm that it is threadsafe...that would be a major test effort that is probably not worth it at this point. |
The downloader for yaml-cpp is still in the package although not used. I would like to keep that for a little while to make sure that libyaml continues to work ok for us. With the addition of this package, the end users of the library should not see anything different. However it does a few things for us.
In general it was much more work that should have been devoted to a low priority bug. :-) |
Oh, another idea as to how to simplify some more... |
Yes, using the parent's core as the parent_ pointer on each node helped somewhat. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does look pretty good!
Thanks for the improved doc & the thread-safety is a nice touch too!
Continuation of PR #282