import pickle


def inverse_scale(dir, set, data):
    """
    Transform the stellar properties back to the original data range.
        
    Parameters
    ----------
    dir : string
        Directory where the data scaler is saved.
        
    set : string
        The dataset to transform, either train, validation, or test.
        
    data : array_like, floats
        Scaled stellar property predictions.
        
    Returns
    ----------
    predictions : array_like, float
        Stellar property predictions in the original data range.
    """
    scaler = pickle.load(open(dir+'y_%s_scaler.sav' % set, 'rb'))

    return scaler.inverse_transform(data.reshape(-1,1)).flatten()