How-to articleMethodology & analyticsComputer science

How to source and build datasets for a machine learning PhD: discovery, labelling, augmentation, synthetic data and licensing

A machine learning thesis is only as credible as its data. This guide shows how to find, extend, generate and label datasets, and how to handle licensing, consent, bias and documentation so that examiners can trust your results.

What you will learn

  • Distinguish data discovery, data augmentation and data generation as routes to a training dataset
  • Choose between public benchmarks, new collection, crowdsourced labelling and synthetic data for your research question
  • Check licences, copyright exceptions, consent and data protection before using a dataset
  • Prevent leakage and other data errors that invalidate machine learning results
  • Document a dataset with a datasheet so that others can judge and reuse it

What you will unlearn

  • A dataset that is publicly downloadable is free to use for any purpose.Public availability is not permission: the licence, terms of service and data protection law decide what you may do.
  • Data augmentation means adding more external data.The term covers two different things, enriching data with external sources and creating transformed copies of existing examples, and you should say which you mean.
  • More data always improves a model.Biased, mislabelled, duplicated or leaked data can make a larger dataset worse than a smaller, cleaner one.
  • Synthetic data removes all privacy and validity concerns.Synthetic data inherit the patterns, and sometimes the records, of the data they were generated from, and must be validated against real data.

Skills you will practise

  • Dataset discovery
  • Labelling design
  • Augmentation and synthetic data
  • Licensing and data protection checks
  • Leakage prevention
  • Dataset documentation

Why data decisions shape a machine learning thesis

Machine learning research learns from data, so the dataset is part of the method rather than a resource you pick up at the end. Whether your thesis develops new algorithms, studies the foundations of learning or applies models to a domain such as health, finance or security, examiners will ask where the data came from, who labelled them, whether they represent the problem and whether you were allowed to use them.

Machine learning data are often unstructured (images, text, audio, network traffic) rather than structured tables, and many projects need labels that no existing source provides. This is why data collection for machine learning has become a research field in its own right. Roh et al. (2021) reviewed it from the perspective of both data management and machine learning and grouped the options into three activities: acquiring data, labelling them and improving the data or models you already have.

Three routes to acquiring data

The acquisition part of the framework by Roh et al. (2021) is a useful checklist when you plan a project.

Data acquisition routes for machine learning, after the taxonomy of Roh et al. (2021)
RouteWhat it involvesTypical doctoral use
Data discovery: sharingPublishing and indexing datasets so others can find them (repositories, collaborative platforms)Depositing your own dataset at the end of the PhD
Data discovery: searchingFinding existing datasets in repositories, data lakes and the webStarting from a recognised benchmark so results are comparable
Data augmentation (enrichment)Adding attributes or records from external sources, for example by data integration or entity augmentationLinking sensor data with weather records, or text with metadata
Data generation: crowdsourcingCollecting or labelling examples through many human contributorsCreating labels for a new task when no labelled data exist
Data generation: synthetic dataProducing artificial examples from simulators, generative models or rulesRare events, privacy-restricted settings, stress-testing models

Most theses combine routes. A common pattern is to train and compare on a public benchmark, then test the best approach on a smaller dataset you collect or label yourself, which shows that the method works beyond the benchmark. For the general logic of primary and secondary data, see how to collect data for your PhD thesis.

Finding and judging existing datasets

Before collecting anything, search for datasets that already address your task. Benchmarks make your results comparable with published work, but they are not neutral. Ask who collected the data, when, from which population and for what purpose. In security, for example, widely used intrusion detection datasets differ greatly in realism and age, and models tuned to one often fail on real traffic (Sommer & Paxson, 2010; Arp et al., 2022).

  • Fit. Does the dataset contain the inputs, outputs and conditions your research question needs?
  • Provenance. Is the collection process described, and is there a datasheet or paper that explains it (Gebru et al., 2021)?
  • Quality. Are there duplicates, label errors, missing values or class imbalance you will need to handle?
  • Representativeness. Which groups, settings or time periods are missing, and how will that limit your claims?
  • Permission. What does the licence allow, and does the dataset contain personal data?

