-
Notifications
You must be signed in to change notification settings - Fork 0
Update Batch create hedge for client #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
claircui
wants to merge
8
commits into
development
Choose a base branch
from
update-batch-create-hedge
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0c9fce3
upload to pypi with v1.4.0
44c3f37
increase batch_size
372ae91
Client updated by chromDROID-V3
8748e76
allow change batch size
585b36e
INFO logger_level + separate k8s
a9e232f
hedge allow input vol / r / q
50439fc
allow pass r/q/vol as input
6c9207c
update version in set-up
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,14 +32,19 @@ class Client: | |
|
||
batch_size = 400 | ||
|
||
def __init__(self, address: str = "guardian", port: str = "50065"): | ||
def __init__(self, | ||
address: str = "guardian", | ||
port: str = "50065", | ||
batch_size: int = None): | ||
self.address = address | ||
self.port = port | ||
# TODO: Use a secure channel because this is external facing | ||
self.channel = grpc.insecure_channel(self.address + ":" + self.port) | ||
self.droid = bot_pb2_grpc.DroidStub( | ||
self.channel | ||
) # This one contains the bistream | ||
if batch_size is not None: | ||
self.batch_size = batch_size | ||
Comment on lines
+46
to
+47
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not needed if you set the default to 400 in the init |
||
|
||
def __string_to_datetime(self, date: str): | ||
date = datetime.strptime(date, "%Y-%m-%d") | ||
|
@@ -85,8 +90,7 @@ def __create_bots_generator(self, input_matrix: np.ndarray): | |
""" | ||
|
||
# Split input matrix into smaller batches | ||
batch_size = 400 | ||
splits = math.ceil(input_matrix.shape[1] / batch_size) | ||
splits = math.ceil(input_matrix.shape[1] / self.batch_size) | ||
input_matrix = np.array_split(input_matrix, splits, axis=1) | ||
|
||
for batch in input_matrix: | ||
|
@@ -296,8 +300,7 @@ def __hedge_bots_generator(self, input_matrix: np.array): | |
""" | ||
|
||
# Split input matrix into smaller batches | ||
batch_size = 400 | ||
splits = math.ceil(input_matrix.shape[1] / batch_size) | ||
splits = math.ceil(input_matrix.shape[1] / self.batch_size) | ||
input_matrix = np.array_split(input_matrix, splits, axis=1) | ||
|
||
for batch in input_matrix: | ||
|
@@ -455,8 +458,7 @@ def __stop_bots_generator( | |
self, | ||
input_matrix: np.ndarray, | ||
): | ||
batch_size = 400 | ||
splits = math.ceil(input_matrix.shape[1] / batch_size) | ||
splits = math.ceil(input_matrix.shape[1] / self.batch_size) | ||
input_matrix = np.array_split(input_matrix, splits, axis=1) | ||
|
||
for batch in input_matrix: | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not put
batch_size: int = 400
instead of None? Then you don't need the if statement below