# Path: revrand/utils/base.py
# class Bunch(dict):
#     """
#     Container object for datasets.
# 
#     Dictionary-like object that exposes its keys as attributes.
# 
#     Examples
#     --------
#     >>> b = Bunch(foo=42, bar=10)
#     >>> b == {'foo': 42, 'bar': 10}
#     True
#     >>> b.foo
#     42
#     >>> b.bar
#     10
#     >>> b['foo']
#     42
#     >>> b.baz = 61
#     >>> b.baz
#     61
#     >>> b['baz']
#     61
#     """
# 
#     def __init__(self, **kwargs):
#         dict.__init__(self, kwargs)
#         self.__dict__ = self


import numpy as np
import requests
import tarfile
import os
from six.moves import urllib
from scipy.io import loadmat
from scipy.spatial.distance import cdist
from unipath import Path
from io import BytesIO
from sklearn.utils import check_random_state
from .base import Bunch
    >>> gpml_sarcos.test.data.shape
    (4449, 21)

    >>> gpml_sarcos.test.targets.shape
    (4449,)
    """
    train_src_url = "http://www.gaussianprocess.org/gpml/data/sarcos_inv.mat"
    test_src_url = ("http://www.gaussianprocess.org/gpml/data/sarcos_inv_test"
                    ".mat")

    data_home = get_data_home(data_home=data_home)

    train_filename = os.path.join(data_home, 'sarcos_inv.mat')
    test_filename = os.path.join(data_home, 'sarcos_inv_test.mat')

    if not os.path.exists(train_filename):
        urllib.request.urlretrieve(train_src_url, train_filename)

    if not os.path.exists(test_filename):
        urllib.request.urlretrieve(test_src_url, test_filename)

    train_data = loadmat(train_filename).get('sarcos_inv')
    test_data = loadmat(test_filename).get('sarcos_inv_test')

    train_bunch = Bunch(data=train_data[:, :21],
                        targets=train_data[:, 21])

    test_bunch = Bunch(data=test_data[:, :21],
                       targets=test_data[:, 21])


# Path: revrand/utils/base.py
# class Bunch(dict):
#     """
#     Container object for datasets.
# 
#     Dictionary-like object that exposes its keys as attributes.
# 
#     Examples
#     --------
#     >>> b = Bunch(foo=42, bar=10)
#     >>> b == {'foo': 42, 'bar': 10}
#     True
#     >>> b.foo
#     42
#     >>> b.bar
#     10
#     >>> b['foo']
#     42
#     >>> b.baz = 61
#     >>> b.baz
#     61
#     >>> b['baz']
#     61
#     """
# 
#     def __init__(self, **kwargs):
#         dict.__init__(self, kwargs)
#         self.__dict__ = self


# Path: revrand/utils/datasets.py
import numpy as np
import requests
import tarfile
import os
from six.moves import urllib
from scipy.io import loadmat
from scipy.spatial.distance import cdist
from unipath import Path
from io import BytesIO
from sklearn.utils import check_random_state
from .base import Bunch

    >>> gpml_sarcos.test.data.shape
    (4449, 21)

    >>> gpml_sarcos.test.targets.shape
    (4449,)
    """
    train_src_url = "http://www.gaussianprocess.org/gpml/data/sarcos_inv.mat"
    test_src_url = ("http://www.gaussianprocess.org/gpml/data/sarcos_inv_test"
                    ".mat")

    data_home = get_data_home(data_home=data_home)

    train_filename = os.path.join(data_home, 'sarcos_inv.mat')
    test_filename = os.path.join(data_home, 'sarcos_inv_test.mat')

    if not os.path.exists(train_filename):
        urllib.request.urlretrieve(train_src_url, train_filename)

    if not os.path.exists(test_filename):
        urllib.request.urlretrieve(test_src_url, test_filename)

    train_data = loadmat(train_filename).get('sarcos_inv')
    test_data = loadmat(test_filename).get('sarcos_inv_test')

    train_bunch = Bunch(data=train_data[:, :21],
                        targets=train_data[:, 21])

    test_bunch = Bunch(data=test_data[:, :21],
                       targets=test_data[:, 21])


    return Bunch(train=train_bunch, test=test_bunch)