mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
chore: fix typos (#11467)
* chore: fix typos Signed-off-by: snoppy <michaleli@foxmail.com> * Apply suggestions from code review Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com> --------- Signed-off-by: snoppy <michaleli@foxmail.com> Co-authored-by: Christian Clauss <cclauss@me.com> Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
This commit is contained in:
parent
31d1cd8402
commit
1cfca52db7
|
@ -141,7 +141,7 @@ def transform(
|
|||
|
||||
center_x, center_y = (x // 2 for x in kernel.shape)
|
||||
|
||||
# Use padded image when applying convolotion
|
||||
# Use padded image when applying convolution
|
||||
# to not go out of bounds of the original the image
|
||||
transformed = np.zeros(image.shape, dtype=np.uint8)
|
||||
padded = np.pad(image, 1, "constant", constant_values=constant)
|
||||
|
|
|
@ -38,7 +38,7 @@ def find_components(
|
|||
reversed_graph: dict[int, list[int]], vert: int, visited: list[bool]
|
||||
) -> list[int]:
|
||||
"""
|
||||
Use depth first search to find strongliy connected
|
||||
Use depth first search to find strongly connected
|
||||
vertices. Now graph is reversed
|
||||
>>> find_components({0: [1], 1: [2], 2: [0]}, 0, 5 * [False])
|
||||
[0, 1, 2]
|
||||
|
|
|
@ -76,9 +76,9 @@ def get_3d_vectors_cross(ab: Vector3d, ac: Vector3d) -> Vector3d:
|
|||
|
||||
def is_zero_vector(vector: Vector3d, accuracy: int) -> bool:
|
||||
"""
|
||||
Check if vector is equal to (0, 0, 0) of not.
|
||||
Check if vector is equal to (0, 0, 0) or not.
|
||||
|
||||
Sine the algorithm is very accurate, we will never get a zero vector,
|
||||
Since the algorithm is very accurate, we will never get a zero vector,
|
||||
so we need to round the vector axis,
|
||||
because we want a result that is either True or False.
|
||||
In other applications, we can return a float that represents the collinearity ratio.
|
||||
|
@ -97,9 +97,9 @@ def are_collinear(a: Point3d, b: Point3d, c: Point3d, accuracy: int = 10) -> boo
|
|||
"""
|
||||
Check if three points are collinear or not.
|
||||
|
||||
1- Create tow vectors AB and AC.
|
||||
2- Get the cross vector of the tow vectors.
|
||||
3- Calcolate the length of the cross vector.
|
||||
1- Create two vectors AB and AC.
|
||||
2- Get the cross vector of the two vectors.
|
||||
3- Calculate the length of the cross vector.
|
||||
4- If the length is zero then the points are collinear, else they are not.
|
||||
|
||||
The use of the accuracy parameter is explained in is_zero_vector docstring.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""
|
||||
- - - - - -- - - - - - - - - - - - - - - - - - - - - - -
|
||||
Name - - CNN - Convolution Neural Network For Photo Recognizing
|
||||
Goal - - Recognize Handing Writing Word Photo
|
||||
Goal - - Recognize Handwriting Word Photo
|
||||
Detail: Total 5 layers neural network
|
||||
* Convolution layer
|
||||
* Pooling layer
|
||||
|
@ -135,7 +135,7 @@ class CNN:
|
|||
)
|
||||
data_featuremap.append(featuremap)
|
||||
|
||||
# expanding the data slice to One dimenssion
|
||||
# expanding the data slice to one dimension
|
||||
focus1_list = []
|
||||
for each_focus in data_focus:
|
||||
focus1_list.extend(self.Expand_Mat(each_focus))
|
||||
|
@ -304,7 +304,7 @@ class CNN:
|
|||
plt.grid(True, alpha=0.5)
|
||||
plt.show()
|
||||
|
||||
print("------------------Training Complished---------------------")
|
||||
print("------------------Training Complete---------------------")
|
||||
print((" - - Training epoch: ", rp, f" - - Mse: {mse:.6f}"))
|
||||
if draw_e:
|
||||
draw_error()
|
||||
|
@ -353,5 +353,5 @@ class CNN:
|
|||
|
||||
if __name__ == "__main__":
|
||||
"""
|
||||
I will put the example on other file
|
||||
I will put the example in another file
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue
Block a user