重量
使用高度/重量执行线性回归的示例SHAInet模型。
以下是Keras等效模型:
import pandas as pd
from keras . models import Sequential
from keras . layers import Dense
from keras . optimizers import SGD
df = pd . read_csv ( './data/weight-height.csv' )
X = df [[ 'Height' ]]. values
Y = df [ 'Weight' ]. values
model = Sequential ()
model . add ( Dense ( 1 , input_shape = ( 1 ,)))
model . compile ( SGD ( lr = 0.01 ), 'mean_squa