Datasets of uncertain or illicit origin, such as leaked databases, raise separate ethical questions even when they are easy to obtain, and research ethics committees will expect you to justify their use (Thomas et al., 2017).

Augmentation, synthetic data and labelling

Keep the two meanings apart in your thesis. Enrichment adds information from other sources. Transformation augmentation creates modified copies of existing training examples, such as cropped, flipped or colour-shifted images, to make a model robust to variation; Krizhevsky et al. (2012) used image translations, reflections and colour changes in this way to reduce overfitting. Transformations must preserve the label: flipping a handwritten "6" can turn it into a "9".

Synthetic data are useful when real data are scarce, sensitive or dangerous to collect, but a model trained only on synthetic data may learn the simulator rather than the world. Report how the generator was built and evaluate final models on real data. Synthetic data generated from personal records can still reveal information about individuals, so they do not automatically fall outside data protection rules.

Labelling is often the most expensive step. Write a labelling guide with definitions and borderline examples, pilot it, measure agreement between labellers and resolve disagreements by a documented rule. If you use crowdworkers, report how they were recruited, paid and checked. A small, carefully labelled test set is worth more than a large one with unknown error.

Licensing, consent and data protection

Check permission before you download, scrape or share. Open datasets carry licences that may forbid commercial use or redistribution, and websites have terms of service. In the UK, a copyright exception allows text and data analysis of lawfully accessed works for non-commercial research (Copyright, Designs and Patents Act 1988), but it does not override data protection law or contracts you have signed, and other countries have different rules.

If your data contain information about identifiable people, you need a lawful basis, ethics approval and a data management plan covering minimisation, pseudonymisation, storage and retention. In the European Union, the Artificial Intelligence Act, adopted in 2024, sets data governance requirements for training, validation and testing data used in high-risk AI systems, including attention to relevance, representativeness and possible bias (European Parliament & Council of the European Union, 2024). A doctoral prototype may not be in scope, but the same questions are a good standard for any thesis. Plan to make data findable, accessible, interoperable and reusable where you can (Wilkinson et al., 2016), and explain any restrictions.

Protecting validity: leakage, bias and poisoning

Data problems are a leading cause of machine learning results that do not hold up. Kapoor and Narayanan (2023) found data leakage, where information from the test set reaches training, across many fields that use machine learning, producing over-optimistic results. Typical causes are random splits of data that should be split by time, patient or user; duplicates across splits; and preprocessing fitted on the whole dataset.

A review of COVID-19 imaging models by Roberts et al. (2021) found that problems with data sources, such as mixing images from different populations so that a model could learn where an image came from rather than the disease, made many published models unsuitable for clinical use. Web-scale data bring a further risk: Carlini et al. (2024) showed that attackers can poison widely used web-crawled datasets at low cost, so record exactly which snapshot you used and check integrity where possible.

Worked example (illustrative)

A hypothetical PhD aims to detect plant diseases from leaf photographs taken by farmers on smartphones. The researcher starts from a public leaf-image benchmark (data discovery) and notes that its photographs were taken against plain backgrounds, unlike field images. She therefore collects 2,000 field photographs with farmers' consent, removes location metadata, and writes a labelling guide that two plant pathologists apply independently, with agreement reported and disagreements resolved by discussion. Transformation augmentation (rotation, brightness, blur) is applied to training images only. The test set is split by farm, not by image, to avoid leakage (Kapoor & Narayanan, 2023). Synthetic images of a rare disease are used to explore class imbalance, but all reported results come from real field images. The thesis appendix contains a datasheet (Gebru et al., 2021) and the code and split files needed to reproduce the results (Pineau et al., 2021).

What to report about your data

Data reporting checklist for a machine learning thesis
ElementWhat to state
Source and versionRepository, snapshot date or version, and the licence or terms of use
CollectionWho collected the data, how, when and from whom; consent and ethics approval
LabelsLabelling guide, who labelled, agreement statistics and how disagreements were resolved
Augmentation and synthesisWhich meaning of augmentation; transformations used; generator for synthetic data
SplitsHow training, validation and test sets were formed and why this prevents leakage
LimitationsGroups, settings or periods not represented, and known label noise or imbalance
AvailabilityWhere data, code and documentation can be accessed, or why access is restricted

