Create network links using explicit lists of target IDs, weights and other link attributes.
targets_in
column, and if an ID exists
also in the source
column, the corresponding rows will be connected, optionally with specified
attributes.
The targets_in
column may contain one target ID per row, or lists of target IDs. In either case,
any additional attribute columns should be of the same type. I.e. if each row specifies multiple links via
lists in targets_in
, then attribute columns should also contain lists of the same length, such that each
link can be assigned its corresponding attribute. If the lengths of lists containing target IDs and attributes
do not match, the attributes for links in that row will be missing. If attributes are single-valued (not
containing lists), all links specified in that row will have the same attribute value.
Note that the types of values in source
and link_targets
identifying the nodes/rows to be linked should also
match. Ideally, either both columns have numeric values or both have string-like (categorical) values. However, as
long as one can be converted safely to the other, linking will work as expected (e.g. source IDs could be specified
as numbers [0, 1, 2] and target IDs as strings [“3”, “2”, “1”] without the step failing).
The step will generate at least target and weight columns, as well as another column for each input. If link attribute
columns were passed, the weight_column
parameter should be used to identify the column containing link weights
(importances). If there is no such column, the parameter value should be null
, in which case an new weights column
will be generated automatically (see parameters below).
Examples
link_source
, to rows/nodes specified in the column link_targets
, which contains lists of such link targets.
Additionally, we use the columns link_weights
and links_are_reciprocal
(which contain lists of the same lengths as targets
), to add attributes to the created links (the weight of the link and whether it is unidirectional or bidirectional).ds.first_name
), datasets (ds
or ds[["first_name", "last_name"]]
) or models (referenced
by name e.g. "churn-clf"
).
Inputs
targets_in
column! E.g. if these are twitter handles,
then the targets must also be twitter handles.link_targets
if the
latter contains lists. If an attribute column has a single value per row, it is assumed that all targets in
that row have the same attribute value.Outputs
step(..., {"param": "value", ...}) -> (output)
.
Parameters
null
, an extra
output column will be created containing a weight of 1.0 for each link defined in
the target column (unless a weight_factor
is applied, in which case the weights
will have the corresponding value, see below).