Skip to content

Datasets

datasets

Data loaders. The chapter 4 data set is shipped inside the package (qlpca/data).

data_dir

data_dir()

Folder that holds the data files.

Returns:

Type Description
Path

The folder given by the QLPCA_DATA environment variable if set, otherwise the package's own data folder.

load_st_gender

load_st_gender()

Science & Technology gender data, 15 EU countries (thesis chapter 4, Appendix A.1).

The file is shipped with the package and read with :mod:importlib.resources, so this works after pip install. Set the environment variable QLPCA_DATA to a folder containing st_gender_eu15.csv to read another copy. The data are not covered by the MIT licence of the code (see qlpca/data/README.md).

Returns:

Name Type Description
X ndarray of shape (15, 11)

The 11 indicators.

variables list of str

Variable names.

countries list of str

Country codes.

make_cylinder

make_cylinder(n=51, noise=0.0, random_state=None)

Simulated "cylinder problem" (thesis section 3.3).

Twelve variables derived from the height a and base area b of n cylinders, with a, b ~ U(0, 1) (stated in the MSc thesis, chapter 6). With noise, every variable is mapped to its linearising scale (log; log(tan) for the arctan variable and log(cot) for the arccot variable), normal noise with standard deviation noise times the sample standard deviation of the variable on that scale is added, and the result is mapped back (docs/SPEC.md sections 7 and 9).

Parameters:

Name Type Description Default
n int

Number of cylinders (thesis: 51).

51
noise float

0, 0.10 or 0.25 in the thesis.

0.0
random_state (None, int or Generator)

Seed.

None

Returns:

Name Type Description
X ndarray of shape (n, 12)

The simulated variables.

names list of str

Variable names.