def test_core_computation(): inbag_ex = np.array([[1., 2., 0., 1.], [1., 0., 2., 0.], [1., 1., 1., 2.]]) X_train_ex = np.array([[3, 3], [6, 4], [6, 6]]) X_test_ex = np.vstack([np.array([[5, 2], [5, 5]]) for _ in range(1000)]) pred_centered_ex = np.vstack([np.array([[-20, -20, 10, 30], [-20, 30, -20, 10]]) for _ in range(1000)]) n_trees = 4 our_vij = fci._core_computation(X_train_ex, X_test_ex, inbag_ex, pred_centered_ex, n_trees) r_vij = np.concatenate([np.array([112.5, 387.5]) for _ in range(1000)]) npt.assert_almost_equal(our_vij, r_vij) for mc, ml in zip([True, False], [.01, None]): our_vij = fci._core_computation(X_train_ex, X_test_ex, inbag_ex, pred_centered_ex, n_trees, memory_constrained=True, memory_limit=.01, test_mode=True) npt.assert_almost_equal(our_vij, r_vij)
def test_core_computation(): inbag_ex = np.array([[1., 2., 0., 1.], [1., 0., 2., 0.], [1., 1., 1., 2.]]) X_train_ex = np.array([[3, 3], [6, 4], [6, 6]]) X_test_ex = np.vstack([np.array([[5, 2], [5, 5]]) for _ in range(1000)]) pred_centered_ex = np.vstack([ np.array([[-20, -20, 10, 30], [-20, 30, -20, 10]]) for _ in range(1000) ]) n_trees = 4 our_vij = fci._core_computation(X_train_ex, X_test_ex, inbag_ex, pred_centered_ex, n_trees) r_vij = np.concatenate([np.array([112.5, 387.5]) for _ in range(1000)]) npt.assert_almost_equal(our_vij, r_vij) our_vij = fci._core_computation(X_train_ex, X_test_ex, inbag_ex, pred_centered_ex, n_trees, memory_constrained=True, memory_limit=.01, test_mode=True) npt.assert_almost_equal(our_vij, r_vij)
def test_core_computation(): inbag_ex = np.array([[1., 2., 0., 1.], [1., 0., 2., 0.], [1., 1., 1., 2.]]) X_train_ex = np.array([[3, 3], [6, 4], [6, 6]]) X_test_ex = np.array([[5, 2], [5, 5]]) pred_centered_ex = np.array([[-20, -20, 10, 30], [-20, 30, -20, 10]]) n_trees = 4 our_vij = fci._core_computation(X_train_ex, X_test_ex, inbag_ex, pred_centered_ex, n_trees) r_vij = np.array([112.5, 387.5]) npt.assert_almost_equal(our_vij, r_vij)
def test_bias_correction(): inbag_ex = np.array([[1., 2., 0., 1.], [1., 0., 2., 0.], [1., 1., 1., 2.]]) X_train_ex = np.array([[3, 3], [6, 4], [6, 6]]) X_test_ex = np.array([[5, 2], [5, 5]]) pred_centered_ex = np.array([[-20, -20, 10, 30], [-20, 30, -20, 10]]) n_trees = 4 our_vij = fci._core_computation(X_train_ex, X_test_ex, inbag_ex, pred_centered_ex, n_trees) our_vij_unbiased = fci._bias_correction(our_vij, inbag_ex, pred_centered_ex, n_trees) r_unbiased_vij = np.array([-42.1875, 232.8125]) npt.assert_almost_equal(our_vij_unbiased, r_unbiased_vij)
def test_bias_correction(): inbag_ex = np.array([[1., 2., 0., 1.], [1., 0., 2., 0.], [1., 1., 1., 2.]]) X_train_ex = np.array([[3, 3], [6, 4], [6, 6]]) X_test_ex = np.array([[5, 2], [5, 5]]) pred_centered_ex = np.array([[-20, -20, 10, 30], [-20, 30, -20, 10]]) n_trees = 4 our_vij = fci._core_computation(X_train_ex, X_test_ex, inbag_ex, pred_centered_ex, n_trees) our_vij_unbiased = fci._bias_correction(our_vij, inbag_ex, pred_centered_ex, n_trees) r_unbiased_vij = np.array([-42.1875, 232.8125]) npt.assert_almost_equal(our_vij_unbiased, r_unbiased_vij)