@ignore_warnings
def check_estimators_unfitted(name, Estimator):
 (X, y) = _boston_subset()
 est = Estimator()
 msg = 'fit'
 if hasattr(est, 'predict'):
  assert_raise_message((AttributeError, ValueError), msg, est.predict, X)
 if hasattr(est, 'decision_function'):
  assert_raise_message((AttributeError, ValueError), msg, est.decision_function, X)
 if hasattr(est, 'predict_proba'):
  assert_raise_message((AttributeError, ValueError), msg, est.predict_proba, X)
 if hasattr(est, 'predict_log_proba'):
  assert_raise_message((AttributeError, ValueError), msg, est.predict_log_proba, X)

@ ignore_warnings def check_estimators_unfitted ( name , Estimator ) : ( X , y ) = _boston_subset ( ) est = Estimator ( ) msg = 'fit' if hasattr ( est , 'predict' ) : assert_raise_message ( ( AttributeError , ValueError ) , msg , est . predict , X ) if hasattr ( est , 'decision_function' ) : assert_raise_message ( ( AttributeError , ValueError ) , msg , est . decision_function , X ) if hasattr ( est , 'predict_proba' ) : assert_raise_message ( ( AttributeError , ValueError ) , msg , est . predict_proba , X ) if hasattr ( est , 'predict_log_proba' ) : assert_raise_message ( ( AttributeError , ValueError ) , msg , est . predict_log_proba , X )
check that predict raises an exception in an unfitted estimator .