0

I want to initialize a logistic regression with an outdated model, I want to use the tips given here Initializing logistic regression coefficients when using the Spark dataset-based ML APIs?, but the main method I want to use is private, how can I extend this class to override this private method or override the whole class? I'm new to scala thanks for being lenient or at least kind

treated here Override whole class in java/scala but no satisfaying answer

Talm
  • 118
  • 7
  • Maybe you can add some pieces of code, from that main private method, or something you have tried in order to add more context and help others to understand the problem. In any case, if you want to override a method, it has to be `protected` or `public`, you can't override a private one – Javier Montón May 30 '22 at 16:51
  • Can you also provide the class and the exact method you want to override? I think the answer in the link you provided should work fine (rewriting the class in your project). – AminMal May 30 '22 at 19:37
  • You can't. That's the definition of `private` members: it is impossible to access them from outside the enclosing class. I could never understand why people like and overuse them so much, especially in scala, but unfortunately they do :( Your best bet is to make a copy of the class in your project, and modify it to make that method public. – Dima May 30 '22 at 22:47

0 Answers0