보스턴 주택 가격 예측 연속적인 값을 예측하는 회귀 문제이다. 1970년대 보스턴 지역의 범죄율, 토지 지역의 비율, 방의 개수 등 정답을 포함한 14개의 특성으로 이루어져 있다. 1. 데이터 다운 및 전처리 from tensorflow.keras.datasets.boston_housing import load_data # 데이터를 다운받습니다. (x_train, y_train), (x_test, y_test) = load_data(path='boston_housing.npz', test_split=0.2, seed=777) print(x_train.shape, y_train.shape) print(x_test.shape, y_test.shape) import numpy as np # 데이..
python

Perception import math import matplotlib.pyplot as plt import numpy as np 입력 : 입력: (x1, x2) 출력: a = x1 * w1 + x2 * w2 + b 계산 y = 1, a > 임계값= 0, a Example def step_function(x): if x > 0: return 1 else: return 0 > Execute x = np.arange(-3, 4) print('x = ', x) for x_i in x: print(step_function(x_i), end ='\t') > Result x = [-3 -2 -1 0 1 2 3] 0 0 0 0 1 1 1 > Numpy.exp()와 Math.exp() 비교 def step_funct..

Perceptron(퍼셉트론) 다수의 신호를 입력 받아서, 하나의 신호를 출력 - And Gate def and_gate(x1, x2): w1, w2 = 1.0, 1.0 # 가중치 bias = -1 y = x1 * w1 + x2 * w2 + bias if y > 0: return 1 else: return 0 - Or Gate def or_gate(x1, x2): w1, w2 = 1.0, 1.0 b = -0.5 y = x1 * w1 + x2 * w2 + b if y > 0: return 1 else: return 0 - Nand Gate def nand_gate(x1, x2): w1, w2 = 0.5, 0.5 # 가중치(weight) b = 0 # 편향(bias) y = x1 * w1 + x2 * w2 ..
# numpy.c_ (column bind)와 numpy_r(row bind)의 비교a = np.array([1, 2, 3])b = np.array([4, 5, 6])print(a, type(a), a.shape)print(b, type(b), b.shape) [1 2 3] (3,)[4 5 6] (3,) c = np.c_[a, b]print(c, type(c), c.shape)[[1 4] [2 5] [3 6]] (3, 2) d = np.r_[a, b]print(d, type(d), d.shape)[1 2 3 4 5 6] (6,) e = np.r_[[a], [b]]print(e, type(e), e.shape)[[1 2 3] [4 5 6]] (2, 3) f = np.array([[1, 2, 3], [4, ..