diff --git a/GPy/inference/latent_function_inference/var_dtc.py b/GPy/inference/latent_function_inference/var_dtc.py index 7344b204..0cc841ed 100644 --- a/GPy/inference/latent_function_inference/var_dtc.py +++ b/GPy/inference/latent_function_inference/var_dtc.py @@ -192,17 +192,22 @@ class VarDTC(object): class VarDTCMissingData(object): const_jitter = 1e-6 - def __init__(self, limit=1): + def __init__(self, limit=1, inan=None): from ...util.caching import Cacher self._Y = Cacher(self._subarray_computations, limit) + self._inan = inan pass def set_limit(self, limit): self._Y.limit = limit def _subarray_computations(self, Y): - inan = np.isnan(Y) - has_none = inan.any() + if self._inan is None: + inan = np.isnan(Y) + has_none = inan.any() + else: + inan = self._inan + has_none = True if has_none: from ...util.subarray_and_sorting import common_subarrays self._subarray_indices = [] diff --git a/GPy/util/data_resources.json b/GPy/util/data_resources.json index 57b79f10..845d56be 100644 --- a/GPy/util/data_resources.json +++ b/GPy/util/data_resources.json @@ -1,409 +1 @@ -{ - "rogers_girolami_data":{ - "files":[ - [ - "firstcoursemldata.tar.gz" - ] - ], - "license":null, - "citation":"A First Course in Machine Learning. Simon Rogers and Mark Girolami: Chapman & Hall/CRC, ISBN-13: 978-1439824146", - "details":"Data from the textbook 'A First Course in Machine Learning'. Available from http://www.dcs.gla.ac.uk/~srogers/firstcourseml/.", - "urls":[ - "https://www.dropbox.com/sh/7p6tu1t29idgliq/_XqlH_3nt9/" - ], - "suffices":[ - [ - "?dl=1" - ] - ], - "size":21949154 - }, - "ankur_pose_data":{ - "files":[ - [ - "ankurDataPoseSilhouette.mat" - ] - ], - "citation":"3D Human Pose from Silhouettes by Relevance Vector Regression (In CVPR'04). A. Agarwal and B. Triggs.", - "license":null, - "urls":[ - "http://staffwww.dcs.shef.ac.uk/people/N.Lawrence/dataset_mirror/ankur_pose_data/" - ], - "details":"Artificially generated data of silhouettes given poses. Note that the data does not display a left/right ambiguity because across the entire data set one of the arms sticks out more the the other, disambiguating the pose as to which way the individual is facing.", - "size":1 - }, - "football_data":{ - "files":[ - [ - "E0.csv", "E1.csv", "E2.csv", "E3.csv" - ] - ], - "citation":"", - "license":null, - "urls":[ - "http://www.football-data.co.uk/mmz4281/" - ], - "details":"Results of English football matches since 1993/94 season.", - "size":1 - }, - "google_trends":{ - "files":[ - [ - ] - ], - "citation":"", - "license":null, - "urls":[ - "http://www.google.com/trends/" - ], - "details":"Google trends results.", - "size":0 - }, - "osu_accad":{ - "files":[ - [ - "swagger1TXT.ZIP", - "handspring1TXT.ZIP", - "quickwalkTXT.ZIP", - "run1TXT.ZIP", - "sprintTXT.ZIP", - "dogwalkTXT.ZIP", - "camper_04TXT.ZIP", - "dance_KB3_TXT.ZIP", - "per20_TXT.ZIP", - "perTWO07_TXT.ZIP", - "perTWO13_TXT.ZIP", - "perTWO14_TXT.ZIP", - "perTWO15_TXT.ZIP", - "perTWO16_TXT.ZIP" - ], - [ - "connections.txt" - ] - ], - "license":"Data is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License (http://creativecommons.org/licenses/by-nc-sa/3.0/).", - "citation":"The Open Motion Data Project by The Ohio State University Advanced Computing Center for the Arts and Design, http://accad.osu.edu/research/mocap/mocap_data.htm.", - "details":"Motion capture data of different motions from the Open Motion Data Project at Ohio State University.", - "urls":[ - "http://accad.osu.edu/research/mocap/data/", - "http://staffwww.dcs.shef.ac.uk/people/N.Lawrence/dataset_mirror/stick/" - ], - "size":15922790 - }, - "isomap_face_data":{ - "files":[ - [ - "face_data.mat" - ] - ], - "license":null, - "citation":"A Global Geometric Framework for Nonlinear Dimensionality Reduction, J. B. Tenenbaum, V. de Silva and J. C. Langford, Science 290 (5500): 2319-2323, 22 December 2000", - "details":"Face data made available by Tenenbaum, de Silva and Langford to demonstrate isomap, available from http://isomap.stanford.edu/datasets.html.", - "urls":[ - "http://staffwww.dcs.shef.ac.uk/people/N.Lawrence/dataset_mirror/isomap_face_data/" - ], - "size":24229368 - }, - "boston_housing":{ - "files":[ - [ - "Index", - "housing.data", - "housing.names" - ] - ], - "license":null, - "citation":"Harrison, D. and Rubinfeld, D.L. 'Hedonic prices and the demand for clean air', J. Environ. Economics & Management, vol.5, 81-102, 1978.", - "details":"The Boston Housing data relates house values in Boston to a range of input variables.", - "urls":[ - "http://archive.ics.uci.edu/ml/machine-learning-databases/housing/" - ], - "size":51276 - }, - "cmu_mocap_full":{ - "files":[ - [ - "allasfamc.zip" - ] - ], - "license":"From http://mocap.cs.cmu.edu. This data is free for use in research projects. You may include this data in commercially-sold products, but you may not resell this data directly, even in converted form. If you publish results obtained using this data, we would appreciate it if you would send the citation to your published paper to jkh+mocap@cs.cmu.edu, and also would add this text to your acknowledgments section: The data used in this project was obtained from mocap.cs.cmu.edu. The database was created with funding from NSF EIA-0196217.", - "citation":"Please include this in your acknowledgements: The data used in this project was obtained from mocap.cs.cmu.edu.\nThe database was created with funding from NSF EIA-0196217.", - "details":"CMU Motion Capture data base. Captured by a Vicon motion capture system consisting of 12 infrared MX-40 cameras, each of which is capable of recording at 120 Hz with images of 4 megapixel resolution. Motions are captured in a working volume of approximately 3m x 8m. The capture subject wears 41 markers and a stylish black garment.", - "urls":[ - "http://mocap.cs.cmu.edu/subjects" - ], - "size":null - }, - "brendan_faces":{ - "files":[ - [ - "frey_rawface.mat" - ] - ], - "license":null, - "citation":"Frey, B. J., Colmenarez, A and Huang, T. S. Mixtures of Local Linear Subspaces for Face Recognition. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition 1998, 32-37, June 1998. Computer Society Press, Los Alamitos, CA.", - "details":"A video of Brendan Frey's face popularized as a benchmark for visualization by the Locally Linear Embedding.", - "urls":[ - "http://www.cs.nyu.edu/~roweis/data/" - ], - "size":1100584 - }, - "olympic_marathon_men":{ - "files":[ - [ - "olympicMarathonTimes.csv" - ] - ], - "license":null, - "citation":null, - "details":"Olympic mens' marathon gold medal winning times from 1896 to 2012. Time given in pace (minutes per kilometer). Data is originally downloaded and collated from Wikipedia, we are not responsible for errors in the data", - "urls":[ - "http://staffwww.dcs.shef.ac.uk/people/N.Lawrence/dataset_mirror/olympic_marathon_men/" - ], - "size":584 - }, - "pumadyn-32nm":{ - "files":[ - [ - "pumadyn-32nm.tar.gz" - ] - ], - "license":"Data is made available by the Delve system at the University of Toronto", - "citation":"Created by Zoubin Ghahramani using the Matlab Robotics Toolbox of Peter Corke. Corke, P. I. (1996). A Robotics Toolbox for MATLAB. IEEE Robotics and Automation Magazine, 3 (1): 24-32.", - "details":"Pumadyn non linear 32 input data set with moderate noise. See http://www.cs.utoronto.ca/~delve/data/pumadyn/desc.html for details.", - "urls":[ - "ftp://ftp.cs.toronto.edu/pub/neuron/delve/data/tarfiles/pumadyn-family/" - ], - "size":5861646 - }, - "ripley_prnn_data":{ - "files":[ - [ - "Cushings.dat", - "README", - "crabs.dat", - "fglass.dat", - "fglass.grp", - "pima.te", - "pima.tr", - "pima.tr2", - "synth.te", - "synth.tr", - "viruses.dat", - "virus3.dat" - ] - ], - "license":null, - "citation":"Pattern Recognition and Neural Networks by B.D. Ripley (1996) Cambridge University Press ISBN 0 521 46986 7", - "details":"Data sets from Brian Ripley's Pattern Recognition and Neural Networks", - "urls":[ - "http://www.stats.ox.ac.uk/pub/PRNN/" - ], - "size":93565 - }, - "three_phase_oil_flow":{ - "files":[ - [ - "DataTrnLbls.txt", - "DataTrn.txt", - "DataTst.txt", - "DataTstLbls.txt", - "DataVdn.txt", - "DataVdnLbls.txt" - ] - ], - "license":null, - "citation":"Bishop, C. M. and G. D. James (1993). Analysis of multiphase flows using dual-energy gamma densitometry and neural networks. Nuclear Instruments and Methods in Physics Research A327, 580-593", - "details":"The three phase oil data used initially for demonstrating the Generative Topographic mapping.", - "urls":[ - "http://staffwww.dcs.shef.ac.uk/people/N.Lawrence/dataset_mirror/three_phase_oil_flow/" - ], - "size":712796 - }, - "robot_wireless":{ - "files":[ - [ - "uw-floor.txt" - ] - ], - "license":null, - "citation":"WiFi-SLAM using Gaussian Process Latent Variable Models by Brian Ferris, Dieter Fox and Neil Lawrence in IJCAI'07 Proceedings pages 2480-2485. Data used in A Unifying Probabilistic Perspective for Spectral Dimensionality Reduction: Insights and New Models by Neil D. Lawrence, JMLR 13 pg 1609--1638, 2012.", - "details":"Data created by Brian Ferris and Dieter Fox. Consists of WiFi access point strengths taken during a circuit of the Paul Allen building at the University of Washington.", - "urls":[ - "http://staffwww.dcs.shef.ac.uk/people/N.Lawrence/dataset_mirror/robot_wireless/" - ], - "size":284390 - }, - "xw_pen":{ - "files":[ - [ - "xw_pen_15.csv" - ] - ], - "license":null, - "citation":"Michael E. Tipping and Neil D. Lawrence. Variational inference for Student-t models: Robust Bayesian interpolation and generalised component analysis. Neurocomputing, 69:123--141, 2005", - "details":"Accelerometer pen data used for robust regression by Tipping and Lawrence.", - "urls":[ - "http://staffwww.dcs.shef.ac.uk/people/N.Lawrence/dataset_mirror/xw_pen/" - ], - "size":3410 - }, - "swiss_roll":{ - "files":[ - [ - "swiss_roll_data.mat" - ] - ], - "license":null, - "citation":"A Global Geometric Framework for Nonlinear Dimensionality Reduction, J. B. Tenenbaum, V. de Silva and J. C. Langford, Science 290 (5500): 2319-2323, 22 December 2000", - "details":"Swiss roll data made available by Tenenbaum, de Silva and Langford to demonstrate isomap, available from http://isomap.stanford.edu/datasets.html.", - "urls":[ - "http://isomap.stanford.edu/" - ], - "size":800256 - }, - "osu_run1":{ - "files":[ - [ - "run1TXT.ZIP" - ], - [ - "connections.txt" - ] - ], - "license":"Data is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License (http://creativecommons.org/licenses/by-nc-sa/3.0/).", - "citation":"The Open Motion Data Project by The Ohio State University Advanced Computing Center for the Arts and Design, http://accad.osu.edu/research/mocap/mocap_data.htm.", - "details":"Motion capture data of a stick man running from the Open Motion Data Project at Ohio State University.", - "urls":[ - "http://accad.osu.edu/research/mocap/data/", - "http://staffwww.dcs.shef.ac.uk/people/N.Lawrence/dataset_mirror/stick/" - ], - "size":338103 - }, - "creep_rupture":{ - "files":[ - [ - "creeprupt.tar" - ] - ], - "license":null, - "citation":"Materials Algorithms Project Data Library: MAP_DATA_CREEP_RUPTURE. F. Brun and T. Yoshida.", - "details":"Provides 2066 creep rupture test results of steels (mainly of two kinds of steels: 2.25Cr and 9-12 wt% Cr ferritic steels). See http://www.msm.cam.ac.uk/map/data/materials/creeprupt-b.html.", - "urls":[ - "http://www.msm.cam.ac.uk/map/data/tar/" - ], - "size":602797 - }, - "olivetti_faces":{ - "files":[ - [ - "att_faces.zip" - ], - [ - "olivettifaces.mat" - ] - ], - "license":null, - "citation":"Ferdinando Samaria and Andy Harter, Parameterisation of a Stochastic Model for Human Face Identification. Proceedings of 2nd IEEE Workshop on Applications of Computer Vision, Sarasota FL, December 1994", - "details":"Olivetti Research Labs Face data base, acquired between December 1992 and December 1994 in the Olivetti Research Lab, Cambridge (which later became AT&T Laboratories, Cambridge). When using these images please give credit to AT&T Laboratories, Cambridge. ", - "urls":[ - "http://staffwww.dcs.shef.ac.uk/people/N.Lawrence/dataset_mirror/olivetti_faces/", - "http://www.cs.nyu.edu/~roweis/data/" - ], - "size":8561331 - }, - "olivetti_glasses":{ - "files":[ - [ - "has_glasses.np" - ], - [ - "olivettifaces.mat" - ] - ], - "license":null, - "citation":"Information recorded in olivetti_faces entry. Should be used from there.", - "details":"Information recorded in olivetti_faces entry. Should be used from there.", - "urls":[ - "http://staffwww.dcs.shef.ac.uk/people/N.Lawrence/dataset_mirror/olivetti_faces/", - "http://www.cs.nyu.edu/~roweis/data/" - ], - "size":4261047 - }, - "della_gatta":{ - "files":[ - [ - "DellaGattadata.mat" - ] - ], - "license":null, - "citation":"Direct targets of the TRP63 transcription factor revealed by a combination of gene expression profiling and reverse engineering. Giusy Della Gatta, Mukesh Bansal, Alberto Ambesi-Impiombato, Dario Antonini, Caterina Missero, and Diego di Bernardo, Genome Research 2008", - "details":"The full gene expression data set from della Gatta et al (http://www.ncbi.nlm.nih.gov/pmc/articles/PMC2413161/) processed by RMA.", - "urls":[ - "http://staffwww.dcs.shef.ac.uk/people/N.Lawrence/dataset_mirror/della_gatta/" - ], - "size":3729650 - }, - "epomeo_gpx":{ - "files":[ - [ - "endomondo_1.gpx", - "endomondo_2.gpx", - "garmin_watch_via_endomondo.gpx", - "viewranger_phone.gpx", - "viewranger_tablet.gpx" - ] - ], - "license":null, - "citation":"", - "details":"Five different GPS traces of the same run up Mount Epomeo in Ischia. The traces are from different sources. endomondo_1 and endomondo_2 are traces from the mobile phone app Endomondo, with a split in the middle. garmin_watch_via_endomondo is the trace from a Garmin watch, with a segment missing about 4 kilometers in. viewranger_phone and viewranger_tablet are traces from a phone and a tablet through the viewranger app. The viewranger_phone data comes from the same mobile phone as the Endomondo data (i.e. there are 3 GPS devices, but one device recorded two traces).", - "urls":[ - "http://staffwww.dcs.shef.ac.uk/people/N.Lawrence/dataset_mirror/epomeo_gpx/" - ], - "size":2031872 - }, - "mauna_loa":{ - "files":[ - [ - "co2_mm_mlo.txt" - ] - ], - "license":"-------------------------------------------------------------------- USE OF NOAA ESRL DATA\n\n These data are made freely available to the public and the scientific community in the belief that their wide dissemination will lead to greater understanding and new scientific insights. The availability of these data does not constitute publication of the data. NOAA relies on the ethics and integrity of the user to insure that ESRL receives fair credit for their work. If the data are obtained for potential use in a publication or presentation, ESRL should be informed at the outset of the nature of this work. If the ESRL data are essential to the work, or if an important result or conclusion depends on the ESRL data, co-authorship may be appropriate. This should be discussed at an early stage in the work. Manuscripts using the ESRL data should be sent to ESRL for review before they are submitted for publication so we can insure that the quality and limitations of the data are accurately represented.\n\n Contact: Pieter Tans (303 497 6678; pieter.tans@noaa.gov)\n\n RECIPROCITY Use of these data implies an agreement to reciprocate. Laboratories making similar measurements agree to make their own data available to the general public and to the scientific community in an equally complete and easily accessible form. Modelers are encouraged to make available to the community, upon request, their own tools used in the interpretation of the ESRL data, namely well documented model code, transport fields, and additional information necessary for other scientists to repeat the work and to run modified versions. Model availability includes collaborative support for new users of the models.\n --------------------------------------------------------------------\n\n See www.esrl.noaa.gov/gmd/ccgg/trends/ for additional details.", - "citation":"Mauna Loa Data. Dr. Pieter Tans, NOAA/ESRL (www.esrl.noaa.gov/gmd/ccgg/trends/) and Dr. Ralph Keeling, Scripps Institution of Oceanography (scrippsco2.ucsd.edu/).", - "details":"The 'average' column contains the monthly mean CO2 mole fraction determined from daily averages. The mole fraction of CO2, expressed as parts per million (ppm) is the number of molecules of CO2 in every one million molecules of dried air (water vapor removed). If there are missing days concentrated either early or late in the month, the monthly mean is corrected to the middle of the month using the average seasonal cycle. Missing months are denoted by -99.99. The 'interpolated' column includes average values from the preceding column and interpolated values where data are missing. Interpolated values are computed in two steps. First, we compute for each month the average seasonal cycle in a 7-year window around each monthly value. In this way the seasonal cycle is allowed to change slowly over time. We then determine the 'trend' value for each month by removing the seasonal cycle; this result is shown in the 'trend' column. Trend values are linearly interpolated for missing months. The interpolated monthly mean is then the sum of the average seasonal cycle value and the trend value for the missing month.\n\nNOTE: In general, the data presented for the last year are subject to change, depending on recalibration of the reference gas mixtures used, and other quality control procedures. Occasionally, earlier years may also be changed for the same reasons. Usually these changes are minor.\n\nCO2 expressed as a mole fraction in dry air, micromol/mol, abbreviated as ppm \n\n (-99.99 missing data; -1 no data for daily means in month)", - "urls":[ - "ftp://aftp.cmdl.noaa.gov/products/trends/co2/" - ], - "size":46779 - }, - "boxjenkins_airline":{ - "files":[ - [ - "boxjenkins_airline.csv" - ] - ], - "license":"You may copy and redistribute the data. You may make derivative works from the data. You may use the data for commercial purposes. You may not sublicence the data when redistributing it. You may not redistribute the data under a different license. Source attribution on any use of this data: Must refer source.", - "citation":"Box & Jenkins (1976), in file: data/airpass, Description: International airline passengers: monthly totals in thousands. Jan 49 – Dec 60", - "details":"International airline passengers, monthly totals from January 1949 to December 1960.", - "urls":[ - "http://staffwww.dcs.shef.ac.uk/people/N.Lawrence/dataset_mirror/boxjenkins_airline/" - ], - "size":46779 - }, - - "decampos_characters":{ - "files":[ - [ - "characters.npy", - "digits.npy" - ] - ], - "license":null, - "citation":"T. de Campos, B. R. Babu, and M. Varma. Character recognition in natural images. VISAPP 2009.", - "details":"Examples of hand written digits taken from the de Campos et al paper on Character Recognition in Natural Images.", - "urls":[ - "http://staffwww.dcs.shef.ac.uk/people/N.Lawrence/dataset_mirror/decampos_digits/" - ], - "size":2031872 - } -} +{"rogers_girolami_data": {"files": [["firstcoursemldata.tar.gz"]], "license": null, "citation": "A First Course in Machine Learning. Simon Rogers and Mark Girolami: Chapman & Hall/CRC, ISBN-13: 978-1439824146", "details": "Data from the textbook 'A First Course in Machine Learning'. Available from http://www.dcs.gla.ac.uk/~srogers/firstcourseml/.", "urls": ["https://www.dropbox.com/sh/7p6tu1t29idgliq/_XqlH_3nt9/"], "suffices": [["?dl=1"]], "size": 21949154}, "ankur_pose_data": {"files": [["ankurDataPoseSilhouette.mat"]], "citation": "3D Human Pose from Silhouettes by Relevance Vector Regression (In CVPR'04). A. Agarwal and B. Triggs.", "license": null, "urls": ["http://staffwww.dcs.shef.ac.uk/people/N.Lawrence/dataset_mirror/ankur_pose_data/"], "details": "Artificially generated data of silhouettes given poses. Note that the data does not display a left/right ambiguity because across the entire data set one of the arms sticks out more the the other, disambiguating the pose as to which way the individual is facing."}, "osu_accad": {"files": [["swagger1TXT.ZIP", "handspring1TXT.ZIP", "quickwalkTXT.ZIP", "run1TXT.ZIP", "sprintTXT.ZIP", "dogwalkTXT.ZIP", "camper_04TXT.ZIP", "dance_KB3_TXT.ZIP", "per20_TXT.ZIP", "perTWO07_TXT.ZIP", "perTWO13_TXT.ZIP", "perTWO14_TXT.ZIP", "perTWO15_TXT.ZIP", "perTWO16_TXT.ZIP"], ["connections.txt"]], "license": "Data is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License (http://creativecommons.org/licenses/by-nc-sa/3.0/).", "citation": "The Open Motion Data Project by The Ohio State University Advanced Computing Center for the Arts and Design, http://accad.osu.edu/research/mocap/mocap_data.htm.", "details": "Motion capture data of different motions from the Open Motion Data Project at Ohio State University.", "urls": ["http://accad.osu.edu/research/mocap/data/", "http://staffwww.dcs.shef.ac.uk/people/N.Lawrence/dataset_mirror/stick/"], "size": 15922790}, "isomap_face_data": {"files": [["face_data.mat"]], "license": null, "citation": "A Global Geometric Framework for Nonlinear Dimensionality Reduction, J. B. Tenenbaum, V. de Silva and J. C. Langford, Science 290 (5500): 2319-2323, 22 December 2000", "details": "Face data made available by Tenenbaum, de Silva and Langford to demonstrate isomap, available from http://isomap.stanford.edu/datasets.html.", "urls": ["http://staffwww.dcs.shef.ac.uk/people/N.Lawrence/dataset_mirror/isomap_face_data/"], "size": 24229368}, "boston_housing": {"files": [["Index", "housing.data", "housing.names"]], "license": null, "citation": "Harrison, D. and Rubinfeld, D.L. 'Hedonic prices and the demand for clean air', J. Environ. Economics & Management, vol.5, 81-102, 1978.", "details": "The Boston Housing data relates house values in Boston to a range of input variables.", "urls": ["http://archive.ics.uci.edu/ml/machine-learning-databases/housing/"], "size": 51276}, "cmu_mocap_full": {"files": [["allasfamc.zip"]], "license": "From http://mocap.cs.cmu.edu. This data is free for use in research projects. You may include this data in commercially-sold products, but you may not resell this data directly, even in converted form. If you publish results obtained using this data, we would appreciate it if you would send the citation to your published paper to jkh+mocap@cs.cmu.edu, and also would add this text to your acknowledgments section: The data used in this project was obtained from mocap.cs.cmu.edu. The database was created with funding from NSF EIA-0196217.", "citation": "Please include this in your acknowledgements: The data used in this project was obtained from mocap.cs.cmu.edu.'\n 'The database was created with funding from NSF EIA-0196217.", "details": "CMU Motion Capture data base. Captured by a Vicon motion capture system consisting of 12 infrared MX-40 cameras, each of which is capable of recording at 120 Hz with images of 4 megapixel resolution. Motions are captured in a working volume of approximately 3m x 8m. The capture subject wears 41 markers and a stylish black garment.", "urls": ["http://mocap.cs.cmu.edu"], "size": null}, "brendan_faces": {"files": [["frey_rawface.mat"]], "license": null, "citation": "Frey, B. J., Colmenarez, A and Huang, T. S. Mixtures of Local Linear Subspaces for Face Recognition. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition 1998, 32-37, June 1998. Computer Society Press, Los Alamitos, CA.", "details": "A video of Brendan Frey's face popularized as a benchmark for visualization by the Locally Linear Embedding.", "urls": ["http://www.cs.nyu.edu/~roweis/data/"], "size": 1100584}, "olympic_marathon_men": {"files": [["olympicMarathonTimes.csv"]], "license": null, "citation": null, "details": "Olympic mens' marathon gold medal winning times from 1896 to 2012. Time given in pace (minutes per kilometer). Data is originally downloaded and collated from Wikipedia, we are not responsible for errors in the data", "urls": ["http://staffwww.dcs.shef.ac.uk/people/N.Lawrence/dataset_mirror/olympic_marathon_men/"], "size": 584}, "pumadyn-32nm": {"files": [["pumadyn-32nm.tar.gz"]], "license": "Data is made available by the Delve system at the University of Toronto", "citation": "Created by Zoubin Ghahramani using the Matlab Robotics Toolbox of Peter Corke. Corke, P. I. (1996). A Robotics Toolbox for MATLAB. IEEE Robotics and Automation Magazine, 3 (1): 24-32.", "details": "Pumadyn non linear 32 input data set with moderate noise. See http://www.cs.utoronto.ca/~delve/data/pumadyn/desc.html for details.", "urls": ["ftp://ftp.cs.toronto.edu/pub/neuron/delve/data/tarfiles/pumadyn-family/"], "size": 5861646}, "ripley_prnn_data": {"files": [["Cushings.dat", "README", "crabs.dat", "fglass.dat", "fglass.grp", "pima.te", "pima.tr", "pima.tr2", "synth.te", "synth.tr", "viruses.dat", "virus3.dat"]], "license": null, "citation": "Pattern Recognition and Neural Networks by B.D. Ripley (1996) Cambridge University Press ISBN 0 521 46986 7", "details": "Data sets from Brian Ripley's Pattern Recognition and Neural Networks", "urls": ["http://www.stats.ox.ac.uk/pub/PRNN/"], "size": 93565}, "three_phase_oil_flow": {"files": [["DataTrnLbls.txt", "DataTrn.txt", "DataTst.txt", "DataTstLbls.txt", "DataVdn.txt", "DataVdnLbls.txt"]], "license": null, "citation": "Bishop, C. M. and G. D. James (1993). Analysis of multiphase flows using dual-energy gamma densitometry and neural networks. Nuclear Instruments and Methods in Physics Research A327, 580-593", "details": "The three phase oil data used initially for demonstrating the Generative Topographic mapping.", "urls": ["http://staffwww.dcs.shef.ac.uk/people/N.Lawrence/dataset_mirror/three_phase_oil_flow/"], "size": 712796}, "robot_wireless": {"files": [["uw-floor.txt"]], "license": null, "citation": "WiFi-SLAM using Gaussian Process Latent Variable Models by Brian Ferris, Dieter Fox and Neil Lawrence in IJCAI'07 Proceedings pages 2480-2485. Data used in A Unifying Probabilistic Perspective for Spectral Dimensionality Reduction: Insights and New Models by Neil D. Lawrence, JMLR 13 pg 1609--1638, 2012.", "details": "Data created by Brian Ferris and Dieter Fox. Consists of WiFi access point strengths taken during a circuit of the Paul Allen building at the University of Washington.", "urls": ["http://staffwww.dcs.shef.ac.uk/people/N.Lawrence/dataset_mirror/robot_wireless/"], "size": 284390}, "xw_pen": {"files": [["xw_pen_15.csv"]], "license": null, "citation": "Michael E. Tipping and Neil D. Lawrence. Variational inference for Student-t models: Robust Bayesian interpolation and generalised component analysis. Neurocomputing, 69:123--141, 2005", "details": "Accelerometer pen data used for robust regression by Tipping and Lawrence.", "urls": ["http://staffwww.dcs.shef.ac.uk/people/N.Lawrence/dataset_mirror/xw_pen/"], "size": 3410}, "swiss_roll": {"files": [["swiss_roll_data.mat"]], "license": null, "citation": "A Global Geometric Framework for Nonlinear Dimensionality Reduction, J. B. Tenenbaum, V. de Silva and J. C. Langford, Science 290 (5500): 2319-2323, 22 December 2000", "details": "Swiss roll data made available by Tenenbaum, de Silva and Langford to demonstrate isomap, available from http://isomap.stanford.edu/datasets.html.", "urls": ["http://isomap.stanford.edu/"], "size": 800256}, "osu_run1": {"files": [["run1TXT.ZIP"], ["connections.txt"]], "license": "Data is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License (http://creativecommons.org/licenses/by-nc-sa/3.0/).", "citation": "The Open Motion Data Project by The Ohio State University Advanced Computing Center for the Arts and Design, http://accad.osu.edu/research/mocap/mocap_data.htm.", "details": "Motion capture data of a stick man running from the Open Motion Data Project at Ohio State University.", "urls": ["http://accad.osu.edu/research/mocap/data/", "http://staffwww.dcs.shef.ac.uk/people/N.Lawrence/dataset_mirror/stick/"], "size": 338103}, "creep_rupture": {"files": [["creeprupt.tar"]], "license": null, "citation": "Materials Algorithms Project Data Library: MAP_DATA_CREEP_RUPTURE. F. Brun and T. Yoshida.", "details": "Provides 2066 creep rupture test results of steels (mainly of two kinds of steels: 2.25Cr and 9-12 wt% Cr ferritic steels). See http://www.msm.cam.ac.uk/map/data/materials/creeprupt-b.html.", "urls": ["http://www.msm.cam.ac.uk/map/data/tar/"], "size": 602797}, "hapmap3": {"files": [["hapmap3_r2_b36_fwd.consensus.qc.poly.map.bz2", "hapmap3_r2_b36_fwd.consensus.qc.poly.ped.bz2", "relationships_w_pops_121708.txt"]], "license": "International HapMap Project Public Access License (http://hapmap.ncbi.nlm.nih.gov/cgi-perl/registration#licence)", "citation": "Gibbs, Richard A., et al. \"The international HapMap project.\" Nature 426.6968 (2003): 789-796.", "details": "HapMap Project: Single Nucleotide Polymorphism sequenced in all human populations. See http://www.nature.com/nature/journal/v426/n6968/abs/nature02168.html for details.", "urls": ["http://hapmap.ncbi.nlm.nih.gov/downloads/genotypes/latest_phaseIII_ncbi_b36/plink_format/"], "size": 3458246739}, "olivetti_faces": {"files": [["att_faces.zip"], ["olivettifaces.mat"]], "license": null, "citation": "Ferdinando Samaria and Andy Harter, Parameterisation of a Stochastic Model for Human Face Identification. Proceedings of 2nd IEEE Workshop on Applications of Computer Vision, Sarasota FL, December 1994", "details": "Olivetti Research Labs Face data base, acquired between December 1992 and December 1994 in the Olivetti Research Lab, Cambridge (which later became AT&T Laboratories, Cambridge). When using these images please give credit to AT&T Laboratories, Cambridge. ", "urls": ["http://staffwww.dcs.shef.ac.uk/people/N.Lawrence/dataset_mirror/olivetti_faces/", "http://www.cs.nyu.edu/~roweis/data/"], "size": 8561331}, "della_gatta": {"files": [["DellaGattadata.mat"]], "license": null, "citation": "Direct targets of the TRP63 transcription factor revealed by a combination of gene expression profiling and reverse engineering. Giusy Della Gatta, Mukesh Bansal, Alberto Ambesi-Impiombato, Dario Antonini, Caterina Missero, and Diego di Bernardo, Genome Research 2008", "details": "The full gene expression data set from della Gatta et al (http://www.ncbi.nlm.nih.gov/pmc/articles/PMC2413161/) processed by RMA.", "urls": ["http://staffwww.dcs.shef.ac.uk/people/N.Lawrence/dataset_mirror/della_gatta/"], "size": 3729650}, "epomeo_gpx": {"files": [["endomondo_1.gpx", "endomondo_2.gpx", "garmin_watch_via_endomondo.gpx", "viewranger_phone.gpx", "viewranger_tablet.gpx"]], "license": null, "citation": "", "details": "Five different GPS traces of the same run up Mount Epomeo in Ischia. The traces are from different sources. endomondo_1 and endomondo_2 are traces from the mobile phone app Endomondo, with a split in the middle. garmin_watch_via_endomondo is the trace from a Garmin watch, with a segment missing about 4 kilometers in. viewranger_phone and viewranger_tablet are traces from a phone and a tablet through the viewranger app. The viewranger_phone data comes from the same mobile phone as the Endomondo data (i.e. there are 3 GPS devices, but one device recorded two traces).", "urls": ["http://staffwww.dcs.shef.ac.uk/people/N.Lawrence/dataset_mirror/epomeo_gpx/"], "size": 2031872}} \ No newline at end of file diff --git a/GPy/util/datasets.py b/GPy/util/datasets.py index f53163f4..748a5839 100644 --- a/GPy/util/datasets.py +++ b/GPy/util/datasets.py @@ -106,9 +106,30 @@ def download_url(url, store_directory, save_name = None, messages = True, suffix raise ValueError('Tried url ' + url + suffix + ' and received client error ' + str(response.code)) elif response.code > 499: raise ValueError('Tried url ' + url + suffix + ' and received server error ' + str(response.code)) - # if we wanted to get more sophisticated maybe we should check the response code here again even for successes. with open(save_name, 'wb') as f: - f.write(response.read()) + meta = response.info() + file_size = int(meta.getheaders("Content-Length")[0]) + status = "" + file_size_dl = 0 + block_sz = 8192 + line_length=30 + while True: + buff = response.read(block_sz) + if not buff: + break + file_size_dl += len(buff) + f.write(buff) + sys.stdout.write(" "*(len(status)) + "\r") + status = r"[{perc: <{ll}}] {dl:7.3f}/{full:.3f}MB".format(dl=file_size_dl/(1.*1e6), + full=file_size/(1.*1e6), ll=line_length, + perc="="*int(line_length*float(file_size_dl)/file_size)) + sys.stdout.write(status) + sys.stdout.flush() + sys.stdout.write(" "*(len(status)) + "\r") + print status + # if we wanted to get more sophisticated maybe we should check the response code here again even for successes. + #with open(save_name, 'wb') as f: + # f.write(response.read()) #urllib.urlretrieve(url+suffix, save_name, reporthook) @@ -552,6 +573,151 @@ def swiss_roll_generated(num_samples=1000, sigma=0.0): c = c[so, :] return {'Y':Y, 't':t, 'colors':c} +def hapmap3(data_set='hapmap3'): + """ + The HapMap phase three SNP dataset - 1184 samples out of 11 populations. + + SNP_matrix (A) encoding [see Paschou et all. 2007 (PCA-Correlated SNPs...)]: + Let (B1,B2) be the alphabetically sorted bases, which occur in the j-th SNP, then + + / 1, iff SNPij==(B1,B1) + Aij = | 0, iff SNPij==(B1,B2) + \ -1, iff SNPij==(B2,B2) + + The SNP data and the meta information (such as iid, sex and phenotype) are + stored in the dataframe datadf, index is the Individual ID, + with following columns for metainfo: + + * family_id -> Family ID + * paternal_id -> Paternal ID + * maternal_id -> Maternal ID + * sex -> Sex (1=male; 2=female; other=unknown) + * phenotype -> Phenotype (-9, or 0 for unknown) + * population -> Population string (e.g. 'ASW' - 'YRI') + * rest are SNP rs (ids) + + More information is given in infodf: + + * Chromosome: + - autosomal chromosemes -> 1-22 + - X X chromosome -> 23 + - Y Y chromosome -> 24 + - XY Pseudo-autosomal region of X -> 25 + - MT Mitochondrial -> 26 + * Relative Positon (to Chromosome) [base pairs] + """ + try: + from pandas import read_pickle, DataFrame + from sys import stdout + import bz2 + except ImportError as i: + raise i, "Need pandas for hapmap dataset, make sure to install pandas (http://pandas.pydata.org/) before loading the hapmap dataset" + if not data_available(data_set): + download_data(data_set) + dirpath = os.path.join(data_path,'hapmap3') + hapmap_file_name = 'hapmap3_r2_b36_fwd.consensus.qc.poly' + preprocessed_data_paths = [os.path.join(dirpath,hapmap_file_name + file_name) for file_name in \ + ['.snps.pickle', + '.info.pickle', + '.nan.pickle']] + if not reduce(lambda a,b: a and b, map(os.path.exists, preprocessed_data_paths)): + if not overide_manual_authorize and not prompt_user("Preprocessing requires ~25GB " + "of memory and can take a (very) long time, continue? [Y/n]"): + print "Preprocessing required for further usage." + return + status = "Preprocessing data, please be patient..." + print status + def write_status(message, progress, status): + stdout.write(" "*len(status)); stdout.write("\r"); stdout.flush() + status = r"[{perc: <{ll}}] {message: <13s}".format(message=message, ll=20, + perc="="*int(20.*progress/100.)) + stdout.write(status); stdout.flush() + return status + unpacked_files = [os.path.join(dirpath, hapmap_file_name+ending) for ending in ['.ped', '.map']] + if not reduce(lambda a,b: a and b, map(os.path.exists, unpacked_files)): + status=write_status('unpacking...', 0, '') + curr = 0 + for newfilepath in unpacked_files: + if not os.path.exists(newfilepath): + filepath = newfilepath + '.bz2' + file_size = os.path.getsize(filepath) + with open(newfilepath, 'wb') as new_file, open(filepath, 'rb') as f: + decomp = bz2.BZ2Decompressor() + file_processed = 0 + buffsize = 100 * 1024 + for data in iter(lambda : f.read(buffsize), b''): + new_file.write(decomp.decompress(data)) + file_processed += len(data) + status=write_status('unpacking...', curr+12.*file_processed/(file_size), status) + curr += 12 + status=write_status('unpacking...', curr, status) + status=write_status('reading .ped...', 25, status) + # Preprocess data: + snpstrnp = np.loadtxt(unpacked_files[0], dtype=str) + status=write_status('reading .map...', 33, status) + mapnp = np.loadtxt(unpacked_files[1], dtype=str) + status=write_status('reading relationships.txt...', 42, status) + # and metainfo: + infodf = DataFrame.from_csv(os.path.join(dirpath,'./relationships_w_pops_121708.txt'), header=0, sep='\t') + infodf.set_index('IID', inplace=1) + status=write_status('filtering nan...', 45, status) + snpstr = snpstrnp[:,6:].astype('S1').reshape(snpstrnp.shape[0], -1, 2) + inan = snpstr[:,:,0] == '0' + status=write_status('filtering reference alleles...', 55, status) + ref = np.array(map(lambda x: np.unique(x)[-2:], snpstr.swapaxes(0,1)[:,:,:])) + status=write_status('encoding snps...', 70, status) + # Encode the information for each gene in {-1,0,1}: + status=write_status('encoding snps...', 73, status) + snps = (snpstr==ref[None,:,:]) + status=write_status('encoding snps...', 76, status) + snps = (snps*np.array([1,-1])[None,None,:]) + status=write_status('encoding snps...', 78, status) + snps = snps.sum(-1) + status=write_status('encoding snps...', 81, status) + snps = snps.astype('i8') + status=write_status('marking nan values...', 88, status) + # put in nan values (masked as -128): + snps[inan] = -128 + status=write_status('setting up meta...', 94, status) + # get meta information: + metaheader = np.r_[['family_id', 'iid', 'paternal_id', 'maternal_id', 'sex', 'phenotype']] + metadf = DataFrame(columns=metaheader, data=snpstrnp[:,:6]) + metadf.set_index('iid', inplace=1) + metadf = metadf.join(infodf.population) + metadf.to_pickle(preprocessed_data_paths[1]) + # put everything together: + status=write_status('setting up snps...', 96, status) + snpsdf = DataFrame(index=metadf.index, data=snps, columns=mapnp[:,1]) + with open(preprocessed_data_paths[0], 'wb') as f: + pickle.dump(f, snpsdf, protocoll=-1) + status=write_status('setting up snps...', 98, status) + inandf = DataFrame(index=metadf.index, data=inan, columns=mapnp[:,1]) + inandf.to_pickle(preprocessed_data_paths[2]) + status=write_status('done :)', 100, status) + print '' + else: + print "loading snps..." + snpsdf = read_pickle(preprocessed_data_paths[0]) + print "loading metainfo..." + metadf = read_pickle(preprocessed_data_paths[1]) + print "loading nan entries..." + inandf = read_pickle(preprocessed_data_paths[2]) + snps = snpsdf.values + populations = metadf.population.values.astype('S3') + hapmap = dict(name=data_set, + description='The HapMap phase three SNP dataset - ' + '1184 samples out of 11 populations. inan is a ' + 'boolean array, containing wheather or not the ' + 'given entry is nan (nans are masked as ' + '-128 in snps).', + snpsdf=snpsdf, + metadf=metadf, + snps=snps, + inan=inandf.values, + inandf=inandf, + populations=populations) + return hapmap + def swiss_roll_1000(): return swiss_roll(num_samples=1000) diff --git a/GPy/util/datasets/data_resources_create.py b/GPy/util/datasets/data_resources_create.py index 8ae62a85..4e7c3524 100644 --- a/GPy/util/datasets/data_resources_create.py +++ b/GPy/util/datasets/data_resources_create.py @@ -24,12 +24,12 @@ data_resources = {'ankur_pose_data' : {'urls' : [neil_url + 'ankur_pose_data/'], 'license': None, 'size' : 1100584}, 'cmu_mocap_full' : {'urls' : ['http://mocap.cs.cmu.edu'], - 'files' : [['allasfamc.zip']], - 'citation' : """Please include this in your acknowledgements: The data used in this project was obtained from mocap.cs.cmu.edu. -The database was created with funding from NSF EIA-0196217.""", - 'details' : """CMU Motion Capture data base. Captured by a Vicon motion capture system consisting of 12 infrared MX-40 cameras, each of which is capable of recording at 120 Hz with images of 4 megapixel resolution. Motions are captured in a working volume of approximately 3m x 8m. The capture subject wears 41 markers and a stylish black garment.""", - 'license' : """From http://mocap.cs.cmu.edu. This data is free for use in research projects. You may include this data in commercially-sold products, but you may not resell this data directly, even in converted form. If you publish results obtained using this data, we would appreciate it if you would send the citation to your published paper to jkh+mocap@cs.cmu.edu, and also would add this text to your acknowledgments section: The data used in this project was obtained from mocap.cs.cmu.edu. The database was created with funding from NSF EIA-0196217.""", - 'size' : None}, + 'files' : [['allasfamc.zip']], + 'citation' : """Please include this in your acknowledgements: The data used in this project was obtained from mocap.cs.cmu.edu.' + 'The database was created with funding from NSF EIA-0196217.""", + 'details' : """CMU Motion Capture data base. Captured by a Vicon motion capture system consisting of 12 infrared MX-40 cameras, each of which is capable of recording at 120 Hz with images of 4 megapixel resolution. Motions are captured in a working volume of approximately 3m x 8m. The capture subject wears 41 markers and a stylish black garment.""", + 'license' : """From http://mocap.cs.cmu.edu. This data is free for use in research projects. You may include this data in commercially-sold products, but you may not resell this data directly, even in converted form. If you publish results obtained using this data, we would appreciate it if you would send the citation to your published paper to jkh+mocap@cs.cmu.edu, and also would add this text to your acknowledgments section: The data used in this project was obtained from mocap.cs.cmu.edu. The database was created with funding from NSF EIA-0196217.""", + 'size' : None}, 'creep_rupture' : {'urls' : ['http://www.msm.cam.ac.uk/map/data/tar/'], 'files' : [['creeprupt.tar']], 'citation' : 'Materials Algorithms Project Data Library: MAP_DATA_CREEP_RUPTURE. F. Brun and T. Yoshida.', @@ -120,8 +120,49 @@ The database was created with funding from NSF EIA-0196217.""", 'details' : """Accelerometer pen data used for robust regression by Tipping and Lawrence.""", 'citation' : 'Michael E. Tipping and Neil D. Lawrence. Variational inference for Student-t models: Robust Bayesian interpolation and generalised component analysis. Neurocomputing, 69:123--141, 2005', 'license' : None, - 'size' : 3410} + 'size' : 3410}, + 'hapmap3' : {'urls' : ['http://hapmap.ncbi.nlm.nih.gov/downloads/genotypes/latest_phaseIII_ncbi_b36/plink_format/'], + 'files' : [['hapmap3_r2_b36_fwd.consensus.qc.poly.map.bz2', 'hapmap3_r2_b36_fwd.consensus.qc.poly.ped.bz2', 'relationships_w_pops_121708.txt']], + 'details' : """ + HapMap Project: Single Nucleotide Polymorphism sequenced in all human populations. + The HapMap phase three SNP dataset - 1184 samples out of 11 populations. + See http://www.nature.com/nature/journal/v426/n6968/abs/nature02168.html for details. + + SNP_matrix (A) encoding [see Paschou et all. 2007 (PCA-Correlated SNPs...)]: + Let (B1,B2) be the alphabetically sorted bases, which occur in the j-th SNP, then + + / 1, iff SNPij==(B1,B1) + Aij = | 0, iff SNPij==(B1,B2) + \ -1, iff SNPij==(B2,B2) + + The SNP data and the meta information (such as iid, sex and phenotype) are + stored in the dataframe datadf, index is the Individual ID, + with following columns for metainfo: + + * family_id -> Family ID + * paternal_id -> Paternal ID + * maternal_id -> Maternal ID + * sex -> Sex (1=male; 2=female; other=unknown) + * phenotype -> Phenotype (-9, or 0 for unknown) + * population -> Population string (e.g. 'ASW' - 'YRI') + * rest are SNP rs (ids) + + More information is given in infodf: + + * Chromosome: + - autosomal chromosemes -> 1-22 + - X X chromosome -> 23 + - Y Y chromosome -> 24 + - XY Pseudo-autosomal region of X -> 25 + - MT Mitochondrial -> 26 + * Relative Positon (to Chromosome) [base pairs] + + """, + 'citation': """Gibbs, Richard A., et al. "The international HapMap project." Nature 426.6968 (2003): 789-796.""", + 'license' : """International HapMap Project Public Access License (http://hapmap.ncbi.nlm.nih.gov/cgi-perl/registration#licence)""", + 'size' : 2*1729092237 + 62265}, } -with open('data_resources.json', 'w') as file: - json.dump(data_resources, file) +with open('data_resources.json', 'w') as f: + print "writing data_resources" + json.dump(data_resources, f)