09.10.2023 Views

Advanced Data Analytics Using Python_ With Machine Learning, Deep Learning and NLP Examples ( 2023)

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 7

Analytics at Scale

high = res['high']

low = res['low']

if self.big:

key = self.client.key('multiplier_

all_num', self.domain + "_big")

res = self.client.get(key)

high_big = res['high']

low_big = res['low']

return high, low, high_big, low_big

return high, low

def on_post(self, req, resp):

if True:

input_json = json.loads(req.stream.

read(),encoding='utf-8')

input_json['visible'] = input_json['client_

size'] + "_" + input_json['ad_position']

del input_json['client_size']

del input_json['ad_position']

howbig = 0

pred = 0

prob = 0

pred_big = 0

prob_big = 0

worker = ThreadPoolExecutor(max_workers=1)

thread = worker.submit(self.get_multiplier)

with ThreadPoolExecutor(max_workers=8) as

pool:

future_array = { pool.submit(self.

get_value,f,input_json[f]) : f for f

in input_json}

176

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!