Skip to content

Commit

Permalink
change: docstring in module00
Browse files Browse the repository at this point in the history
  • Loading branch information
Amir Mahla authored and Amir Mahla committed Jun 16, 2024
1 parent e669a8d commit 41e0350
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
48 changes: 24 additions & 24 deletions module05/en.subject.tex
Original file line number Diff line number Diff line change
Expand Up @@ -612,10 +612,10 @@ \section*{Instructions}
def simple_predict(x, theta):
"""Computes the vector of prediction y_hat from two non-empty numpy.ndarray.
Args:
x: has to be an numpy.ndarray, a one-dimensional vector of size m.
theta: has to be an numpy.ndarray, a one-dimensional vector of size 2.
x: has to be an numpy.ndarray, a one-dimensional array of size m.
theta: has to be an numpy.ndarray, a one-dimensional array of size 2.
Returns:
y_hat as a numpy.ndarray, a one-dimensional vector of size m.
y_hat as a numpy.ndarray, a one-dimensional array of size m.
None if x or theta are empty numpy.ndarray.
None if x or theta dimensions are not appropriate.
Raises:
Expand Down Expand Up @@ -694,7 +694,7 @@ \section*{Instructions}
def add_intercept(x):
"""Adds a column of 1's to the non-empty numpy.array x.
Args:
x: has to be a numpy.array. x can be a one-dimensional (m * 1) or two-dimensional (m * n) vector.
x: has to be a numpy.array. x can be a one-dimensional (m * 1) or two-dimensional (m * n) array.
Returns:
X, a numpy.array of dimension m * (n + 1).
None if x is not a numpy.array.
Expand Down Expand Up @@ -811,10 +811,10 @@ \section*{Instructions}
def predict_(x, theta):
"""Computes the vector of prediction y_hat from two non-empty numpy.array.
Args:
x: has to be an numpy.array, a one-dimensional vector of size m.
theta: has to be an numpy.array, a two-dimensional vector of shape 2 * 1.
x: has to be an numpy.array, a one-dimensional array of size m.
theta: has to be an numpy.array, a two-dimensional array of shape 2 * 1.
Returns:
y_hat as a numpy.array, a two-dimensional vector of shape m * 1.
y_hat as a numpy.array, a two-dimensional array of shape m * 1.
None if x and/or theta are not numpy.array.
None if x or theta are empty numpy.array.
None if x or theta dimensions are not appropriate.
Expand Down Expand Up @@ -895,9 +895,9 @@ \section*{Instructions}
def plot(x, y, theta):
"""Plot the data and prediction line from three non-empty numpy.array.
Args:
x: has to be an numpy.array, a one-dimensional vector of size m.
y: has to be an numpy.array, a one-dimensional vector of size m.
theta: has to be an numpy.array, a two-dimensional vector of shape 2 * 1.
x: has to be an numpy.array, a one-dimensional array of size m.
y: has to be an numpy.array, a one-dimensional array of size m.
theta: has to be an numpy.array, a two-dimensional array of shape 2 * 1.
Returns:
Nothing.
Raises:
Expand Down Expand Up @@ -1011,10 +1011,10 @@ \section*{Instructions}
Description:
Calculates all the elements (y_pred - y)^2 of the loss function.
Args:
y: has to be an numpy.array, a two-dimensional vector of shape m * 1.
y_hat: has to be an numpy.array, a two-dimensional vector of shape m * 1.
y: has to be an numpy.array, a two-dimensional array of shape m * 1.
y_hat: has to be an numpy.array, a two-dimensional array of shape m * 1.
Returns:
J_elem: numpy.array, a vector of dimension (number of the training examples,1).
J_elem: numpy.array, a array of dimension (number of the training examples, 1).
None if there is a dimension matching problem.
None if any argument is not of the expected type.
Raises:
Expand All @@ -1027,8 +1027,8 @@ \section*{Instructions}
Description:
Calculates the value of loss function.
Args:
y: has to be an numpy.array, a two-dimensional vector of shape m * 1.
y_hat: has to be an numpy.array, a two-dimensional vector of shape m * 1.
y: has to be an numpy.array, a two-dimensional array of shape m * 1.
y_hat: has to be an numpy.array, a two-dimensional array of shape m * 1.
Returns:
J_value : has to be a float.
None if there is a dimension matching problem.
Expand Down Expand Up @@ -1141,8 +1141,8 @@ \section*{Instructions}
"""Computes the half mean squared error of two non-empty numpy.array, without any for loop.
The two arrays must have the same dimensions.
Args:
y: has to be an numpy.array, a one-dimensional vector of size m.
y_hat: has to be an numpy.array, a one-dimensional vector of size m.
y: has to be an numpy.array, a one-dimensional array of size m.
y_hat: has to be an numpy.array, a one-dimensional array of size m.
Returns:
The half mean squared error of the two vectors as a float.
None if y or y_hat are empty numpy.array.
Expand Down Expand Up @@ -1334,7 +1334,7 @@ \section*{Instructions}
Description:
Calculate the MSE between the predicted output and the real output.
Args:
y: has to be a numpy.array, a two-dimensional vector of shape m * 1.
y: has to be a numpy.array, a two-dimensional array of shape m * 1.
y_hat: has to be a numpy.array, a two-dimensional vector of shape m * 1.
Returns:
mse: has to be a float.
Expand All @@ -1350,8 +1350,8 @@ \section*{Instructions}
Description:
Calculate the RMSE between the predicted output and the real output.
Args:
y: has to be a numpy.array, a two-dimensional vector of shape m * 1.
y_hat: has to be a numpy.array, a two-dimensional vector of shape m * 1.
y: has to be a numpy.array, a two-dimensional array of shape m * 1.
y_hat: has to be a numpy.array, a two-dimensional array of shape m * 1.
Returns:
rmse: has to be a float.
None if there is a matching dimension problem.
Expand All @@ -1366,8 +1366,8 @@ \section*{Instructions}
Description:
Calculate the MAE between the predicted output and the real output.
Args:
y: has to be a numpy.array, a two-dimensional vector of shape m * 1.
y_hat: has to be a numpy.array, a two-dimensional vector of shape m * 1.
y: has to be a numpy.array, a two-dimensional array of shape m * 1.
y_hat: has to be a numpy.array, a two-dimensional array of shape m * 1.
Returns:
mae: has to be a float.
None if there is a matching dimension problem.
Expand All @@ -1382,8 +1382,8 @@ \section*{Instructions}
Description:
Calculate the R2score between the predicted output and the output.
Args:
y: has to be a numpy.array, a two-dimensional vector of shape m * 1.
y_hat: has to be a numpy.array, a two-dimensional vector of shape m * 1.
y: has to be a numpy.array, a two-dimensional array of shape m * 1.
y_hat: has to be a numpy.array, a two-dimensional array of shape m * 1.
Returns:
r2score: has to be a float.
None if there is a matching dimension problem.
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v5.0.2
v5.0.2.post1

0 comments on commit 41e0350

Please sign in to comment.