#NEWLINE# def column_or_1d( y , warn = False ) : #NEWLINE# #INDENT# ' Ravel column or 1d numpy array, else raises an error\n\n    Parameters\n    ----------\n    y : array-like\n\n    warn : boolean, default False\n       To control display of warnings.\n\n    Returns\n    -------\n    y : array\n\n    ' #NEWLINE# shape = np . shape ( y ) #NEWLINE# if ( len ( shape ) == 1 ) : #NEWLINE# #INDENT# return np . ravel ( y ) #NEWLINE# #UNINDENT# if ( ( len ( shape ) == 2 ) and ( shape [ 1 ] == 1 ) ) : #NEWLINE# #INDENT# if warn : #NEWLINE# #INDENT# warnings . warn ( 'A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().' , _DataConversionWarning , stacklevel = 2 ) #NEWLINE# #UNINDENT# return np . ravel ( y ) #NEWLINE# #UNINDENT# raise ValueError ( 'bad input shape {0}' . format ( shape ) )