Skip to content

Commit

Permalink
Merge pull request #16 from MagriLab/9-total-clean-up
Browse files Browse the repository at this point in the history
Cleaned up
  • Loading branch information
defneozan authored Sep 8, 2023
2 parents 7682322 + 1296ef1 commit 7d84d59
Show file tree
Hide file tree
Showing 23 changed files with 298 additions and 13,724 deletions.
9 changes: 1 addition & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
**/data
**/data_test
**/data_new
**/results
**/results_new
**/wandb
__pycache__/
.ipynb_checkpoints/
images
images_old
*.txt
tmp_*
local*
paper
data
13 changes: 11 additions & 2 deletions adjoint_esn/esn.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def __init__(
output_bias=np.array([]),
input_seeds=[None, None, None],
reservoir_seeds=[None, None],
tikhonov=None,
verbose=True,
r2_mode=False,
input_only_mode=False,
Expand Down Expand Up @@ -111,6 +112,10 @@ def __init__(
self.spectral_radius = spectral_radius
# reservoir weights are automatically scaled if spectral radius is updated

# tikhonov coefficient
if tikhonov:
self.tikhonov = tikhonov

# initialise output weights
self.W_out_shape = (self.N_reservoir + len(self.output_bias), self.N_dim)
# N_reservoir+length of output bias because we augment the outputs with a bias
Expand Down Expand Up @@ -574,8 +579,12 @@ def train(
)

# solve for W_out using ridge regression
self.tikhonov = tikhonov # set the tikhonov during training
self.output_weights = self.solve_ridge(X_train_augmented, Y_train, tikhonov)
if not self.tikhonov:
self.tikhonov = tikhonov # set the tikhonov during training

self.output_weights = self.solve_ridge(
X_train_augmented, Y_train, self.tikhonov
)
return

# Georgios implementation
Expand Down
Loading

0 comments on commit 7d84d59

Please sign in to comment.