Edited, memorised or added to reading queue

on 29-Apr-2024 (Mon)

Do you want BuboFlash to help you learning these things? Click here to log in or create user.

Flashcard 7624073284876

Tags
#tensorflow #tensorflow-certificate
Question

from tensorflow.keras import Sequential
from tensorflow.keras.layers import [...]
import numpy as np

model = Sequential(Dense(1, input_shape=[1]))
model.compile(optimizer='sgd', loss='mean_squared_error')
xs = np.array([1,5,12,-1,10], dtype=float)
ys = np.array([5,13,27,1,23], dtype=float)
model.fit(xs, ys, epochs=500)
model.predict(x=[15])

Answer
Dense

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Tensorflow basics - typical flow of model building
from tensorflow.keras import Sequential from tensorflow.keras.layers import Dense import numpy as np model = Sequential(Dense(1, input_shape=[1])) model.compile(optimizer='sgd', loss='mean_squared_error') xs = np.array([1,5,12,-1,10], dtype=float) ys = np.array([5,13







Flashcard 7624089275660

Tags
#tensorflow #tensorflow-certificate
Question

import tensorflow as tf

#stop training after reaching accuract of 0.99
class MyCallback(tf.keras.callbacks.Callback):
  def on_epoch_end(self, epoch, logs={}):
    if logs.get('accuracy')>=0.99:
      print('\nAccuracy 0.99 achieved')
      self.model.[...] = True

Answer
stop_training

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Tensorflow - callbacks
r reaching accuract of 0.99 class MyCallback(tf.keras.callbacks.Callback): def on_epoch_end(self, epoch, logs={}): if logs.get('accuracy')>=0.99: print('\nAccuracy 0.99 achieved') self.model.<span>stop_training = True <span>







Flashcard 7625108229388

Tags
#tensorflow #tensorflow-certificate
Question
changeable_tensor = tf.Variable([10, 7])

changeable_tensor[0] = 77

Output:
TypeError: 'ResourceVariable' object does not support item assignment


changeable_tensor[0].assign(77)

Output:
<tf.Variable 'UnreadVariable' shape=([...]) dtype=int32, numpy=array([77,  7], dtype=int32)>

Answer
2,

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Tensorflow basics
([10, 7]) changeable_tensor[0] = 77 Output: TypeError: 'ResourceVariable' object does not support item assignment changeable_tensor[0].assign(77) Output: <tf.Variable 'UnreadVariable' shape=(<span>2,) dtype=int32, numpy=array([77, 7], dtype=int32)> <span>







Flashcard 7625629371660

Tags
#tensorflow #tensorflow-certificate
Question
# Calculate MSE "by hand" in steps - identify functions

abs_err = tf.abs(tf.subtract([...](y_test, dtype=tf.float32), tf.squeeze(y_pred)))
sq_abs_err = tf.multiply(abs_err, abs_err)
sq_abs_err
tf.math.reduce_mean(sq_abs_err)



<tf.Tensor: shape=(), dtype=float32, numpy=155.11417>

Answer
tf.cast

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Calculate MSE &quot;by hand&quot; in steps - identify functions
# Calculate MSE "by hand" in steps - identify functions abs_err = tf.abs(tf.subtract(tf.cast(y_test, dtype=tf.float32), tf.squeeze(y_pred))) sq_abs_err = tf.multiply(abs_err, abs_err) sq_abs_err tf.math.reduce_mean(sq_abs_err) <tf.Tensor: shape=(), dtype=float32, numpy=155.1







#deep-learning #keras #lstm #python #sequence

Integer Encoding

As a first step, each unique category value is assigned an integer value. For example, red is 1, green is 2, and blue is 3. This is called label encoding or an integer encoding and is easily reversible. For some variables, this may be enough. The integer values have a natural ordered relationship between each other and machine learning algorithms may be able to understand and harness this relationship. For example, ordinal variables like the place example above would be a good example where a label encoding would be sufficient

statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on


Parent (intermediate) annotation

Open it
3.2.1 How to Convert Categorical Data to Numerical Data This involves two steps: 1. Integer Encoding. 2. One Hot Encoding. Integer Encoding As a first step, each unique category value is assigned an integer value. For example, red is 1, green is 2, and blue is 3. This is called label encoding or an integer encoding and is easily reversible. For some variables, this may be enough. The integer values have a natural ordered relationship between each other and machine learning algorithms may be able to understand and harness this relationship. For example, ordinal variables like the place example above would be a good example where a label encoding would be sufficient

Original toplevel document (pdf)

cannot see any pdfs




Flashcard 7625711422732

Tags
#has-images #recurrent-neural-networks #rnn
[unknown IMAGE 7101511240972]
Question
The two calendar components – the month and week indicators – represent time-varying [...] information which is shared across the individuals within a given cohort. In addition, in this example, we include also an individual time-invariant covariate (gender) and a time-varying, individual-level covariate (marketing appeals)
Answer
contextual

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Parent (intermediate) annotation

Open it
The two calendar components – the month and week indicators – represent time-varying contextual information which is shared across the individuals within a given cohort. In addition, in this example, we include also an individual time-invariant covariate (gender) and a time-varyin

Original toplevel document (pdf)

cannot see any pdfs







Changes in tensorflow
#tensorflow #tensorflow-certificate
From tensorflow version 2.7.0 model.fit() no longer automatically upscales inputs from shape (batch_size, ) to (batch_size, 1).
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on




Flashcard 7625714830604

Tags
#tensorflow #tensorflow-certificate
Question
From tensorflow version 2.7.0 model.fit() no longer automatically upscales inputs from shape ([...] ) to (batch_size, 1).
Answer
batch_size,

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Changes in tensorflow
From tensorflow version 2.7.0 model.fit() no longer automatically upscales inputs from shape (batch_size, ) to (batch_size, 1).







#tensorflow #tensorflow-certificate

OLD

Fit the model

model.fit(X, y, epochs=5) # this will break with TensorFlow 2.7.0+

New

Fit the model

model.fit(tf.expand_dims(X, axis=-1), y, epochs=5) # <- updated line

statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on




Flashcard 7625718238476

Tags
#tensorflow #tensorflow-certificate
Question

OLD

Fit the model

model.fit(X, y, epochs=5) # this will break with TensorFlow 2.7.0+

New

Fit the model

model.fit([...], y, epochs=5) # <- updated line

Answer
tf.expand_dims(X, axis=-1)

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Open it
OLD Fit the model model.fit(X, y, epochs=5) # this will break with TensorFlow 2.7.0+ New Fit the model model.fit(tf.expand_dims(X, axis=-1), y, epochs=5) # <- updated line







#tensorflow #tensorflow-certificate

from tensorflow.keras.utils import plot_model

plot_model(model, show_shapes=True)

statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on




Flashcard 7625721646348

Tags
#tensorflow #tensorflow-certificate
Question

from tensorflow.keras.[...] import plot_model

plot_model(model, show_shapes=True)

Answer
utils

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Open it
from tensorflow.keras.utils import plot_model plot_model(model, show_shapes=True)







#tensorflow #tensorflow-certificate
#### Def some functions to calculate losses (mae, mse)

def evaluate_mae(y_true, y_pred):
  return tf.keras.losses.mean_absolute_error(y_true = y_true,
                                      y_pred = tf.squeeze(y_pred))

statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on




Flashcard 7625725054220

Tags
#tensorflow #tensorflow-certificate
Question
#### Def some functions to calculate losses (mae, mse)

def evaluate_mae(y_true, y_pred):
  [...] tf.keras.losses.mean_absolute_error(y_true = y_true,
                                      y_pred = tf.squeeze(y_pred))

Answer
return

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Open it
#### Def some functions to calculate losses (mae, mse) def evaluate_mae(y_true, y_pred): return tf.keras.losses.mean_absolute_error(y_true = y_true, y_pred = tf.squeeze(y_pred))







Deep learning advice
#tensorflow #tensorflow-certificate
You should minimize the time between your experiments (that's why you should start with smaller models). The more experiments you do, the more things you'll figure out that don't work.
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on




Flashcard 7625728199948

Tags
#tensorflow #tensorflow-certificate
Question
You should [...] between your experiments (that's why you should start with smaller models). The more experiments you do, the more things you'll figure out that don't work.
Answer
minimize the time

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Deep learning advice
You should minimize the time between your experiments (that's why you should start with smaller models). The more experiments you do, the more things you'll figure out that don't work.







Tensorflow fundamentals
#tensorflow #tensorflow-certificate

Tensorflow fundamentals

Basic operations on tensors in tensorflow

  • Introduction to tensors
  • Getting information from tensors
  • Manipulating tensors
  • Tensors wit NumPy
  • Using @tf.function (a way for speed up a regular python functions)
  • Using GPUs with tensorflow
  • Excersises
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on




Flashcard 7625731607820

Tags
#tensorflow #tensorflow-certificate
Question

Tensorflow fundamentals

Basic operations on tensors in tensorflow

  • Introduction to tensors
  • Getting information from tensors
  • Manipulating tensors
  • Tensors wit NumPy
  • Using [...] (a way for speed up a regular python functions)
  • Using GPUs with tensorflow
  • Excersises
Answer
@tf.function

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Tensorflow fundamentals
Tensorflow fundamentals Basic operations on tensors in tensorflow Introduction to tensors Getting information from tensors Manipulating tensors Tensors wit NumPy Using @tf.function (a way for speed up a regular python functions) Using GPUs with tensorflow Excersises







Tensorflow fundamentals
#tensorflow #tensorflow-certificate

another_matrix = tf.constant([[10. ,66.],
                              [5. , 9.],
                              [13. , 4.]], dtype=tf.float16)
another_matrix

Out:
<tf.Tensor: shape=(3, 2), dtype=float16, numpy=
array([[10., 66.],
       [ 5.,  9.],
       [13.,  4.]], dtype=float16)>

statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on




Flashcard 7625735015692

Tags
#tensorflow #tensorflow-certificate
Question

another_matrix = tf.[...]([[10. ,66.],
                              [5. , 9.],
                              [13. , 4.]], dtype=tf.float16)
another_matrix

Out:
<tf.Tensor: shape=(3, 2), dtype=float16, numpy=
array([[10., 66.],
       [ 5.,  9.],
       [13.,  4.]], dtype=float16)>

Answer
constant

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Tensorflow fundamentals
another_matrix = tf.constant([[10. ,66.], [5. , 9.], [13. , 4.]], dtype=tf.float16) another_matrix Out: <tf.Tensor: shape=(3, 2), dtype=float16, numpy= array([[10., 66.], [ 5., 9.], [13., 4.]], dtype=float16)&gt