<jupyter_start><jupyter_text>Boston housing prediction参考了以下的程序   https://pchun.work/keras%e3%81%a7%e5%9b%9e%e5%b8%b0/<jupyter_code>import tensorflow.keras
from tensorflow.keras.datasets import boston_housing
(X_train, y_train), (X_test, y_test) = boston_housing.load_data()
#トレーニングデータの正規化
X_train_mean = X_train.mean(axis=0)
X_train_std = X_train.std(axis=0)
X_train -= X_train_mean
X_train /= X_train_std

y_train_mean = y_train.mean()
y_train_std = y_train.std()
y_train -= y_train_mean
y_train /= y_train_std
#テストデータの正規化
X_test -= X_train_mean
X_test /= X_train_std
y_test -= y_train_mean
y_test /= y_train_std
X_train[0]
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense

model = Sequential()
model.add(Dense(64, activation='relu', input_shape=(X_train.shape[1],)))
model.add(Dense(64, activation='relu'))
model.add(Dense(1))
model.summary()
# 13*64+64=896
# 64*64+64=4160
# 64*1+1=65
# 本层的参数数量 = 输入通道数*输出通道数+输出通道数
model.compile(optimizer='adam', 
              loss='mse', 
              metrics=['accuracy'])
history = model.fit(X_train, y_train,
                    batch_size=1,
                    epochs=100,
                    verbose=1,
                    validation_data=(X_test, y_test))<jupyter_output>Train on 404 samples, validate on 102 samples
Epoch 1/100
404/404 [==============================] - 2s 5ms/sample - loss: 0.3470 - mae: 0.3803 - val_loss: 0.1696 - val_mae: 0.2874
Epoch 2/100
404/404 [==============================] - 1s 2ms/sample - loss: 0.1637 - mae: 0.2807 - val_loss: 0.2546 - val_mae: 0.3257
Epoch 3/100
404/404 [==============================] - 1s 2ms/sample - loss: 0.1365 - mae: 0.2581 - val_loss: 0.2057 - val_mae: 0.2959
Epoch 4/100
404/404 [==============================] - 1s 2ms/sample - loss: 0.1175 - mae: 0.2335 - val_loss: 0.1929 - val_mae: 0.2837
Epoch 5/100
404/404 [==============================] - 1s 2ms/sample - loss: 0.0966 - mae: 0.2250 - val_loss: 0.2053 - val_mae: 0.3026
Epoch 6/100
404/404 [==============================] - 1s 2ms/sample - loss: 0.0941 - mae: 0.2126 - val_loss: 0.1637 - val_mae: 0.2783
Epoch 7/100
404/404 [==============================] - 1s 2ms/sample - loss: 0.0835 - mae: 0.2024 - val_loss: 0.1959 - val_mae: 0.3051
Epoch 8/1[...]
{'fraction_non_alphanumeric': 0.22403888643393724, 'fraction_numerical': 0.1241714538223597, 'mean_word_length': 3.8170212765957445, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '368764', 'license': 'Apache-2.0', 'n_tokens_mistral': 1127, 'n_tokens_neox': 932, 'n_words': 174, 'path': 'experiment/.ipynb_checkpoints/boston_housing-checkpoint.ipynb', 'repo_name': 'qiulongquan/DS_Research', 'size': '2263'}