Skip to content
Snippets Groups Projects
Commit 963d09fa authored by Christoph Lange's avatar Christoph Lange
Browse files

picture for the htbd presentation

parent dc616e5a
No related branches found
No related tags found
1 merge request!11Try fitting randomly generated data
Pipeline #11985 passed
Showing
with 20 additions and 33 deletions
......@@ -117,7 +117,6 @@ def sample_time_series_dataset(
for cluster_idx in range(cluster_length)
]
def custom_generator():
for combination in combinations:
......@@ -127,7 +126,9 @@ def sample_time_series_dataset(
time_series[cluster_idx * cluster_length + sample]
for cluster_idx, sample in zip(
input_clusters,
combination[:math.ceil(num_clusters * cut_off_rate)]
combination[
:math.ceil(num_clusters * cut_off_rate)
]
)
],
dtype=tf.float32,
......@@ -137,7 +138,9 @@ def sample_time_series_dataset(
time_series[cluster_idx * cluster_length + sample]
for cluster_idx, sample in zip(
label_clusters,
combination[math.ceil(num_clusters * cut_off_rate):]
combination[
math.ceil(num_clusters * cut_off_rate):
]
)
],
dtype=tf.float32,
......@@ -152,7 +155,6 @@ def sample_time_series_dataset(
).batch(batch_size)
def create_validation_dataset(
data,
cut_off,
......
......@@ -29,7 +29,8 @@ class VariableLSTM(tf.keras.Model):
self.lstm_cell = tf.keras.layers.LSTMCell(
units,
kernel_regularizer=tf.keras.regularizers.L2(lstm_regularization),
recurrent_regularizer=tf.keras.regularizers.L2(lstm_regularization),
recurrent_regularizer=tf.keras.regularizers.L2(
lstm_regularization),
dropout=lstm_dropout,
)
# Also wrap the LSTMCell in an RNN to make the warmup easier
......@@ -58,7 +59,8 @@ class VariableLSTM(tf.keras.Model):
)
+ [tf.keras.layers.Dense(
1,
kernel_regularizer=tf.keras.regularizers.L2(dense_regularization),
kernel_regularizer=tf.keras.regularizers.L2(
dense_regularization),
)]
)
......@@ -75,7 +77,10 @@ class VariableLSTM(tf.keras.Model):
inputs, labels = data
with tf.GradientTape() as tape:
initial_prediction, initial_state = self.warmup(inputs, training=True)
initial_prediction, initial_state = self.warmup(
inputs,
training=True
)
predictions_array = [initial_prediction]
state = initial_state
......@@ -141,20 +146,3 @@ class VariableLSTM(tf.keras.Model):
predictions = predictions_array.stack()
return tf.transpose(predictions, [1, 0, 2])
# def test_step(self, data):
# # Unpack the data
# x, y = data
# # Compute predictions
# y_pred = self(x, training=False)
#
# # redo normalization
# original_y = y * tf.cast(self.norm_std, dtype=y.dtype) + tf.cast(self.norm_mean, dtype=y.dtype)
# original_y_pred = y_pred * tf.cast(self.norm_std, dtype=y_pred.dtype) + tf.cast(self.norm_mean, dtype=y_pred.dtype)
# # Updates the metrics tracking the loss
# self.compiled_loss(original_y, original_y_pred, regularization_losses=self.losses)
# # Update the metrics.
# self.compiled_metrics.update_state(original_y, original_y_pred)
# # Return a dict mapping metric names to current value.
# # Note that it will include the loss (tracked in self.metrics).
# return {m.name: m.result() for m in self.metrics}
......@@ -105,5 +105,3 @@ def cross_validation(
performance.append(model.evaluate(validation_dataset))
return performance
No preview for this file type
......@@ -49,9 +49,8 @@
\end{frame}
\section{Overview}
\subsection{Spectroscopy}
\section{Spectroscopy}
\begin{frame}{Raman Spectra}
\smallHead
......@@ -88,7 +87,7 @@
\end{frame}
\subsection{Image Analysis}
\section{Image Analysis}
\begin{frame}{Microscopic Image Analysis}
\smallHead
......
presentations/images/cell_parameter.png

163 KiB

presentations/images/lstm_examples.png

146 KiB

presentations/images/microscopic_cells.jpg

4.51 KiB

presentations/images/microscopic_images.png

159 KiB

presentations/images/old_new_image.png

169 KiB

presentations/images/raman_sample.png

83.1 KiB

presentations/images/residuals.png

59.5 KiB

presentations/images/sphinx_docu.png

185 KiB

presentations/images/time_series_dataset.png

275 KiB

......@@ -290,10 +290,10 @@ def test_sample_time_series_dataset_three():
for label, expected in zip(
labels,
[
tf.constant([[[0], [2]],], dtype=tf.float32),
tf.constant([[[1], [4]],], dtype=tf.float32),
tf.constant([[[0], [3]],], dtype=tf.float32),
tf.constant([[[1], [5]],], dtype=tf.float32),
tf.constant([[[0], [2]], ], dtype=tf.float32),
tf.constant([[[1], [4]], ], dtype=tf.float32),
tf.constant([[[0], [3]], ], dtype=tf.float32),
tf.constant([[[1], [5]], ], dtype=tf.float32),
]
)
])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment