<jupyter_start><jupyter_text>For the IMDB type of graph where a lot of relationships are among different entinties the motif representationwill be quite poor. Consider combining several relationtypes to get more interesting signals...<jupyter_code>folder='../../../PGD-orbit-master/'
etype='directed_by'
dataset='imdb'
stype='person'
dtype='movie'
# the row index corresponds to the original id and the value corresponds to the internal id used by nasreen
vertex_mapping_2_nasreens_ids=np.loadtxt(folder+"vertex_mapping.txt") 
mapping_from_nasreens_ids={i: vertex_mapping_2_nasreens_ids[i] for i in range(len(vertex_mapping_2_nasreens_ids))}
motif_per_node=np.loadtxt(folder+dataset+'_'+etype+"-node.txt",skiprows=1,delimiter=',')
motif_node_features=torch.zeros((motif_per_node.shape[0],motif_per_node.shape[1]-1))

if stype not in motif_features:
    motif_features[stype]={}
if dtype not in motif_features:
    motif_features[dtype]={}   
for i in range(motif_per_node.shape[0]):
    internal_id,ntype=mapping_dict[etype][int(mapping_from_nasreens_ids[i])]
    if internal_id in motif_features[ntype]:
        motif_features[ntype][internal_id]+=[torch.tensor(motif_per_node[int(mapping_from_nasreens_ids[i]),1:])]
    else:
        motif_features[ntype][internal_id]=[torch.tensor(motif_per_node[int(mapping_from_nasreens_ids[i]),1:])]

    
motif_features<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11798561151079137, 'fraction_numerical': 0.007194244604316547, 'mean_word_length': 7.533742331288344, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '554342', 'license': 'Apache-2.0', 'n_tokens_mistral': 487, 'n_tokens_neox': 479, 'n_words': 87, 'path': 'data_handler/motifs/hetero_graph_to_edge_list_per_rel_4_struct_embed.ipynb', 'repo_name': 'amazon-research/panrep', 'size': '1390'}