09.10.2023 Views

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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 7

Analytics at Scale

y=height=0

try:

height = int(client_size.split(',')[1])

y = int(ad_position.split(',')[1])

except:

pass

if y < height:

return "1"

else:

return "0"

class Predictor(object):

def __init__(self,domain,is_big):

self.client = datastore.Client('sulvo-east')

self.ctr = 'ctr_' + domain

self.ip = "ip_" + domain

self.scores = "score_num_" + domain

self.probabilities = "probability_num_" + domain

if is_big:

self.is_big = "is_big_num_" + domain

self.scores_big = "score_big_num_" + domain

self.probabilities_big = "probability_big_

num_" + domain

self.gi = pygeoip.GeoIP('GeoIP.dat')

self.big = is_big

self.domain = domain

def get_hour(self,timestamp):

return dt.datetime.utcfromtimestamp(timestamp /

1e3).hour

171

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

Saved successfully!

Ooh no, something went wrong!