2024-03-29 09:59:11.164507: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable TF_ENABLE_ONEDNN_OPTS=0.
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
TF_ENABLE_ONEDNN_OPTS = 0
boston_housing = tf.keras.datasets.boston_housing
(train_x, train_y), (_, _) = boston_housing.load_data(test_split = 0)
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
titles = ["CRIN", "ZN", "INDUS", "CHAS", "NOX", "RM", "AGE", "DIS", "RAD", "TAX", "PTRATIO", "B-1000", "LSTAT", "MEDV"]
plt.figure(figsize=(12, 12))
for i in range(13):
plt.subplot(4, 4, (i + 1))
plt.scatter(train_x[:, i], train_y)
plt.xlabel(titles[i])
plt.ylabel("Price($1000's)")
plt.title(str(i + 1) + "." + titles[i] + " - Price")
plt.tight_layout()
plt.suptitle("各个属性与房价的关系", x = 0.5, y = 1.02, fontsize = 20)
plt.show
运行波士顿房价绘图 出现错误