Skip to content

Clarity regarding OpTC.ipynb #4

@amaana259

Description

@amaana259

I am trying to train the model from scratch and see what the results are, but I am having difficulty understanding what file 'Train File' refers to here, for the file_path.

from sklearn.utils import class_weight
if gnnTrain or create_store:

    file_path = 'Enter Path to Train File Here'

    nodes,labels,edges,mapp,lbl,nemap = load_data(file_path)

    l = np.array(labels)
    class_weights = class_weight.compute_class_weight(class_weight = "balanced",classes = np.unique(l),y = l)
    class_weights = torch.tensor(class_weights,dtype=torch.float).to(device)
    criterion = CrossEntropyLoss(weight=class_weights,reduction='mean')

    graph = Data(x=torch.tensor(nodes,dtype=torch.float).to(device),y=torch.tensor(labels,dtype=torch.long).to(device), edge_index=torch.tensor(edges,dtype=torch.long).to(device))

Additionally, I noticed that the code to train a Word2vec model from scratch has been provided but it is never used in the code. Could you please explain how I can fix these two issues, so I can produce results from scratch?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions