Plots¶
            tinytopics.plot
¶
    
            plot_loss(losses, figsize=(10, 8), dpi=300, title='Loss curve', color_palette=None, output_file=None)
¶
    Plot the loss curve over training epochs.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                losses
             | 
            
                  Sequence[float]
             | 
            
               List of loss values for each epoch.  | 
            required | 
                figsize
             | 
            
                  tuple[int, int]
             | 
            
               Plot size.  | 
            
                  (10, 8)
             | 
          
                dpi
             | 
            
                  int
             | 
            
               Plot resolution.  | 
            
                  300
             | 
          
                title
             | 
            
                  str
             | 
            
               Plot title.  | 
            
                  'Loss curve'
             | 
          
                color_palette
             | 
            
                  Sequence[str] | str | None
             | 
            
               Custom color palette.  | 
            
                  None
             | 
          
                output_file
             | 
            
                  str | None
             | 
            
               File path to save the plot. If None, displays the plot.  | 
            
                  None
             | 
          
            plot_structure(L_matrix, normalize_rows=False, figsize=(12, 6), dpi=300, title='Structure Plot', color_palette=None, output_file=None)
¶
    Structure plot for visualizing document-topic distributions.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                L_matrix
             | 
            
                  ndarray
             | 
            
               Document-topic distribution matrix.  | 
            required | 
                normalize_rows
             | 
            
                  bool
             | 
            
               If True, normalizes each row of L_matrix to sum to 1.  | 
            
                  False
             | 
          
                figsize
             | 
            
                  tuple[int, int]
             | 
            
               Plot size.  | 
            
                  (12, 6)
             | 
          
                dpi
             | 
            
                  int
             | 
            
               Plot resolution.  | 
            
                  300
             | 
          
                title
             | 
            
                  str
             | 
            
               Plot title.  | 
            
                  'Structure Plot'
             | 
          
                color_palette
             | 
            
                  Sequence[str] | str | None
             | 
            
               Custom color palette.  | 
            
                  None
             | 
          
                output_file
             | 
            
                  str | None
             | 
            
               File path to save the plot. If None, displays the plot.  | 
            
                  None
             | 
          
            plot_top_terms(F_matrix, n_top_terms=10, term_names=None, figsize=(10, 8), dpi=300, title='Top Terms', color_palette=None, nrows=None, ncols=None, output_file=None)
¶
    Plot top terms for each topic in horizontal bar charts.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                F_matrix
             | 
            
                  ndarray
             | 
            
               Topic-term distribution matrix.  | 
            required | 
                n_top_terms
             | 
            
                  int
             | 
            
               Number of top terms to display per topic.  | 
            
                  10
             | 
          
                term_names
             | 
            
                  Sequence[str] | None
             | 
            
               List of term names corresponding to indices.  | 
            
                  None
             | 
          
                figsize
             | 
            
                  tuple[int, int]
             | 
            
               Plot size.  | 
            
                  (10, 8)
             | 
          
                dpi
             | 
            
                  int
             | 
            
               Plot resolution.  | 
            
                  300
             | 
          
                title
             | 
            
                  str
             | 
            
               Plot title.  | 
            
                  'Top Terms'
             | 
          
                color_palette
             | 
            
                  Sequence[str] | str | None
             | 
            
               Custom color palette.  | 
            
                  None
             | 
          
                nrows
             | 
            
                  int | None
             | 
            
               Number of rows in the subplot grid.  | 
            
                  None
             | 
          
                ncols
             | 
            
                  int | None
             | 
            
               Number of columns in the subplot grid.  | 
            
                  None
             | 
          
                output_file
             | 
            
                  str | None
             | 
            
               File path to save the plot. If None, displays the plot.  | 
            
                  None
             |