-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixed online() function for cases where the regret is exactly zero. This can happen if: * * Only a single expert is used * * Only two experts are provided and they both have the same predictions (in the beginning).
- Loading branch information
Showing
4 changed files
with
57 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
skip_if(debug_mode) | ||
# %% Test online "combination" of a single expert | ||
set.seed(1) | ||
|
||
mod <- online( | ||
y = array(rnorm(30), | ||
dim = c(5, 3) | ||
), array(rnorm(30), | ||
dim = c(5, 3, 1) | ||
), | ||
tau = .5, | ||
trace = FALSE | ||
) | ||
|
||
expect_true(all(mod$weights == 1)) | ||
# %% | ||
|
||
|
||
# %% Test online "combination" of two experts that are the same | ||
set.seed(1) | ||
|
||
experts <- array(NA, | ||
dim = c(5, 3, 2) | ||
) | ||
|
||
experts[, , 1] <- array(rnorm(30), | ||
dim = c(5, 3) | ||
) | ||
experts[, , 2] <- experts[, , 1] | ||
|
||
mod <- online( | ||
y = array(rnorm(30), | ||
dim = c(5, 3) | ||
), experts, | ||
tau = .5, | ||
trace = FALSE | ||
) | ||
|
||
expect_true(all(mod$weights == 0.5)) | ||
# %% |