Skip to content

Commit 29b13cf

Browse files
committed
add docstring example for ImputerDiffusion
1 parent e6a5f5a commit 29b13cf

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

qolmat/imputations/imputers_pytorch.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,21 @@ def __init__(
568568
freq_str : str
569569
Frequency string of DateOffset of Pandas.
570570
It is for processing time-series data, used in diffusion models e.g., TsDDPM.
571+
572+
Examples
573+
--------
574+
>>> import numpy as np
575+
>>> from qolmat.imputations.imputers_pytorch import ImputerDiffusion
576+
>>> from qolmat.imputations.diffusions.ddpms import TabDDPM
577+
>>>
578+
>>> X = np.array([[1, 1, 1, 1], [np.nan, np.nan, 3, 2], [1, 2, 2, 1], [2, 2, 2, 2]])
579+
>>> imputer = ImputerDiffusion(model=TabDDPM(random_state=11), epochs=50, batch_size=1)
580+
>>>
581+
>>> imputer.fit_transform(X)
582+
array([[1. , 1. , 1. , 1. ],
583+
[1.39418268, 2. , 3. , 2. ],
584+
[1. , 2. , 2. , 1. ],
585+
[2. , 2. , 2. , 2. ]])
571586
"""
572587
super().__init__(groups=groups, columnwise=False)
573588
self.model = model

0 commit comments

Comments
 (0)