mirror of
https://github.com/TheAlgorithms/Python.git
synced 2026-03-13 09:50:19 +08:00
The black formatter is no longer beta (#5960)
* The black formatter is no longer beta
* pre-commit autoupdate
* pre-commit autoupdate
* Remove project_euler/problem_145 which is killing our CI tests
* updating DIRECTORY.md
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
@@ -112,7 +112,7 @@ def compute_heterogeneity(data, k, centroids, cluster_assignment):
|
||||
distances = pairwise_distances(
|
||||
member_data_points, [centroids[i]], metric="euclidean"
|
||||
)
|
||||
squared_distances = distances ** 2
|
||||
squared_distances = distances**2
|
||||
heterogeneity += np.sum(squared_distances)
|
||||
|
||||
return heterogeneity
|
||||
|
||||
@@ -25,7 +25,7 @@ def weighted_matrix(point: np.mat, training_data_x: np.mat, bandwidth: float) ->
|
||||
# calculating weights for all training examples [x(i)'s]
|
||||
for j in range(m):
|
||||
diff = point - training_data_x[j]
|
||||
weights[j, j] = np.exp(diff * diff.T / (-2.0 * bandwidth ** 2))
|
||||
weights[j, j] = np.exp(diff * diff.T / (-2.0 * bandwidth**2))
|
||||
return weights
|
||||
|
||||
|
||||
|
||||
@@ -345,15 +345,15 @@ class SmoSVM:
|
||||
ol = (
|
||||
l1 * f1
|
||||
+ L * f2
|
||||
+ 1 / 2 * l1 ** 2 * K(i1, i1)
|
||||
+ 1 / 2 * L ** 2 * K(i2, i2)
|
||||
+ 1 / 2 * l1**2 * K(i1, i1)
|
||||
+ 1 / 2 * L**2 * K(i2, i2)
|
||||
+ s * L * l1 * K(i1, i2)
|
||||
)
|
||||
oh = (
|
||||
h1 * f1
|
||||
+ H * f2
|
||||
+ 1 / 2 * h1 ** 2 * K(i1, i1)
|
||||
+ 1 / 2 * H ** 2 * K(i2, i2)
|
||||
+ 1 / 2 * h1**2 * K(i1, i1)
|
||||
+ 1 / 2 * H**2 * K(i2, i2)
|
||||
+ s * H * h1 * K(i1, i2)
|
||||
)
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user