-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make shared pointer available in python for DataMatrix, DataVector an…
…d Grid; ignoring ambiguous declaration of doTransformation in python interface
- Loading branch information
Fabian Franzelin
committed
Mar 13, 2016
1 parent
932ed12
commit 9514d92
Showing
14 changed files
with
123 additions
and
53 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,52 @@ | ||
from pysgpp.extensions.datadriven.uq.dists import SGDEdist | ||
from pysgpp import (RegularGridConfiguration, Linear, LinearBoundary, | ||
AdpativityConfiguration, | ||
SLESolverConfiguration, | ||
RegularizationConfiguration, Laplace, | ||
LearnerSGDEConfiguration, | ||
DataVector, DataMatrix, Grid, LearnerSGDE) | ||
from pysgpp.extensions.datadriven.uq.dists import SGDEdist, TNormal, J | ||
from pysgpp import DataMatrix | ||
import numpy as np | ||
|
||
dist = SGDEdist.byLearnerSGDE(samples, gridConfig, adaptConfig, solverConfig, | ||
regularizationConfig, learnerConfig) | ||
# -------------------- prepare data | ||
U = J([TNormal(0.5, 0.06, 0, 1)]) | ||
np.random.seed(12345) | ||
samples = DataMatrix(U.rvs(1000)) | ||
# ---------- using SGDE from SG++ ------------------------ | ||
gridConfig = RegularGridConfiguration() | ||
gridConfig.dim_ = U.getDim() | ||
gridConfig.level_ = 6 | ||
gridConfig.type_ = LinearBoundary | ||
|
||
adaptConfig = AdpativityConfiguration() | ||
adaptConfig.noPoints_ = 10 | ||
adaptConfig.numRefinements_ = 0 | ||
|
||
solverConfig = SLESolverConfiguration() | ||
solverConfig.maxIterations_ = 100 | ||
solverConfig.eps_ = 1e-10 | ||
solverConfig.threshold_ = 1e-10 | ||
|
||
regularizationConfig = RegularizationConfiguration() | ||
regularizationConfig.regType_ = Laplace | ||
|
||
learnerConfig = LearnerSGDEConfiguration() | ||
learnerConfig.doCrossValidation_ = False | ||
learnerConfig.kfold_ = 0 | ||
learnerConfig.lambdaStart_ = 1e-1 | ||
learnerConfig.lambdaEnd_ = 1e-10 | ||
learnerConfig.lambdaSteps_ = 0 | ||
learnerConfig.logScale_ = True | ||
learnerConfig.shuffle_ = False | ||
learnerConfig.seed_ = 1234567 | ||
learnerConfig.silent_ = False | ||
|
||
learner = LearnerSGDE(gridConfig, adaptConfig, solverConfig, | ||
regularizationConfig, learnerConfig) | ||
learner.initialize(samples) | ||
grid = learner.getGrid() | ||
print learner.getDim(), learner.getNsamples() | ||
print learner.getGrid() | ||
print learner.getSurpluses() | ||
# dist = SGDEdist.byLearnerSGDE(samples, gridConfig, adaptConfig, solverConfig, | ||
# regularizationConfig, learnerConfig) |
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
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
Oops, something went wrong.