sfa.control.influence module¶
-
sfa.control.influence.
arrange_si
(df_splo, df_inf, output, min_splo=None, max_splo=None, thr_inf=1e-10, ascending=True)[source]¶
-
sfa.control.influence.
compute_influence
(W, alpha=0.9, beta=0.1, S=None, rtype='df', outputs=None, n2i=None, max_iter=1000, tol=1e-07, get_iter=False, device='cpu', sparse=False)[source]¶ - Compute the influence.
It estimates the effects of a node to the other nodes, by calculating partial derivative with respect to source nodes, based on a simple iterative method.
Based on the below difference equation,
x(t+1) = alpha*W.dot(x(t)) + (1-alpha)*b
The influence matrix, S, is computed using chain rule of partial derivative as follows.
- begin{align}
- S_{ij} &= frac{partial{x_i}}{partial{x_j}} \
&= (I + alpha W + alpha^2 W^2 + … + alpha^{infty}W^{infty})_{ij} \ &approx (I + alpha W + alpha^2 W^2 + … + alpha^{l}W^{l})_{ij} \
end{align}
This is the summation of the weight multiplications along all paths including cycles. $S_{ij}$ denotes the influence of node (j) on node (i).
An iterative method for an approximated solution is as follows.
S(t+1) = alpha WS(t) + I,
where $S(0) = beta I$ and $S(1) = beta(I + alpha W)$ $(t>1)$.
The iteration continues until $||S(t+1) - S(t)|| leq tol$.
- Parameters
- Wnumpy.ndarray
Weight matrix.
- alphafloat, optional
Hyperparameter for adjusting the effect of signal flow.
- betafloat, optional
Hyperparameter for adjusting the effect of basal activity.
- Snumpy.ndarray, optional
Initial influence matrix.
- rtype: str (optional)
Return object type: ‘df’ or ‘array’.
- outputs: list (or iterable) of str, optional
Names of output nodes, which is necessary for ‘df’ rtype.
- n2i: dict, optional
Name to index dict, which is necessary for ‘df’ rtype.
- max_iterint, optional
The maximum iteration number for the estimation.
- tolfloat, optional
Tolerance for terminating the iteration.
- get_iterbool, optional
Determine whether the actual iteration number is returned.
- devicestr, optional, {‘CPU’, ‘GPU:0’, ‘GPU:1’, …}
Select which device to use. ‘CPU’ is default.
- sparsebool, optional
Use sparse matrices for the computation.
- Returns
- Snumpy.ndarray, optional
2D array of influence.
- dfpd.DataFrame, optional
Influences for each output in DataFrame.
- num_iterint, optional
The actual number of iteration.
-
sfa.control.influence.
prioritize
(df_splo, df_inf, output, dac, thr_rank=3, min_group_size=0, min_splo=None, max_splo=None, thr_inf=1e-10)[source]¶ Prioritize target candiates.
- Parameters
- df_splopandas.DataFrame
Dataframe for SPLO information.
- df_infpandas.DataFrame
Dataframe for influence information.
- outputstr
Names of output node, which is necessary for ‘df_inf’.
- dacint
Direction of activity change (DAC) of the output.
- thr_rankint or float
Rank to filter out the entities. The entities whose ranks are greater than thr_rank survive.
- min_group_sizeint
Minimum group size to be satisfied.