Код: Выделить всё
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import Sequential
from tensorflow.keras.layers import Dense
import numpy as np
x = [20, 23, 25, 28, 30, 37, 40, 43, 46]
y = [45, 51, 55, 61, 65, 79, 85, 91, 97]
study_model = Sequential([Dense(units=1, input_shape=[1])])
study_model.compile(optimizer='adam', loss='mean_squared_error')
x = np.array(x, dtype=int)
y = np.array(y, dtype=int)
history = study_model.fit(x, y, epochs=25)
n = 38
result = study_model.predict([n])[0][0]
rounded_number = round(result, 2)
print(f"If I study for {n} hours, I will get { rounded_number} marks as my grade.")
Код: Выделить всё
raise ValueError(f"Unrecognized data type: x={x} (of type {type(x)})")
ValueError: Unrecognized data type: x=[38] (of type )
Подробнее здесь: https://stackoverflow.com/questions/784 ... f-type-typ