--- title: Architectures keywords: fastai sidebar: home_sidebar summary: "Classes to create hierachy architectures from array configurations." description: "Classes to create hierachy architectures from array configurations." nb_path: "nbs/08_architectures.ipynb" ---
%load_ext autoreload
%autoreload 2
from pct.environments import VelocityModel
from pct.structure import ArchitectureStructure
from pct.functions import IndexedParameter
from pct.hierarchy import PCTHierarchy
from pct.structure import LevelKey
from pct.nodes import PCTNode
env = VelocityModel(name='VModel')
namespace=env.namespace
inputs=[2]
structure = ArchitectureStructure()
config = {'parameters': {}, 'level0': [[[1.0864011617580416, -1.0342161642584196], [-8.899524671308557, -8.976856229389936]], [-0.7295091920311653, -4.460573287694404], [0, 0], [[-4.146713118740296, 1.2794655139677662]]]}
pa = DynamicArchitecture(structure=structure, config=config, env=env, input_indexes=inputs, namespace=namespace) #, error_collector=te)
pa()
#hpct = pa.get_hierarchy()
#hpct.summary()
#move={'VModel': [-0.2, -0.3],'Input0': [-0.3, 0],'OL0C0ws': [-0.4, 0],'OL0C1ws': [0.6, 0]}
#hpct.draw(move=move, with_edge_labels=True, figsize=(14,14))
from pct.environments import Pendulum
from pct.functions import Constant
pen = Pendulum(name='Pendulum',render=True)
namespace = pen.namespace
#print(namespace)
inputs=[2, 3]
config = {'level0': [[[0, 0, 1], [0, 0, 1]], [74.7727669099358, 37.42447782017047, 70.45900090605967], [[1, 0, 1]]], 'level1': [[[1, 0, 1], [1, 1, 1]], [0.028281504070566288, 0.29618653732851286], [[-49.05302284318027, 46.949638698585005], [-96.63198831250754, -29.78373183094591], [-3.8249493797145107, -60.95121501461629]]], 'level2': [[[1, 0], [0, 1]], [0.633350421196448, 0.5607290603484817], [[41.217164164869104, -76.70635343790484], [83.21744682425535, -96.9311066757899]], [1, 2]], 'parameters': {}}
for key in config.keys():
print(key, config[key])
pa = ProportionalArchitecture(config=config, env=pen, input_indexes=inputs, namespace=namespace)
pa()
hpct = pa.get_hierarchy()
hpct.draw(move={'Pendulum': [-0.2, -0.3],'Input0': [-0.3, 0], 'Input1': [0.3, 0]})
pen = Pendulum(name='Pendulum',render=True)
namespace = pen.namespace
inputs=[2, 3]
config = {'level0': [[[0], [0]], [60.92750637861888], [[1]]], 'level1': [[[1], [1]], [0.8221926728404025, 0.5936199577845901], [[2.941087338758976, -68.59700733589955]], [1, 2]], 'parameters': {}}
for key in config.keys():
print(key, config[key])
pa = ProportionalArchitecture(config=config, env=pen, input_indexes=inputs, namespace = namespace)
pa()
hpct = pa.get_hierarchy()
hpct.draw(move={'Pendulum': [-0.2, -0.3],'Input0': [-0.3, 0], 'Input1': [0.3, 0]})
pen = Pendulum(name='Pendulum',render=True)
namespace = pen.namespace
inputs=[2]
config = {'level0': [[[1]], [62.82423385532463], [[0]], [1]], 'parameters': {}}
for key in config.keys():
print(key, config[key])
pa = ProportionalArchitecture(config=config, env=pen, input_indexes=inputs, namespace = namespace)
pa()
hpct = pa.get_hierarchy()
hpct.draw(move={'Pendulum': [-0.2, -0.3],'Input0': [-0.3, 0]})