Skip to main content
Ctrl+K
IMDb-IR-System  documentation - Home IMDb-IR-System  documentation - Home

Contents:

  • Logic package
    • Logic.core package
      • Logic.core.classification package
      • Logic.core.clustering package
      • Logic.core.indexer package
      • Logic.core.link_analysis package
      • Logic.core.utility package
      • Logic.core.word_embedding package
  • UI package
  • .rst

Logic.core.link_analysis package

Contents

  • Logic.core.link_analysis.analyzer module
    • LinkAnalyzer
      • LinkAnalyzer.expand_graph()
      • LinkAnalyzer.hits()
      • LinkAnalyzer.initiate_params()
  • Logic.core.link_analysis.graph module
    • LinkGraph
      • LinkGraph.add_edge()
      • LinkGraph.add_node()
      • LinkGraph.get_predecessors()
      • LinkGraph.get_successors()

Logic.core.link_analysis package#

Logic.core.link_analysis.analyzer module#

class LinkAnalyzer(root_set)#

Bases: object

expand_graph(corpus)#

expand hubs, authorities and graph using given corpus

Parameters:

corpus (list) – A list of movie dictionaries with the following keys: “id”: A unique ID for the movie “stars”: A list of movie star names

Note

To build the base set, we need to add the hubs and authorities that are inside the corpus and refer to the nodes in the root set to the graph and to the list of hubs and authorities.

hits(num_iteration=5, max_result=10)#

Return the top movies and actors using the Hits algorithm

Parameters:
  • num_iteration (int) – Number of algorithm execution iterations

  • max_result (int) – The maximum number of results to return. If None, all results are returned.

Returns:

  • list – List of names of 10 actors with the most scores obtained by Hits algorithm in descending order

  • list – List of names of 10 movies with the most scores obtained by Hits algorithm in descending order

initiate_params()#

Initialize links graph, hubs list and authorities list based of root set

Parameters:

attributes (This function has no parameters. You can use self to get or change)

Logic.core.link_analysis.graph module#

class LinkGraph#

Bases: object

Use this class to implement the required graph in link analysis. You are free to modify this class according to your needs. You can add or remove methods from it.

add_edge(u_of_edge, v_of_edge)#
add_node(node_to_add)#
get_predecessors(node)#
get_successors(node)#

previous

Logic.core.indexer package

next

Logic.core.utility package

Contents
  • Logic.core.link_analysis.analyzer module
    • LinkAnalyzer
      • LinkAnalyzer.expand_graph()
      • LinkAnalyzer.hits()
      • LinkAnalyzer.initiate_params()
  • Logic.core.link_analysis.graph module
    • LinkGraph
      • LinkGraph.add_edge()
      • LinkGraph.add_node()
      • LinkGraph.get_predecessors()
      • LinkGraph.get_successors()

By AmirHossein Razlighi

© Copyright 2024, MIR Course team @ CE at Sharif University.