问题一:对特征归一化
Min-Max Scaling:
X′=a+(X?Xmin)(b?a)/(Xmax?Xmin)
# Problem 1 - Implement Min-Max scaling for grayscale image data
def normalize_grayscale(image_data):
"""
Normalize the image data with Min-Max scaling to a range of [0.1, 0.9]
:param image_data: The image data to be normalized
:return: Normalized image data
"""
# TODO: Implement Min-Max scaling for grayscale image data
a = 0.1
b = 0.9
grayscal_min=0
grayscal_max=255
return a + (((image_data-grayscal_min)*(b-a))/(grayscal_max-grayscal_min))
问题二:用 TensorFlow 创建特征、目标、权重和偏置项 tensor。
问题三:调整学习率,epochs 和 batch size 来获取最高准确率