smartcore icon indicating copy to clipboard operation
smartcore copied to clipboard

Use Default::default instead of new in traits

Open morenol opened this issue 2 years ago • 2 comments

I'm submitting a

  • [x] improvement.

Current Behaviour:

Currently, traits in https://github.com/smartcorelib/smartcore/blob/development/src/api.rs#L24 requires implementation of fn new() -> Self;, I think that instead we should rely on Default::default,

Do you want to work on this issue?

Yes

Any thoughts?

morenol avatar Nov 04 '22 15:11 morenol

I had to implement the new() method as it looked like the best way of passing the estimators to cross_validate and cross_validate_predict. If you find a better way would be happy to go for it.

Mec-iS avatar Nov 04 '22 18:11 Mec-iS

gotcha, I think that we can use generics to define the type that we need to use instead of passing a blank parameter that is not used

morenol avatar Nov 04 '22 20:11 morenol