diff --git a/.gitignore b/.gitignore index e1fd5f1f..119e22e3 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ *.gz *.pyc __pycache__/ + +.idea diff --git a/ch05/common b/ch05/common new file mode 120000 index 00000000..60d3b0a6 --- /dev/null +++ b/ch05/common @@ -0,0 +1 @@ +../common \ No newline at end of file diff --git a/ch05/dataset b/ch05/dataset new file mode 120000 index 00000000..aa7f0465 --- /dev/null +++ b/ch05/dataset @@ -0,0 +1 @@ +../dataset \ No newline at end of file diff --git a/common/functions.py b/common/functions.py index 0453ae6c..42f6f173 100644 --- a/common/functions.py +++ b/common/functions.py @@ -39,9 +39,12 @@ def softmax(x): return np.exp(x) / np.sum(np.exp(x)) -def mean_squared_error(y, t): +def squared_error(y, t): return 0.5 * np.sum((y-t)**2) +def mean_squared_error(y, t): + n = len(y) + return np.sum((y-t)**2) / n def cross_entropy_error(y, t): if y.ndim == 1: diff --git a/dataset/mnist.pkl b/dataset/mnist.pkl new file mode 100644 index 00000000..57e81d62 Binary files /dev/null and b/dataset/mnist.pkl differ