Class NodeClassificationTask<T>
- Namespace
- AiDotNet.Data.Structures
- Assembly
- AiDotNet.dll
Represents a node classification task where the goal is to predict labels for individual nodes.
public class NodeClassificationTask<T>
Type Parameters
TThe numeric type used for calculations, typically float or double.
- Inheritance
-
NodeClassificationTask<T>
- Inherited Members
Remarks
Node classification is a fundamental graph learning task where each node in a graph has a label, and the goal is to predict labels for unlabeled nodes based on: - Node features - Graph structure (connections between nodes) - Labels of neighboring nodes
For Beginners: Node classification is like categorizing people in a social network.
Real-world examples:
Social Networks:
- Nodes: Users
- Task: Predict user interests/communities
- How: Use profile features + friend connections
- Example: "Is this user interested in sports?"
Citation Networks:
- Nodes: Research papers
- Task: Classify paper topics
- How: Use paper abstracts + citation links
- Example: Papers citing each other often share topics
Fraud Detection:
- Nodes: Financial accounts
- Task: Detect fraudulent accounts
- How: Use transaction patterns + account relationships
- Example: Fraudsters often form connected clusters
Key Insight: Node classification leverages the graph structure. Connected nodes often share similar properties (homophily), so a node's neighbors provide valuable information for prediction.
Properties
Graph
The graph data containing nodes, edges, and features.
public GraphData<T> Graph { get; set; }
Property Value
- GraphData<T>
Remarks
This is the complete graph structure. In semi-supervised node classification, some nodes have known labels (training set) and others don't (test set).
IsMultiLabel
Whether this is a multi-label classification task.
public bool IsMultiLabel { get; set; }
Property Value
Remarks
- False: Each node has exactly one label (e.g., paper topic)
- True: Each node can have multiple labels (e.g., user interests)
Labels
Node labels for all nodes in the graph. Shape: [num_nodes] for single-label or [num_nodes, num_classes] for multi-label.
public Tensor<T> Labels { get; set; }
Property Value
- Tensor<T>
Remarks
In semi-supervised settings, labels for test nodes are only used for evaluation, not during training.
NumClasses
Number of classes in the classification task.
public int NumClasses { get; set; }
Property Value
TestIndices
Indices of nodes to use for testing.
public int[] TestIndices { get; set; }
Property Value
- int[]
TrainIndices
Indices of nodes to use for training.
public int[] TrainIndices { get; set; }
Property Value
- int[]
Remarks
For Beginners: In semi-supervised node classification, we typically have: - Small set of labeled nodes for training (5-20% of nodes) - Larger set of unlabeled nodes for testing
This split simulates real-world scenarios where getting labels is expensive. For example, manually labeling research papers by topic requires expert knowledge.
ValIndices
Indices of nodes to use for validation.
public int[] ValIndices { get; set; }
Property Value
- int[]