#NEWLINE# def minmax_scale( X , feature_range = ( 0 , 1 ) , axis = 0 , copy = True ) : #NEWLINE# #INDENT# 'Transforms features by scaling each feature to a given range.\n\n    This estimator scales and translates each feature individually such\n    that it is in the given range on the training set, i.e. between\n    zero and one.\n\n    The transformation is given by::\n\n        X_std = (X - X.min(axis=0)) / (X.max(axis=0) - X.min(axis=0))\n        X_scaled = X_std * (max - min) + min\n\n    where min, max = feature_range.\n\n    This transformation is often used as an alternative to zero mean,\n    unit variance scaling.\n\n    Read more in the :ref:`User Guide <preprocessing_scaler>`.\n\n    .. versionadded:: 0.17\n       *minmax_scale* function interface to :class:`sklearn.preprocessing.MinMaxScaler`.\n\n    Parameters\n    ----------\n    feature_range: tuple (min, max), default=(0, 1)\n        Desired range of transformed data.\n\n    axis : int (0 by default)\n        axis used to scale along. If 0, independently scale each feature,\n        otherwise (if 1) scale each sample.\n\n    copy : boolean, optional, default is True\n        Set to False to perform inplace scaling and avoid a copy (if the input\n        is already a numpy array).\n    ' #NEWLINE# X = check_array ( X , copy = False , ensure_2d = False , warn_on_dtype = True , dtype = FLOAT_DTYPES ) #NEWLINE# original_ndim = X . ndim #NEWLINE# if ( original_ndim == 1 ) : #NEWLINE# #INDENT# X = X . reshape ( X . shape [ 0 ] , 1 ) #NEWLINE# #UNINDENT# s = MinMaxScaler ( feature_range = feature_range , copy = copy ) #NEWLINE# if ( axis == 0 ) : #NEWLINE# #INDENT# X = s . fit_transform ( X ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# X = s . fit_transform ( X . T ) . T #NEWLINE# #UNINDENT# if ( original_ndim == 1 ) : #NEWLINE# #INDENT# X = X . ravel ( ) #NEWLINE# #UNINDENT# return X