Ejemplo n.º 1
0
class CustomerInstanceGenerator(object):
	def __init__(self, stores):
		self.stores = stores
		self.store_sampler = StoreSampler(stores)

	def generate(self):
		name = random.choice(first_names) + " " + random.choice(last_names)
		pet = random.choice(pets)
		purchase_value = self.sample_exp()
		zipcode = self.store_sampler.sample().loc["zipcode"]
		return {"name" : name, "pet_type" : pet, "purchase_value" : purchase_value, "zipcode" : zipcode}

	def sample_exp(self):
		mean = 1.0
		return random.expovariate(mean)
Ejemplo n.º 2
0
class CustomerInstanceGenerator(object):
    def __init__(self, stores):
        self.stores = stores
        self.store_sampler = StoreSampler(stores)

    def generate(self):
        name = random.choice(first_names) + " " + random.choice(last_names)
        pet = random.choice(pets)
        purchase_value = self.sample_exp()
        zipcode = self.store_sampler.sample().loc["zipcode"]
        return {
            "name": name,
            "pet_type": pet,
            "purchase_value": purchase_value,
            "zipcode": zipcode
        }

    def sample_exp(self):
        mean = 1.0
        return random.expovariate(mean)
Ejemplo n.º 3
0
 def __init__(self, stores):
     self.stores = stores
     self.store_sampler = StoreSampler(stores)
Ejemplo n.º 4
0
	def __init__(self, stores):
		self.stores = stores
		self.store_sampler = StoreSampler(stores)