Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
empyre
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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dieter Weber
empyre
Commits
69879fe6
Commit
69879fe6
authored
10 years ago
by
Jörn Ungermann
Browse files
Options
Downloads
Patches
Plain Diff
Added p and TV regularisation.
parent
8faed108
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pyramid/regularisator.py
+17
-9
17 additions, 9 deletions
pyramid/regularisator.py
with
17 additions
and
9 deletions
pyramid/regularisator.py
+
17
−
9
View file @
69879fe6
...
...
@@ -12,7 +12,8 @@ import numpy as np
from
scipy.sparse
import
coo_matrix
,
csr_matrix
import
jutil.norms
as
jnorm
import
jutil.diff
as
jdiff
import
jutil.operator
as
joperator
from
pyramid.converter
import
IndexConverter
import
logging
...
...
@@ -103,9 +104,13 @@ class ZeroOrderRegularisator(Regularisator):
LOG
=
logging
.
getLogger
(
__name__
+
'
.ZeroOrderRegularisator
'
)
def
__init__
(
self
,
lam
):
def
__init__
(
self
,
_
,
lam
,
p
=
2
):
self
.
LOG
.
debug
(
'
Calling __init__
'
)
norm
=
jnorm
.
L2Square
()
self
.
p
=
p
if
p
==
2
:
norm
=
jnorm
.
L2Square
()
else
:
norm
=
jnorm
.
LPPow
(
p
,
1e-12
)
super
(
ZeroOrderRegularisator
,
self
).
__init__
(
norm
,
lam
)
self
.
LOG
.
debug
(
'
Created
'
+
str
(
self
))
...
...
@@ -113,11 +118,14 @@ class ZeroOrderRegularisator(Regularisator):
class
FirstOrderRegularisator
(
Regularisator
):
# TODO: Docstring!
def
__init__
(
self
,
mask
,
lam
,
x_a
=
None
):
import
jutil
D0
=
jutil
.
diff
.
get_diff_operator
(
mask
,
0
,
3
)
D1
=
jutil
.
diff
.
get_diff_operator
(
mask
,
1
,
3
)
D
=
jutil
.
operator
.
VStack
([
D0
,
D1
])
norm
=
jutil
.
norms
.
WeightedL2Square
(
D
)
def
__init__
(
self
,
mask
,
lam
,
p
=
2
):
self
.
p
=
p
D0
=
jdiff
.
get_diff_operator
(
mask
,
0
,
3
)
D1
=
jdiff
.
get_diff_operator
(
mask
,
1
,
3
)
D
=
joperator
.
VStack
([
D0
,
D1
])
if
p
==
2
:
norm
=
jnorm
.
WeightedL2Square
(
D
)
else
:
norm
=
jnorm
.
WeightedTV
(
jnorm
.
LPPow
(
p
,
1e-12
),
D
,
[
D0
.
shape
[
0
],
D
.
shape
[
0
]])
super
(
FirstOrderRegularisator
,
self
).
__init__
(
norm
,
lam
)
self
.
LOG
.
debug
(
'
Created
'
+
str
(
self
))
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