mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-06 10:31:29 +08:00
pyupgrade --py37-plus **/*.py (#1654)
* pyupgrade --py37-plus **/*.py * fixup! Format Python code with psf/black push
This commit is contained in:

committed by
John Law

parent
34c808b375
commit
28419cf839
@ -126,7 +126,7 @@ def plot_heterogeneity(heterogeneity, k):
|
||||
plt.plot(heterogeneity, linewidth=4)
|
||||
plt.xlabel("# Iterations")
|
||||
plt.ylabel("Heterogeneity")
|
||||
plt.title("Heterogeneity of clustering over time, K={0:d}".format(k))
|
||||
plt.title(f"Heterogeneity of clustering over time, K={k:d}")
|
||||
plt.rcParams.update({"font.size": 16})
|
||||
plt.show()
|
||||
|
||||
@ -164,7 +164,7 @@ def kmeans(
|
||||
num_changed = np.sum(prev_cluster_assignment != cluster_assignment)
|
||||
if verbose:
|
||||
print(
|
||||
" {0:5d} elements changed their cluster assignment.".format(
|
||||
" {:5d} elements changed their cluster assignment.".format(
|
||||
num_changed
|
||||
)
|
||||
)
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
## Logistic Regression from scratch
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
# coding: utf-8
|
||||
"""
|
||||
Implementation of sequential minimal optimization(SMO) for support vector machines(SVM).
|
||||
|
||||
@ -29,7 +28,6 @@ Reference:
|
||||
http://web.cs.iastate.edu/~honavar/smo-svm.pdf
|
||||
"""
|
||||
|
||||
from __future__ import division
|
||||
|
||||
import os
|
||||
import sys
|
||||
@ -44,7 +42,7 @@ from sklearn.preprocessing import StandardScaler
|
||||
CANCER_DATASET_URL = "http://archive.ics.uci.edu/ml/machine-learning-databases/breast-cancer-wisconsin/wdbc.data"
|
||||
|
||||
|
||||
class SmoSVM(object):
|
||||
class SmoSVM:
|
||||
def __init__(
|
||||
self,
|
||||
train,
|
||||
@ -405,7 +403,7 @@ class SmoSVM(object):
|
||||
return self.samples.shape[0]
|
||||
|
||||
|
||||
class Kernel(object):
|
||||
class Kernel:
|
||||
def __init__(self, kernel, degree=1.0, coef0=0.0, gamma=1.0):
|
||||
self.degree = np.float64(degree)
|
||||
self.coef0 = np.float64(coef0)
|
||||
|
Reference in New Issue
Block a user