-
Notifications
You must be signed in to change notification settings - Fork 2
Tests for DFO minimizer #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -59,21 +57,6 @@ def add_fit_constraint(self, constraint: ObjConstraint): | |||
def remove_fit_constraint(self, index: int) -> None: | |||
del self._constraints[index] | |||
|
|||
@abstractmethod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
@@ -129,26 +112,6 @@ def evaluate(self, x: np.ndarray, minimizer_parameters: dict[str, float] = None, | |||
|
|||
return self._fit_function(x, **minimizer_parameters, **kwargs) | |||
|
|||
def _prepare_parameters(self, parameters: dict[str, float]) -> dict[str, float]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved below
""" | ||
Convert an `EasyScience.Objects.Base.Parameter` object to an engine Parameter object. | ||
""" | ||
|
||
@abstractmethod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
|
||
@abstractmethod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
@@ -37,108 +40,8 @@ def __init__(self, obj, fit_function: Callable, method: Optional[str] = None): | |||
super().__init__(obj=obj, fit_function=fit_function, method=method) | |||
self._p_0 = {} | |||
|
|||
def make_model(self, pars: Optional[List] = None) -> Callable: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved below
pars = self._cached_pars | ||
item = {} | ||
for p_name, par in pars.items(): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
used more meaningful names
@@ -291,10 +292,8 @@ def _gen_fit_results(self, fit_results, weights, **kwargs) -> FitResults: | |||
|
|||
return results | |||
|
|||
def available_methods(self) -> List[str]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved above
return ['leastsq'] | ||
|
||
def dfols_fit(self, model: Callable, **kwargs): | ||
@staticmethod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made a static method where pars are now passed
InspectParameter.POSITIONAL_OR_KEYWORD, | ||
annotation=_empty, | ||
default=default_value, | ||
@staticmethod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made a static method since its functionality only makes sense for the class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, minor stylistic suggestions raised.
* first tests and adjustments * test and changes from public to private methods * all tests * fix tests * PR response * typing and test * revert to prevent circular import * init file corrected * code cleaning
Added test for DFO minimizer:
Cleaned up
minimizer_base.py
_prepare_parameters
is just movedCleaned up
minimizer_dfo.py