Comments (5)
originally posted by Bas Nijholt (@basnijholt) at 2018-11-19T15:24:43.030Z on GitLab
This is actually a really great way of using it.
This means that if 'fname' does not exist this method silently fails. IMO it is the caller's responsibility to catch any errors.
That doesn't happen, because this is always called.
from adaptive.
originally posted by Joseph Weston (@jbweston) at 2018-11-19T17:12:48.672Z on GitLab
This is actually a really great way of using it.
I don't understand what this means.
If I call learner.load('doesnotexistlol')
I would expect it to raise an exception and tell me that the file does not exist. Is it not confusing if your script just carries on with no data in the learner?
from adaptive.
originally posted by Joseph Weston (@jbweston) at 2018-12-07T13:55:14.137Z on GitLab
So it seems that there is a difference between what we both consider as sane behaviour.
My understanding of the arguments is as follows
Raise an exception when loading from a data file that does not exist
This makes sense because most other APIs that deal with reading files raise exceptions when the files don't exist, e.g. open()
.
If you write code that says "load some data from file X" then your expectation is that there exists a file X with loadable data
in it, and we should load this data. If any of these assumptions is false, an exception should be raised.
My opinion is that we should not make too many decisions for users. In this instance that means that we should err on the side of giving back
more information than necessary (raising an exception), rather than too little.
Silently continuing and not loading any data
This makes sense because it means that the code used in the workflow of @basnijholt can be more streamlined.
Instead of
try:
learner.load('data.txt')
except:
pass
...
we can write
learner.load('data.txt')
...
from adaptive.
originally posted by Joseph Weston (@jbweston) at 2018-12-07T13:56:30.174Z on GitLab
@jorn @anton-akhmerov opinions
from adaptive.
originally posted by Bas Nijholt (@basnijholt) at 2018-12-07T14:01:07.991Z on GitLab
The silencing is useful when running a BalancingLearner
with some parameters combinations only and then the next time adding some parameter.
like (from the documentation)
def combo_fname(learner):
val = learner.function.keywords # because functools.partial
fname = '__'.join([f'{k}_{v}.pickle' for k, v in val])
return 'data_folder/' + fname
def f(x, a, b):
return a * x**2 + b
combos = adaptive.utils.named_product(a=[1, 2], b=[1])
learners = [Learner1D(functools.partial(f, **combo), (-1, 1)) for combo in combos]
learner = BalancingLearner(learners)
runner = adaptive.Runner(learner)
learner.save(combo_fname) # use 'load' in the same way
Then you change
combos = adaptive.utils.named_product(a=[1, 2], b=[1, 2, 3])
and a part of the data will be loaded.
from adaptive.
Related Issues (20)
- Incompatibility of adaptive (asyncio) with python=3.10 HOT 4
- Stop using atomic writes HOT 2
- Documentation: use cases of coroutine by Learner and Runner not properly explained HOT 2
- Rename master branch to main HOT 3
- Fix branch name (master --> main) in binder link in readme HOT 1
- No module named 'typing_extensions'" HOT 2
- Learner2D.interpolator and Learner2D.interpolated_on_grid give different results HOT 5
- Target function returns NaN HOT 5
- Use in script with BlockingRunner: get log and/or feedback on progress HOT 4
- Handling with regions unreachable inside the `ConvexHull` in `LearnerND` HOT 2
- large delay when using start_periodic_saving
- Create API for just signle process (No pickle) HOT 2
- Efficient sampling of measurment bound functions: BatchExecutor? HOT 2
- Question on uncertainty quantification HOT 2
- Issues with Multiprocess and AsyncRunner in adaptive for Phase Diagram Illustration HOT 2
- Async Running Problem with AsyncRunner HOT 2
- Normalize variabels HOT 4
- Question: is this applicable for time series?
- [Question] Calculate loss given resampled data
- LearnerND not loading properly HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adaptive.