Skip to content
This repository has been archived by the owner on Nov 19, 2020. It is now read-only.

So much hidden information. Is this intended? #627

Closed
arubiomoreno opened this issue Jun 1, 2017 · 2 comments
Closed

So much hidden information. Is this intended? #627

arubiomoreno opened this issue Jun 1, 2017 · 2 comments

Comments

@arubiomoreno
Copy link

arubiomoreno commented Jun 1, 2017

I am using Accord.Statistics and Accord.Math.Optimization and there are so much private properties that (imho) sould not be.
Examples:

  • On Accord.Statistics.Distributions.Univariate, most of the distributions do not expose the parameters as properties (exposing getter would be OK). Example: WeibullDistribution do not expose scale and shape.
  • On Accord.Math.Optimization, the class NelderMead does not allow you to change the LowerBounds and UpperBounds. The properties only have a getter. I am changing the private fields with reflection without issues, but using reflection for this purposes is annoying.

There are more examples, but this are the last I used and came to my mind.
Is this intended? and if so, why?

Making all the relevant, non-implementation-breaking stuff public, or in the case of the statistical distributions at least exposing a getter would be great.

@cesarsouza
Copy link
Member

Hi Arubio,

Thank you for the suggestions: it is almost certain that this information hiding was not intended. I will go through the properties you mention, please let me know of any other points where you think a getter should have been available but for some unknown reason, isn't.

However, regarding your second point about NelderMead: The properties you are referring to are arrays, so in this case you can set their elements directly, without using reflection or even a setter, by using nelderMead.UpperBound[0] = 42).

I hope it helps,
Cesar

@arubiomoreno
Copy link
Author

The properties you are referring to are arrays, so in this case you can set their elements directly

🤦‍♂️ You are totally correct. I was so blindly trying to assign the array (as nelderMead.UpperBound = new double[] {...};) that completely missed that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants