With reference to AFML ("Advances in Financial Machine Learning" book by Marcos Lopez de Prado). Are sample uniqueness and sample weight pointing towards to the same thing? I am confused on the term here. Thanks if anyone could help.


1 Answer 1


That is a very good question.

If you look at sklearn fit() method parameters, you can find sample_weights parameter which tells the model which samples it should give more attention/weight when the model is fit.

Sample uniqueness is a bit different. Firstly, sample uniqueness is used to calculate sample weights (for return based sample weights, we divide abs(return of sample) / sample uniqueness). However, the rest of Sample Weights chapter tells the reader how to improve bagging algorithm (used in ensemble models like BaggingClassifier, RandomForestClassifier) is such a way that instead of randomly choosing samples used for training estimators in ensemble model, the algorithm chooses the most unique one. This is called Sequential Bootstrapping. So this algorithm (if implemented) changes how the model is fit.

NB: I am the contributor of an open-source package mlfinlab (https://github.com/hudson-and-thames/mlfinlab) which implements the concepts described in AFML book. We have an ensemble model SequentiallyBootstrappedBaggingClassifier/Regressor which extend sklearn's BaggingClassifier model with Sequential Bootstrapping instead of random sampling.

Our research team also has a blog where we discuss various financial machine learning problems and how mlfinlab can be used to solve them. Regarding your question, there is the blog post on sample uniqueness and Sequential Bootstrapping (https://hudsonthames.org/bagging-in-financial-machine-learning-sequential-bootstrapping-python/)

  • $\begingroup$ Thank you very much Mr. Proskurin and for your recommendations. It's really good to know that there are experts working on the libraries. $\endgroup$ Feb 4, 2020 at 11:32
  • $\begingroup$ May I ask one more question regarding the sample uniqueness technique? As from the book, I saw that it means to tackle the I.I.D. problem. However, from my poor understanding, it seems only to tackle the "independent" issue but not "identical" issue. Is there any intuitive understanding towards this "identical" issue and any test to verify it? Thank you for your time. $\endgroup$ Feb 4, 2020 at 11:34
  • $\begingroup$ 'Identical' means that the distribution of asset prices used in labeling it the same for each label, which is, of course, is not true in finance. However, if you apply filtering techniques (what Marcos suggests to do), in theory, it generates closely related samples with pretty much the same distributions. But you are right, SB algorithm tackles only 'independent' ascpect, not 'identical' $\endgroup$ Feb 4, 2020 at 12:37
  • $\begingroup$ Thank you very much Mr. Proskurin. $\endgroup$ Feb 4, 2020 at 13:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.