mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-12 05:22:38 +02:00
52 lines
No EOL
1.8 KiB
Python
52 lines
No EOL
1.8 KiB
Python
# Copyright (c) 2014, Max Zwiessele, James Hensman
|
|
# Licensed under the BSD 3-clause license (see LICENSE.txt)
|
|
|
|
from paramz import Parameterized
|
|
from .priorizable import Priorizable
|
|
|
|
import logging
|
|
logger = logging.getLogger("parameters changed meta")
|
|
|
|
class Parameterized(Parameterized, Priorizable):
|
|
"""
|
|
Parameterized class
|
|
|
|
Say m is a handle to a parameterized class.
|
|
|
|
Printing parameters:
|
|
|
|
- print m: prints a nice summary over all parameters
|
|
- print m.name: prints details for param with name 'name'
|
|
- print m[regexp]: prints details for all the parameters
|
|
which match (!) regexp
|
|
- print m['']: prints details for all parameters
|
|
|
|
Fields:
|
|
|
|
Name: The name of the param, can be renamed!
|
|
Value: Shape or value, if one-valued
|
|
Constrain: constraint of the param, curly "{c}" brackets indicate
|
|
some parameters are constrained by c. See detailed print
|
|
to get exact constraints.
|
|
Tied_to: which paramter it is tied to.
|
|
|
|
Getting and setting parameters:
|
|
|
|
Set all values in param to one:
|
|
|
|
m.name.to.param = 1
|
|
|
|
Handling of constraining, fixing and tieing parameters:
|
|
|
|
You can constrain parameters by calling the constrain on the param itself, e.g:
|
|
|
|
- m.name[:,1].constrain_positive()
|
|
- m.name[0].tie_to(m.name[1])
|
|
|
|
Fixing parameters will fix them to the value they are right now. If you change
|
|
the parameters value, the param will be fixed to the new value!
|
|
|
|
If you want to operate on all parameters use m[''] to wildcard select all paramters
|
|
and concatenate them. Printing m[''] will result in printing of all parameters in detail.
|
|
"""
|
|
pass |