Neural Network Unit Test Unit 1 ~ Unit 14

Lecture 1 Unit Testing

‌1. The scientist known as the "father of artificial intelligence" is __Turing_. ‎ 2
‌Among the following statements, it is correct that ___what we are now realizing is almost all weak artificial intelligence_____. ‏ 3 ‎The English abbreviation of AI is ___ Artificial Intelligence_____. ‎ 4 ‍The purpose of studying artificial intelligence is to allow machines to ___ simulate, extend and expand human intelligence _____. ‍5 ‎Natural language understanding is an important application field of artificial intelligence. The ___scientific calculations listed below have higher precision and faster speed____ are not the goals it wants to achieve.










Lecture 2 Unit Test

1
‏Among the following Anaconda tools, ___Anaconda Navigator____ cannot be directly used to edit and run source code. ‍ 2
‎Among the following statements, the correct one is: Anaconda does not have to be installed for programming in the Python language . 3 ‍In the command to install the package below, the error is: ___ pip install tensorflow=2.4.0 alpha___. ‎ 4 ‏__Package Management____ can not only install, update, and uninstall toolkits conveniently, but also automatically install the corresponding dependent packages during installation. ‌ 5 Create a file add.py and write the following code :










print( “the first number is:)
print(30+50)
print(“the second number is:)
30*50

Save and run the script file, the output is:
‎ the first number is:
80
the second number is:

Lecture 3 Unit Testing

1
‏The wrong statement in the following statement is _______.
The execution speed of the Python language is higher than that of the C language
2
‌Receive user input information, and use the name and age entered by the user to greet the user. The following ______ program segment is correct.
‌ name
= input(“Please input your name:”)
age=int(input(“Please input your age:”))
print('Hello!%s,I know your age is %d.'%(name,age ))
3
‍The following _______ are Python legal identifiers. ‍test
4 ‎The following _______ statements are illegal in Python. ‌ max = x >y ? x : y 5 ‎After executing the following program, assuming the user inputs 123, the output result is ______.






