1
lub first
Copy of X
replace: X2
1,3,2
A*A
,ignore range 1,3
A*A*A
,ignore range 3
+ Invert selection
—
Kod do punktu 2.9
from keras import layers from keras import models from keras.models import Sequential,InputLayer from keras.layers import Dense from io import StringIO import tensorflow as tf import matplotlib.pyplot as plt import numpy as np # 005.arff data = """ -4.84295,-27.856212 ... """ #enter data as a string inp = StringIO(data) x, y = np.loadtxt(inp, delimiter=',', usecols=(0, 1), unpack=True,skiprows=0) X = np.stack((x,x**2,x**3),axis=-1) tf.random.set_seed(1) model = models.Sequential() model.add(layers.InputLayer(input_shape=(X.shape[1],))) model.add(layers.Dense(1)) model.summary() model.compile(optimizer=tf.keras.optimizers.RMSprop(????), loss='mse', metrics=['mse','mae']) hist = model.fit(X,y,epochs=???,verbose=1) y_pred = model.predict(X) plt.scatter(x,y) plt.plot(x,(x+4)*(x+1)*(x-3),c='g') plt.plot(x,y_pred,c='r')