TillRS / SUN_TopicModel

Python implementation of the SUN Topic Model.
0 stars 0 forks source link

Update Code Documentation #2

Open yoonspark opened 6 days ago

yoonspark commented 6 days ago

Despite serving as the entry point for the user, the suntopic class is relatively under-documented, lacking parameter descriptions. Add detailed parameter descriptions in docstrings, which will then appear as helpful tooltips in IDEs and interactive computing sessions.

I recommend the NumPy style (examples here), which is already used in the parent classes (e.g., SNMF). For better type inference by linters and other tools, I also recommend adding type hints to the function signatures.

For instance, suntopic.__init__()'s docstring can be updated as follows:

    def __init__(self, Y: np.ndarray, X: np.ndarray, alpha: float, num_bases: int, random_state: int = None):
        """
        Initialize the Suntopic class.

        Parameters
        ----------
        X : np.ndarray
            Input data array of shape (n, d) where `n` is the number of samples and 
            `d` is the dimension of each data sample.
        Y : np.ndarray
            Response variable array of shape (n,) where `n` is the number of samples.
        alpha : float
            Specifies the weight of the response variable. Must be a float in the range (0, 1).
        num_bases : int
            Specifies the number of topics to model.
        random_state : int
            Seed for the random number generator, to ensure reproducibility.
        """