Skip to main content
For each row this step iterates over the lists of IDs in one or more target columns, and if a ID exists also in the source column, the corresponding rows will be connected. Note that while this step allows multiple input columns to be used as link targets, it does not allow for the specification of link weights. See the step link_rows for creating weighted networks. All link weights will be set to 1.0 by default. But see the weight_factor param to specify another constant instead.

Usage

The following example shows how the step can be used in a recipe.

Examples

  • Example 1
  • Signature
Given a dataset ds, where each row is associated with a twitter user (identified by column account_id), the following line connects each of these users with other users specified in columns reply_ids and mention_ids.
link_rows_by_id(ds.account_id, ds.reply_ids, ds.mention_ids) -> (ds.targets, ds.weights)

Inputs & Outputs

The following are the inputs expected by the step and the outputs it produces. These are generally columns (ds.first_name), datasets (ds or ds[["first_name", "last_name"]]) or models (referenced by name e.g. "churn-clf").
source_id
column[number|category]
required
A column of IDs corresponding to the nodes/rows acting as the source of a link.
*target_ids
column[number|category|list[number]|list[category]]
One or more columns of IDs (can be lists) corresponding to the target of a link.
targets
column
required
A column containing for each item a list of row numbers identfying all other items it will be linked to.
weights
column
required
A column containing for each item a list of weights identfying the “importance” of each link to other items identified in the targets column (counting how many times a consecutive pair of items was found together in the sequences).

Configuration

The following parameters can be used to configure the behaviour of the step by including them in a json object as the last “input” to the step, i.e. step(..., {"param": "value", ...}) -> (output).

Parameters

weight_factor
number
default:"1.0"
Multiply link weights by this number.
I