SverreNystad / power-predictor

Using Machine Learning for time series forecasting of photovoltaic measurement for solar systems based on weather features
Other
6 stars 2 forks source link

1D CNN (Convolutional neural network) #17

Closed SverreNystad closed 7 months ago

SverreNystad commented 9 months ago

1D Convolutional Neural Networks (1D CNNs) can be highly effective for time series forecasting due to their ability to detect local temporal patterns and their capacity to handle sequential data.

1D CNNs can also be combined with other models like Recurrent Neural Networks (RNNs) or Long Short-Term Memory (LSTM) networks to leverage the advantages of both architectures. For example, a CNN can be used to extract local features, which can then be fed into an LSTM to capture long-term dependencies in the sequence.

1D CNNs offer several advantages for time series forecasting, including the ability to capture local temporal patterns, robustness to noise, and scalability to long sequences. Their efficiency, parallelizability, and ability to learn hierarchical features make them a popular choice for various time series applications.

SverreNystad commented 9 months ago

Code snippet for 1D CNN using KERAS

from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Conv1D, MaxPooling1D, Flatten, Dense

model = Sequential()
model.add(Conv1D(filters=64, kernel_size=3, activation='relu', input_shape=(sequence_length, n_features)))
model.add(MaxPooling1D(pool_size=2))
model.add(Flatten())
model.add(Dense(50, activation='relu'))
model.add(Dense(1))
model.compile(optimizer='adam', loss='mse')
SverreNystad commented 7 months ago

Gave worse results