Skip to content

Commit

Permalink
Merge branch 'main' into bug/error-scaling/84/lauren
Browse files Browse the repository at this point in the history
  • Loading branch information
carynbear authored Jul 10, 2024
2 parents 6c6693d + 157aee8 commit 2dda041
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/python-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11']
os: [ubuntu-latest, macOS-latest] #,windows-latest]
python-version: ['3.10'] #3.11
os: [ubuntu-latest] #, macOS-latest] #,windows-latest]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
pyenv shell 3.10.14 #use the newly installed version
```

Check your installation by running `which python` which should output something along the lines of:
Check your installation by running `which python`. Output should be along the lines of:
- for mise: `/Users/[user]/.local/share/mise/installs/python/3.10.14/bin/python`

- for pyenv: `/Users/[user]/.pyenv/shims/python`
Expand Down
6 changes: 3 additions & 3 deletions demos/systems/kuramoto_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@
}
],
"source": [
"plot([x], legend_labels=[\"IND\"], max_oscillators=3, title=\"InD\", max_lines=2, phase_dynamics=True)\n",
"plot([x], labels=[\"IND\"], max_oscillators=3, title=\"InD\", max_lines=2, phase_dynamics=True)\n",
"\n",
"plot([x], legend_labels=[\"IND\"], max_oscillators=3, title=\"InD\", max_lines=2, phase_dynamics=False)\n",
"plot([x], labels=[\"IND\"], max_oscillators=3, title=\"InD\", max_lines=2, phase_dynamics=False)\n",
"# plot([y], max_oscillators=3, title=\"OOD\")"
]
},
Expand Down Expand Up @@ -126,7 +126,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.14"
"version": "3.10.11"
}
},
"nbformat": 4,
Expand Down
10 changes: 6 additions & 4 deletions src/dynadojo/baselines/dnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import time

from ..abstractions import AbstractAlgorithm

import logging


class TorchBaseClass(AbstractAlgorithm, torch.nn.Module):
Expand All @@ -33,7 +33,8 @@ def __init__(
torch.manual_seed(seed)

self.device = device or "cuda" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu"
print(f"Using device: {self.device}")
logging.info(f"Using device: {self.device}")
# print(f"Using device: {self.device}")
# self.model = self.create_model()
self.criterion = torch.nn.MSELoss()

Expand Down Expand Up @@ -90,7 +91,7 @@ def fit(self, x: np.ndarray,
losses = []
self.train()
training_start_time = time.time()
print(f'Dataloader length: {len(dataloader)}')
# print(f'Dataloader length: {len(dataloader)}')
for epoch in range(epochs):
self.train()
epoch_loss = 0
Expand Down Expand Up @@ -170,8 +171,9 @@ class DNN(TorchBaseClass):
def __init__(self,
embed_dim,
timesteps,
max_control_cost,
**kwargs):
super().__init__(embed_dim, timesteps, **kwargs)
super().__init__(embed_dim, timesteps, max_control_cost, **kwargs)
self.model = torch.nn.Sequential(
torch.nn.Linear(self.embed_dim, embed_dim*10),
torch.nn.ReLU(),
Expand Down
6 changes: 3 additions & 3 deletions tests/test_deterministic.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
# baselines
from dynadojo.baselines.aug_ode import AugODE
from dynadojo.baselines.cnn import CNN
from dynadojo.baselines.dmd import DMD
# from dynadojo.baselines.dmd import DMD
from dynadojo.baselines.dnn import DNN
from dynadojo.baselines.ode import ODE
# from dynadojo.baselines.sindy import SINDy

ALL_BASELINES = [
# AugODE,
# CNN,
DMD,
# DMD,
DNN,
# ODE,
# SINDy
Expand Down Expand Up @@ -157,7 +157,7 @@ def test_with_trials(self, algo):
algo_kwargs=None)
cols = ['trial', 'latent_dim', 'embed_dim', 'timesteps', 'n', 'error', 'ood_error', 'total_cost',
'system_seed', 'algo_seed']
df1 = df1[cols]
df1 = df1[cols].loc[df2['trial'] == 1]
df2 = df2[cols].loc[df2['trial'] == 1]
self.assertEqual(df1, df2)

Expand Down

0 comments on commit 2dda041

Please sign in to comment.