-
Notifications
You must be signed in to change notification settings - Fork 0
45 add interpolation methods for input output #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 21 commits
1ffcccb
b8706cc
499b4c7
f404396
15c2ed7
690cb96
828c64d
95ff10f
e2986de
9973f0c
0d3783b
2d23228
5ba2f22
4b12e2b
3e0a8ad
3dec440
88b1ccc
ef9a8d4
b458803
23ac15b
80815ee
367624f
567efcd
e0fc769
be1365b
7d439f8
f160948
11d1719
8d9af45
8f8c377
c42f424
8323ee5
8fd0093
0496761
03335f6
9450d0f
93068a0
096a863
203c601
bafeb3c
79db1dc
c2f002a
ae0e378
3cbcdba
6dbe18a
69a27f6
1af0fb4
bcef26e
095516e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| from physXAI.models.ann.ann_design import ClassicalANNModel | ||
| from physXAI.preprocessing.preprocessing import PreprocessingSingleStep | ||
| from physXAI.preprocessing.constructed import Feature | ||
| from physXAI.utils.logging import Logger | ||
|
|
||
|
|
||
| """ | ||
| This script demonstrates the usage of different shifts. It is not physically meaningful. | ||
| """ | ||
| # Setup up logger for saving | ||
| Logger.setup_logger(folder_name='Dummy_shifting_ann', override=True) | ||
|
|
||
| # File path to data | ||
| file_path = r"data/bestest_hydronic_heat_pump/pid_data.csv" | ||
|
|
||
| # List of input features. Can include constructed features and lagged inputs | ||
| inputs = ['reaTZon_y', 'reaTZon_y_lag1', 'reaTZon_y_lag2', 'weaSta_reaWeaTDryBul_y', 'weaSta_reaWeaTDryBul_y_lag1', | ||
| 'weaSta_reaWeaHDirNor_y', 'oveHeaPumY_u', 'oveHeaPumY_u_lag1', 'oveHeaPumY_u_lag2'] | ||
| # Output feature | ||
| output = 'Change(T_zone)' | ||
|
|
||
| """ | ||
| The constructed features are automatically added to the data via 'physXAI.preprocessing.constructed.py' | ||
| Lagged inputs can be added directly based on the feature | ||
| """ | ||
| x1 = Feature('reaTZon_y') | ||
| x1.lag(2) # reaTZon_y_lag1, reaTZon_y_lag2 | ||
| x2 = Feature('weaSta_reaWeaTDryBul_y') | ||
| x2.lag(1) # weaSta_reaWeaTDryBul_y_lag1 | ||
| x3 = Feature('oveHeaPumY_u') | ||
| x3.lag(2) # oveHeaPumY_u_lag1, oveHeaPumY_u_lag2 | ||
|
|
||
|
|
||
| """ | ||
| shift (Union[int, str, dict]): Time step of the input data used to predict the output. | ||
| - If a single int or str is given, it applies to all inputs. | ||
| - If a dict is provided, it can specify different shifts for individual inputs. | ||
| - If not all inputs are specified in the dict, unspecified inputs will use a default value (autocomplete). | ||
| Examples: | ||
| - shift = 0 or shift = 'current': Current time step will be used for prediction. | ||
| - shift = 1 or shift = 'previous': Previous values will be used for prediction. | ||
| - shift = 'mean_over_interval': Mean between current and previous time step will be used. | ||
| - shift = { | ||
| 'inp_1': 1, | ||
| 'inp_2': 'mean_over_interval', | ||
| '_default': 0, # current time step will be used for all inputs not specified in the dict | ||
| # If no custom default value is given in dict, 'previous' will be used as default | ||
| } | ||
| """ | ||
| shift = { | ||
| 'reaTZon_y': 'previous', # for all lags of reaTZon_y, the shift will be set automatically | ||
| 'weaSta_reaWeaHDirNor_y': 'mean_over_interval', | ||
| '_default': 0, | ||
| } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should include this as part of Feature with attribute sampling_method. Default should be None, and there should be a class attribute default_sampling_method that is used if None |
||
|
|
||
| # Create Training data | ||
| # Time step defines target sampling: if original sampling of data is in 15min intervals, it is resampled to 1h intervals for time_step=4 | ||
| # Hence, if the shift method of an input is defined as 'mean_over_interval', the mean over the last hour is taken as input | ||
| prep = PreprocessingSingleStep(inputs, output, shift=shift, time_step=4) | ||
|
|
||
| # Process Training data | ||
| td = prep.pipeline(file_path) | ||
|
|
||
| # Classical ANN | ||
| m = ClassicalANNModel(epochs=50) | ||
|
|
||
| # Training pipeline | ||
| model = m.pipeline(td) | ||
|
|
||
| # Log setup of preprocessing and model as json | ||
| Logger.log_setup(prep, m) | ||
| # Log training data as pickle | ||
| Logger.save_training_data(td) | ||
Uh oh!
There was an error while loading. Please reload this page.