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)
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)
def __init__(self, stores): self.stores = stores self.store_sampler = StoreSampler(stores)