darkmachines / high-dimensional-sampling Goto Github PK
View Code? Open in Web Editor NEWFramework for the high-dimensional sampling challenge of DarkMachines.org
License: MIT License
Framework for the high-dimensional sampling challenge of DarkMachines.org
License: MIT License
As learned during the investigation for #64, we are currently without a CI-tool. A new one needs to be found and implemented. Apart from the link to the repo, this should be relatively straightforward, as the tests are still there. Maybe Github Actions is a solution? Not sure, needs investigating.
The number of unit tests is very limited at the moment. This should be expanded such that stability of the package is more guaranteed than it is now.
When the simple function (get_simple_interface()) is passed to Pyscannerbit's scan function, PS uses inspect.getargspec to determine the number of arguments of the function, but it appears to only find one. I've avoided this so far by using 'neg_f = lambda x,y: -simple(x,y)', which is necessary anyway as the functions are defined as the negative of what PS is expecting. However, this line of code would need to be manually altered every time the dimensionality of the function changes. Is there an alternative solution?
Currently the package has 100% coverage, but the unit tests are quite ugly. A lot of stuff is tested multiple times, so there are efficiency gains to be made.
The implementation of AMGPO by the openopt
package does not support Python version >=3.8. As the unit tests currently test the package against Python 3.8 and 3.9, I have disabled the test for AMPGO for now. We need to decide how to deal with unit tests for optimisation algorithms if they are no longer properly supported.
Hi,
I tried running the pyscannerbit example today (on a new Ubuntu 18.04 system), but I got a failure when it couldn't import TurboM. I ended up installing Turbo by hand using:
git clone https://github.com/uber-research/TuRBO
cd TuRBO
python setup.py sdist
pip3 install .
Should we add these instructions to the README? Also, is it good practise to require all algorithms to be present to run any of them? This might hold back users from testing their own technique.
Cheers,
Martin
It seems that there is an issue with the yaml dumper when using the newly-added CMB likelihood test function:
File "rejection_sampling.py", line 91, in
experiment.run(function, finish_line=1000)
File "/home/nicholas/.local/lib/python3.8/site-packages/high_dimensional_sampling/experiments.py", line 247, in run
self._perform_experiment(function, log_data)
File "/home/nicholas/.local/lib/python3.8/site-packages/high_dimensional_sampling/experiments.py", line 88, in _perform_experiment
self.logger.log_experiment(self, function)
File "/home/nicholas/.local/lib/python3.8/site-packages/high_dimensional_sampling/experiments.py", line 620, in log_experiment
yaml.dump(info, handle, default_flow_style=False)
File "/usr/lib/python3/dist-packages/yaml/init.py", line 290, in dump
return dump_all([data], stream, Dumper=Dumper, **kwds)
File "/usr/lib/python3/dist-packages/yaml/init.py", line 278, in dump_all
dumper.represent(data)
File "/usr/lib/python3/dist-packages/yaml/representer.py", line 27, in represent
node = self.represent_data(data)
File "/usr/lib/python3/dist-packages/yaml/representer.py", line 48, in represent_data
node = self.yaml_representers[data_types[0]](self, data)
File "/usr/lib/python3/dist-packages/yaml/representer.py", line 207, in represent_dict
return self.represent_mapping('tag:yaml.org,2002:map', data)
File "/usr/lib/python3/dist-packages/yaml/representer.py", line 118, in represent_mapping
node_value = self.represent_data(item_value)
File "/usr/lib/python3/dist-packages/yaml/representer.py", line 48, in represent_data
node = self.yaml_representers[data_types[0]](self, data)
File "/usr/lib/python3/dist-packages/yaml/representer.py", line 207, in represent_dict
return self.represent_mapping('tag:yaml.org,2002:map', data)
File "/usr/lib/python3/dist-packages/yaml/representer.py", line 118, in represent_mapping
node_value = self.represent_data(item_value)
File "/usr/lib/python3/dist-packages/yaml/representer.py", line 48, in represent_data
node = self.yaml_representers[data_types[0]](self, data)
File "/usr/lib/python3/dist-packages/yaml/representer.py", line 207, in represent_dict
return self.represent_mapping('tag:yaml.org,2002:map', data)
File "/usr/lib/python3/dist-packages/yaml/representer.py", line 118, in represent_mapping
node_value = self.represent_data(item_value)
File "/usr/lib/python3/dist-packages/yaml/representer.py", line 52, in represent_data
node = self.yaml_multi_representers[data_type](self, data)
File "/usr/lib/python3/dist-packages/yaml/representer.py", line 317, in represent_object
reduce = data.reduce_ex(2)
File "stringsource", line 2, in classy.Class.reduce_cython
TypeError: no default reduce due to non-trivial cinit
For now I've just commented out the yaml dumper in line 619 of experiments.py.
Also just a heads up for the rejection sampling example, to find the right ranges for the CMB likelihood it should be ranges = function.ranges not ranges = function.get_ranges(0.01). check_testfunction should have also have function as an attribute.
When using the invert interface on the simple function, the invert applies to the original function as well, which led to the pyscannerbit interface reporting the negative of the actual function values.
simple = function.get_simple_interface_with_scan()
simple.invert(True)
...
y = function(x)
Fixed by returning -function(x)
instead.
When testing the HDS package with Python 3.10, the following error pops up
Processing dependencies for high-dimensional-sampling==0.2.0
Searching for tensorflow
Reading https://pypi.org/simple/tensorflow/
No local packages or working download links found for tensorflow
error: Could not find suitable distribution for Requirement.parse('tensorflow')
I don't really understand where this error comes from, as there are no problems with Python 3.8 and 3.9. The tensorflow website even says that 3.10 is supported...
With regards to interfacing Pyscannerbit with HDS, given that PS does all the sampling, it will need to give the results to HDS so that Bob's plotting routines work. PS can make available vectors containing all sampled points - is there a way for HDS to treat them like it did the sampling itself and record the results?
Experiment running with Rosenbrock function yields the following error message:
`Run experiment for 'RandomOptimisation' on function 'Rosenbrock'...
/home/dm/DarkMachines/high-dimensional-sampling/examples/random_optimisation.py:50: RuntimeWarning: invalid value encountered in add
x = x * (r[:, 1] - r[:, 0]) + r[:, 0]
/home/dm/anaconda3/envs/DarkMachine/lib/python3.8/site-packages/high_dimensional_sampling/functions.py:186: RuntimeWarning: invalid value encountered in less
if np.any(d < 0.0) or np.any(d > 1.0):
/home/dm/anaconda3/envs/DarkMachine/lib/python3.8/site-packages/high_dimensional_sampling/functions.py:186: RuntimeWarning: invalid value encountered in greater
if np.any(d < 0.0) or np.any(d > 1.0):
Traceback (most recent call last):
File ~/DarkMachines/high-dimensional-sampling/examples/random_optimisation.py:75 in
experiment.run(function, finish_line=1000)
File ~/anaconda3/envs/DarkMachine/lib/python3.8/site-packages/high_dimensional_sampling/experiments.py:247 in run
self._perform_experiment(function, log_data)
File ~/anaconda3/envs/DarkMachine/lib/python3.8/site-packages/high_dimensional_sampling/experiments.py:114 in _perform_experiment
self._event_new_samples(x, y)
File ~/anaconda3/envs/DarkMachine/lib/python3.8/site-packages/high_dimensional_sampling/experiments.py:352 in _event_new_samples
self.best_x, self.best_y = self._find_minima(x, y, self.best_x,
File ~/anaconda3/envs/DarkMachine/lib/python3.8/site-packages/high_dimensional_sampling/experiments.py:317 in _find_minima
return x_candi[indices], y_candi[indices]
IndexError: arrays used as indices must be of integer (or boolean) type
`
For some reason I cannot debug anything in this project, :(
With the implementation in pull request #42, is the plotting code in the results submodule still needed?
The repository houses both the code for the high-dimensional-sampling package and the source code for the paper. After a disucssion with Will (#1) I made the master branch of the repository only changable by pull request. For the code of the package this is absolutely awesome, for the paper less so, as it halts the work people do on it a bit. I already got the first questions about why people were not able to push their paper additions to the repo.
I can of course allow pushing to the repository again, losing the advantages it gives to code stability. On the other hand, it might also be worthwhile to move the paper to a system like overleaf, which -- with its in-browser editor -- might be easier to use for most people.
Hi,
Working on a new Ubuntu 18.04 desktop, I just got a problem with the installation of the hidden functions. For some reason, the pip install put them here:
~/.local/lib/python3.6/site-packages/high_dimensional_sampling/hidden_functions/
instead of here:
~/.local/lib/python3.6/site-packages/high_dimensional_sampling/hidden_functions/18.04/
so that the function that checks the compiled version failed at runtime. Making the directory by hand and moving the test functions into it cured the problem.
This worked fine on my Ubuntu 18.04 laptop! So I'm not sure how we can debug this.
Cheers,
Martin
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.