You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30-29Lines changed: 30 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -155,47 +155,48 @@ After installation, activate the virtual environment to run your code or noteboo
155
155
156
156
### Basic Example
157
157
158
-
The main entry point for running experiments is typically a script or notebook that defines the parameter space and iterates through it. Here is a conceptual example of how to run a single pipeline iteration:
158
+
The main entry point forrunning experiments is a script or notebook that loads the configuration and iterates through the parameter space definedin`config.yml`.
159
+
160
+
1. **Configure your experiment in`config.yml`:**
161
+
- Set the data path, models, and parameter space.
162
+
163
+
2. **Run the experiment:**
164
+
- The following script demonstrates how to execute a full grid search based on your `config.yml`.
159
165
160
166
```python
161
-
import os
162
167
from pathlib import Path
163
168
from ml_grid.pipeline.data import pipe
164
169
from ml_grid.util.param_space import parameter_space
165
-
from ml_grid.util.global_params import global_parameters
166
170
from ml_grid.util.create_experiment_directory import create_experiment_directory
171
+
from ml_grid.util.config_parser import load_config
167
172
168
-
# Define global settings
169
-
global_parameters.verbose = 2
170
-
global_parameters.error_raise = False
173
+
# Load configuration from config.yml
174
+
config = load_config()
171
175
172
-
# Define project root and experiment directories robustly
173
-
# Assumes the script/notebook is in a subdirectory like 'notebooks'
176
+
# Set project root
174
177
project_root = Path().resolve().parent
175
178
176
-
# Define a base directory for all experiments within the project root
# Iterate through each parameter combination and run the pipeline
190
+
fori, rowinparam_space_df.iterrows():
191
+
local_param_dict = row.to_dict()
192
+
print(f"Running experiment {i+1}/{len(param_space_df)} with params: {local_param_dict}")
193
+
pipe(
194
+
config=config,
195
+
local_param_dict=local_param_dict,
196
+
base_project_dir=project_root,
197
+
experiment_dir=experiment_dir,
198
+
param_space_index=i
199
+
)
199
200
```
200
201
If you are using Jupyter, you can also selectthe kernel created during installation (e.g., `Python (ml_grid_env)`) directly from the Jupyter interface.
0 commit comments