I am using Moodle to make my subjects exams. I would like to mix a numerical cloze question, with a single-choice or a multiple-choice question. And each question should have different percentages on the final mark of the question, for example: first numerical question 5%, second numerical question 15%, third multichoice question 20% and so on. I made a cloze_mchoice.Rnw file:
<<echo=FALSE, results=hide>>=
#
\usepackage{Sweave}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}
\SweaveOpts{pdf=false}
\begin{question}
%
%
This is the question. This is the question
\begin{answerlist}
\item Numerical answer 1. %Solution: 10
\item Numerical answer 2. %Solution: 20
\item Multiple choice answer 1. %true
\item Multiple choice answer 2. %true
\item Multiple choice answer 3. %false
\item Multiple choice answer 4. %false
\item Numerical answer 3. %Solution: 30
\item Numerical answer 4. %Solution: 35
\end{answerlist}
%
\end{question}
\exname{cloze_mchoice}
\extype{cloze}
\exclozetype{num|num|mchoice|num|num}
%percentage of rigth answer:
% (5%-15%-20%-25%-35%)
\exsolution{10|20|1100|30|35|}
\extol{0.1*10|0.1*20|0.1*30|0.1*35} %Numerical Answer Tolerance
First I use to compile in HTML but I receive this warning:
exams2html("cloze_mchoice.Rnw", encoding = "UTF-8", template = "plain8")
## Warning message:
## In do.call(paste("as", type, sep = "."), list(rval)) :
## NAs introduced by coercion
I have been trying to compile into xml using
rmx <- exams2moodle("cloze_mchoice.Rnw", n = 1, name = "p_cloze_mchoice",
mchoice = list(abstention = "No answer."))
but I received the same warning message shown above. The p_cloze_mchoice.xml file is not reading by Moodle.
The file Rnw is a template, I will use a csv file to import input data and output data.
Main problem: The error has got nothing to do with the specific question, it's just due to expoints being set to something that is not numeric. For example, instead of 0.1 * 10 you should use 1. When you want to compute expoints dynamically, you need to do that in an R code chunk and then insert it with \Sexpr{} into \expoints{}.
Further aspects:
Multiple-choice items within cloze questions have been added relatively recently in Moodle XML. They do not offer all features, though, that are available for single-choice items or some of them do not work reliably, see: Cloze question combining mchoice and num import in Moodle
R/exams has been improved recently to adapt to the behavior of Moodle. To make use of these features, please install at least version 2.4-0 of the package.
Currently you cannot add an abstention option to multiple-choice questions within a cloze, at least not reliably to the best of my knowledge.
The percentages for the cloze items cannot be specified like that in Moodle. Moodle wants integer "weights". Hence, exams2moodle() multiplies fractions with a suitable constant (here 100). However, Moodle does not always scale the default grade with these weights. We suspect that this is a problem in Moodle and recommend to use integer expoints instead.
The extol has to be the same length as exclozetype (and not just the same as the number of num items). Here, you could insert a 0 for the mchoice itemm.
The LaTeX \usepackage{} are completely ignored by R/exams. For conversion to HTML (as for Moodle) they wouldn't have any effect on the HTML converter anyway. And for producing PDF output, these commands should be in the LaTeX master template as opposed to the individual exercises.
Jargon: You had used "multichoice" in your original question to refer to multiple-choice questions (mchoice in R/exams). I changed this because in Moodle "multichoice" refers to single-choice questions (with dropdown menu). Jargon simply isn't unified across systems here and I tried to avoid confusion.
The best version of your exercise I could come up with is included below. Note that the fractional expoints lead to a warning in R/exams and do not work correctly in Moodle (as explained above).
\begin{question}
This is the question. This is the question
\begin{answerlist}
\item Numerical answer 1.
\item Numerical answer 2.
\item Multiple choice answer 1.
\item Multiple choice answer 2.
\item Multiple choice answer 3.
\item Multiple choice answer 4.
\item Numerical answer 3.
\item Numerical answer 4.
\end{answerlist}
\end{question}
\exname{cloze_mchoice}
\extype{cloze}
\exclozetype{num|num|mchoice|num|num}
\exsolution{10|20|1100|30|35|}
\extol{1|2|0|3|3.5}
\expoints{0.05|0.15|0.2|0.25|0.35}
Thanks for the interesting thread. Is there a template file that mixes single choice and numerical answers? Also, is it possible to start each single/multiple choice question with text common to all MC fields, such as
\begin{question}
This is the general question
\begin{answerlist}
\item question with numerical answer 1.
\item question for MC :
\begin{answerlist}
\item Multiple choice answer 1.
\item Multiple choice answer 2.
\item Multiple choice answer 3.
\end{answerlist}
\end{answerlist}
\end{question}
Thanks,
Related
I apologize if the title doesn't properly describe the issue or if solutions have already been posted, I wasn't sure what to call this.
I have a list of scientific articles as references. The format is:
Mazourek, M., Pujar, A., Borovsky, Y., Paran, I., Mueller, L., Jahn, M. M. (2009). A dynamic interface for capsaicinoid systems biology. Plant Physiology, 150(4), 1806-1821.
I get these from Google Scholar directly (APA format) and want to maintain this format. Can I use this as a source in Word without having to fill out the entire form and write one-by-one every author and all the fields about journal, year, etc.? I want to reference this using its number in a numbered list, and for word to automatically update the numbers of in-text citations if I add a new reference to the start of the list, for example. Thanks.
My problem occurs in questions exported to moodle.
I intend to create a cloze question that has a part being single choice (schoice) and another part being multiple choice (mchoice). When exporting using the exams2moodle function I have two possible behaviors: either all questions are displayed as schoice (drop-down menu) or all are displayed as mchoice (check box). Visually the second case may even work, however it does not correctly score points or penalties, as the questions is treated as mchoice, regardless of its definition.
How do these distinct behaviors occur? The first item defines the behavior of the question, if the first is schoice then everyone will appear as such and vice versa.
Minimal example (all questions are shown as mchoice in moodle)
\begin{question}
This is the question. This is the question
\begin{answerlist}
\item Multiple choice answer 1.
\item Multiple choice answer 2.
\item Multiple choice answer 3.
\item Multiple choice answer 4.
\item Single choice 1.
\item Single choice 2.
\end{answerlist}
\end{question}
\exname{cloze_schoice_mchoice}
\extype{cloze}
\exclozetype{mchoice|schoice}
\exsolution{1100|10}
Minimal example (all questions are shown as schoice in moodle)
\begin{question}
This is the question. This is the question
\begin{answerlist}
\item Single choice 1.
\item Single choice 2.
\item Multiple choice answer 1.
\item Multiple choice answer 2.
\item Multiple choice answer 3.
\item Multiple choice answer 4.
\end{answerlist}
\end{question}
\exname{cloze_schoice_mchoice}
\extype{cloze}
\exclozetype{schoice|mchoice}
\exsolution{10|1100}
Is it possible to get a proper behavior or do some workaround?
This was a bug in exams2moodle(), thanks for pointing this out. I have fixed it in exams 2.4-0. If you install that, running exams2moodle() gives you check boxes for the mchoice questions and a drop-down menu for the schoice questions. These defaults can be modified via
exams2moodle(...,
cloze = list(cloze_mchoice_display = ..., cloze_schoice_display = ...))
The starspace documentation is unclear on the parameter 'fileFormat' which takes the value 'labelDoc' or 'fastText'.
I would like to understand intuitively what material difference setting this paramter would have.
Currently, my best guess is that if you set fileFormat to 'fastText' then all tokens in the training file that do not have the prefix '__label__' will be broken down into character-level n-grams as in fastText.
Alternatively, if you set fileFormat to 'labelDoc' then starspace will assume that all tokens are actually labels, and you do not need to prepend '__label__' to the tokens, because they will be recognized as labels anyway.
Is my thinking correct?
The way StarSpace uses the labels highly depends on the trainMode you are using. The labelDoc format is useful when you go for a trainMode that just relies on labels (trainMode 1 through 4) where it may be the same thing to use a fastText format specifying the __label__ prefix but some trainModes benefit from labelDoc format (i.e. trainMode 1 or 3) to use a whole sentence as a label element for that trainMode.
So to clarify that, if you are performing a text classification task(as explained in this example labelDoc wouldn't have any input recognized but on the other hand, as you stated, using fastText format will breakdown all non-labeled text as input and learn to predict the __label__ tags.
And an example for labelDoc format would be developing a content based recommender system (as explained in this example) every tab separated sentence is used at LHS or RHS during training time. But if you go on a collaborative approach (the content of the articles or wherever you sentences come from is not taken in account) it can be trained either with fastText (specifying the __label__ prefix) or labelDoc file format as labels are picked randomly during training time for LHS or RHS. (This second example is explained here).
I am developing the keccak sponge function and have some strange behaviour about the hash result.
I use the string "abc" with 24 bits (3 bytes).
The test vectors for SHA-3 on http://www.di-mgt.com.au/sha_testvectors.html say that the result of SHA3-512 is following:
SHA3-512 from Test Vector
b751850b1a57168a 5693cd924b6b096e 08f621827444f70d 884f5d0240d2712e 10e116e9192af3c9 1a7ec57647e39340 57340b4cf408d5a5 6592f8274eec53f0
I also used cryptopp version 5.62 and it gives me this output:
CryptoPP
18587dc2ea106b9a1563e32b3312421ca164c7f1f07bc922a9c83d77cea3a1e5d0c69910739025372dc14ac9642629379540c17e2a65b19d77aa511a9d00bb96
I use HashTab 5.2.0.14 on Windows and it gives me for a file with "abc" the same output:
HashTab 5.2.0.14 18587dc2ea106b9a1563e32b3312421ca164c7f1f07bc922a9c83d77cea3a1e5d0c69910739025372dc14ac9642629379540c17e2a65b19d77aa511a9d00bb96
So, there are some references but one of them is different to the others. It is explained on the website, that the input message is attached with 2 bits "10" defined in the FIPS-202 draft. So, CryptoPP and HashTab use maybe another implementation but which one??
Now I have my program and the "reference code" from the keccak site and also another implementation in python:
My program returns this hash value for "abc":
My Program
20FF13D217D5789FA7FC9E0E9A2EE627363EC28171D0B6C52BBD2F240554DBC94289F4D61CB57DF72DF08AAC4366022D5DF23E703B8FDFF6306021DB4D5E6760
This is the keccak reference code (http://keccak.noekeon.org/KeccakReferenceAndOptimized-3.2.zip) on the http://keccak.noekeon.org/files.html which calculates the same value:
Keccak-Reference 3.2
Message of size 2040 bits with Keccak[r=1024, c=576]
20FF13D217D5789FA7FC9E0E9A2EE627363EC28171D0B6C52BBD2F240554DBC94289F4D61CB57DF72DF08AAC4366022D5DF23E703B8FDFF6306021DB4D5E6760 (truncated to the same length)
This is the python implementation from https://github.com/mgoffin/keccak-python/blob/master/Keccak.py resulting in the same value:
keccak-python
Value after squeezing : 20FF13D217D5789FA7FC9E0E9A2EE627363EC28171D0B6C52BBD2F240554DBC94289F4D61CB57DF72DF08AAC4366022D5DF23E703B8FDFF6306021DB4D5E67601173D04BF5AEC3EBBCA87696355C5FB4D72D00D2CC4F843A0A3A0ED8924A16FC37769A3DB7C3A84F31E92375A7D74A0136D80A647FBC5AF8D733B43873A3709F
So my questions:
1) Is it true that Keccak and SHA-3 have different outputs based on the specification NIST made with FIPS 202?
2) Why do I have now three different hash values which are not unique?
3) Is the capacity changed in SHA3-512 so that it has 512 bits capacity and 1600-512 bitrate? This is another difference I read on a presentation about SHA-3 but I did not find it in the FIPS-202 document.
Thank you very much!
Regards,
Burak
2)
Like mentioned in https://crypto.stackexchange.com/questions/15727/what-are-the-key-differences-between-the-draft-sha-3-standard-and-the-keccak-sub
FIPS 202 was changed on April 7, 2014.
The last release from CryptoPP is from 2/20/2013 (which was the first release including SHA3)
see http://www.cryptopp.com/
This explains why CryptoPP produces a different hash compared to actual test vectors. I think same will apply for HashTab.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
This question is related to my previous one: MATLAB m-file help formatting.
What do you usually write to describe authorship of your own function? Do you put it at the end of the function body or right after the help text before any code?
How do you include version information? Is it possible to automatically update version after function modification?
This is what I usually include:
% My Name <my#email>
% My company
% Created: September 2010
% Modified: October 2010
Please share your thoughts, ideas?
I have a function in the MATLAB Central File Exchange that helps you document your function in a standard way, and works with version control software (CVS and Subversion; not git) to automatically update the author field and time of modification.
You just type new at the command prompt, then the name of the function, and it sorts out the rest.
The basic template for documentation that I use is
function [outputArgs] = TestFunction(inputArgs)
%TESTFUNCTION Summary of this function goes here
%
% [OUTPUTARGS] = TESTFUNCTION(INPUTARGS) Explain usage here
%
% Examples:
%
% Provide sample usage code here
%
% See also: List related files here
% $Author: rcotton $ $Date: 2010/10/01 18:23:52 $ $Revision: 0.1 $
% Copyright: Health and Safety Laboratory 2010
(You'll obviously want a different company in your copyright statement.)
The first line of the help documentation is known as the H1 line, and is used by the function lookfor, among others. It is important that this comes straight after the function definition line.
If you have different use cases (maybe with and without optional arguments), then you should describe each one.
The Examples: and See also: lines are formatted in a way the works with the help report generator. (I've just spotted a bug - the year should be before the company name in the copyright line. Fix on its way.)
$Author:, etc., are formatted for use with CSV/SVN. Since git uses hashes of files, you can't change the content of the file, without git thinking that it's been updated.
We keep our code in a Subversion repository and use the keywords functionality for writing this sort of information into the header comments of the m-file when it is committed to the repo. We put a block of comments right after the initial function line in (most of) our m-files.
If you are not using a source code control system then:
You really should start using one right now.
You could write a script (in Matlab, why not) for maintaining the comment information you require, and implement some process to ensure that you run the script when necessary.
We don't generally put modification dates or histories in our source files, the repository tracks changes for us. Which is another reason you should be using one.
And, while you are thinking about all this, if you haven't already done so: check out Matlab's publish functionality.
EDIT: #yuk: I guess from your mention of TortoiseSVN that you are working on Windows. It's a couple of years since I installed Subversion on my Windows PC. I don't recall any problems at all with the installation, and I'm not qualified to help you debug yours -- but there are plenty on SO who are.
As for keeping version (etc) info up to date, there's no scripting required. You simply include the special strings, such as $Rev$, which Subversion recognises as keywords in the locations in your files (probably in the comments) where you want the version information (etc). This is well explained in the Subversion Book.
As for the Matlab documentation, I think the publish (and related) features are well explained in the Desktop Tools and Development Environment handbook which is available on-line at the Mathworks web-site.
As High Performance Mark points out, some form of source code control is ideal for handling this situation. However, if you are adding information by hand here are a few pointers:
I would definitely include a line stating the MATLAB version your code was written in, or perhaps which versions you know it works for.
When adding the information, you have to leave space between it and the help comment block if you don't want to display it when the user views the help contents, like so:
function myFunction
%# Help text for function
%# Your information
Unless you do want it displayed with the help. Then just make one big comment block.