diff --git a/tutorials/polynomial_regression.ipynb b/tutorials/polynomial_regression.ipynb index 629db56..6bb562a 100644 --- a/tutorials/polynomial_regression.ipynb +++ b/tutorials/polynomial_regression.ipynb @@ -258,19 +258,21 @@ "metadata": {}, "outputs": [ { - "data": { - "text/plain": [ - "Matrix([[0.0, 0.0, 0.0], [0.0, 0.0, 0.0]])" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" + "name": "stdout", + "output_type": "stream", + "text": [ + "Matrix([[0.0, 0.0, 0.0], [0.0, 0.0, 0.0]])\n", + "Matrix([[0.0, 0.0, 0.0], [0.0, 0.0, 1.0]])\n", + "Matrix([[0.0, 0.0], [0.0, 0.0], [0.0, 1.0]])\n" + ] } ], "source": [ "A = Matrix.zeros(2, 3) # rows - columns\n", - "A # each row is a vector of length 3" + "print(A) # each row is a vector of length 3\n", + "A[1, 2] = 1.0\n", + "print(A)\n", + "print(A.transpose())" ] }, { @@ -311,7 +313,7 @@ " X = Matrix.zeros(n_samples, n_features) # `Matrix.ones` is needed\n", " for row in range(n_samples):\n", " for col in range(n_features):\n", - " X.data[row][col] = x_data[row] ** col\n", + " X[row, col] = x_data[row] ** col\n", "\n", " return X" ] @@ -326,7 +328,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Matrix([[1, 0, 0, 0], [1, 1, 1, 1], [1, 2, 4, 8], [1, 3, 9, 27], [1, 4, 16, 64]])\n" + "Matrix([[1.0, 0.0, 0.0, 0.0], [1.0, 1.0, 1.0, 1.0], [1.0, 2.0, 4.0, 8.0], [1.0, 3.0, 9.0, 27.0], [1.0, 4.0, 16.0, 64.0]])\n" ] } ], @@ -378,7 +380,7 @@ "outputs": [], "source": [ "degree = 3\n", - "X_design = design_matrix_for_poly(xx.data, degree)" + "X_design = design_matrix_for_poly(xx, degree)" ] }, {