tfidf¶
¶
find_similarities(tfidf_matrix, index, top_n=5)
¶
Use to find similarities.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tfidf_matrix |
List |
Tf-idf-weighted document-term matrix. |
required |
index |
int |
Dish id from dataset. |
required |
top_n |
int |
Max recommendation count, max value 30. |
5 |
Returns:
Type | Description |
---|---|
dict |
indice, similarity value (dictionary): Indice, similarity value. |
Source code in koolsla/tfidf.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|
train_engine(plots)
¶
Train engine from dish names.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
plots |
List |
List of dish names. |
required |
Returns:
Type | Description |
---|---|
tfidf_matrix (sparse matrix, [n_samples, n_features]) |
Tf-idf-weighted document-term matrix. |
Source code in koolsla/tfidf.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|