Edited, memorised or added to reading queue

on 14-Apr-2024 (Sun)

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

Flashcard 7624065944844

Tags
#tensorflow #tensorflow-certificate
Question

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', [...]='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
loss

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,27,1,23], dtype=float) model.fit(xs, ys, epochs=500) model.predict(x=[15])







Flashcard 7624086129932

Tags
#tensorflow #tensorflow-certificate
Question

import tensorflow as tf

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

Answer
on_epoch_end

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

Tensorflow - callbacks
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.stop_training = True







Flashcard 7624235289868

Tags
#tensorflow #tensorflow-certificate
Question
# Create matrix
another_matrix = tf.[...]([[10. ,66.],
                              [5. , 9.],
                              [13. , 4.]], dtype=tf.float16)
another_matrix


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


another_matrix.ndim
2

Answer
constant

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

Tensors fundamentals - creating tensors
# Create matrix another_matrix = tf.constant([[10. ,66.], [5. , 9.], [13. , 4.]], dtype=tf.float16) another_matrix <tf.Tensor: shape=(3, 2), dtype=float16, numpy= array([[10., 66.], [ 5., 9.], [13., 4.]], dtype=float16)> ano