Skip to content
This repository was archived by the owner on Jun 11, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,7 @@ mlruns/
pytest-coverage.txt

# saved models
saved_models/
saved_models/

# sims
sim/
18 changes: 14 additions & 4 deletions conf/data/moab_5Kepi.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
data:
path: csv_data/moab_sim_5KepiPosVelMinStates.csv
path: csv_data/moab_sim_5Kepi.csv #PosVelMinStates.csv
full_or_relative: relative
inputs: state
outputs: state
inputs: [
"state_ball_x",
"state_ball_y",
"state_ball_vel_x",
"state_ball_vel_y",
]
outputs: [
"state_ball_x",
"state_ball_y",
"state_ball_vel_x",
"state_ball_vel_y",
]
augmented_cols: ["action_input_roll","action_input_pitch"]
iteration_order: -1
episode_col: episode
iteration_col: iteration
max_rows: 230000 # 251000 used in LNN to generate 232432 samples of which 200K is trained
scale_data: True
diff_state: True
diff_state: False
test_perc: 0.25
23 changes: 19 additions & 4 deletions ddm_test_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@
logger = logging.getLogger("datamodeler")

import hydra
from omegaconf import DictConfig
from omegaconf import DictConfig, ListConfig

from all_models import available_models

## Add a local simulator in a `sim` folder to validate data-driven model
# Commented example import of sim model from the sim folder can be similar to mba example
# from sim.moab.moab_main import SimulatorSession, env_setup
# from sim.moab.policies import coast, random_policy, small_perturbations
## Example: Quanser from a Microsoft Bonsai
"""
├───ddm_test_validate.py
Expand Down Expand Up @@ -54,7 +57,7 @@ def __init__(
self.action_keys = actions
self.sim_orig = (
sim_orig()
) # include simulator function if comparing to simulator
) # include simulator instance if comparing to simulator
self.diff_state = diff_state
if log_file == "enable":
current_time = datetime.datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
Expand Down Expand Up @@ -109,6 +112,7 @@ def episode_step(self, action: Dict[str, int]):
list(self.config.values()),
list(action.values()),
]
print(input_list)

input_array = [item for subl in input_list for item in subl]
X = np.array(input_array).reshape(1, -1)
Expand Down Expand Up @@ -267,6 +271,15 @@ def main(cfg: DictConfig):
output_cols = cfg["data"]["outputs"]
augmented_cols = cfg["data"]["augmented_cols"]

if type(input_cols) == ListConfig:
input_cols = list(input_cols)
if type(output_cols) == ListConfig:
output_cols = list(output_cols)
if type(augmented_cols) == ListConfig:
augmented_cols = list(augmented_cols)
print(type(input_cols))
print(type(augmented_cols))

input_cols = input_cols + augmented_cols

ddModel = available_models[model_name]
Expand All @@ -284,9 +297,11 @@ def main(cfg: DictConfig):
model.load_model(filename=save_path, scale_data=scale_data)

# Grab standardized way to interact with sim API
sim = Simulator(model, states, actions, configs, logflag, diff_state)
sim = Simulator(
model, states, actions, configs, logflag, diff_state
) # , SimulatorSession)

test_sim_model(1, 250, logflag, sim)
test_sim_model(10, 250, logflag, sim)

return sim

Expand Down
Loading