Ejemplo n.º 1
0
    def test_bootstrap_ranges(self):
        np.random.seed(42)
        X = np.random.normal(size=(50, 3))
        f = np.random.normal(size=(50, 1))
        df = np.random.normal(size=(50, 3))
        weights = np.ones((50, 1)) / 50

        e, W = ss.active_subspace(df, weights)
        ssmethod = lambda X, f, df, weights: ss.active_subspace(df, weights)
        d = ss._bootstrap_ranges(e,
                                 W,
                                 None,
                                 None,
                                 df,
                                 weights,
                                 ssmethod,
                                 nboot=10)

        e, W = ss.ols_subspace(X, f, weights)
        ssmethod = lambda X, f, df, weights: ss.ols_subspace(X, f, weights)
        d = ss._bootstrap_ranges(e, W, X, f, None, weights, ssmethod, nboot=10)

        e, W = ss.qphd_subspace(X, f, weights)
        ssmethod = lambda X, f, df, weights: ss.qphd_subspace(X, f, weights)
        d = ss._bootstrap_ranges(e, W, X, f, None, weights, ssmethod, nboot=10)

        e, W = ss.opg_subspace(X, f, weights)
        ssmethod = lambda X, f, df, weights: ss.opg_subspace(X, f, weights)
        d = ss._bootstrap_ranges(e, W, X, f, None, weights, ssmethod, nboot=10)
Ejemplo n.º 2
0
 def test_bootstrap_ranges(self):
     np.random.seed(42)
     X = np.random.normal(size=(50,3))
     f = np.random.normal(size=(50,1))
     df = np.random.normal(size=(50,3))
     weights = np.ones((50,1)) / 50
     
     e, W = ss.active_subspace(df, weights)
     ssmethod = lambda X, f, df, weights: ss.active_subspace(df, weights)
     d = ss.bootstrap_ranges(e, W, None, None, df, weights, ssmethod, nboot=10)
     
     e, W = ss.normalized_active_subspace(df, weights)
     ssmethod = lambda X, f, df, weights: ss.normalized_active_subspace(df, weights)
     d = ss.bootstrap_ranges(e, W, None, None, df, weights, ssmethod, nboot=10)
     
     e, W = ss.active_subspace_x(X, df, weights)
     ssmethod = lambda X, f, df, weights: ss.active_subspace_x(X, df, weights)
     d = ss.bootstrap_ranges(e, W, X, None, df, weights, ssmethod, nboot=10)
     
     e, W = ss.normalized_active_subspace(df, weights)
     ssmethod = lambda X, f, df, weights: ss.normalized_active_subspace(df, weights)
     d = ss.bootstrap_ranges(e, W, None, None, df, weights, ssmethod, nboot=10)
     
     e, W = ss.swarm_subspace(X, f, weights)
     ssmethod = lambda X, f, df, weights: ss.swarm_subspace(X, f, weights)
     d = ss.bootstrap_ranges(e, W, X, f, None, weights, ssmethod, nboot=10)
     
     e, W = ss.ols_subspace(X, f, weights)
     ssmethod = lambda X, f, df, weights: ss.ols_subspace(X, f, weights)
     d = ss.bootstrap_ranges(e, W, X, f, None, weights, ssmethod, nboot=10)
     
     e, W = ss.qphd_subspace(X, f, weights)
     ssmethod = lambda X, f, df, weights: ss.qphd_subspace(X, f, weights)
     d = ss.bootstrap_ranges(e, W, X, f, None, weights, ssmethod, nboot=10)
     
     e, W = ss.sir_subspace(X, f, weights)
     ssmethod = lambda X, f, df, weights: ss.sir_subspace(X, f, weights)
     d = ss.bootstrap_ranges(e, W, X, f, None, weights, ssmethod, nboot=10)
     
     e, W = ss.phd_subspace(X, f, weights)
     ssmethod = lambda X, f, df, weights: ss.phd_subspace(X, f, weights)
     d = ss.bootstrap_ranges(e, W, X, f, None, weights, ssmethod, nboot=10)
     
     e, W = ss.save_subspace(X, f, weights)
     ssmethod = lambda X, f, df, weights: ss.save_subspace(X, f, weights)
     d = ss.bootstrap_ranges(e, W, X, f, None, weights, ssmethod, nboot=10)
     
     #### UNDER CONSTRUCTION
     #e, W = ss.mave_subspace(X, f, weights)
     #ssmethod = lambda X, f, df, weights: ss.mave_subspace(X, f, weights)
     #d = ss.bootstrap_ranges(e, W, X, f, None, weights, ssmethod, nboot=10)
     
     e, W = ss.opg_subspace(X, f, weights)
     ssmethod = lambda X, f, df, weights: ss.opg_subspace(X, f, weights)
     d = ss.bootstrap_ranges(e, W, X, f, None, weights, ssmethod, nboot=10)
Ejemplo n.º 3
0
 def test_qphd_subspace(self):
     np.random.seed(42)
     X = np.random.normal(size=(50,3))
     f = np.random.normal(size=(50,1))
     weights = np.ones((50,1)) / 50
     e, W = ss.qphd_subspace(X, f, weights)
     np.testing.assert_array_less(e[1], e[0])
Ejemplo n.º 4
0
 def test_qphd_subspace(self):
     np.random.seed(42)
     X = np.random.normal(size=(50,3))
     f = np.random.normal(size=(50,1))
     weights = np.ones((50,1)) / 50
     e, W = ss.qphd_subspace(X, f, weights)
     np.testing.assert_array_less(e[1], e[0])
Ejemplo n.º 5
0
 def test_bootstrap_ranges(self):
     np.random.seed(42)
     X = np.random.normal(size=(50,3))
     f = np.random.normal(size=(50,1))
     df = np.random.normal(size=(50,3))
     weights = np.ones((50,1)) / 50
     
     e, W = ss.active_subspace(df, weights)
     ssmethod = lambda X, f, df, weights: ss.active_subspace(df, weights)
     d = ss._bootstrap_ranges(e, W, None, None, df, weights, ssmethod, nboot=10)
     
     e, W = ss.ols_subspace(X, f, weights)
     ssmethod = lambda X, f, df, weights: ss.ols_subspace(X, f, weights)
     d = ss._bootstrap_ranges(e, W, X, f, None, weights, ssmethod, nboot=10)
     
     e, W = ss.qphd_subspace(X, f, weights)
     ssmethod = lambda X, f, df, weights: ss.qphd_subspace(X, f, weights)
     d = ss._bootstrap_ranges(e, W, X, f, None, weights, ssmethod, nboot=10)
     
     e, W = ss.opg_subspace(X, f, weights)
     ssmethod = lambda X, f, df, weights: ss.opg_subspace(X, f, weights)
     d = ss._bootstrap_ranges(e, W, X, f, None, weights, ssmethod, nboot=10)