Turi Create  4.0
pagerank.hpp
1 /* Copyright © 2017 Apple Inc. All rights reserved.
2  *
3  * Use of this source code is governed by a BSD-3-clause license that can
4  * be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
5  */
6 #include <model_server/lib/toolkit_function_specification.hpp>
7 #ifndef TURI_UNITY_PAGERANK
8 #define TURI_UNITY_PAGERANK
9 
10 namespace turi {
11 namespace pagerank {
12 
13 /**
14  * Obtains the registration for the PageRank Toolkit.
15  *
16  * Performs the following iterative pagerank computation:
17  * \f[
18  * PR_i = r + (1.0 - r) \times \sum_{j\in\textrm{InNbrs}_i} \frac{PR_j}{\textrm{OutNbrs}_j}
19  * \f]
20  *
21  * Note that this implements the 'unnormalized' pagerank value.
22  *
23  * <b> Toolkit Name: pagerank </b>
24  *
25  * Accepted Parameters:
26  * \li \b threshold (flexible_type: float). The termination threshold. PageRank
27  * values which change by less than this threshold will request neighbor
28  * recomputation. Defaults to 1E-2. Must be > 0.
29  *
30  * \li \b random_jump_prob (flexible_type: float). The random jump probability.
31  * Defaults to 0.15. Must be > 0 and < 1. Corresponds to r in the formula above.
32  *
33  * Returned Parameters:
34  * \li \b training_time (flexible_type: float). The training time of the algorithm in seconds
35  * excluding all other preprocessing stages.
36  *
37  * \li \b total_pagerank (flexible_type: float). The sum of all the pagerank
38  * values on all vertices.
39  *
40  * \li \b delta (flexible_type: float). The absolute sum of all last changes
41  * made to each vertex.
42  *
43  * \li \b __graph__ (unity_graph). The graph object with the fields "pagerank"
44  * and "delta" on each vertex. The "pagerank" field (float) contains the
45  * pagerank of the vertex, and the "delta" field (float) contains the last
46  * change performed to the vertex's pagerank value.
47  */
48 std::vector<toolkit_function_specification> get_toolkit_function_registration();
49 
50 } // namespace pagerank
51 } // namespace turi
52 #endif