human
Give me a code to 3 given the following:
3.4. Running the Experiments"
Please write code following the instructions in jupyter notebook style.
assistant
#Here is code to 3.

class Experiment():
    def __init__(self, inf_method, dataset, sumstats, quantile=None, schedule=None, Nsamp=100):
        '''
        inf_method - 'SMC' or 'Rejection'
        dataset    - 'Easy', 'Medium' or 'Hard'
        sumstats   - 'S1', 'S2', 'S3', 'S4' or 'S5'
        '''
        self.inf_method = inf_method
        self.dataset = dataset
        self.sumstats = sumstats
        self.quantile = quantile
        self.schedule = schedule
        self.Nsamp = Nsamp
        self.res = None
        
    def infer(self):
        # read the dataset
        if self.dataset == 'Easy':
            z = y0[0,:].reshape((1,-1))
        elif self.dataset == 'Medium':
            z = y0[1,:].reshape((1,-1))
        elif self.dataset == 'Hard':
            z = y0[2,:].reshape((1,-1))
        sim = elfi.Simulator(stable_dist_rvs,alpha,beta,mu,sigma,observed=z)
        
        ss_func = globals().get(self.sumstats)
        SS = elfi.Summary(ss_func, sim)
        d = elfi.Distance('euclidean',SS)

        # run the inference and save the results
        if self.inf_method == 'SMC':
            algo = elfi.SMC(d, batch_size=Ns)
            self.res = algo.sample(self.Nsamp, self.schedule)
        elif self.inf_method == 'Rejection':
            algo = elfi.Rejection(d, batch_size=Ns)
            self.res = algo.sample(self.Nsamp, quantile=self.quantile)