I have a very strange behavior where I am trying to run PCA on the MNIST data set and then I check the test and train error. However, it seems that I get that the test error is lower than my train error, which seems totally bizarre for me. Is this normal? Has people ever experienced this type of behavior on the MNIST data set?  To make my bug totally reproducible I will give a link to  (i.e. the exact data set I used is there, and its small). Also, the code I ran is super simple:  clear;clc; load('data_MNIST_original_minist_60k_10k_split_train_test'); [N_train, D] = size(X_train) % (N_train x D) [N_test, D] = size(X_test) % (N_test x D) %% preparing model K = 10; [coeff, ~, ~, ~, ~, mu] = pca(X_train); % (D x R) = Rows of X_train correspond to observations and columns to variables.  %% Learn PCA X_train = X_train'; % (D x N) = (N_train x D)' X_test = X_test'; % (D x N) = (N_test x D)' U = coeff(:,1:K); % (D x K) = K pca's of dimension D X_tilde_train = (U * U' * X_train); % (D x N_train)= (D x N)' = ( (D x K) x (K x D) x (D x N) )' X_tilde_test = (U * U' * X_test); % (D x N_test)= (D x N)' = ( (D x K) x (K x D) x (D x N) )' train_error_PCA = (1/N_train)*norm( X_tilde_train - X_train ,'fro')^2 test_error_PCA = (1/N_test)*norm( X_tilde_test - X_test ,'fro')^2   then I got:  train_error_PCA =     29.0759   test_error_PCA =     28.8981   is this normal?  is this why people add background noise to the MNIST data set?  I am just using standard PCA library so I can't possibly see what might have gone wrong    I have also tested this with different non-linear auto-encoders, for example, I tried a 1 layer Radial Basis Function (RBF) and it produces the same strange result:    if you get close enough, the little circle (train) is above each start (test). Which is not expected.    I have now made the same test but with a more complicated MNIST data set that can be found () and I also included it with the git large file tracking () on the repo (it will eventually reach github). Now with this it seems the train error is lower than test, as I assume it should be:    and ran the code:  clear;clc; %load('data_MNIST_original_minist_60k_10k_split_train_test'); load('mnist_background_random_test'); load('mnist_background_random_train'); X_train = mnist_background_random_train(:,1:784); X_test = mnist_background_random_test(:,1:784); [N_train, D] = size(X_train) % (N_train x D) [N_test, D] = size(X_test) % (N_test x D) %% [coeff, ~, ~, ~, ~, mu] = pca(X_train); % (D x R) = Rows of X_train correspond to observations and columns to variables.   num_centers = 5; % &lt;-- change start_centers = 10; end_centers = 500; centers = floor(linspace(start_centers, end_centers, num_centers));  train_errors = zeros(1,num_centers); test_errors = zeros(1,num_centers); for i=1:num_centers     K = centers(i);     %% preparing model     U = coeff(:,1:K); % (D x K) = K pca's of dimension D     X_train_T = X_train'; % (D x N) = (N_train x D)'     X_test_T = X_test'; % (D x N) = (N_test x D)'     X_tilde_train = (U * U' * X_train_T); % (D x N_train)= (D x N)' = ( (D x K) x (K x D) x (D x N) )'     X_tilde_test = (U * U' * X_test_T); % (D x N_test)= (D x N)' = ( (D x K) x (K x D) x (D x N) )'     train_error_PCA = (1/N_train)*norm( X_tilde_train - X_train_T ,'fro')^2;     test_error_PCA = (1/N_test)*norm( X_tilde_test - X_test_T ,'fro')^2;     train_errors(i) = train_error_PCA;     test_errors(i) = test_error_PCA; end fig = figure; plot(centers, train_errors, '-ro', centers, test_errors, '-b*'); legend('train errors', 'test errors');   I will leave the question because I am not sure if I truly fixed the error or not.
Is it possible to have test error lower than training error?  I have a classification problem with 2000 samples, 500 of which are positives, 1500 are negatives. I split my data into 70% training data, 30% test data.  Run random forest with 200 estimators and cv=10. I did this several times and compared the recall and precision score and notice the scores for my test set is significantly better. Is this possible?
How do major and minor grooves arise in the DNA helix? I understand that they arise due to the pairing of bases of two opposite stands and are sites through which important proteins needed for replication and transcription of DNA interact. But I don't get how the arrangement of bases really generate the grooves. There is no or there was no I read a sentence in an exam:     There is no child who did not bring his parents to the picnic.    I think that the sentence does not have tense-agreement. Why is is used instead of was? Please explain it to me. I have the following page (deadlink: http://www.workingstorage.com/Sample.htm ) that has a footer which I can't make sit at the bottom of the page. I want the footer to  stick to the window bottom when the page is short and the screen is not filled, and stay at the document end and move down as normal when there is more than a screenful of content (instead of overlapping the content).  The CSS is inherited and befuddles me. I can't seem to change it properly to put a minimum height on the content or make the footer go to the bottom. I have a problem with using "too" in a sentence. In what situation would you use "too" instead of "so" or "very"? Please include an example to illustrate the difference. The highest common factor and the lowest common multiple of two numbers $A$ and $B$ are $12$ and $168$ respectively. Find the possible values of $A$ and $B$ with the exception of $12$ and $168$.   Help me with this equation please. I kind of get it but I don't understand the concept behind it... I do not want to memorize. Should I remove Adult Dependent from my 2019 tax return so they will receive a COVID Stimulus Check? On my 2019 Tax Return I claimed my 28 year old girlfriend as a dependent. This makes her ineligible to receive a COVID Stimulus Check. My return was already accepted and I have already received my refund. Should I amend my return, remove her as a dependent? Would she then be eligible to receive the stimulus check? Elastic net penalty How to get width of the video and scale another video to that width using ffmpeg? I'm using ffmpeg to stack two videos vertically. They might be different size so I need to scale them to same size. I have found following commands.  First one works for different sizes (but won't scale to proper size):  ffmpeg -i input1 -i input2 -filter_complex '[0:v]pad=iw:ih*2[int];[int][1:v]overlay=0:H/2[vid]' -map [vid] -c:v libx264 -crf 23 -preset veryfast output   Second one works if videos have same width and same pixel format:  ffmpeg -i input1 -i input2 -filter_complex vstack output   How to get width of first input inside complex filter argument so second input could be scaled to same width? What would be the command to do so? I would prefer vstack filter since it should be faster than combination of pad and overlay. Creating flow maps in QGIS I have several records from a survey and would like to show flow map from places mentioned in the survey. I have all places mentioned georeferenced and some records mentioned no places and others mentioned up to 16 places. I made a graphic so I can make myself clearer. Easiest way to sort DOM nodes? If I have a list like this:  &lt;ul id="mylist"&gt;     &lt;li id="list-item1"&gt;text 1&lt;/li&gt;     &lt;li id="list-item2"&gt;text 2&lt;/li&gt;     &lt;li id="list-item3"&gt;text 3&lt;/li&gt;     &lt;li id="list-item4"&gt;text 4&lt;/li&gt; &lt;/ul&gt;   What's the easiest way to re-arrange the DOM nodes to my preference? (This needs to happen automatically when the page loads, the list-order preference is gained from a cookie)  E.g.  &lt;ul id="mylist"&gt;     &lt;li id="list-item3"&gt;text 3&lt;/li&gt;     &lt;li id="list-item4"&gt;text 4&lt;/li&gt;     &lt;li id="list-item2"&gt;text 2&lt;/li&gt;     &lt;li id="list-item1"&gt;text 1&lt;/li&gt; &lt;/ul&gt; How to pick one number from each sorted list so that the difference between the minimum and maximum is as small as possible? How to define servlet filter order of execution using annotations in WAR Why I can't apply mirror modifier? Here's screen LaTeX Editors/IDEs What editors/IDEs are available for easing the process of writing TeX/LaTeX documents? Please state some useful features like code completion, spell checking, building final DVI or PDF files, etc.  This question is undergoing a systematic refurbishment, see  on Meta. If you’d like to see another editor feature covered here or to take care of an editor that’s not covered yet, share your ideas in that meta question.  List of editors Links to answers. Can you enter the Schengen area with a UK visa? "one of the cables that runs" or "one of the cables that run"? Recently at work I was writing the following, and I have not been able to get a firm answer on which version is the most grammatically correct. The sentence is:     We would like to use one of the cables that _________ between rooms.   Is the correct conjugation run or runs?  I think 'run' is correct, because I think that the verb in the prepositional phrase is referring to 'cables' not 'one.' However, a number of colleagues have said that 'runs' is correct because one is singular. Often in my papers I want to mention theorems in the introduction that are introduced in more detail and proved in a later section.  I'd like to include the statement of these theorems twice over, each time numbered as the theorem would naturally appear in its later section.  My current solution (using amsthm) is, e.g.  %(in the introduction) \newtheorem*{thm:associativity}{Theorem \ref{thm:associativity}} \begin{thm:associativity} Lorem ipsum ... \end{thm:associativity}  %(in a later section) \begin{thm} \label{thm:associativity} Lorem ipsum ... \end{thm}      Can anyone think of a cleaner solution? Long-distance Mind Trick Built-in unit strings recognized by Quantity? How to format a USB or external drive? Using Ubuntu 11.10, how do I format an external or USB drive? I don't find an option to 'format' when I right click. In the new version, the drives don't come up on the desktop, but instead come on the Launcher.