We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
首先非常感谢贵校提供的代码,我在看这段的时候有点疑问,不知道是不是代码逻辑问题呢🙋
def process_raw_pred(raw_question_matrix, raw_pred, num_questions: int) -> tuple: questions = torch.nonzero(raw_question_matrix)[1:, 1] % num_questions ##torch.nonzero(raw_question_matrix)[1:, 1]表示raw_question_matrix中非0的位置,即用户的有效回答 length = questions.shape[0] pred = raw_pred[: length] pred = pred.gather(1, questions.view(-1, 1)).flatten() truth = torch.nonzero(raw_question_matrix)[1:, 1] // num_questions #truth表示真实作答情况,0表示回答正确,1表示回答错误,与原始数据相反? # truth = 1 - truth#这里逻辑是不是写错了!! 0表示回答正确,1表示回答错误,与原始数据相反?
return pred, truth
关键在这里➡️ truth = torch.nonzero(raw_question_matrix)[1:, 1] // num_questions 比如one -hot encode后 125错了 numofq=100 那就是encode_q[125]=1 ,但是还原时候,125//100 =1 ,这代表的是回答正确呀?
希望您的解答,谢谢
The text was updated successfully, but these errors were encountered:
No branches or pull requests
首先非常感谢贵校提供的代码,我在看这段的时候有点疑问,不知道是不是代码逻辑问题呢🙋
def process_raw_pred(raw_question_matrix, raw_pred, num_questions: int) -> tuple:
questions = torch.nonzero(raw_question_matrix)[1:, 1] % num_questions ##torch.nonzero(raw_question_matrix)[1:, 1]表示raw_question_matrix中非0的位置,即用户的有效回答
length = questions.shape[0]
pred = raw_pred[: length]
pred = pred.gather(1, questions.view(-1, 1)).flatten()
truth = torch.nonzero(raw_question_matrix)[1:, 1] // num_questions #truth表示真实作答情况,0表示回答正确,1表示回答错误,与原始数据相反?
# truth = 1 - truth#这里逻辑是不是写错了!! 0表示回答正确,1表示回答错误,与原始数据相反?
关键在这里➡️
truth = torch.nonzero(raw_question_matrix)[1:, 1] // num_questions
比如one -hot encode后 125错了 numofq=100 那就是encode_q[125]=1 ,但是还原时候,125//100 =1 ,这代表的是回答正确呀?
希望您的解答,谢谢
The text was updated successfully, but these errors were encountered: