|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
import numpy as np
import matplotlib.pyplot as plt
data = pd.read_csv('C:\\Users\wangying\Desktop\\advertising.csv')
# plt.scatter(data.newspaper,data.sales)
x=data.iloc[:,1:-1]
y=data.iloc[:,-1]
model=tf.keras.Sequential([tf.keras.layers.Dense(10,input_shape=(3,),activation='relu'),tf.keras.layers.Dense(1)])
model.summary()
model.compile(optimizer='adam',loss='mse')
model.fit(x,y,epochs=10000)
这是代码
ValueError: Input 0 of layer sequential is incompatible with the layer: expected axis -1 of input shape to have value 3 but received input with shape [None, 2]
这是错误
TV radio newspaper sales
230.1 37.8 69.2 22.1
44.5 39.3 45.1 10.4
17.2 45.9 69.3 9.3
151.5 41.3 58.5 18.5
180.8 10.8 58.4 12.9
这是我的数据
各位大佬,我知道问题出在哪里,但是我输入的就是三个数据,难道input_shape不应该是3么,但是怎么提示我接收的只能是2维呢
|
|