Skip to content

Conversation

@ViviHong200709
Copy link
Contributor

@ViviHong200709 ViviHong200709 commented Oct 19, 2021

Thanks for sending a pull request!
Please make sure you click the link above to view the contribution guidelines,
then fill out the blanks below.

Description

Limit the range of parameters in IRT and MIRT

What does this implement/fix? Explain your changes.

...

Pull request type

  • [DATASET] Add a new dataset
  • [BUGFIX] Bugfix
  • [FEATURE] New feature (non-breaking change which adds functionality)
  • [BREAKING] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [STYLE] Code style update (formatting, renaming)
  • [REFACTOR] Refactoring (no functional changes, no api changes)
  • [BUILD] Build related changes
  • [DOC] Documentation content changes
  • [Sync] Synchronization with a repository
  • [OTHER] Other (please describe):

Changes

EduCDM/EduCDM/IRT/GD/IRT.py: In IRT,Use value_range to limit the range of theta and b.Also use sigmoid(c) make sure that c is limit to [0,1].
EduCDM/EduCDM/MIRT/MIRT.py, EduCDM/EduCDM/MIRT/MIRT.py: In IRT and MIRT,Use a_range to limit the range of a. If a_range is not given ,use softplus(a) to make sure a>0.

Does this close any currently open issues?

#31

Any relevant logs, error output, etc?

no

Checklist

Before you submit a pull request, please make sure you have to following:

Essentials

  • PR's title starts with a category (e.g. [BUGFIX], [FEATURE], [BREAKING], [DOC], etc)
  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage and al tests passing
  • Code is well-documented (extended the README / documentation, if necessary)
  • If this PR is your first one, add your name and github account to AUTHORS.md

Comments

  • If this change is a backward incompatible change, why must this change be made.
  • Interesting edge cases to note here

@codecov-commenter
Copy link

codecov-commenter commented Oct 19, 2021

Codecov Report

Merging #33 (83b7776) into main (54b25d6) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              main       #33   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           32        32           
  Lines         1148      1162   +14     
=========================================
+ Hits          1148      1162   +14     
Impacted Files Coverage Δ
EduCDM/IRT/GD/IRT.py 100.00% <100.00%> (ø)
EduCDM/MIRT/MIRT.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 54b25d6...83b7776. Read the comment docs.

@tswsxk
Copy link
Collaborator

tswsxk commented Oct 21, 2021

coverage should be 100%

else:
a = F.softplus(a)
if torch.max(theta != theta) or torch.max(a != a) or torch.max(b != b):
raise Exception('Error:theta,a,b may contains nan! The value_range or a_range is too large.')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use ValueError

a = F.softplus(a)
b = torch.squeeze(self.b(item), dim=-1)
if torch.max(theta != theta) or torch.max(a != a) or torch.max(b != b):
raise Exception('Error:theta,a,b may contains nan! The a_range is too large.')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use ValueError


def test_train_with_large_range(data, conf, tmp_path):
user_num, item_num = conf
try:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use pytest.raise to test exception

@tswsxk
Copy link
Collaborator

tswsxk commented Oct 21, 2021

Still, use pytest.raise to test exception

tswsxk
tswsxk previously approved these changes Oct 22, 2021
tswsxk
tswsxk previously approved these changes Oct 22, 2021
tswsxk
tswsxk previously approved these changes Oct 23, 2021
@tswsxk
Copy link
Collaborator

tswsxk commented Oct 23, 2021

The description is not intact @ViviHong200709, you should breifly describe what is changed in Changes part of PR

@ViviHong200709 ViviHong200709 changed the title [BUGFIX] use softplus function make sure a>0 [BUGFIX] Limit the range of parameters in IRT and MIRT Oct 23, 2021
@tswsxk tswsxk linked an issue Nov 12, 2021 that may be closed by this pull request
@tswsxk tswsxk merged commit 8b70f1e into bigdata-ustc:main Nov 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Logical bug in IRTNet.forward

3 participants