Phone

+919997782184

Email

support@roboticswithpython.com

Geeks of Coding

Join us on Telegram

Home Forums Assignment NPTEL_ Practical Machine learning with tensor flow Practical Machine Learning with Tensorflow – Assignment 3

Viewing 0 reply threads
  • Author
    Posts
    • #380
      Abhishek TyagiAbhishek Tyagi
      Keymaster

      1)- We have a 50 x 25 grid with 5 separate quantities for each entry of the grid. Each of the 5 quantities is further represented by 100 values.
      If we want to represent the 50 such grids using a tensor, what is the best way to represent such a tensor (defined using NumPy),
      say X? Given below are the dimensions of 4 tensors. Choose the best option.

      Answer- (50, 50, 25, 5, 100)

       

       

      2)- From the data described in the above question, what will be the dimensions of the following tensor:

      Y = X[20:, 10:25, :50, :100, :50]

      Answer- (30, 15, 25, 5, 50)

       

       

      3)- Let’s take the same tensor X from Q1 and run the following code:

      Y = numpy.mean(X, axis = 3)

      Answer- None of the above

       

       

      4)- Given a tensor t, load the tensor into a tensorflow’s tf.data.Dataset and run the reduce operation with parameters ​ initial_state = 1​ and ​
      reduce_func = lambda x, y: x + y​ on the dataset. Choose the result of the operations from the options below:

      t = [[1, 2, 3, 4, 5, 6, 7], [2, 3, 4, 5, 6, 7, 8], [3, 4, 5, 6, 7, 8, 9]]

      Answer- [7 10 13 16 19 22 25]

       

       

      5)- Using the same tensor from Q4, we load the tensor into a tensorflow’s tf.data.Dataset and run the map operation with ​ map_func = lambda
      x: (x + tf.reduce_mean(x))​ . We then run the reduce operation with parameters initial_state = 5​ and reduce_func = lambda
      x, y: 3*x – 4*y​ on the dataset. Choose the result of the operations from the options below:

      Answer- [-165, -217, -269, -321, -373, -425, -477]

       

       

      6)- What will be the first, last elements and the size of the output array of the following code:

      x= tf.data.dataset.range(1, 10)

      x_= x.repeat(2).batch(20)

      n= next(iter(x_))

      print(n.numpy())

      Answer- 1, 9, 18

       

       

      7)- For the given raw data, which of the following preprocessing steps do you think were necessarily ​ applied before providing it for the training of a neural network? Hint: Only three are correct.

      time, status, age, month_year, col1, col2

      10, A, 76, Jul-1972, 6.76, yes

      30, B, 56, Jan-1968,, No

      35, A, 41, Nov-1977, 1.34,

      99, C, 71,, 2.9, No

      185, B, 52, Mar-1965, 12.08, Yes

      Answer- Handle missing values, Column month_year split, One-hot encoding

       

       

      8)- Suppose the shape of a given data is (100, 15). Our task is to perform regression on the last 5 columns using others 10. We assigned 20% of this data for validation while training process, 20% for evaluating the model after it is trained. What are the correct dimensions of

      x_train, y_train, x_valid, y_valid, x_test, y_test respectively?

      Answer- (60, 10), (60, 5), (20, 10), (20, 5), (20, 10), (20, 5)

       

       

      9)- We are building a two-layer neural network with 7 units in the input layer, 4 units in the hidden layer and 1 unit in the output layer.
      The hidden layer uses ReLU activation and the output layer uses sigmoid activation. Find below the weights and biases of the network. ​Wij is the weight of the j(th) unit in the i(layer) The bias terms ​ b ​ and output terms ​ o follow the same pattern.

      W11 = [-0.05, 0.1, 0.1, 0.2, 0.35, 0.6, -0.9, -0.1]  b11 = -0.8
      W12 = [-0.5, 0.1, 0.1, 0.02, 0.3, 0.36, 0.9, 0.1]  b12 = ​ -0.1
      W13 = [-0.05, 0.1, 0.1, 0.2, 0.35, 0.6, 0.9, -0.1] b13 = -0.1
      W14 = [-0.5, 0.1, 0.1, 0.02, 0.3, 0.36, -0.9, 0.1]  b14 = ​ -0.1

      Given input ​ x = [1, 0.2, 0.4, 0.9, 1, 0, 0.6, 0.3], what are the outputs (rounded) of the hidden layer?

      Answer- [0, 0.348, 0.95, 0]

       

       

      10)- In continuation of the previous question, given the weights and bias for the output layer, what is the output of the neural network?

      W21 = [-0.05, 0.1, 0.1, 0.2];  b21 = 0

      Answer- 0.532

       

       

      11)- Which of the following will help in reducing variance in a neural network?

      Answer- Increasing the dropout rate, Increasing lambda (a parameter that controls L2 regularization), Increasing the size of training data by using data augmentation

Viewing 0 reply threads
  • You must be logged in to reply to this topic.