|
263 | 263 | }
|
264 | 264 | ],
|
265 | 265 | "source": [
|
266 |
| - "dataset = CSVDataset(filename=filepath1)\n", |
| 266 | + "dataset = CSVDataset(src=filepath1)\n", |
267 | 267 | "# construct pandas table to show the data, `CSVDataset` inherits from PyTorch Dataset\n",
|
268 | 268 | "print(pd.DataFrame(dataset.data))"
|
269 | 269 | ]
|
|
308 | 308 | }
|
309 | 309 | ],
|
310 | 310 | "source": [
|
311 |
| - "dataset = CSVDataset([filepath1, filepath2, filepath3], on=\"subject_id\")\n", |
| 311 | + "dataset = CSVDataset(src=[filepath1, filepath2, filepath3], on=\"subject_id\")\n", |
312 | 312 | "# construct pandas table to show the joined data of 3 tables\n",
|
313 | 313 | "print(pd.DataFrame(dataset.data))"
|
314 | 314 | ]
|
|
339 | 339 | ],
|
340 | 340 | "source": [
|
341 | 341 | "dataset = CSVDataset(\n",
|
342 |
| - " filename=[filepath1, filepath2, filepath3],\n", |
| 342 | + " src=[filepath1, filepath2, filepath3],\n", |
343 | 343 | " row_indices=[[0, 2], 3], # load row: 0, 1, 3\n",
|
344 | 344 | " col_names=[\"subject_id\", \"label\", \"ehr_1\", \"ehr_7\", \"meta_1\"],\n",
|
345 | 345 | ")\n",
|
|
396 | 396 | ],
|
397 | 397 | "source": [
|
398 | 398 | "dataset = CSVDataset(\n",
|
399 |
| - " filename=[filepath1, filepath2, filepath3],\n", |
| 399 | + " src=[filepath1, filepath2, filepath3],\n", |
400 | 400 | " col_names=[\"subject_id\", \"image\", *[f\"ehr_{i}\" for i in range(11)], \"meta_0\", \"meta_1\", \"meta_2\"],\n",
|
401 | 401 | " col_groups={\"ehr\": [f\"ehr_{i}\" for i in range(11)], \"meta\": [\"meta_0\", \"meta_1\", \"meta_2\"]},\n",
|
402 | 402 | ")\n",
|
|
433 | 433 | ],
|
434 | 434 | "source": [
|
435 | 435 | "dataset = CSVDataset(\n",
|
436 |
| - " filename=[filepath1, filepath2, filepath3],\n", |
| 436 | + " src=[filepath1, filepath2, filepath3],\n", |
437 | 437 | " col_names=[\"subject_id\", \"label\", \"ehr_0\", \"ehr_1\", \"ehr_9\", \"meta_1\"],\n",
|
438 | 438 | " col_types={\"label\": {\"default\": \"No label\"}, \"ehr_1\": {\"type\": int, \"default\": 0}},\n",
|
439 | 439 | " how=\"outer\", # will load the NaN values in this merge mode\n",
|
|
481 | 481 | ],
|
482 | 482 | "source": [
|
483 | 483 | "dataset = CSVDataset(\n",
|
484 |
| - " filename=[filepath1, filepath2, filepath3],\n", |
| 484 | + " src=[filepath1, filepath2, filepath3],\n", |
485 | 485 | " col_groups={\"ehr\": [f\"ehr_{i}\" for i in range(5)]},\n",
|
486 | 486 | " transform=Compose([LoadImaged(keys=\"image\"), ToNumpyd(keys=\"ehr\")]),\n",
|
487 | 487 | ")\n",
|
|
527 | 527 | }
|
528 | 528 | ],
|
529 | 529 | "source": [
|
530 |
| - "dataset = CSVIterableDataset(filename=[filepath1, filepath2, filepath3], shuffle=False)\n", |
| 530 | + "dataset = CSVIterableDataset(src=[filepath1, filepath2, filepath3], shuffle=False)\n", |
531 | 531 | "# set num workers = 0 for mac / win\n",
|
532 | 532 | "num_workers = 2 if sys.platform == \"linux\" else 0\n",
|
533 | 533 | "dataloader = DataLoader(dataset=dataset, num_workers=num_workers, batch_size=2)\n",
|
|
546 | 546 | },
|
547 | 547 | {
|
548 | 548 | "cell_type": "code",
|
549 |
| - "execution_count": 15, |
| 549 | + "execution_count": 13, |
550 | 550 | "metadata": {},
|
551 | 551 | "outputs": [
|
552 | 552 | {
|
|
563 | 563 | "dataset = CSVIterableDataset(\n",
|
564 | 564 | " chunksize=2,\n",
|
565 | 565 | " buffer_size=4,\n",
|
566 |
| - " filename=[filepath1, filepath2, filepath3],\n", |
| 566 | + " src=[filepath1, filepath2, filepath3],\n", |
567 | 567 | " col_names=[\"subject_id\", \"label\", \"ehr_1\", \"ehr_7\", \"meta_1\"],\n",
|
568 | 568 | " transform=ToNumpyd(keys=\"ehr_1\"),\n",
|
569 | 569 | " shuffle=True,\n",
|
|
0 commit comments