cost1 Linear regression W,b를 조정해서 참에 가까운값으로 예측한다. import tensorflow as tf import numpy as np from tensorflow import keras from tensorflow.keras.optimizers import SGD # X, Y 데이터 x_train = [1,2,3] y_train = [1,2,3] W = tf.Variable(tf.random.normal([1]), name='weight') b = tf.Variable(tf.random.normal([1]), name='bias') #cost/loss function def compute_cost(): # XW+b h = x_train * W + b cost=tf.reduce_mean((h-y_train)**2) .. 2023. 7. 26. 이전 1 다음 반응형