例如:Y=w11+w22+b


import pandas as pd

data=pd.read_csv('/Users/mac/Desktop/Keras/000.数据+课件+代码【下部分】/小型数据集/Advertising.csv')

data.head()

x=data[data.columns[1:-1]]

x

y=data.iloc[:,-1]

y

import keras

import keras.layers as layers

model=keras.Sequential()

model.add(layers.Dense(1,input_dim=3))

model.summary()

model.compile(optimizer='adam',loss='mse')

model.fit(x,y,epochs=2000)

标签: none

添加新评论