mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 17:34:49 +08:00
Upgrade to Python 3.13 (#11588)
This commit is contained in:
@ -19,7 +19,7 @@ def root_mean_square_error(original: np.ndarray, reference: np.ndarray) -> float
|
||||
>>> root_mean_square_error(np.array([1, 2, 3]), np.array([6, 4, 2]))
|
||||
3.1622776601683795
|
||||
"""
|
||||
return np.sqrt(((original - reference) ** 2).mean())
|
||||
return float(np.sqrt(((original - reference) ** 2).mean()))
|
||||
|
||||
|
||||
def normalize_image(
|
||||
@ -273,7 +273,7 @@ def haralick_descriptors(matrix: np.ndarray) -> list[float]:
|
||||
>>> morphological = opening_filter(binary)
|
||||
>>> mask_1 = binary_mask(gray, morphological)[0]
|
||||
>>> concurrency = matrix_concurrency(mask_1, (0, 1))
|
||||
>>> haralick_descriptors(concurrency)
|
||||
>>> [float(f) for f in haralick_descriptors(concurrency)]
|
||||
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
|
||||
"""
|
||||
# Function np.indices could be used for bigger input types,
|
||||
@ -335,7 +335,7 @@ def get_descriptors(
|
||||
return np.concatenate(descriptors, axis=None)
|
||||
|
||||
|
||||
def euclidean(point_1: np.ndarray, point_2: np.ndarray) -> np.float32:
|
||||
def euclidean(point_1: np.ndarray, point_2: np.ndarray) -> float:
|
||||
"""
|
||||
Simple method for calculating the euclidean distance between two points,
|
||||
with type np.ndarray.
|
||||
@ -346,7 +346,7 @@ def euclidean(point_1: np.ndarray, point_2: np.ndarray) -> np.float32:
|
||||
>>> euclidean(a, b)
|
||||
3.3166247903554
|
||||
"""
|
||||
return np.sqrt(np.sum(np.square(point_1 - point_2)))
|
||||
return float(np.sqrt(np.sum(np.square(point_1 - point_2))))
|
||||
|
||||
|
||||
def get_distances(descriptors: np.ndarray, base: int) -> list[tuple[int, float]]:
|
||||
|
Reference in New Issue
Block a user