Skip to content

Sourcery Starbot ⭐ refactored Tybirk/OCAIM#1

Open
SourceryAI wants to merge 1 commit intoTybirk:masterfrom
SourceryAI:master
Open

Sourcery Starbot ⭐ refactored Tybirk/OCAIM#1
SourceryAI wants to merge 1 commit intoTybirk:masterfrom
SourceryAI:master

Conversation

@SourceryAI
Copy link
Copy Markdown

Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨

Here's your pull request refactoring your most popular Python repo.

If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch https://github.com/sourcery-ai-bot/OCAIM master
git merge --ff-only FETCH_HEAD
git reset HEAD^

feature_matrix = np.zeros(numberOfFeatures*numberOfNodes).reshape(numberOfNodes, numberOfFeatures)

featureToIndex = dict()
featureToIndex = {}
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function get_feature_matrix refactored with the following changes:

G = nx.Graph()
else:
G = nx.DiGraph()
G = nx.DiGraph() if directed else nx.Graph()
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function read_graph refactored with the following changes:

Comment on lines -90 to +87
for i in range(numberOfEdges):
for _ in range(numberOfEdges):
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function create_graph refactored with the following changes:


if w is None: w = np.zeros(len(X[1]))
for i in range(epochs):
for _ in range(epochs):
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function mini_batch_grad_descent refactored with the following changes:

This removes the following comments ( why? ):

# lr = lr * np.linalg.norm(grad)/len(y)

Comment on lines -103 to +108
if not linear:
return sigmoid(feature_mat @ parameters)
else:
edge_probs = [max(min(feature_mat[i, :]@linear_parameters, 1),0) for i in range(feature_mat.shape[0])]
return edge_probs
return (
[
max(min(feature_mat[i, :] @ linear_parameters, 1), 0)
for i in range(feature_mat.shape[0])
]
if linear
else sigmoid(feature_mat @ parameters)
)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function get_edge_probabilities refactored with the following changes:

Comment on lines -118 to +119
while len(new_activations) > 0:
while new_activations:
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function simulate_activations refactored with the following changes:

Comment on lines 291 to +293
message = list(bestMessage)
for feature in range(1, numberFeatures):
index += 1

currentResult = 0
for index, feature in enumerate(range(1, numberFeatures), start=1):
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function greedy refactored with the following changes:

plt.xlabel(xlabel, fontsize=40)
if title:
plt.title('%s' %(title), fontsize = 48)
plt.title(f'{title}', fontsize = 48)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function visualiseResults refactored with the following changes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant