-
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.
Added a try_higher_curves production rule (trying higher polynomials …
…or PER and discouraging SE if present) Deemed the LIN with offset sufficiently better than without (it identifies the roots after all)
- Loading branch information
Showing
7 changed files
with
87 additions
and
33 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
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 |
---|---|---|
@@ -1,16 +1,29 @@ | ||
import numpy as np | ||
|
||
from GPy_ABCD.Util.kernelUtil import doGPR | ||
from GPy_ABCD.Kernels.linearKernel import Linear | ||
from GPy_ABCD.Kernels.linearOffsetKernel import LinearWithOffset | ||
from GPy_ABCD.Kernels.baseKernels import C | ||
from GPy_ABCD.Kernels.baseKernels import C, __USE_LIN_KERNEL_HORIZONTAL_OFFSET | ||
from GPy_ABCD.KernelExpansion.kernelExpression import * | ||
from GPy_ABCD.Util.dataAndPlottingUtil import * | ||
from GPy_ABCD.Util.kernelUtil import doGPR, score_ps, BIC, AIC, AICc | ||
from GPy_ABCD.Models.modelSearch import fit_model_list_parallel | ||
|
||
|
||
X, Y = generate_data(lambda x: 2 * x + 20, np.linspace(-20, 20, 201), 1, 0.5) | ||
# kernel = Linear(1) | ||
kernel = Linear(1) + C() | ||
# X, Y = generate_data(lambda x: 2 * x + 20, np.linspace(-20, 20, 201), 1, 0.5) | ||
# # kernel = Linear(1) | ||
# # kernel = Linear(1) + C() | ||
# kernel = LinearWithOffset(1) | ||
|
||
|
||
m = doGPR(X, Y, kernel, 5) | ||
X, Y = generate_data(lambda x: (x - 2) * (x + 3), np.linspace(-20, 20, 201), 1, 1) | ||
# kernel = Linear(1) * Linear(1) | ||
# kernel = Linear(1) * Linear(1) + C() | ||
# kernel = ProductKE(['LIN', 'LIN']).to_kernel() | ||
kernel = SumKE(['C'], [ProductKE(['LIN', 'LIN'])]).to_kernel() | ||
# kernel = LinearWithOffset(1) * LinearWithOffset(1) | ||
# kernel = LinearWithOffset(1) * LinearWithOffset(1) + C() | ||
|
||
|
||
m = doGPR(X, Y, kernel, 5, BIC) | ||
|
||
# VERDICT: LinearWithOffset is just better: better fits (even accounting for extra params) which is interpretable (the offsets are just roots) |
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 |
---|---|---|
@@ -1,14 +1,18 @@ | ||
import numpy as np | ||
|
||
from GPy_ABCD.Util.kernelUtil import doGPR | ||
from GPy_ABCD.Util.dataAndPlottingUtil import generate_data | ||
from GPy_ABCD.Kernels.baseKernels import * | ||
import numpy as np | ||
|
||
# np.seterr(all='raise') # Raise exceptions instead of RuntimeWarnings. The exceptions can then be caught by the debugger | ||
|
||
|
||
X = np.linspace(-10, 10, 101)[:, None] | ||
|
||
Y = np.cos( (X - 5) / 2 )**2 * 7 + np.random.randn(101, 1) * 1 #- 100 | ||
# X, Y = generate_data(lambda x: np.cos( (x - 5) / 2 )**2, np.linspace(-10, 10, 101), 7, 1) | ||
X, Y = generate_data(lambda x: np.cos( (x - 5) / 2 )**2 + 10, np.linspace(-10, 10, 101), 7, 1) | ||
|
||
doGPR(X, Y, PER + C, 10) | ||
|
||
# doGPR(X, Y, PER(), 10) | ||
doGPR(X, Y, PER() + C(), 10) | ||
|
||
# doGPR(X, Y, SE(), 10) | ||
# doGPR(X, Y, SE() + C(), 10) |
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