diff --git a/GPy/util/datasets.py b/GPy/util/datasets.py index b3675a8e..d679c6c3 100644 --- a/GPy/util/datasets.py +++ b/GPy/util/datasets.py @@ -17,17 +17,24 @@ def sample_class(f): c = np.where(c, 1, -1) return c -def fetch_dataset(resource, file_name, messages = True): +def fetch_dataset(resource, save_name = None, save_file = True, messages = True): if messages: print "Downloading resource: " , resource, " ... " response = url.urlopen(resource) # TODO: Some error checking... + # ... html = response.read() response.close() - with open(file_name, "w") as text_file: - text_file.write("%s"%html) - if messages: - print "Done!" + if save_file: + # TODO: Check if already exists... + # ... + with open(save_name, "w") as text_file: + text_file.write("%s"%html) + if messages: + print "Done!" + return html + + def della_gatta_TRP63_gene_expression(gene_number=None): mat_data = scipy.io.loadmat(os.path.join(data_path, 'DellaGattadata.mat'))