def test_fit_values(self, estimator, explainer_type, X_y): X, y = X_y regressor = ExplainableRegressor(estimator, explainer_type) regressor.fit(X, y) cloned_estimator = clone(estimator) cloned_estimator.fit(X, y) estimator_fit_attributes = self._get_fit_attributes( regressor.estimator) cloned_estimator_fit_attributes = self._get_fit_attributes( cloned_estimator) np.testing.assert_array_equal(estimator_fit_attributes, cloned_estimator_fit_attributes)
def test_predict_values(self, estimator, explainer_type, X_y): X, y = X_y X_test = X[:1, :] regressor = ExplainableRegressor(estimator, explainer_type) regressor_predictions = regressor.fit(X, y).predict(X_test) cloned_estimator = clone(estimator) estimator_predictions = cloned_estimator.fit(X, y).predict(X_test) assert regressor_predictions.shape == estimator_predictions.shape assert regressor_predictions.shape[0] == len(regressor.explanations_)