<div>Actually, I found the answer. Both seem to be optimising the loss function for the various algorithms, below I include some links.<br></div><div><br></div><div> If, we pass <b>class_weight</b> and <b>sample_weight,</b> then the final cost / weight is a combination of both.<br></div><div><br></div><div>I have a follow up question: in which scenario would we use both? why do some estimators allow to pass weights both as a dict in the init or as sample weights in fit? what's the logic? I found it a bit confusing at the beginning.<br></div><div><br></div><div>Thank you!<br></div><div><br></div><div><a href="https://stackoverflow.com/questions/30805192/scikit-learn-random-forest-class-weight-and-sample-weight-parameters">https://stackoverflow.com/questions/30805192/scikit-learn-random-forest-class-weight-and-sample-weight-parameters</a><br></div><div><br></div><div><a href="https://stackoverflow.com/questions/30972029/how-does-the-class-weight-parameter-in-scikit-learn-work/30982811#30982811">https://stackoverflow.com/questions/30972029/how-does-the-class-weight-parameter-in-scikit-learn-work/30982811#30982811</a><br></div><div><br></div><div class="protonmail_signature_block"><div class="protonmail_signature_block-user"><div>Soledad Galli<br></div><div><a href="https://www.trainindata.com/">https://www.trainindata.com/</a><br></div></div><div class="protonmail_signature_block-proton protonmail_signature_block-empty"><br></div></div><div><br></div><div>‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐<br></div><div> On Thursday, December 3, 2020 11:55 AM, Sole Galli via scikit-learn <scikit-learn@python.org> wrote:<br></div><div> <br></div><blockquote class="protonmail_quote" type="cite"><div>Hello team,<br></div><div><br></div><div>What is the difference in the implementation of class_weight and sample_weight in those algorithms that support both? like random forest or logistic regression?<br></div><div><br></div><div>Are both modifying the loss function? in a similar way?<br></div><div><br></div><div>Thank you!<br></div><div><br></div><div>Sole<br></div><div class="protonmail_signature_block"><div class="protonmail_signature_block-proton protonmail_signature_block-empty"><br></div></div><div><br></div></blockquote><div><br></div>