From 1431a878d4a67a15f7ce18fa7dbe241cb49a9fd7 Mon Sep 17 00:00:00 2001 From: Javier Vargas Date: Wed, 8 Dec 2021 10:19:25 +0100 Subject: [PATCH] Added more docstring --- experiment1/model.py | 9 +++++++++ experiment1/modules.py | 12 ++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/experiment1/model.py b/experiment1/model.py index 6cbca6c..28d3ec5 100644 --- a/experiment1/model.py +++ b/experiment1/model.py @@ -8,6 +8,15 @@ class Model1(LightningModule): + """First iteration model 1 + + This model is given with two intrinsic knowlegde modules: the Adder + and the Substracter. The model is expected to learn when to use + the Adder or when to use the Substracter. However the adder and the + substracter are already implemented (they are not learnable). This + experiment tries to teach this model to use innate knowledge rather + than learning it from the ground up. + """ def __init__(self, lr: float, optim_conf: dict) -> None: """Modular AI approach 1 diff --git a/experiment1/modules.py b/experiment1/modules.py index d578953..7bf6b6c 100644 --- a/experiment1/modules.py +++ b/experiment1/modules.py @@ -1,23 +1,31 @@ import torch as T +""" +Modules without learnable parameters, this +modules will act as intrinsic knowledge that +the AI must decide when to use and when not +""" + class Adder(object): + """Adder module without learnable parameters""" def __init__(self) -> None: """Init adder module""" super().__init__() def __call__(self, X: T.Tensor) -> T.Tensor: - """Calling the adding operation without gradient""" + """Performing the adding operation""" return X[:, 0] + X[:, 1] class Substracter(object): + """Substracter module without learnable parameters""" def __init__(self) -> None: """Init substracter module""" super().__init__() def __call__(self, X: T.Tensor) -> T.Tensor: - """Calling the adding operation without gradient""" + """Performing the substracting operation""" return X[:, 0] - X[:, 1]