LDA
LDA
Source code in engines/contentFilterEngine/probabilistic_statistical_methods/lda.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
|
__init__(n_components=10, max_iter=10)
Initialize the LDA model with the specified number of topics.
Parameters: - n_components (int): Number of topics. - max_iter (int): Maximum number of iterations for the EM algorithm.
Source code in engines/contentFilterEngine/probabilistic_statistical_methods/lda.py
11 12 13 14 15 16 17 18 19 20 21 |
|
fit(documents)
Fit the LDA model on the provided documents.
Parameters: - documents (List[str]): List of documents to train the model.
Source code in engines/contentFilterEngine/probabilistic_statistical_methods/lda.py
23 24 25 26 27 28 29 30 31 32 33 |
|
recommend(query, top_n=10)
Recommend items based on the similarity of the query to the topics.
Parameters: - query (str): The query text for which to generate recommendations. - top_n (int): Number of top recommendations to return.
Returns: - List[int]: List of recommended item indices.
Source code in engines/contentFilterEngine/probabilistic_statistical_methods/lda.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
|
transform(documents)
Transform documents into the LDA topic space.
Parameters: - documents (List[str]): List of documents to transform.
Returns: - Transformed document matrix in topic space.
Source code in engines/contentFilterEngine/probabilistic_statistical_methods/lda.py
35 36 37 38 39 40 41 42 43 44 45 46 47 |
|