import io
import pickle


def load_regresults(filename=None):
    """Load regression results from pickle file"""
    if filename is None:
        filename = "results/regressors_rmse1.p"
    with io.open(filename, 'rb') as f:
        regresults = pickle.load(f)
    regressors = regresults["regressors"]
    rmse = regresults["rmse"]
    x_keys = regresults["x_keys"]
    y_keys = regresults["y_keys"]
    data = regresults["data"]
    return regressors, rmse, None, x_keys, y_keys, data