Common mistakes

  • Treating a downloadable dataset as free to use without reading its licence.
  • Using the word augmentation without saying whether data were enriched or transformed.
  • Splitting data randomly when related records belong together, which leaks information into the test set.
  • Reporting results only on synthetic data or only on an old benchmark.
  • Leaving labelling undocumented, so that examiners cannot judge label quality.
  • Collecting personal data before ethics approval and a data management plan are in place.

For related reading, see the PhD data analytics guide, programming for AI research and ethics and security in machine learning research.

Key takeaways

Your next step

Want to apply this to your own study?

  1. 1Tell us your topic, data and deadline
  2. 2A subject mentor reviews your work with you
  3. 3You get a plan and a quote
Primary data collection

References

  1. Arp, D., Quiring, E., Pendlebury, F., Warnecke, A., Pierazzi, F., Wressnegger, C., Cavallaro, L., & Rieck, K. (2022). Dos and don'ts of machine learning in computer security. In Proceedings of the 31st USENIX Security Symposium (pp. 3971–3988). USENIX Association. https://www.usenix.org/conference/usenixsecurity22/presentation/arp
  2. Carlini, N., Jagielski, M., Choquette-Choo, C. A., Paleka, D., Pearce, W., Anderson, H. S., Terzis, A., Thomas, K., & Tramèr, F. (2024). Poisoning web-scale training datasets is practical. In 2024 IEEE Symposium on Security and Privacy (pp. 407–425). IEEE. https://doi.org/10.1109/SP54263.2024.00179
  3. Copyright, Designs and Patents Act 1988, c. 48, s. 29A (UK). https://www.legislation.gov.uk/ukpga/1988/48/section/29A
  4. European Parliament & Council of the European Union. (2024). Regulation (EU) 2024/1689 of 13 June 2024 laying down harmonised rules on artificial intelligence (Artificial Intelligence Act). Official Journal of the European Union, L 2024/1689. https://eur-lex.europa.eu/eli/reg/2024/1689/oj/eng
  5. Gebru, T., Morgenstern, J., Vecchione, B., Vaughan, J. W., Wallach, H., Daumé III, H., & Crawford, K. (2021). Datasheets for datasets. Communications of the ACM, 64(12), 86–92. https://doi.org/10.1145/3458723
  6. Kapoor, S., & Narayanan, A. (2023). Leakage and the reproducibility crisis in machine-learning-based science. Patterns, 4(9), 100804. https://doi.org/10.1016/j.patter.2023.100804
  7. Krizhevsky, A., Sutskever, I., & Hinton, G. E. (2012). ImageNet classification with deep convolutional neural networks. In F. Pereira, C. J. C. Burges, L. Bottou, & K. Q. Weinberger (Eds.), Advances in neural information processing systems (Vol. 25, pp. 1097–1105). Curran Associates. https://proceedings.neurips.cc/paper/4824
  8. Pineau, J., Vincent-Lamarre, P., Sinha, K., Larivière, V., Beygelzimer, A., d'Alché-Buc, F., Fox, E., & Larochelle, H. (2021). Improving reproducibility in machine learning research (a report from the NeurIPS 2019 reproducibility program). Journal of Machine Learning Research, 22(164), 1–20. https://www.jmlr.org/papers/v22/20-303.html
  9. Roberts, M., Driggs, D., Thorpe, M., Gilbey, J., Yeung, M., Ursprung, S., Aviles-Rivero, A. I., Etmann, C., McCague, C., Beer, L., . . . Schönlieb, C.-B. (2021). Common pitfalls and recommendations for using machine learning to detect and prognosticate for COVID-19 using chest radiographs and CT scans. Nature Machine Intelligence, 3, 199–217. https://doi.org/10.1038/s42256-021-00307-0
  10. Roh, Y., Heo, G., & Whang, S. E. (2021). A survey on data collection for machine learning: A big data–AI integration perspective. IEEE Transactions on Knowledge and Data Engineering, 33(4), 1328–1347. https://doi.org/10.1109/TKDE.2019.2946162
  11. Sommer, R., & Paxson, V. (2010). Outside the closed world: On using machine learning for network intrusion detection. In 2010 IEEE Symposium on Security and Privacy (pp. 305–316). IEEE. https://www.icsi.berkeley.edu/icsi/publication_details?n=2818
  12. Thomas, D. R., Pastrana, S., Hutchings, A., Clayton, R., & Beresford, A. R. (2017). Ethical issues in research using datasets of illicit origin. In Proceedings of the 2017 Internet Measurement Conference (IMC '17). ACM. https://doi.org/10.1145/3131365.3131389
  13. Wilkinson, M. D., Dumontier, M., Aalbersberg, I. J., Appleton, G., Axton, M., Baak, A., Blomberg, N., Boiten, J.-W., da Silva Santos, L. B., Bourne, P. E., Bouwman, J., Brookes, A. J., Clark, T., Crosas, M., Dillo, I., Dumon, O., Edmunds, S., Evelo, C. T., Finkers, R., . . . Mons, B. (2016). The FAIR guiding principles for scientific data management and stewardship. Scientific Data, 3, Article 160018. https://doi.org/10.1038/sdata.2016.18

How to cite this article

Choose your referencing style, then copy. Check your university's or journal's guide for local variations.

PhD Research Lab Academy. (2021, May 14). How to source and build datasets for a machine learning PhD: discovery, labelling, augmentation, synthetic data and licensing. PhD Research Lab. https://www.phdassistance.com/blog/what-data-needs-to-be-collected-for-a-phd-in-machine-learning/

PhD Research Lab Academy. “How to Source and Build Datasets for a Machine Learning PhD: Discovery, Labelling, Augmentation, Synthetic Data and Licensing.” PhD Research Lab, 14 May 2021, www.phdassistance.com/blog/what-data-needs-to-be-collected-for-a-phd-in-machine-learning. Accessed [access date].

PhD Research Lab Academy (2021) How to source and build datasets for a machine learning PhD: discovery, labelling, augmentation, synthetic data and licensing. PhD Research Lab. Available at: https://www.phdassistance.com/blog/what-data-needs-to-be-collected-for-a-phd-in-machine-learning/ (Accessed: [access date]).

PhD Research Lab Academy. “How to Source and Build Datasets for a Machine Learning PhD: Discovery, Labelling, Augmentation, Synthetic Data and Licensing.” PhD Research Lab. May 14, 2021. https://www.phdassistance.com/blog/what-data-needs-to-be-collected-for-a-phd-in-machine-learning.

PhD Research Lab Academy, ‘How to Source and Build Datasets for a Machine Learning PhD: Discovery, Labelling, Augmentation, Synthetic Data and Licensing’ (PhD Research Lab, 14 May 2021) <https://www.phdassistance.com/blog/what-data-needs-to-be-collected-for-a-phd-in-machine-learning> accessed [access date].

PhD Research Lab Academy. How to source and build datasets for a machine learning PhD: discovery, labelling, augmentation, synthetic data and licensing [Internet]. PhD Research Lab; 2021 May 14 [cited [access date]]. Available from: https://www.phdassistance.com/blog/what-data-needs-to-be-collected-for-a-phd-in-machine-learning/

PhD Research Lab Academy, “How to source and build datasets for a machine learning PhD: discovery, labelling, augmentation, synthetic data and licensing,” PhD Research Lab, May 14, 2021. [Online]. Available: https://www.phdassistance.com/blog/what-data-needs-to-be-collected-for-a-phd-in-machine-learning. [Accessed: [access date]].

@online{what_data_needs_to_be_collected_for_a_phd_in_machine_learning_2021,
  author = {{PhD Research Lab Academy}},
  title = {{How to source and build datasets for a machine learning PhD: discovery, labelling, augmentation, synthetic data and licensing}},
  organization = {PhD Research Lab},
  date = {2021-05-14},
  url = {https://www.phdassistance.com/blog/what-data-needs-to-be-collected-for-a-phd-in-machine-learning},
  urldate = {[access date]}
}

This article is for learning. Use it to understand the method and cite the original sources above in your own work; do not copy or submit it as your own.

How to source and build datasets for a machine learning PhDNeed help applying it to your study?
Primary data collection