-
Notifications
You must be signed in to change notification settings - Fork 317
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
Randomising Values in questions and tests as part of assignment process #1153
Comments
Hmm, yeah, good point. It would definitely require some infrastructure changes to do this (or even just have 2 or 3 different versions that get released to different students) so it would be worthwhile to think about exactly how to do this. Maybe something like:
|
If N different versions of the assignment are created, and each student then allocated one of them, it would also be useful to record exactly which variant each student received, for example, just in case something went wrong with one of the variants... |
Also, if the same student fetches several time, he presumably should always get the same variant. Otherwise fetching several times would allow to choose the variant (e.g. that of his friend). Potential solution: choose the variant based on a hash of the student id and the assignment id. Then that can be recovered at grading time. |
For the randomization itself, I have syntax and code from another project where we do code randomization. Here is an example, in C++:
In the instructor version, the randomization is taken care off by the language itself ( Here were the design goal:
Happy to elaborate. Maybe we can use the same code base for the two projects? Fun fact is that the design of our instructor version ->student version transformation was largely inspired by nbgrader :-) |
To clarify.... we're looking at something akin to: Cell 1:
Cell 3: --- yes? |
To clarify.... we're looking at something akin to:
Cell 1:
` Write a method to calculate the circumference of a circle when the radius is <insert random value>`
Cell 2:
```
def calc_circ:
-- your code here
```
Cell 3:
` assert calc_circ() == <calculated value>`
--- yes?
Thanks for the use case! This could possibly be authored as:
Cell 1:
write a method to calculate the circumference of a circle of radius R
Cell 2:
def calc_circ(R):
### BEGIN SOLUTION
return 2*pi*R
### END SOLUTION
Cell 3:
R = RANDOM_INT(1,5)
assert calc_circ(R) = EVAL(2*pi*R)
Which would render as:
Cell 1:
Write a method to calculate the circumference of a circle of radius R
Cell 2:
def calc_circ(R):
### YOUR CODE HERE
Cell 3:
assert calc_circ(4) == 25.12...
Notes:
- I made R an input of calc_circ, but that's just a matter of taste;
both options would be possible.
- Of course, there is the usual caveat of real number comparison, but
that's not the point here.
- EVAL(...) is not implemented in cpp-info111, but that's definitely
something natural to have; thanks again for this use case :-)
|
Hi, we are implementing nbgrader for multiple courses at our university and were hoping to randomize values in the questions in assignments. I was wondering if any progress was made in this direction. Thanks in anticipation! |
Still on my todo list, but don't hold your breath. I was hoping to get help from an engineer over the summer/fall, but it seems it won't materialize, so progress will be more later than sooner. So you may want to proceed. It should boil down to writing a new nbgrader filter, very similar to that that handle the "BEGIN XXX", but filtering the lines through the randomizing function in cpp-info111. Feel free to hijack whatever chunk of code from there that can be relevant. |
@nthiery Thank you for your prompt response and for sharing the code snippets to get me started. I will post an update here when I make some progress in this direction! |
Having studied the code snippets and the ideas suggested by @nthiery, it seems to me that it will only work for randomization in test cases. I was hoping to randomize the values in the questions such that when students fetch the same assignment again, they receive the same version of the assignment. For example, consider the following question, I realize that this might require major infrastructural changes in nbgrader as currently only one version is broadcasted to all the students (the "outbound" in the exchange directory has only one file per assignment for all the students), whereas randomized versions of the assignments will require nbgrader to broadcast multiple versions to the students and keep track of each version distributed. I was wondering if something similar to this is being planned for the future releases of nbgrader? @jhamrick @minrk Thank you, |
Hi @omrt9, Oh right, I forgot to mention that. Something indeed needs to be done on the infrastructure side. For whatever they are worth, here are some preliminary idea I had:
I believe this should be enough to resolve the problems you mention. But I don't quite trust any idea that's not been implemented :-) |
The above makes two assumptions:
|
I do prefer the simpler version mentioned by @jhamrick where there are simply N assignments, and each students gets one of them. But it may be desirable to hide the chosen version ID from the student. Otherwise, they will know they need to find someone with the same variant-number. This would mean some renaming when downloading and uploading (map user visible assignment name "asg42" to grader assignment "asg42-variantX") |
Is there a way / would it be useful to provide a way of incorporating randomised elements into a question.
For example, I might set a simple task:
Load the file X into a pandas dataframe and preview the first {{import random;N=random.choice(random.randint(6,10)+random.randint(11,16)}} rows of it.
and then in the next cell test on:
When the assignment is created, execute the
{{...}}
code as part of generating the assigned notebook....hmmm... once. per. student. That could get expensive, couldn't it?!Okay, so maybe not for each student. But if you're in the habit of recycling questions one year to the next, with the occasional parameter change, then that could work?!
The text was updated successfully, but these errors were encountered: