Graph Filtering
GraphFiltering
GraphFiltering Class
This class implements graph-based filtering techniques for recommendation systems. Graph-based filtering leverages the structure of a graph to make recommendations by analyzing the relationships between users and items.
Attributes:
Name | Type | Description |
---|---|---|
graph |
Graph
|
The graph structure representing users and items. |
similarity_metric |
str
|
The metric used to calculate similarity between nodes. |
damping_factor |
float
|
The damping factor used in algorithms like PageRank. |
max_iterations |
int
|
Maximum number of iterations for convergence in iterative algorithms. |
Methods:
Name | Description |
---|---|
build_graph |
Constructs the graph from the given data, where nodes represent users and items, and edges represent interactions or similarities. |
compute_similarity |
Computes similarity scores between nodes using the specified similarity metric. |
recommend |
Generates top-N recommendations for a given user by analyzing the graph structure. |
update_graph |
Updates the graph with new interactions or changes in the data, allowing for dynamic recommendations. |
Source code in engines/contentFilterEngine/graph_based_algorithms/graph_filtering.py
8 9 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 |
|
generate_graph(num_people, file_path='graph_dataset.csv', seed=None)
Generate a random graph and save it to a file.
Source code in engines/contentFilterEngine/graph_based_algorithms/graph_filtering.py
40 41 42 43 44 45 |
|
generate_large_graph(num_people, file_path='large_random_graph.csv', seed=None)
Generate a large random graph using multiprocessing.
Source code in engines/contentFilterEngine/graph_based_algorithms/graph_filtering.py
47 48 49 50 51 52 |
|
scale_and_save(input_file, output_dir, num_matrices)
Scale and save matrices to the specified directory.
Source code in engines/contentFilterEngine/graph_based_algorithms/graph_filtering.py
54 55 56 57 58 |
|