-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Saving Model and Predicting classes #38
Comments
After training, in this line, you can add a |
Thanks, How do I predict the label of a new graph, after loading the saved model? |
You can use loop_dataset(): Line 223 in 50f5041
|
Loss, accuracy and logits are generated inside the loop_dataset() function. Where are the predicted values? |
Line 151 in 50f5041
|
Thanks, those are when classifier.regression is True (line 150). |
Line 154 in 50f5041
logits |
After I save the model, where is the second line of code above executed? I am running the shell script, and once training is complete, the program terminates. |
How are you running this program? Are you running it in the terminal or in a python console? Right now, I have been running it in a linux terminal, and it saves the model, then the program terminates. How do I get the variables out after running a shell script? |
I use the linux terminal. After saving the model, you need to rerun the script. In the script, you need to write a "if else" to skip the training part and directly load the saved model for prediction. You may refer to this code for how to implement it. |
How to output the probability that each subgraph is 0 or 1, such as (P(g=0), P(g=1)), if I input 50 subgraphs, how can I output the probability label of 50*2 and the final label? |
The output prediction result of each subgraph should be a 2-dimensional tuple. I want to get the normalized probability. If take exponential of the logits to get the predicted probabilities for being class 1, then how to use the softmax function to get the probability value between 0 and 1. For example, |
Ok.Thanks. |
This is what I have for the main file:
Be advised, I am an engineer inexperienced in computer science. Did I implement the code correctly to make predictions at the bottom? Also, in the util file I added the first line in the argparse: `cmd_opt.add_argument('-predict', action='store_true', default=False, help='...') Please help! Thanks. |
Didn't check completely but it seems basically correct. You don't need the following lines:
And you need to make sure your loaded model name 'data/my_data2.pth' is the same as your saved model name 'saved_model/test2.bin'. |
Thanks so much in advance for your help, I'm very new to this. So when I run
|
Ok, so is it another data set in the same format as the training I did.
Would the prediction data be:
|
The label cannot be missing. You can use a dummy label 0 for all test graphs. For your case, use I think reading the code more carefully can help understand its different functions better. |
In the |
|
|
Did anyone find a solution to this issue? I am also interested in outputting the predicted labels. |
When I try to run the code without test graphs I get this error: Has someone successfully saved the model to predict new values? Thak you for your help. |
Then a workaround would be appending a dummy test graph to the |
@andreitam11 Did you modify the saved file name in |
I cannot retrain the model. Even if I modify the name in |
I read the file in terminal as a text file and it is correct, but when I run it it does not ready the correct information.
|
@andreitam11 Seems that when you modify the file, you modify |
I only converted it to a .txt to see if it was reading it and to echo it in the terminal, but I run the |
I cannot guess what happened but there might be something wrong with your implementation of the |
|
Hello, I finally made it work, and I also changed the util.py to print out the label dictionary. What I needed to do was to erase the Here are the modifications main.py
util.py
|
Hello, I would like to ask whether the model you proposed is competent to predict the classification of the missing graph by training the labeled graph when some graph labels are missing. |
@xianggai Yes. This is exactly the graph classification setting which DGCNN is proposed to address. |
How can I save the model trained? What line of code needs to be modified?
Moreover, how can I load the saved model in order to predict the label of a new NetworkX graph?
The text was updated successfully, but these errors were encountered: