예제 #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)
예제 #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)
예제 #3
0
 def __init__(self, stores):
     self.stores = stores
     self.store_sampler = StoreSampler(stores)
예제 #4
0
	def __init__(self, stores):
		self.stores = stores
		self.store_sampler = StoreSampler(stores)