getml.datasets
The datasets
module includes utilities to load datasets,
including methods to load and fetch popular reference datasets. It also
features some artificial data generators.
load_air_pollution
load_air_pollution(
roles: bool = True, as_pandas: bool = False
) -> DataFrameT
Regression dataset on air pollution in Beijing, China
The dataset consists of a single table split into train and test sets around 2014-01-01.
Reference
Liang, X., Zou, T., Guo, B., Li, S., Zhang, H., Zhang, S., Huang, H. and Chen, S. X. (2015). Assessing Beijing's PM2.5 pollution: severity, weather impact, APEC and winter heating. Proceedings of the Royal Society A, 471, 20150257.
PARAMETER | DESCRIPTION |
---|---|
as_pandas |
Return data as
TYPE:
|
roles |
Return data with roles set
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
DataFrameT
|
A DataFrame holding the data described above. The following DataFrames are returned:
|
Example
air_pollution = getml.datasets.load_air_pollution()
type(air_pollution)
getml.data.data_frame.DataFrame
Note
Roles can be set ad-hoc by supplying the respective flag. If
roles
is False
, all columns in the returned
DataFrame
have roles
unused_string
or
unused_float
. This dataset contains no units.
Before using them in an analysis, a data model needs to be constructed
using Placeholder
.
Source code in getml/datasets/base.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
|
load_atherosclerosis
load_atherosclerosis(
roles: bool = True,
as_pandas: bool = False,
as_dict: bool = False,
) -> Union[Tuple[DataFrameT, ...], Dict[str, DataFrameT]]
Binary classification dataset on the lethality of atherosclerosis
The atherosclerosis dataset is a medical dataset from the Relational Dataset Repository (former CTU Prague Relational Learning Repository) . It contains information from a longitudinal study on 1417 middle-aged men observed over the course of 20 years. After preprocessing, it consists of 2 tables with 76 and 66 columns:
-
population
: Data on the study's participants -
contr
: Data on control dates
The population table is split into a training (70%), a testing (15%) set and a validation (15%) set.
PARAMETER | DESCRIPTION |
---|---|
as_pandas |
Return data as
TYPE:
|
roles |
Return data with roles set
TYPE:
|
as_dict |
Return data as dict with
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Union[Tuple[DataFrameT, ...], Dict[str, DataFrameT]]
|
Tuple containing (sorted alphabetically by The following DataFrames are returned:
|
Example
population, contr = getml.datasets.load_atherosclerosis()
type(population)
getml.data.data_frame.DataFrame
Note
Roles can be set ad-hoc by supplying the respective flag. If
roles
is False
, all columns in the returned
DataFrame
have roles
unused_string
or
unused_float
. This dataset contains no units.
Before using them in an analysis, a data model needs to be constructed
using Placeholder
.
Source code in getml/datasets/base.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 |
|
load_biodegradability
load_biodegradability(
roles: bool = True,
as_pandas: bool = False,
as_dict: bool = False,
) -> Union[Tuple[DataFrameT, ...], Dict[str, DataFrameT]]
Regression dataset on molecule weight prediction
The QSAR biodegradation dataset was built in the Milano Chemometrics and QSAR Research Group (Universita degli Studi Milano-Bicocca, Milano, Italy). The data have been used to develop QSAR (Quantitative Structure Activity Relationships) models for the study of the relationships between chemical structure and biodegradation of molecules. Biodegradation experimental values of 1055 chemicals were collected from the webpage of the National Institute of Technology and Evaluation of Japan (NITE).
Reference
Mansouri, K., Ringsted, T., Ballabio, D., Todeschini, R., Consonni, V. (2013). Quantitative Structure - Activity Relationship models for ready biodegradability of chemicals. Journal of Chemical Information and Modeling, 53, 867-878
The dataset was collected through the Relational Dataset Repository (former CTU Prague Relational Learning Repository)
It contains information on 1309 molecules with 6166 bonds. It consists of 5 tables.
The population table is split into a training (50 %) and a testing (25%) and validation (25%) sets.
PARAMETER | DESCRIPTION |
---|---|
as_pandas |
Return data as
TYPE:
|
roles |
Return data with roles set
TYPE:
|
as_dict |
Return data as dict with
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Union[Tuple[DataFrameT, ...], Dict[str, DataFrameT]]
|
Tuple containing (sorted alphabetically by The following DataFrames are returned:
|
Example
biodegradability = getml.datasets.load_biodegradability(as_dict=True)
type(biodegradability["molecule_train"])
getml.data.data_frame.DataFrame
Note
Roles can be set ad-hoc by supplying the respective flag. If
roles
is False
, all columns in the returned
DataFrame
have roles
unused_string
or
unused_float
. This dataset contains no units.
Before using them in an analysis, a data model needs to be constructed
using Placeholder
.
Source code in getml/datasets/base.py
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 |
|
load_consumer_expenditures
load_consumer_expenditures(
roles: bool = True,
units: bool = True,
as_pandas: bool = False,
as_dict: bool = False,
) -> Union[Tuple[DataFrameT, ...], Dict[str, DataFrameT]]
Binary classification dataset on consumer expenditures
The Consumer Expenditure Data Set is a public domain data set provided by the American Bureau of Labor Statistics. It includes the diary entries, where American consumers are asked to keep record of the products they have purchased each month.
We use this dataset to classify whether an item was purchased as a gift or not.
PARAMETER | DESCRIPTION |
---|---|
roles |
Return data with roles set
TYPE:
|
units |
Return data with units set
TYPE:
|
as_pandas |
Return data as
TYPE:
|
as_dict |
Return data as dict with
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Union[Tuple[DataFrameT, ...], Dict[str, DataFrameT]]
|
Tuple containing (sorted alphabetically by The following DataFrames are returned:
|
Example
ce = getml.datasets.load_consumer_expenditures(as_dict=True)
type(ce["expd"])
getml.data.data_frame.DataFrame
Note
Roles and units can be set ad-hoc by supplying the respective flag. If
roles
is False
, all columns in the returned
DataFrame
have roles
unused_string
or
unused_float
.
Before using them in an analysis, a data model needs to be constructed
using Placeholder
.
Source code in getml/datasets/base.py
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 |
|
load_interstate94
load_interstate94(
roles: bool = True,
units: bool = True,
as_pandas: bool = False,
) -> DataFrameT
Regression dataset on traffic volume prediction
The interstate94 dataset is a multivariate time series containing the hourly traffic volume on I-94 westbound from Minneapolis-St Paul. It is based on data provided by the MN Department of Transportation. Some additional data preparation done by John Hogue. The dataset features some particular interesting characteristics common for time series, which classical models may struggle to appropriately deal with. Such characteristics are:
- High frequency (hourly)
- Dependence on irregular events (holidays)
- Strong and overlapping cycles (daily, weekly)
- Anomalies
- Multiple seasonalities
PARAMETER | DESCRIPTION |
---|---|
roles |
Return data with roles set
TYPE:
|
units |
Return data with units set
TYPE:
|
as_pandas |
Return data as
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
DataFrameT
|
A DataFrame holding the data described above. The following DataFrames are returned:
|
Example
traffic = getml.datasets.load_interstate94()
type(traffic)
getml.data.data_frame.DataFrame
Note
Roles and units can be set ad-hoc by supplying the respective flags. If
roles
is False
, all columns in the returned
DataFrame
have roles
unused_string
or
unused_float
. Before using them in an
analysis, a data model needs to be constructed using
Placeholder
.
Source code in getml/datasets/base.py
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 |
|
load_loans
load_loans(
roles: bool = True,
units: bool = True,
as_pandas: bool = False,
as_dict: bool = False,
) -> Union[Tuple[DataFrameT, ...], Dict[str, DataFrameT]]
Binary classification dataset on loan default
The loans dataset is based on a financial dataset from the Relational Dataset Repository (former CTU Prague Relational Learning Repository).
Reference
Berka, Petr (1999). Workshop notes on Discovery Challenge PKDD'99.
The dataset contains information on 606 successful and 76 unsuccessful loans. After some preprocessing it contains 5 tables
-
account
: Information about the borrower(s) of a given loan. -
loan
: Information about the loans themselves, such as the date of creation, the amount, and the planned duration of the loan. The target variable is the status of the loan (default/no default) -
meta
: Meta information about the obligor, such as gender and geo-information -
order
: Information about permanent orders, debited payments and account balances. -
trans
: Information about transactions and accounts balances.
The population table is split into a training and a testing set at 80% of the main population.
PARAMETER | DESCRIPTION |
---|---|
roles |
Return data with roles set
TYPE:
|
units |
Return data with units set
TYPE:
|
as_pandas |
Return data as
TYPE:
|
as_dict |
Return data as dict with
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Union[Tuple[DataFrameT, ...], Dict[str, DataFrameT]]
|
Tuple containing (sorted alphabetically by The following DataFrames are returned:
|
Example
loans = getml.datasets.load_loans(as_dict=True)
type(loans["population_train"])
getml.data.data_frame.DataFrame
Note
Roles and units can be set ad-hoc by supplying the respective flags. If
roles
is False
, all columns in the returned
DataFrame
have roles
unused_string
or
unused_float
. Before using them in an
analysis, a data model needs to be constructed using
Placeholder
.
Source code in getml/datasets/base.py
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 |
|
load_occupancy
load_occupancy(
roles: bool = True,
as_pandas: bool = False,
as_dict: bool = False,
) -> Union[Tuple[DataFrameT, ...], Dict[str, DataFrameT]]
Binary classification dataset on occupancy detection
The occupancy detection dataset is a very simple multivariate time series from the UCI Machine Learning Repository . It is a binary classification problem. The task is to predict room occupancy from Temperature, Humidity, Light and CO2.
Reference
Candanedo, L. M., & Feldheim, V. (2016). Accurate occupancy detection of an office room from light, temperature, humidity and CO2 measurements using statistical learning models. Energy and Buildings, 112, 28-39.
PARAMETER | DESCRIPTION |
---|---|
roles |
Return data with roles set
TYPE:
|
as_pandas |
Return data as
TYPE:
|
as_dict |
Return data as dict with
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Union[Tuple[DataFrameT, ...], Dict[str, DataFrameT]]
|
Tuple containing (sorted alphabetically by The following DataFrames are returned:
|
Example
population_train, population_test, _ = getml.datasets.load_occupancy()
type(occupancy_train)
getml.data.data_frame.DataFrame
Note
Roles can be set ad-hoc by supplying the respective flag. If
roles
is False
, all columns in the returned
DataFrame
have roles
unused_string
or
unused_float
. This dataset contains no units.
Before using them in an analysis, a data model needs to be constructed
using Placeholder
.
Source code in getml/datasets/base.py
620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 |
|
make_categorical
make_categorical(
n_rows_population: int = 500,
n_rows_peripheral: int = 125000,
random_state: Optional[int] = None,
population_name: str = "",
peripheral_name: str = "",
aggregation: str = aggregations.COUNT,
) -> Tuple[DataFrame, DataFrame]
Generate a random dataset with categorical variables
The dataset consists of a population table and one peripheral table.
The peripheral table has 3 columns:
column_01
: random categorical variable between '0' and '9'join_key
: random integer in the range from 0 ton_rows_population
time_stamp
: random number between 0 and 1
The population table has 4 columns:
column_01
: random categorical variable between '0' and '9'join_key
: unique integer in the range from 0 ton_rows_population
time_stamp
: random number between 0 and 1targets
: target variable. Defined as the number of matching entries in the peripheral table for whichtime_stamp_peripheral < time_stamp_population
and the category in the peripheral table is not 1, 2 or 9. The SQL definition of the target variable read like this
SELECT aggregation( column_01 )
FROM POPULATION_TABLE t1
LEFT JOIN PERIPHERAL_TABLE t2
ON t1.join_key = t2.join_key
WHERE (
( t2.column_01 != '1' AND t2.column_01 != '2' AND t2.column_01 != '9' )
) AND t2.time_stamps <= t1.time_stamps
GROUP BY t1.join_key,
t1.time_stamp;
PARAMETER | DESCRIPTION |
---|---|
n_rows_population |
Number of rows in the population table.
TYPE:
|
n_rows_peripheral |
Number of rows in the peripheral table.
TYPE:
|
random_state |
Seed to initialize the random number generator used for
the dataset creation. If set to None, the seed will be the
'microsecond' component of
|
population_name |
Name assigned to the
TYPE:
|
peripheral_name |
Name assigned to the
TYPE:
|
aggregation |
|
RETURNS | DESCRIPTION |
---|---|
Tuple[DataFrame, DataFrame]
|
Source code in getml/datasets/samples_generator.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
|
make_discrete
make_discrete(
n_rows_population: int = 500,
n_rows_peripheral: int = 125000,
random_state: Optional[int] = None,
population_name: str = "",
peripheral_name: str = "",
aggregation: str = aggregations.COUNT,
) -> Tuple[DataFrame, DataFrame]
Generate a random dataset with categorical variables
The dataset consists of a population table and one peripheral table.
The peripheral table has 3 columns:
column_01
: random integer between -10 and 10join_key
: random integer in the range from 0 ton_rows_population
time_stamp
: random number between 0 and 1
The population table has 4 columns:
column_01
: random number between -1 and 1join_key
: unique integer in the range from 0 ton_rows_population
time_stamp
: random number between 0 and 1targets
: target variable. Defined as the minimum value greater than 0 in the peripheral table for whichtime_stamp_peripheral < time_stamp_population
and the join key matchesSELECT aggregation( column_01 ) FROM POPULATION t1 LEFT JOIN PERIPHERAL t2 ON t1.join_key = t2.join_key WHERE ( ( t2.column_01 > 0 ) ) AND t2.time_stamp <= t1.time_stamp GROUP BY t1.join_key, t1.time_stamp;
PARAMETER | DESCRIPTION |
---|---|
n_rows_population |
Number of rows in the population table.
TYPE:
|
n_rows_peripheral |
Number of rows in the peripheral table.
TYPE:
|
random_state |
Seed to initialize the random number generator used for
the dataset creation. If set to None, the seed will be the
'microsecond' component of
|
population_name |
Name assigned to the
TYPE:
|
peripheral_name |
Name assigned to the
TYPE:
|
aggregation |
aggregations used to generate the 'target' column. |
RETURNS | DESCRIPTION |
---|---|
Tuple[DataFrame, DataFrame]
|
Source code in getml/datasets/samples_generator.py
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 |
|
make_numerical
make_numerical(
n_rows_population: int = 500,
n_rows_peripheral: int = 125000,
random_state: Optional[int] = None,
population_name: str = "",
peripheral_name: str = "",
aggregation: str = aggregations.COUNT,
) -> Tuple[DataFrame, DataFrame]
Generate a random dataset with continuous numerical variables
The dataset consists of a population table and one peripheral table.
The peripheral table has 3 columns:
column_01
: random number between -1 and 1join_key
: random integer in the range from 0 ton_rows_population
time_stamp
: random number between 0 and 1
The population table has 4 columns:
column_01
: random number between -1 and 1join_key
: unique integer in the range from 0 ton_rows_population
time_stamp
: random number between 0 and 1targets
: target variable. Defined as the number of matching entries in the peripheral table for whichtime_stamp_peripheral < time_stamp_population < time_stamp_peripheral + 0.5
SELECT aggregation( column_01 )
FROM POPULATION t1
LEFT JOIN PERIPHERAL t2
ON t1.join_key = t2.join_key
WHERE (
( t1.time_stamp - t2.time_stamp <= 0.5 )
) AND t2.time_stamp <= t1.time_stamp
GROUP BY t1.join_key,
t1.time_stamp;
PARAMETER | DESCRIPTION |
---|---|
n_rows_population |
Number of rows in the population table.
TYPE:
|
n_rows_peripheral |
Number of rows in the peripheral table.
TYPE:
|
random_state |
Seed to initialize the random number generator used for
the dataset creation. If set to None, the seed will be the
'microsecond' component of
|
population_name |
Name assigned to the
TYPE:
|
peripheral_name |
Name assigned to the
TYPE:
|
aggregation |
aggregations used to generate the 'target' column. |
RETURNS | DESCRIPTION |
---|---|
Tuple[DataFrame, DataFrame]
|
Source code in getml/datasets/samples_generator.py
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 |
|
make_same_units_categorical
make_same_units_categorical(
n_rows_population: int = 500,
n_rows_peripheral: int = 125000,
random_state: Optional[int] = None,
population_name: str = "",
peripheral_name: str = "",
aggregation: str = aggregations.COUNT,
) -> Tuple[DataFrame, DataFrame]
Generate a random dataset with categorical variables
The dataset consists of a population table and one peripheral table.
The peripheral table has 3 columns:
column_01
: random categorical variable between '0' and '9'join_key
: random integer in the range from 0 ton_rows_population
time_stamp
: random number between 0 and 1
The population table has 4 columns:
column_01
: random categorical variable between '0' and '9'join_key
: unique integer in the range from 0 ton_rows_population
time_stamp
: random number between 0 and 1targets
: target variable. Defined as the number of matching entries in the peripheral table for whichtime_stamp_peripheral < time_stamp_population
and the category in the peripheral table is not 1, 2 or 9
SELECT aggregation( column_02 )
FROM POPULATION_TABLE t1
LEFT JOIN PERIPHERAL_TABLE t2
ON t1.join_key = t2.join_key
WHERE (
( t1.column_01 == t2.column_01 )
) AND t2.time_stamps <= t1.time_stamps
GROUP BY t1.join_key,
t1.time_stamp;
PARAMETER | DESCRIPTION |
---|---|
n_rows_population |
Number of rows in the population table.
TYPE:
|
n_rows_peripheral |
Number of rows in the peripheral table.
TYPE:
|
random_state |
Seed to initialize the random number generator used for
the dataset creation. If set to None, the seed will be the
'microsecond' component of
|
population_name |
Name assigned to the
TYPE:
|
peripheral_name |
Name assigned to the
TYPE:
|
aggregation |
aggregations used to generate the 'target' column. |
RETURNS | DESCRIPTION |
---|---|
Tuple[DataFrame, DataFrame]
|
Source code in getml/datasets/samples_generator.py
589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 |
|
make_same_units_numerical
make_same_units_numerical(
n_rows_population: int = 500,
n_rows_peripheral: int = 125000,
random_state: Optional[int] = None,
population_name: str = "",
peripheral_name: str = "",
aggregation: str = aggregations.COUNT,
) -> Tuple[DataFrame, DataFrame]
Generate a random dataset with continuous numerical variables
The dataset consists of a population table and one peripheral table.
The peripheral table has 3 columns:
column_01
: random number between -1 and 1join_key
: random integer in the range from 0 ton_rows_population
time_stamp
: random number between 0 and 1
The population table has 4 columns:
column_01
: random number between -1 and 1join_key
: unique integer in the range from 0 ton_rows_population
time_stamp
: random number between 0 and 1targets
: target variable. Defined as the number of matching entries in the peripheral table for whichtime_stamp_peripheral < time_stamp_population < time_stamp_peripheral + 0.5
SELECT aggregation( column_01 )
FROM POPULATION t1
LEFT JOIN PERIPHERAL t2
ON t1.join_key = t2.join_key
WHERE (
( t1.column_01 - t2.column_01 <= 0.5 )
) AND t2.time_stamp <= t1.time_stamp
GROUP BY t1.join_key,
t1.time_stamp;
PARAMETER | DESCRIPTION |
---|---|
n_rows_population |
Number of rows in the population table.
TYPE:
|
n_rows_peripheral |
Number of rows in the peripheral table.
TYPE:
|
random_state |
Seed to initialize the random number generator used for
the dataset creation. If set to None, the seed will be the
'microsecond' component of
|
population_name |
Name assigned to the
TYPE:
|
peripheral_name |
Name assigned to
TYPE:
|
aggregation |
aggregations used to generate the 'target' column. |
RETURNS | DESCRIPTION |
---|---|
Tuple[DataFrame, DataFrame]
|
Source code in getml/datasets/samples_generator.py
787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 |
|
make_snowflake
make_snowflake(
n_rows_population: int = 500,
n_rows_peripheral1: int = 5000,
n_rows_peripheral2: int = 125000,
random_state: Optional[int] = None,
population_name: str = "",
peripheral_name1: str = "",
peripheral_name2: str = "",
aggregation1: str = aggregations.SUM,
aggregation2: str = aggregations.COUNT,
) -> Tuple[DataFrame, DataFrame, DataFrame]
Generate a random dataset with continuous numerical variables
The dataset consists of a population table and two peripheral tables.
The first peripheral table has 4 columns:
column_01
: random number between -1 and 1join_key
: random integer in the range from 0 ton_rows_population
join_key2
: unique integer in the range from 0 ton_rows_peripheral1
time_stamp
: random number between 0 and 1
The second peripheral table has 3 columns:
column_01
: random number between -1 and 1join_key2
: random integer in the range from 0 ton_rows_peripheral1
time_stamp
: random number between 0 and 1
The population table has 4 columns:
column_01
: random number between -1 and 1join_key
: unique integer in the range from 0 ton_rows_population
time_stamp
: random number between 0 and 1targets
: target variable as defined by the SQL block below:
SELECT aggregation1( feature_1_1 )
FROM POPULATION t1
LEFT JOIN (
SELECT aggregation2( t4.column_01 ) AS feature_1_1
FROM PERIPHERAL t3
LEFT JOIN PERIPHERAL2 t4
ON t3.join_key2 = t4.join_key2
WHERE (
( t3.time_stamp - t4.time_stamp <= 0.5 )
) AND t4.time_stamp <= t3.time_stamp
GROUP BY t3.join_key,
t3.time_stamp
) t2
ON t1.join_key = t2.join_key
WHERE t2.time_stamp <= t1.time_stamp
GROUP BY t1.join_key,
t1.time_stamp;
PARAMETER | DESCRIPTION |
---|---|
n_rows_population |
Number of rows in the population table.
TYPE:
|
n_rows_peripheral1 |
Number of rows in the first peripheral table.
TYPE:
|
n_rows_peripheral2 |
Number of rows in the second peripheral table.
TYPE:
|
random_state |
Seed to initialize the random number generator used for
the dataset creation. If set to None, the seed will be the
'microsecond' component of
|
population_name |
Name assigned to the
TYPE:
|
peripheral_name1 |
Name assigned to the
TYPE:
|
peripheral_name2 |
Name assigned to the
TYPE:
|
aggregation1 |
aggregations used to generate the 'target' column in the first peripheral table. |
aggregation2 |
aggregations used to generate the 'target' column in the second peripheral table. |
RETURNS | DESCRIPTION |
---|---|
Tuple[DataFrame, DataFrame, DataFrame]
|
Source code in getml/datasets/samples_generator.py
979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 |
|