Skip to content

Commit

Permalink
fix: code formatting with black
Browse files Browse the repository at this point in the history
  • Loading branch information
rememberYou committed Apr 29, 2022
1 parent 5d52520 commit 5b71492
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions examples/literals.py
Expand Up @@ -71,7 +71,7 @@
# Fit a Support Vector Machine on train embeddings and pick the best
# C-parameters (regularization strength).
clf = GridSearchCV(
SVC(random_state=RANDOM_STATE), {"C": [10 ** i for i in range(-3, 4)]}
SVC(random_state=RANDOM_STATE), {"C": [10**i for i in range(-3, 4)]}
)
clf.fit(train_embeddings, train_labels)

Expand All @@ -81,7 +81,7 @@
f"Predicted {len(test_entities)} entities with an accuracy of "
+ f"{accuracy_score(test_labels, predictions) * 100 :.4f}%"
)
print(f"Confusion Matrix ([[TN, FP], [FN, TP]]):")
print("Confusion Matrix ([[TN, FP], [FN, TP]]):")
print(confusion_matrix(test_labels, predictions))

print("\nUsing literals:")
Expand Down Expand Up @@ -141,7 +141,7 @@

# fit a Support Vector Machine on train embeddings.
clf = GridSearchCV(
SVC(random_state=RANDOM_STATE), {"C": [10 ** i for i in range(-3, 4)]}
SVC(random_state=RANDOM_STATE), {"C": [10**i for i in range(-3, 4)]}
)
clf.fit(train_embeddings2, train_labels)

Expand All @@ -151,7 +151,7 @@
f"Predicted {len(test_entities)} entities with an accuracy of "
+ f"{accuracy_score(test_labels, predictions2) * 100 :.4f}%"
)
print(f"Confusion Matrix ([[TN, FP], [FN, TP]]):")
print("Confusion Matrix ([[TN, FP], [FN, TP]]):")
print(confusion_matrix(test_labels, predictions2))

f, ax = plt.subplots(1, 2, figsize=(15, 6))
Expand Down
4 changes: 2 additions & 2 deletions examples/mutag.py
Expand Up @@ -68,7 +68,7 @@
# Fit a Support Vector Machine on train embeddings and pick the best
# C-parameters (regularization strength).
clf = GridSearchCV(
SVC(random_state=RANDOM_STATE), {"C": [10 ** i for i in range(-3, 4)]}
SVC(random_state=RANDOM_STATE), {"C": [10**i for i in range(-3, 4)]}
)
clf.fit(train_embeddings, train_labels)

Expand All @@ -78,7 +78,7 @@
f"Predicted {len(test_entities)} entities with an accuracy of "
+ f"{accuracy_score(test_labels, predictions) * 100 :.4f}%"
)
print(f"Confusion Matrix ([[TN, FP], [FN, TP]]):")
print("Confusion Matrix ([[TN, FP], [FN, TP]]):")
print(confusion_matrix(test_labels, predictions))

# Reduce the dimensions of entity embeddings to represent them in a 2D plane.
Expand Down
12 changes: 6 additions & 6 deletions examples/online-learning.py
Expand Up @@ -51,7 +51,7 @@
# Fit a Support Vector Machine on train embeddings and pick the best
# C-parameters (regularization strength).
clf = GridSearchCV(
SVC(random_state=RANDOM_STATE), {"C": [10 ** i for i in range(-3, 4)]}
SVC(random_state=RANDOM_STATE), {"C": [10**i for i in range(-3, 4)]}
)
clf.fit(train_embeddings, train_labels)

Expand All @@ -61,7 +61,7 @@
f"Predicted {len(test_entities)} entities with an accuracy of "
+ f"{accuracy_score(test_labels, predictions) * 100 :.4f}%"
)
print(f"Confusion Matrix ([[TN, FP], [FN, TP]]):")
print("Confusion Matrix ([[TN, FP], [FN, TP]]):")
print(confusion_matrix(test_labels, predictions))

print("\nAdding 20 mores entities.")
Expand Down Expand Up @@ -89,7 +89,7 @@
test_embeddings = embeddings[len(train_entities) :][: -len(new_entities)]

clf = GridSearchCV(
SVC(random_state=RANDOM_STATE), {"C": [10 ** i for i in range(-3, 4)]}
SVC(random_state=RANDOM_STATE), {"C": [10**i for i in range(-3, 4)]}
)
clf.fit(train_embeddings + new_embeddings, train_labels + new_labels)

Expand All @@ -98,7 +98,7 @@
f"Predicted {len(test_entities)} entities with an accuracy of "
+ f"{accuracy_score(test_labels, predictions) * 100 :.4f}%"
)
print(f"Confusion Matrix ([[TN, FP], [FN, TP]]):")
print("Confusion Matrix ([[TN, FP], [FN, TP]]):")
print(confusion_matrix(test_labels, predictions))

print("\nTrain all the entities.")
Expand All @@ -116,7 +116,7 @@
test_embeddings = embeddings[len(train_entities) + len(new_entities) :]

clf = GridSearchCV(
SVC(random_state=RANDOM_STATE), {"C": [10 ** i for i in range(-3, 4)]}
SVC(random_state=RANDOM_STATE), {"C": [10**i for i in range(-3, 4)]}
)
clf.fit(train_embeddings, train_labels + new_labels)

Expand All @@ -125,7 +125,7 @@
f"Predicted {len(test_entities)} entities with an accuracy of "
+ f"{accuracy_score(test_labels, predictions) * 100 :.4f}%"
)
print(f"Confusion Matrix ([[TN, FP], [FN, TP]]):")
print("Confusion Matrix ([[TN, FP], [FN, TP]]):")
print(confusion_matrix(test_labels, predictions))

os.remove("mutag")
2 changes: 1 addition & 1 deletion examples/samplers.py
Expand Up @@ -77,7 +77,7 @@
# Fit a Support Vector Machine on train embeddings and pick the best
# C-parameters (regularization strength).
clf = GridSearchCV(
SVC(random_state=RANDOM_STATE), {"C": [10 ** i for i in range(-3, 4)]}
SVC(random_state=RANDOM_STATE), {"C": [10**i for i in range(-3, 4)]}
)
clf.fit(train_embeddings, train_labels)

Expand Down
2 changes: 1 addition & 1 deletion pyrdf2vec/utils/validation.py
Expand Up @@ -92,7 +92,7 @@ def is_valid_url(url: str) -> bool:
"""
try:
query = "ASK {}"
res_code = requests.head(url, params={'query': query}).status_code
res_code = requests.head(url, params={"query": query}).status_code
return res_code == requests.codes.ok
except Exception:
return False

0 comments on commit 5b71492

Please sign in to comment.