Comments (2)
An example:
import equinox as eqx
import jax.tree_util as jtu
# Class of which all parameters are trained
class Class1(eqx.Module):
param1: float
param2: float
# inherits param1, but param2 is set as fixed now
class Class2(Class1):
param2: float = eqx.static_field()
# make two examples
c1 = Class1(1, 2)
c2 = Class2(1, 3)
# with tree flatten we can check which parameters are part of the pytree
# (they are trainable) and which are part of the structure (they are fixed)
print(jtu.tree_flatten(c1), jtu.tree_flatten(c2))
# this function returns a copy of obj, that behaves like cls
def change_class(obj, cls):
# make a copy
flat, treedef = jtu.tree_flatten(obj)
obj = treedef.unflatten(flat)
# change class object.__setattr__(obj, "__class__", cls)
return obj
# the value 2 is now part of the strucure. seems to work!
c1 = change_class(c1, Class2)
print(jtu.tree_flatten(c1))
from dynax.
Fixed by new free_field
, static_field
functionality.
from dynax.
Related Issues (20)
- Host documentation
- static_field property of attributes is not inherited HOT 1
- Estimate parameter covariance in fit_least_squares HOT 1
- Fitting procedures should output a results object
- Compute parameter identifiability
- Documentation
- Linearization of discrete-time systems HOT 1
- Fit with optax
- Remove n_states, n_inputs, n_outputs HOT 2
- make fit / fit_linear a method of flow / dynamical_system
- Remove time dependency from ControlAffine
- Own classes for opt results
- Pytrees everywhere
- Implement nonlinearity measures
- Add methods for approximately linearizing systems
- Optimization of bounded parameters change values during estimation even if model is independent of them.
- Test general nonlinear solver like ipopt
- Multichannel input-output linearization
- Add example for integrating with UltraNest
- Export everthing from dynax
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dynax.