Graph Algorithms
Graph Algorithms
WIP: These classes are currently actively being developed and are subject to change in both API and functionality over time.
- TBD: TBD
Graph Algorithms
Docs TBD
ProximityGraph
Build a proximity graph of the nearest neighbors based on feature space.
Source code in src/workbench/algorithms/graph/light/proximity_graph.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
|
__init__(n_neighbors=5)
Initialize the ProximityGraph with the specified parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n_neighbors
|
int
|
Number of neighbors to consider (default: 5) |
5
|
Source code in src/workbench/algorithms/graph/light/proximity_graph.py
build_graph(df, features, id_column, target, store_features=True)
Processes the input DataFrame and builds a proximity graph.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df
|
DataFrame
|
The input DataFrame containing feature columns. |
required |
features
|
list
|
List of feature column names to be used for building the proximity graph. |
required |
id_column
|
str
|
Name of the ID column in the DataFrame. |
required |
target
|
str
|
Name of the target column in the DataFrame. |
required |
store_features
|
bool
|
Whether to store the features as node attributes (default: True). |
True
|
Returns:
Type | Description |
---|---|
Graph
|
nx.Graph: The proximity graph as a NetworkX graph. |
Source code in src/workbench/algorithms/graph/light/proximity_graph.py
get_neighborhood(node_id, radius=1)
Get a subgraph containing nodes within a given number of hops around a specific node.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
Union[str, int]
|
The ID of the node to center the neighborhood around. |
required |
radius
|
int
|
The number of hops to consider around the node (default: 1). |
1
|
Returns:
Type | Description |
---|---|
Graph
|
nx.Graph: A subgraph containing the specified neighborhood. |
Source code in src/workbench/algorithms/graph/light/proximity_graph.py
Questions?
The SuperCowPowers team is happy to answer any questions you may have about AWS and Workbench. Please contact us at workbench@supercowpowers.com or on chat us up on Discord