Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MLAir
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
esde
machine-learning
MLAir
Commits
2612c377
Commit
2612c377
authored
2 years ago
by
Felix Kleinert
Browse files
Options
Downloads
Patches
Plain Diff
check some settings for probnet
parent
0966d8e3
No related branches found
No related tags found
2 merge requests
!474
Draft: Resolve "DataHandler with multiple stats per variable"
,
!466
Draft: Resolve "Include CRPS analysis and other ens verif methods or plots"
Pipeline
#109634
passed
2 years ago
Stage: test
Stage: docs
Stage: pages
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
mlair/model_modules/probability_models.py
+23
-2
23 additions, 2 deletions
mlair/model_modules/probability_models.py
with
23 additions
and
2 deletions
mlair/model_modules/probability_models.py
+
23
−
2
View file @
2612c377
...
@@ -314,7 +314,7 @@ class MyUnetProb(AbstractModelClass):
...
@@ -314,7 +314,7 @@ class MyUnetProb(AbstractModelClass):
pars
=
tf
.
keras
.
layers
.
Dense
(
params_size
)(
dl
)
pars
=
tf
.
keras
.
layers
.
Dense
(
params_size
)(
dl
)
# pars = DenseVariationalCustom(
# pars = DenseVariationalCustom(
# units=params_size, make_prior_fn=prior, make_posterior_fn=posterior,
# units=params_size, make_prior_fn=prior, make_posterior_fn=posterior,
# kl_use_exact=
Tru
e, kl_weight=1./self.
x_train_shape
)(dl)
# kl_use_exact=
Fals
e, kl_weight=1./self.
num_of_training_samples
)(dl)
# outputs = tfpl.MixtureSameFamily(self.k_mixed_components,
# outputs = tfpl.MixtureSameFamily(self.k_mixed_components,
# tfpl.MultivariateNormalTriL(
# tfpl.MultivariateNormalTriL(
...
@@ -323,9 +323,22 @@ class MyUnetProb(AbstractModelClass):
...
@@ -323,9 +323,22 @@ class MyUnetProb(AbstractModelClass):
# )
# )
# )(pars)
# )(pars)
# outputs = tfpl.MultivariateNormalTriL(
# self._output_shape,
# convert_to_tensor_fn=tfp.distributions.Distribution.mode
# )(pars)
outputs
=
tfpl
.
MultivariateNormalTriL
(
outputs
=
tfpl
.
MultivariateNormalTriL
(
self
.
_output_shape
,
self
.
_output_shape
,
convert_to_tensor_fn
=
tfp
.
distributions
.
Distribution
.
mode
# lambda s: s.sample(10),
sample_real
(
10
),
activity_regularizer
=
tfpl
.
KLDivergenceRegularizer
(
tfd
.
MultivariateNormalDiag
(
loc
=
tf
.
zeros
(
self
.
_output_shape
),
scale_diag
=
tf
.
ones
(
self
.
_output_shape
)),
weight
=
self
.
num_of_training_samples
)
# convert_to_tensor_fn=tfp.distributions.Distribution.mode
)(
pars
)
)(
pars
)
self
.
model
=
keras
.
Model
(
inputs
=
input_train
,
outputs
=
outputs
)
self
.
model
=
keras
.
Model
(
inputs
=
input_train
,
outputs
=
outputs
)
...
@@ -846,6 +859,14 @@ class Convolution2DReparameterizationCustom(tfpl.Convolution2DReparameterization
...
@@ -846,6 +859,14 @@ class Convolution2DReparameterizationCustom(tfpl.Convolution2DReparameterization
})
})
return
config
return
config
def
sample_real
(
n_real
=
10
):
global
sample
def
sample
(
s
):
return
s
.
sample
(
n_real
)
return
sample
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
...
...
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