Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
adaptive
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Quantum Tinkerer
adaptive
Commits
6d7d8e58
Commit
6d7d8e58
authored
7 years ago
by
Bas Nijholt
Browse files
Options
Downloads
Patches
Plain Diff
1D: implement returning of n points for empty learner
parent
f7c63a26
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!4
Implement BalancingLearner
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
adaptive/learner.py
+10
-7
10 additions, 7 deletions
adaptive/learner.py
with
10 additions
and
7 deletions
adaptive/learner.py
+
10
−
7
View file @
6d7d8e58
...
...
@@ -212,7 +212,7 @@ class Learner1D(BaseLearner):
self
.
_oldscale
=
copy
(
self
.
_scale
)
self
.
bounds
=
list
(
bounds
)
self
.
_include
d
_bounds
=
list
(
bounds
)
self
.
_include_bounds
=
list
(
bounds
)
@property
def
data_combined
(
self
):
...
...
@@ -301,9 +301,9 @@ class Learner1D(BaseLearner):
def
add_point
(
self
,
x
,
y
):
real
=
y
is
not
None
# Remove the point from _include
d
_bounds
if
real
and
x
in
self
.
_include
d
_bounds
:
self
.
_include
d
_bounds
.
remove
(
x
)
# Remove the point from _include_bounds
if
x
in
self
.
_include_bounds
:
self
.
_include_bounds
.
remove
(
x
)
if
real
:
# Add point to the real data dict and pop from the unfinished
...
...
@@ -359,10 +359,13 @@ class Learner1D(BaseLearner):
if
n
==
0
:
return
[]
for
bound
in
self
.
_include
d
_bounds
:
for
bound
in
self
.
_include_bounds
:
if
bound
not
in
self
.
data_combined
:
n
=
min
(
n
,
len
(
self
.
_included_bounds
))
return
self
.
_included_bounds
[:
n
]
bounds
=
self
.
_include_bounds
[:
min
(
n
,
len
(
self
.
_include_bounds
))]
if
n
<=
2
:
return
bounds
else
:
return
np
.
linspace
(
*
bounds
,
n
)
def
points
(
x
,
n
):
return
list
(
np
.
linspace
(
x
[
0
],
x
[
1
],
n
,
endpoint
=
False
)[
1
:])
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment