Skip to content

Format docs #7821

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions machine_learning/data_transformations.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""
Normalization Wikipedia: https://en.wikipedia.org/wiki/Normalization
Normalization.

Wikipedia: https://en.wikipedia.org/wiki/Normalization
Normalization is the process of converting numerical data to a standard range of values.
This range is typically between [0, 1] or [-1, 1]. The equation for normalization is
x_norm = (x - x_min)/(x_max - x_min) where x_norm is the normalized value, x is the
Expand Down Expand Up @@ -28,7 +30,8 @@

def normalization(data: list, ndigits: int = 3) -> list:
"""
Returns a normalized list of values
Return a normalized list of values.

@params: data, a list of values to normalize
@returns: a list of normalized values (rounded to ndigits decimal places)
@examples:
Expand All @@ -46,7 +49,8 @@ def normalization(data: list, ndigits: int = 3) -> list:

def standardization(data: list, ndigits: int = 3) -> list:
"""
Returns a standardized list of values
Return a standardized list of values.

@params: data, a list of values to standardize
@returns: a list of standardized values (rounded to ndigits decimal places)
@examples:
Expand Down
5 changes: 4 additions & 1 deletion physics/kinetic_energy.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""
Find the kinetic energy of an object, give its mass and velocity
Find the kinetic energy of an object, given its mass and velocity.

Description : In physics, the kinetic energy of an object is the energy that it
possesses due to its motion. It is defined as the work needed to accelerate a body of a
given mass from rest to its stated velocity. Having gained this energy during its
Expand All @@ -19,6 +20,8 @@

def kinetic_energy(mass: float, velocity: float) -> float:
"""
Calculate kinetick energy.

The kinetic energy of a non-rotating object of mass m traveling at a speed v is ½mv²

>>> kinetic_energy(10,10)
Expand Down
9 changes: 6 additions & 3 deletions sorts/merge_sort.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""
This is a pure Python implementation of the merge sort algorithm
This is a pure Python implementation of the merge sort algorithm.

For doctests run following command:
python -m doctest -v merge_sort.py
or
Expand All @@ -10,7 +11,7 @@


def merge_sort(collection: list) -> list:
"""Pure implementation of the merge sort algorithm in Python
"""
:param collection: some mutable ordered collection with heterogeneous
comparable items inside
:return: the same collection ordered by ascending
Expand All @@ -24,7 +25,9 @@ def merge_sort(collection: list) -> list:
"""

def merge(left: list, right: list) -> list:
"""merge left and right
"""
Merge left and right.

:param left: left collection
:param right: right collection
:return: merge result
Expand Down
9 changes: 7 additions & 2 deletions sorts/odd_even_sort.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
"""For reference
"""
Odd even sort implementation.

https://en.wikipedia.org/wiki/Odd%E2%80%93even_sort
"""


def odd_even_sort(input_list: list) -> list:
"""this algorithm uses the same idea of bubblesort,
"""
Sort input with odd even sort.

This algorithm uses the same idea of bubblesort,
but by first dividing in two phase (odd and even).
Originally developed for use on parallel processors
with local interconnections.
Expand Down