I don't understand the computing of the certitude parameter.
In Example1: ...Twelve of the 51 characters have been matched.. Why 51 characters ?
In Example2:... Eight of the 37 characters have been matched: "My", " 's ", and "been". 7 not 8 characters ?
Could you be more specific ?
Thank you for these great problems !
Hello, Jean-Marie Sainthillier. Thanks for your feedback. Regarding Ex. 1, the key information is given in a preceding paragraph about the general calculation of 'certitude', which states: "[...] accounting for [...] of the characters (excluding spaces)". I excluded spaces because there are none in the 'dictionary', so they would skew the results. E.g. if the phrase "They didn't understand" were padded with one hundred spaces before encoding, then we would always get a low 'certitude' if spaces weren't excluded (viz. 28%), suggesting only low–moderate confidence in the decryption, despite decoding half of the matchable characters, which should have given us high confidence (viz. 100%) given the small size of our 'dictionary'. Arguably punctuation could have been excluded too, but I opted to _include_ punctuation, not least because apostrophes do occur in the 'dictionary'. That is why there are 8 matched characters in Ex. 2: the apostrophe is counted (in _'s_). In a bigger 'dictionary', hyphens and full stops could also occur. Some punctuation, such as commas and semicolons, would perhaps never occur in any practical 'dictionary', but their effect on the 'certitude' is relatively small, and segregating punctuation according to function is beyond the present scope!! —DIV
Thank you :)
I would like to suggest that when timing code for exercises that you only measure the function implemented by the user. In this case, your test suite code should be:
for i = 1 : qBig
% EDIT (2018-06-17). Ensure each case is unique.
characters = [' , .' char(randi([97,122], [1,23]))];
x(1+i) = {characters( randperm(numel(characters)) )};
% END EDIT (2018-06-17)
end;
t0 = clock;
t0_cpu = cputime;
% Loop
for i = 1 : qBig
y(1) = x(1);
y(2) = x(1+i);
solution = decode(y, bncWordlist);
end;
% Compute and display elapsed time.
dt = etime(clock, t0);
dt_cpu = (cputime - t0_cpu);
for dummy = 1 : 10, disp(' . '); end;
fprintf('Your wall time to decode %u message batches = %2.2f seconds.\n\r', qBig, dt)
Finally, I am not sure that cputime or clock are indeed good tools for measuring efficient code (this is not their purpose). Timeit is much more adequate since it runs our code several times and uses the median for removing noise. The function cputime measures the amount of work that the CPU is currently doing, which may include everything that is running on a MATLAB session.
This problem is way too hard. It is not enough to solve the test cases or do vectorized code, we must find the right combination of MATLAB functions that achieve the greatest speed, which is boring. This means we have to write many times the same code until the right combination of functions becomes obvious (I had to create 6 different codes or more, until I finally got a valid solution). Moreover it is not clear why the number 8 (seconds) is somehow a fair measurement of timing for this task since we must try all combinations and deal with strings. Operation Phoenix and Orthos were nice, good job. They had a limit of 3 seconds, but we didn't have to look up words in a dictionary (adding just 5 more seconds for searching in a dicionary of 100 words that must be used at every iteration doesn't seem fair). Even after converting the dictionary words to hash keys, I was able to barely pass the test suite.
Alfonso Nieto-Castanon's solution passed all tests in the Test Suite on 03 February 2019.
Wall time for 1193 message batches = 6.14 s. (CPU time = 8.24 seconds.)
Mu's solution passed all tests in the Test Suite on 08 January 2019.
Wall time for 1170 message batches = 4.26 s. (CPU time = 6.25 seconds.)
William's solution passed all tests in the Test Suite on 25 September 2018.
Wall time for 1080 message batches = 7.17 s. (CPU time = 9.01 seconds.)
William's solution passed all tests in the Test Suite on 25 September 2018.
Wall time for 1080 message batches = 7.30 s. (CPU time = 9.21 seconds.)
Jean-Marie Sainthillier's solution passed all tests in the Test Suite on 13 July 2018.
Wall time for 1021 message batches = 6.77 s. (CPU time = 7.09 seconds.)
David Verrelli's solution passed all tests in the Test Suite on 18 June 2018.
Wall time for 1001 message batches = 7.05 s. (CPU time = 9.01 seconds.)
Binbin Qi's solution passed all tests in the Test Suite on 17 June 2018.
Wall time for 1001 message batches = 3.81 s. (CPU time = 4.73 seconds.)
J. S. Kowontan's solution passed all tests in the Test Suite on 17 June 2018.
Wall time for 1001 message batches = 3.36 s. (CPU time = 4.06 seconds.)
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!