def test_exact_ties(self): adj_models = self.models_df - 100.0 adj_models.iloc[:, :2] -= adj_models.iloc[:, :2].mean() adj_models.iloc[:, :2] += self.benchmark_df.mean().iloc[0] stepm = StepM(self.benchmark_df, adj_models, size=0.10) stepm.compute() assert_equal(len(stepm.superior_models), self.models.shape[1] - 2)
def test_exact_ties(self): adj_models = self.models_df - 100.0 adj_models.iloc[:, :2] -= adj_models.iloc[:,:2].mean() adj_models.iloc[:, :2] += self.benchmark_df.mean().iloc[0] stepm = StepM(self.benchmark_df, adj_models, size=0.10) stepm.compute() assert_equal(len(stepm.superior_models), self.models.shape[1] - 2)
def test_superior_models(self): adj_models = self.models - linspace(-0.4, 0.4, self.k) stepm = StepM(self.benchmark, adj_models, reps=120) stepm.compute() superior_models = stepm.superior_models spa = SPA(self.benchmark, adj_models, reps=120) spa.compute() spa.pvalues spa.critical_values(0.05) spa.better_models(0.05) adj_models = self.models_df - linspace(-3.0, 3.0, self.k) stepm = StepM(self.benchmark_series, adj_models, reps=120) stepm.compute() superior_models = stepm.superior_models
def test_equivalence(self): adj_models = self.models - linspace(-2.0, 2.0, self.k) stepm = StepM(self.benchmark, adj_models, size=0.20, reps=200) stepm.seed(23456) stepm.compute() adj_models = self.models_df - linspace(-2.0, 2.0, self.k) stepm_pandas = StepM(self.benchmark_series, adj_models, size=0.20, reps=200) stepm_pandas.seed(23456) stepm_pandas.compute() stepm_pandas.superior_models numeric_locs = np.argwhere(adj_models.columns.isin(stepm_pandas.superior_models)).squeeze() numeric_locs.sort() assert_equal(np.array(stepm.superior_models), numeric_locs)
def test_superior_models(self): adj_models = self.models - linspace(-0.4, 0.4, self.k) stepm = StepM(self.benchmark, adj_models, reps=120) stepm.compute() superior_models = stepm.superior_models spa = SPA(self.benchmark, adj_models, reps=120) spa.compute() spa.pvalues spa.critical_values(0.05) spa.better_models(0.05) adj_models = self.models_df - linspace(-3.0, 3.0, self.k) stepm = StepM(self.benchmark_series, adj_models, reps=120) stepm.compute() superior_models = stepm.superior_models
def test_equivalence(self): adj_models = self.models - linspace(-2.0, 2.0, self.k) stepm = StepM(self.benchmark, adj_models, size=0.20, reps=200) stepm.seed(23456) stepm.compute() adj_models = self.models_df - linspace(-2.0, 2.0, self.k) stepm_pandas = StepM(self.benchmark_series, adj_models, size=0.20, reps=200) stepm_pandas.seed(23456) stepm_pandas.compute() stepm_pandas.superior_models numeric_locs = np.argwhere( adj_models.columns.isin(stepm_pandas.superior_models)).squeeze() numeric_locs.sort() assert_equal(np.array(stepm.superior_models), numeric_locs)
def test_all_superior(self): adj_models = self.models - 100.0 stepm = StepM(self.benchmark, adj_models, size=0.10) stepm.compute() assert_equal(len(stepm.superior_models), self.models.shape[1])
def test_single_model(self): stepm = StepM(self.benchmark, self.models[:,0], size=0.10) stepm.compute() stepm = StepM(self.benchmark_series, self.models_df.iloc[:,0]) stepm.compute()
def test_all_superior(self): adj_models = self.models - 100.0 stepm = StepM(self.benchmark, adj_models, size=0.10) stepm.compute() assert_equal(len(stepm.superior_models), self.models.shape[1])
def test_single_model(self): stepm = StepM(self.benchmark, self.models[:, 0], size=0.10) stepm.compute() stepm = StepM(self.benchmark_series, self.models_df.iloc[:, 0]) stepm.compute()