<jupyter_start><jupyter_text>Some to learn Dirichlet distribution  Reading based on **torch_geometric.data**<jupyter_code># ! pip uninstall torch torch-scatter torch-sparse torch-cluster torch-spline-conv torch_geometric 
# ! pip3 install torch==1.11.0+cu113 torchvision==0.12.0+cu113 torchaudio===0.11.0+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
! pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.11.0+cu113.html
! pip install torch-sparse -f https://pytorch-geometric.com/whl/torch-1.11.0+cu113.html
! pip install torch-cluster -f https://pytorch-geometric.com/whl/torch-1.11.0+cu113.html
! pip install torch-spline-conv -f https://pytorch-geometric.com/whl/torch-1.11.0+cu113.html
! pip install torch_geometric 
import torch
from torch_geometric.data import Data
print(torch.__version__)
data = Data(
    x=torch.randn(5, 8, dtype=torch.float),
    edge_index=torch.tensor([[0, 1, 2, 2], [1, 2, 3, 4]], dtype=torch.float), 
    edge_attr=torch.randn(4, 3, dtype=torch.float), 
    y=[1, 0, 1, 0], 
    pos=None,
    is_edge_attr=True,
)
data.to_dict()
data.apply(torch.exp, "pos").to_dict()
data.has_isolated_nodes()
import networkx as nx
from torch_geometric.utils import to_networkx
G = to_networkx(data, to_undirected=False)
nx.draw(G, pos=nx.spiral_layout(G))<jupyter_output><empty_output><jupyter_text>- index_select: choose nodes- `TemporalData`: the shape of src, dst, t and the first dimension of :obj.msg should be the same (num_events).- raw_file_names and processed_file_names exist to ship the download or process  Further Reading based on **CREATING YOUR OWN DATASETS**- @property raw_file_names: list of file names- @property processed_file_names: return ['data.pt']- download: download_url(url, self.raw_dir)- process: pre_transform, pre_filter- Application of ImbalancedSampler: sampler in other loaders-  - transform  - pre_transform  - subgraph  - pin_memory, share_memory  Reading on **torch_geometric.loader**- Dataloader: mini-batch- Over-smoothing: GraphSAINT (node/edge/random walk), multi-dimensional random walk sampler- ClusterData/ClusterLoader: useful to construct some motifs?<jupyter_code>from torch_geometric.datasets import Planetoid
from torch_geometric.loader import NeighborLoader

data = Planetoid(root="./HWK3/dataset", name='Cora')[0]

loader = NeighborLoader(
    data,
    # Sample 5 neighbors for each node for 2 iterations
    num_neighbors=[5] * 2,
    # Use a batch size of 128 for sampling training nodes
    batch_size=16,
    input_nodes=data.train_mask,
)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11890007745933386, 'fraction_numerical': 0.030983733539891558, 'mean_word_length': 5.179425837320574, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '326199', 'license': 'MIT', 'n_tokens_mistral': 933, 'n_tokens_neox': 884, 'n_words': 217, 'path': 'GNN_PRP/prp_3_14/torch_geometric_learn.ipynb', 'repo_name': 'frankling2020/Self-learn-Repo', 'size': '2582'}