turicreate.label_propagation.LabelPropagationModel — Turi Create API 6.4.1 documentation (original) (raw)
A LabelPropagationModel computes the probability of each class label for each unlabeled vertex.
For each labeled vertices, the probability for class k is fixed to:
\[Pr_i(label=k) = I(label[i] == k)\]
where \(I()\) is the indicator function.
For all unlabeled vertices, the probability for each class k is computed from applying the following update iteratively:
\[ \begin{align}\begin{aligned}Pr_i(label=k) = Pr_i(label=k) * W_0 + \sum_{j\in N(i)} Pr_j(label=k) * W(j,i)\\Pr_i = Normalize(Pr_i)\end{aligned}\end{align} \]
where \(N(i)\) is the set containing all vertices \(j\) such that there is an edge going from \(j\) to \(i\). \(W(j,i)\) is the edge weight from \(j\) to \(i\), and \(W_0\) is the weight for self edge.
In the above equation, the first term is the probability of keeping the label from the previous iteration, and the second term is the probability of transition to a neighbor’s label.
Repeated edges (i.e., multiple edges where the source vertices are the same and the destination vertices are the same) are treated like normal edges in the above recursion.
By default, the label propagates from source to target. But if undirectedis set to true in turicreate.label_propagation.create(), then the label propagates in both directions for each edge.
Below is a list of queryable fields for this model:
Field | Description |
---|---|
labels | An SFrame with label probability for each vertex |
graph | A new SGraph with label probability as vertex properties |
delta | Average changes in label probability during the last iteration (avg. of the L2 norm of the changes) |
num_iterations | Number of iterations |
training_time | Total training time of the model |
threshold | The convergence threshold in average L2 norm |
self_weight | The weight for self edge |
weight_field | The edge weight field id |
label_field | The vertex label field id |
undirected | Treat edge as undirected |
This model cannot be constructed directly. Instead, useturicreate.label_propagation.create() to create an instance of this model. A detailed list of parameter options and code samples are available in the documentation for the create function.