Skip to content

ML - Module06 - ex05 - Typo in Docstring and examples #262

@Tablerase

Description

@Tablerase

In docstring (return in case of empty x) :

"""Computes the normalized version of a non-empty numpy.ndarray using the z-score standardization.

    Args:
        x: has to be an numpy.ndarray, a vector.
    Returns:
        x' as a numpy.ndarray.
        None if x is a non-empty numpy.ndarray or not a numpy.ndarray.
    Raises:
        This function shouldn't raise any Exception.

to

"""Computes the normalized version of a non-empty numpy.ndarray using the z-score standardization.

    Args:
        x: has to be an numpy.ndarray, a vector.
    Returns:
        x' as a numpy.ndarray.
        None if x is an empty numpy.ndarray or not a numpy.ndarray.
    Raises:
        This function shouldn't raise any Exception.

And different numpy alias (numpy and np) in examples:

# Example 1:
X = numpy.array([0, 15, -9, 7, 12, 3, -21])
zscore(X)
# Output:
array([-0.08620324, 1.2068453 , -0.86203236, 0.51721942, 0.94823559,
0.17240647, -1.89647119])
# Example 2:
Y = np.array([2, 14, -13, 5, 12, 4, -19]).reshape((-1, 1))
zscore(Y)
# Output:
array([ 0.11267619, 1.16432067, -1.20187941, 0.37558731, 0.98904659,
0.28795027, -1.72770165])

to

# Example 1:
    X = np.array([0, 15, -9, 7, 12, 3, -21])
    zscore(X)
    # Output:
    # array([-0.08620324, 1.2068453 , -0.86203236, 0.51721942, 0.94823559,
    # 0.17240647, -1.89647119])

    # Example 2:
    Y = np.array([2, 14, -13, 5, 12, 4, -19]).reshape((-1, 1))
    zscore(Y)
    # Output:
    # array([[ 0.11267619]
    #  [ 1.16432067]
    #  [-1.20187941]
    #  [ 0.37558731]
    #  [ 0.98904659]
    #  [ 0.28795027]
    #  [-1.72770165]])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions