Skip to content

Commit 3b728de

Browse files
committed
added comments and added target as feature aswell
1 parent de5ffa7 commit 3b728de

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/safeds/data/tabular/containers/_timeseries_table.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ def _as_table(self: TimeSeries) -> Table:
431431

432432

433433
# ------------------------------------------------------------------------------------------------------------------
434-
# Windiw Functions and needed class:
434+
# Window Functions and needed class:
435435
# for testing purposes they are here
436436
# ------------------------------------------------------------------------------------------------------------------
437437

@@ -458,8 +458,12 @@ def _generate_label_windows( ):
458458

459459

460460
def into_DataLoader(self):
461+
#code below concatenate the column like the following
462+
#f1:[w1, w2, w3] f2[w1, w2, w3] -> [w1+w1, w2+w2, w3+w3]
461463
x_train = np.concatenate(list(self._create_all_windows_for_column()), axis=1)
464+
#for target this will be created: [ t1, t2, t3]
462465
y_train = np.array(self._create_all_labels_for_target_column())
466+
#load them into PyTorch
463467
dataset = TimeSeriesDataset(x_train,y_train)
464468
return DataLoader(dataset, batch_size=1)
465469

tests/safeds/data/tabular/containers/_table/_timeseries_table/test_timeseries_creation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ def test_create_timeseries() -> None:
3030
date_name="f1",
3131
window_size=2,
3232
forecast_horizon=1,
33-
feature_names=["f1", "f2"])
33+
feature_names=["f1", "f2", "target"])
3434

3535

3636
# ein Modell erstellen ist in safeDS noch nicht definiert darum low level in PyTorch
3737
# 2 ist hier die number der feature Columns
38-
input_dim = ts._window_size * 2
38+
input_dim = ts._window_size * len(ts._feature_names)
3939
hidden_dim = 1
4040
output_dim = ts._forecast_horizon
4141
model = LSTMModel(input_dim, hidden_dim, output_dim)
@@ -50,4 +50,4 @@ def test_create_timeseries() -> None:
5050

5151

5252
#wenn durchläuft wurde korrekt Table in Dataloader geladen
53-
assert False
53+
#assert False

0 commit comments

Comments
 (0)