n=int(input('请输入一个三位正整数:'))
a=n//100
b=(n//10)%10
c=n%10
print(a,end=',')
print(b,end=',')
print(c)


1,2,3

6
‍The following ones that cannot increase the value of variable a by 1 are _______.
a+1

7
‍It is known that x=2, y=3, after the compound assignment statement x*=y+5 is executed, the value in the x variable is _______.
16

8
‏Execute the following program segment, the output result is _______.

‏a = 30
‏b = 1if a >=10:
‏    a = 20elif a>=20:
‏    a = 30elif a>=30:
‏    b = aelse:
‏    b = 0print('a=%d, b=%d'%(a,b))

‌ a
=20, b=1
9
‌The output of the following code is _______.

for i in range(10):if i%2==0:continueelse:print(i, end=",")

1,3,5,7,9,
10
‍The output of the following program is: _______.

sum=1for i in range(1,5):sum *= iprint(sum)


24

Lecture 4 Unit Testing

1
‎Among the following options, the one that correctly defines a dictionary is _______.
dic={'a':1,'b':2,'c':3}
2
‏The following definitions about lists and tuples, the wrong one is _______.
‎ tup
=(1)
3
‌Assuming that the file does not exist, if you use the open method to open the file, an error will be reported, then the file is opened in the following _______ mode.
'r'
4
‍The execution result of the following program is _______.
‏ ‍str
="HelloWorld"
‏ ‍print
(str[5:])
‏ ‍print
(str[-5:]) ‏ World
World 5 Execute the following code, the correct result is _______. ‌ class MyClass: ‌ a = 10 ‌ b = 100 ‌ x = MyClass() ‌ print (xb) ‌ print (x. a) ‌ 100 Program error



















6
‍The result of the following program is
___.
‏ ‍def
mul(a=1,b=4,c):
‏ ‍ return
a b c
‏ ‍print
(mul(2,3,2))
‏Operation
error
7
‎If the content of the text file a.txt is as follows
:
‎abcdef‍ ‎123456‍ ‎Then the execution result of the following program is _______. ‍ ‎f =open("a.txt", "r")‍ ‎s =f.readline()‍ ‎s1 =list(s)‍ ‎print (s1)‍ [ 'a', 'b', ' c', 'd', 'e', ​​'f', '\n']8‌The result of the following program is _______. ‎ ‌lst_demo =[10,23,66,26,35,1,76,88,58]‎ ‌lst_demo.reverse ( )





















‌print(lst_demo[3])
‎ ‌lst_demo.sort
()
‎ ‌print
(lst_demo[3])
‎ 1
26
9
‏Execute the following program segment, and the output result is _______.
‎ ‏class
Person: ‎ ‏ def
del (self): ‎ ‏ print (“–del–”) ‎ ‏person = Person() ‎ ‏del person ‎ ‏print (“–end–”) –del– –end– 10 ‎If the contents of the text file hello.txt are as follows: ‍ ‎Hello , Python! ‍ ‎The execution result of the following ‍ ‎with open(“hello.txt”) as f: ‍ ‎print (f.read()) ‍ ‎print (f.read() )
























First output Hello, Python! Then it prompts that an I/O operation exception occurs

Lecture 5 Unit Testing

1
Which of the following statements is incorrect. ‎The shape of the
two-dimensional 2 The following statement about Numpy is wrong _______. ‍When Numpy 3 ‍After executing the following program segment, the result is _______. ‌ ‍import numpy as np ‌ ‍b = np.array([[[0,1,2],[3,4,5]],[[6,7,8],[9,10,11]]]) ‌ ‍b [1,1,2] ‌ 11 4 ‎The execution result of the following program is _______. ‍ ‎a =np.array([4,3,2,1]) ‍ ‎print (a[1:3]) ‍ [ 3 2] 5 After executing the following program segment, the result is _______. ‎ import numpy as np ‎ a = np.array([[[4,3,2,1],[1,2,3,4]],[[7,8,9,10],[10,9 ,8,7]]] )






























print(a.ndim)
‎ print
(a.shape)
‎ print
(a.size) ‎ 3
(2, 2, 4) 16 6 two-dimensional array a=np.array([[1, 2, 3],[ 4, 5, 6],[7, 8, 9]]), the statement that cannot take out all the elements of the 1st and 2nd rows is _______. a[0:1, 0:2] 7 ‏The execution result of the following program is _______. ‏import numpy as np ‏a = np.arange(0, 8, 2, dtype='int32') ‏print(a) [0 2 4 6] 8 ‍After executing the following functions, the result is _______. ‍import numpy as np ‍a = np.linspace(0,10,num = 3) ‍b = np.logspace(1,7,4,base=2) ‍print(a) ‍print(b) [ 0.5.10.] [ 2. 8. 32. 128.] 9 ‌After executing the following program segment, the result is _______. ‏ ‌a =[1,2,3]

























‏ ‌b
=np.array(a)
‏ ‌type
(b) ‏ numpy.ndarray
10 ‌After performing the following operations, the correct output is _______. ‏ ‌import numpy as np ‏ ‌a = np.array([0, 1, 2, 3]) ‏ ‌print (a) ‏ [ 0 1 2 3] 11 ‏The execution result of the following program segment is _______. ‏ ‏import numpy as np ‏ ‏t = np.arange(120).reshape(3,4,5,2) ‏ ‏t0 =np.sum(t,axis=1) ‏ ‏print (t0.shape ) (3,5,2) 12 ‌The execution result of the following program segment is _______. ‏ ‌arr = np.arange(12).reshape(2,2,3) ‏ ‌np.sum (arr, axis=0 )






























array([[6,8,10], [12,14,16]])
13
‎Define the following matrix a, b, then the output result in the option is the same as the b matrix is ​​_______.
‏ ‎a
= np.mat([[0,1],[2,3]])
‏ ‎b
= np.mat([[1,0],[0,1]])
‏ aI
*a
14
Among the following functions, the return value is not a floating point number is _______.
‎ np.random.randint
()
15
The execution result of the following program is _______.
‏ a
= np.array([5.5, 6.2, 8.7])
‏ b
= np.array([3, 4, 5])
‏ c
= a - b ‏ c.dtype
‏ dtype ('float64')


Lecture 6 Unit Testing

1
Regarding the figure() function, the description of the error is ______.
‏ figure
( num,figsize,dpi,facecolor,edgecolor,frameon ) ‏ ‌ num represents the number of sub-figures 2 For the output of the following program segment, the wrong one is ______. ‏ import matplotlib.pyplot as plt ‏ fig = plt.figure(facecolor="g") ‏ plt.subplot (252) ‏ plt.subplot (257) ‏ plt.subplot (2,5,10) ‏ plt.show ( ) ‏ ‎The resulting 3 subplots are on separate columns 3 ‏The following ______ functions are used to draw a scatterplot. ‏ scatter () 4Which of the following statements is wrong is ______. ‎When using 5 The following ______ parameters are used to set the size of the data points in the line chart.































‍markersize
6
‌If you use the tight_layout(rect=[]) function to compress the sub-image upwards (that is, leave the space below the sub-image), you can consider modifying the parameter in rect to ______.
‎ rect
[0 , 0.1 , 1 , 1]
7Download
the Boston house price data set, put the training set into train_x, then execute the ______ statement to get the first 5 rows of data.
‌ print
(train_x[0:5])
8
The execution result of the following program segment is ______.
‍ import
tensorflow as tf
‍ boston_housing
= tf.keras.datasets.boston_housing
‍(
train_x,train_y),(test_x,test_y)= boston_housing.load_data(test_split=0.1)
‍print
("Training set:", len(train_x))
‍ print
(“Testing set:”, len(test_x)) ‍ ‍ Training set: 455 Testing set: 51



9
‏In the Boston data set, access to the ZN and INDUS attributes (column 2 and column 3 elements) of all samples in the test set test_x can be achieved through the ______ statement.
‌ test_x
[:, 1:3]
10
After executing the following program segment, the data point at x=4 is ______.
‌ import
numpy as np
‌ import
matplotlib.pyplot as plt
‌ x
= np.arange(8)
‌ y
= np.arange(8)
‌ dot_color
= [1, 2, 0, 2, 1, 0, 0, 2]
‌ plt.scatter
(x,y, c = dot_color,cmap = 'brg')
‌ plt.show
() ‌red

Lecture 7 Unit Testing

1
‍In the following description, the wrong one is _______. ‍The bit depth of the
grayscale 2 ‍In the following description, the correct one is _______. By default, 60,000 entries in the MINST dataset are training data, and 10,000 entries are testing data. 3 ‎Storing a grayscale image with 512×512 pixels will occupy _______ memory space. ‎ 256KB 4 ‎The following _______ is a lossless compressed image format, and is suitable for images with regular gradient colors. PNG 5 single choice (2 points) Save the 600×600 image lena.tiff in the current path, execute the following program segment to crop the image, and the _______ point is in the cropping area. import matplotlib.pyplot as plt from PIL import Image image = Iamge.open(“Lena.tiff”) img_region = img.crop((100,300,300,500)) plt.imshow(img_region) plt.show() (220,460) 6 The following program In the paragraph, _______ can save the picture lena.bmp in JPEG format.
























image = Image.open(“lena.bmp”)
image.save(“lena.jpg”)

7
‌Among the following functions of the Pillow library, the one that directly scales the original image is _______.
thumbnail()
8
lena.jpg is a grayscale image, after executing the following program segment, mylena.jpg is _______.
‍ import
matplotlib.pyplot as plt
‍ from
PIL import Image
‍ img
= Image.open(“lena.jpg”)
‍ img
= img.convert(“1”)
‍ img.save
(“mylena.jpg”) ‍ ‏two Value image 9 In the MINST data set, access to the label value of the sixth sample in the training set train_y can be achieved through the _______ statement. ‎ train_y [5] 10 converts a 256×256 RGB color image into an array whose shape is _______. (256, 256, 3) 11 Execute the following code segment, and the correct description of the output result is _______. ‌ import tensorflow as tf ‌ mnist = tf.keras.datasets.mnist

















(train_x, train_y), (test_x, test_y) = mnist.load_data()

print(“training set:”, train_x.shape)

print(“testing set:”, len(test_x))


training set: (60000, 28, 28)
testing set: 10000

12
Execute the following code segment, and the wrong description of the output result is _______.
‌ import
tensorflow as tf
‌ import
numpy as np
‌ import
matplotlib.pyplot as plt
‌ mnist
= tf.keras.datasets.mnist
‌ (
train_x, train_y), (test_x, test_y) = mnist.load_data()
‌ for
i in range (9):
‌ num
= np.random.randint(1,60000)
‌ plt.subplot
(3, 3, i+1)
‌ plt.axis
(“off”)
‌ plt.imshow
(train_x[num], cmap ='gray')
‌ plt.title
(train_y[num]) ‌ plt.show
(
) ‌ ‎ ‌The function of this





‏Store 1,000 color pictures with a size of 28×32 in the multidimensional array pic. The shape of the pic is ____. After the slice operation "pic[0]" is performed on the pic, the obtained array is ____.
‏(
1000,28,32,3) three-dimensional array
14
‎Store 5000 color pictures with a size of 28×32 in the multi-dimensional array pic, and extract the index value of pic from 9 to 19 (the index starts from 0) For the G channel of the picture, ______ should be used.
‌ pic
[9 : 20 , : , : , 1]

Lecture 8 Unit Testing

1
‍Which of the following statements is wrong.
‍Python
lists are very suitable for numerical calculations
2
In the following statement about TensorFlow, it is wrong.
‍ Tensorflow 2.0
adopts the dynamic graph mechanism by default, and its execution efficiency is higher than that of the static graph mechanism
3
‏The following statements about TensorFlow tensors are wrong.
‏After
the tensor is divided or spliced, the storage order of the tensor will change.
4
‍Execute the following program segment, and the description of the running result is correct.
‍import tensorflow as tf
‍a = tf.constant(1234567, dtype=tf.float32)
‍tf.cast(a, tf.float64)
<tf.Tensor: id=11, shape=(), dtype=float64, numpy=1234567.0>
5 ‍ ‎ ‍After executing
‎ ‍import tensorflow as tf ‎ ‍import numpy as np ‎ ‍a = np.arange(9).reshape(3,3 )









‍b = tf.convert_to_tensor(a)
‎ ‍print
(tf.is_tensor(a))
‎ ‍isinstance
(b,tf.Tensor) ‎ False
True 6 ‌Execute the following program segment, the result description is wrong. ‏ ‌import tensorflow as tf ‏ ‌tf.random.truncated_normal (shape=(2, 2), mean=0.0, stddev=2.0) ‏Points other than [-4,4] may appear in the generated 7 ‏The following statements are correct yes. ‏After using 8 ‏The following statements about tensor operations are wrong. ‎When adding two ‏After executing the following program segment, the correct result is . ‏ ‏import tensorflow as tf ‏ ‏a = tf.range(8, delta=2) ‏ ‏a1 = tf.reshape(a, [-1,2])



























‏b = tf.range(1, 9,delta=2)

‏b1 = tf.reshape(b, [2,-1])

‏c = tf.stack((a1, b1),axis=0)

‏print(“shape:\n”,c.shape)

‏print(“value:\n”,c.numpy())

shape:
(2, 2, 2)
value:
[[[0 2]
[4 6]]
[[1 3]
[5 7]]]

‍10. Run the following program segment, the result is correct.
‍import tensorflow as tf
‍t1 = tf.constant([[1, 2, 3], [4, 5, 6]])
‍t2 = tf.constant([[7, 8, 9], [10, 11, 12] ])
‍t = tf.stack((t1, t2), axis=-1)
‍print(t.shape)

(2, 3, 2)
11
‍The execution result of the following program segment is.
‎ ‍import
tensorflow as tf
‎ ‍a
= tf.range(6)
‎ ‍a1
= tf.reshape(a, [2, 3])
‎ ‍b
= tf.constant([[7, 8, 9], [10, 11, 12]])
‎ ‍b1
= tf.gather(b, axis=1, indices=[1, 2, 0])
‎ ‍c
= a1*b1
‎ ‍print
(c.numpy())
‎ [
[ 0 9 14] [ 33 48 50]]
12
‍For the execution results of the following program segments, the description is wrong.
‏ ‍import
tensorflow as tf
‏ ‍x
= tf.constant([1., 4., 9., 16.])
‏ ‍pow
(x, 0.5) ‏The shape of
the output 13 ‎The following program segment The execution result is. ‌ ‎import tensorflow as tf





‌ ‎a
= tf.range(24)
‌ ‎b
= tf.reshape(a,[4,6])
‌‎c
= tf.gather_nd(b,[[0,0],[1,1],[ 2,2]])
‌ ‎print
(c.numpy())
‌ [
0 7 14]
14
‌ After executing the following program segment, the result is .
‍ ‌import
tensorflow as tf
‍ ‌import
numpy as np
‍ ‌a
= tf.constant(np.arange(48).reshape(3,2,4,2))
‍ ‌b
=tf.random.shuffle(a)
‍ ‌c
= tf .constant(np.arange(8).reshape(2,4))
‍ ‌d
= a@c
‍ ‌print
(d.shape)
‍ (
3, 2, 4, 4)
15
‍The execution result of the following program segment is.
‍import tensorflow as tf
‍import numpy as np
‍a = tf.constant([[1., 2., 3.],[4., 5., 6.]])
‍b = tf.random.shuffle(a)
‍c = tf.constant(np.arange( 6), shape=(3,2) ,dtype=tf.float32)
‍d = tf.reduce_mean(b@c, axis=0)
‍e = tf.argmin(d,axis=0)
‍print(“d_value:”, d.numpy())
‍print(“e_value:”,e.numpy())
d_value: [25. 35.5]
e_value: 0
16
‌The following description is wrong is ______.
CPU has higher floating-point computing power than GPU
17
‎The following description is wrong ______.
‎By
default, TensorFlow assigns operations to the CPU first

Lecture 9 Unit Testing

1
‏Which of the following statements is incorrect is _____. ‎There are two or more independent variables
in 2 The wrong statement in the following statement is _____. ‏Supervised learning includes learning from labeled and unlabeled samples 3 ‌Which of the following statements is incorrect is _____. ‏The best -fit straight line should pass through each sample point 4 ‌The result of the following procedure is _____. ‌import tensorflow as tf ‌a = tf.constant([1, 3, 5]) ‌b = 2 ‌c = tf.reduce_sum(a+b) ‌c.numpy() 15 5 ‎After executing the following code, the result is _____ . ‏ ‎X =1/3 ‏ ‎print (round(X, 2)) ‏ 0.33 6 After executing the following function, the result is _____. ‍ import numpy as np ‍ X0 =np.ones(3) ‍X1 =np.zeros(3)

































‍ X2
=np. array([1,2,3])
‍ X
=np. stack((X0,X1,X2), axis=1)
‍ print
(X)
‍ [
[1,0,1],[ 1,0,2],[1,0,3]]
7
Run the following program, regarding the data types of a, b, c, d, e, the correct one of the following is _____.
import numpy as np
import tensorflow as tf
a=np.array([1,2,3])
b=2
c=a+b
d=tf.add(a,1)
e=c+d
a,b,c There are 2 TensorFlow tensors
8 in ,d,e
After executing the following program segment, the shape of the array c is: . ‍ ‎ ‍ ‎import numpy as np ‍ ‎a =np.arange(5).reshape(-1,1) ‍ ‎b =a+1 ‍ ‎c =b.reshape(-1) ‍ ‎c.shape (5, ) 9















‍The running result of the following program segment is
.
‌ import
numpy as np
‌ A
= np.array([[2, 3], [2, 1]])
‌ B
= np.array([[2, 0], [1, 2]])
‌ X
= A * B
‌ Y
= np.matmul(A, B)
‌ print
(“X:\n”, X)
‌ print
(“Y:\n”, Y)
‌ X
:
[[4 0]
[2 2] ]
Y:
[[7 6]
[5 2]]
10
judgments (2 points)
‎Analytic solution refers to the solution obtained by derivation and calculation through strict formulas.
right

Lecture 10 Unit Testing

1
‌Which of the following statements is incorrect is ______.
‌A Variable
object is a variable that cannot be trained automatically
2
‎The following statement about the array x is wrong ______.
‌ ‎w
= tf.Variable(np.random.randn(3, 1)) ‌ The type of elements in
w 3 ‍The execution result of the following program segment is ______. ‌ ‍x = [] ‌ ‍for i in range(5): ‌ ‍ i += 1 ‌ ‍ x.append (i) ‌ ‍print (x[2:4]) ‌ [ 3, 4] 4 After executing the following code, The result obtained is ______. ‎ import tensorflow as tf ‎ a = tf.constant(3) ‎ x = tf.Variable(a) ‎ print (isinstance(a, tf.Tensor), isinstance(a, tf.Variable) )


























print(isinstance(x, tf.Tensor), isinstance(x, tf.Variable))
‎ True
False
False True
5
After executing the following code, the result is ______.
‌ ‌import
tensorflow as tf
‌ ‌x
= tf.Variable([1., 2.])
‌ ‌y
= tf.Variable([3., 4.])
‌with
tf.GradientTape() as tape:
‌f
= tf .square(x) + 2*tf.square(y) + 1
‌ ‌df_dx
, df_dy = tape.gradient(f, [x, y])
‌‌print
(“df_dx:”, df_dx.numpy())
‌ ‌print
( "df_dy:", df_dy.numpy())
‌ df_dx
: [2. 4.]
df_dy: [12. 16.]
6
‍Execute the following program segment, and the result is ______.
‍import tensorflow as tf
‍x = tf.Variable(4.)
‍with tf.GradientTape() as tape:
‍y = tf.square(x)
‍dy_dx = tape.gradient(y, x)
‍print(y.numpy(),dy_dx.numpy() )
16.0 8.0
7
‏Which of the following statements is incorrect is______.
‏Overfitting
is over-learning, the performance on the training set is very poor, and the generalization error on the new sample is also very large
8
‏In the following program segment, the array x can be normalized by column.
‎ ‏import
numpy as np
‎ ‏x
= np.array([[4., 30, 200],
‎ ‏ [
1., 30, 100],
‎ ‏ [
2., 40, 300],
‎ ‏ [
5 ., 30, 400]])
‎ a
=(x.max(axis=0)-x.min(axis=0))
(xx.min(axis=0)) / a
9
‎Execution of the following program segment The result description is correct
.
‍ ‎import
numpy as
np
‎x0 = np.array([[3., 10, 500],

‎ [1., 30, 100],

‎ [2., 40, 300]])

‎x1 = np.ones(len(x0)).reshape(-1,1)

‎x = tf.cast(tf.concat([x0, x1], axis=1), tf.float64)

‎print(x.dtype, x.shape)

float64 (3, 4)

Lecture 11 Unit Testing

1
Run the following program, the correct result is ______.
‌ import
tensorflow as tf
‌ import
pandas as pd
‌ TRAIN_URL
= “https://download.tensorflow.org/data/iris_training.csv”
‌ train_path
= tf.keras.utils.get_file(TRAIN_URL.split('/')[ -1], TRAIN_URL)
‌ df_iris
= pd.read_csv(train_path, header=0)
‌ iris
= np.array(df_iris)
‌ train_x
= iris[:,0:2]
‌ print
(train_x.shape)
‌ (
120, 2)
2
‎Among the following options, the one that can be used to fill the partition is ______.
‏ plt.contourf
()
3
‎Run the following program, the correct result is ______.
‍ ‎import
numpy as np
‍ ‎test
= np.arange(0,5,1)
‍ ‎a
= np.max(test)
‍ ‎b
= np.argmax(test)
‍ ‎print
(a,b)
‍ 4
4
4
‍The following statement about the Softmax function is wrong ______.
Softmax function does not belong to generalized linear regression
5
‏In the following statement, the wrong one is ______. ‌A linearly separable data set in
three-dimensional 6 After executing the following code, the result is ______. pred = np. array([0.1, 0.2, 0.6, 0.8]) a = np. array([1,2,3,4]) b = np. array([10,20,30,40]) tf. where(pred<0.5, a, b) ([1,2,30,40]) 7 ‎The result obtained after executing the function tf.round(0.5) is______. ‎ 0.0 8 100 samples, 3 categories of questions, the correct expression in the following options is ______.














9
‌In the following code segment, the length and width of the iris petals are obtained, and the correct expression is ______.
‎ ‌import
tensorflow as tf
‎ ‌import
numpy as np
‎ ‌impor
pandas as pd
‎ ‌TRAIN_URL
= “https://download.tensorflow.org/data/iris_training.csv”
‎ ‌train_path
= tf.keras.utils.get_file(TRAIN_URL.split( '/')[-1], TRAIN_URL)
‎ ‌df_iris_train
= pd.read_csv(train_path, header=0)
‎ ‌iris_train
= np.array(df_iris_train) ‎ ‌x_train = iris_train[:, 2:4] 10 ‏A good one model, all attributes in the dataset should be used. ‏The smaller the cross entropy is, the closer the two probability distributions are. ‏Yes










Lecture 12 Unit Testing

1
Which of the following statements is incorrect is ______.
When implementing a neural network, the value of the hyperparameter is generally obtained according to the training
2
‍The error in the following statement is ______. ‎Using the gradient descent method to calculate the gradient
in 3 The following statements about hyperparameters and data sets are incorrect. ‎Neither the number of layers nor the error value of the hidden 4 ‍_____ is most suitable as the activation function of the output layer in the multi-classification task. ‌softmax function 5 ‌Among the following statements about the activation function, the error is ______. ‎Using the Tanh function instead of the logistic function can avoid the gradient vanishing problem6 ‏The execution result of the following program is ______. ‍ ‏import tensorflow as tf ‍ ‏a = tf.Variable([1., 1.]) ‍ ‏b = tf.Variable([2., 2.]) ‍ ‏with tf.GradientTape() as tape : ‏ y = tf.square(a) + 2 tf.square(b) + 1

























‍ ‏grads
= tape.gradient(y, [a,b])
‍ ‏a.assign_sub
(grads[0]
b)
‍ ‏print
(a.numpy())
‍ [
-3. -3.]
7
single choice (2 points)
‏Among the statements about single-layer neural network and multi-layer neural network, the wrong one is ______.
‏Single layer
neural network can only have one hidden layer

Lecture 13 Unit Testing

1
When training on large datasets, the preferred gradient descent algorithm is ______.
Mini-batch Gradient Descent Method
2
‏Which of the following statements about the gradient descent algorithm is incorrect is ______.
The calculation speed of the stochastic gradient descent algorithm is fast, which can make the model converge quickly.
3
‎The main factors affecting the efficiency of the mini-batch gradient descent method include ______.
‎ ‎①Selection
of small batch samples②Batch size③Learning rate④Gradient‎ ①②③④ 4
‎Which of the following statements is wrong is______. ‍The more advanced the gradient descent optimization algorithm is used be . ‎ As a front-end tool, Keras 6 ‍The following description about Sequential is wrong.______. ‌Sequential can only implement a fully connected neural network 7 ‍The following description of the loss function is wrong. ______. ‎In multi 8 to use the neural network to realize the iris flower classification task. The output layer uses the softmax activation function. If the label value and the predicted value are expressed in numeric and one-hot encoding, the ______ is usually used Model performance evaluation function.




















tf.keras.metrics.SparseCategoricalAccuracy()
9
Use the following statement to train the Mnist handwritten digit recognition network, where the correct statement is ____. ‎ model.fit(x_train, y_train, batchsize=64 ,
epochs
=5, validation_split=0, verbose=2) ‎A
total of
60,000 pieces of data participated in model training10 ‏Use the following code to build a neural network model. The correct statement is______. ‍ ‏import tensorflow as tf ‍ ‏model = tf.keras.Sequential() ‍ ‏model.add (tf.keras.layers.Dense(8, activation="relu", input_shape=(4, ))) ‍ ‏model .add(tf.keras.layers.Dense(4, activation="relu")) ‍ ‏model.add (tf.keras.layers.Dense(3, activation="softmax")) ‍ ‏model.summary () ‍The model has a total of 91 trainable parameters 11

















‎Create a model model, the following methods of saving and loading the model, the wrong description is ______.
‏Using
the tf.keras.models.load_model() method can only load the structural information of the model.
12Use
the following program segment to create a neural network model. The wrong statement in the following statement is ______.
‍ import
tensorflow as tf
‍ model
= tf.keras.Sequential()
‍ model.add
(tf.keras.layers.Flatten(input_shape=(5, 5)))
‍model.add
(tf.keras.layers.Dense( 5, activation="relu"))
‍ model.add
(tf.keras.layers.Dense(3, activation="softmax"))
‍ model.summary
()
‍This
neural network contains 2 hidden layers

13
‏Create a model model, use the following statement to save the model information, the wrong statement is ______.
‏model.save("test", include_optimizer=True, save_format="tf")
model file is saved in HDF5 format

Lecture 14 Unit Testing

1
‍Which of the following statements is incorrect is ______.
‏Traditional
machine learning can automatically learn task-related features from data
2
‏The following statement is wrong ______.
The image border is not filled, and the image after convolution operation has the same size as the original image.
3
The wrong statement in the following statement is ______. ‌Compared
with image 4 After a round of convolution with a stride of 3, the size of the resulting image is ______. ‏ 5 ×5 5 ‏Which of the following statements is incorrect is ______. Convolutional neural network is a kind of feedback neural network 6 ‏Which of the following statements is wrong is ______. ‎The role of the pooling











Guess you like

Origin blog.csdn.net/qq_53869058/article/details/131094473