Skip to content

Commit

Permalink
update AGSO properties and fix sklearn metric scorers
Browse files Browse the repository at this point in the history
  • Loading branch information
earthai-tech committed Jul 9, 2023
1 parent 0b5e872 commit e6f5eda
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 4 additions & 5 deletions watex/geology/drilling.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

from .core import GeoBase
from .geology import Geology
from .stratigraphic import GeoStrataModel
from .._typing import Any, NDArray, DataFrame
from ..decorators import export_data
from ..exceptions import NotFittedError, DrillError
Expand Down Expand Up @@ -1115,7 +1114,7 @@ def _set_strata (self, add_electrical_properties =False,
"""
self.inspect
# use default columns [electrical, _description] properties
e_props, strata = GeoStrataModel._getProperties()
e_props, strata = GeoBase.getProperties()
# compute the mean with electrical properties
if add_electrical_properties:
e_props = list (map ( lambda x : np.mean ( x ) if hasattr (
Expand Down Expand Up @@ -1806,8 +1805,8 @@ def get_collar (self, data =None, reset_collar =False , **kws ):
if ( data is None and not hasattr (self, 'collar_')):
raise DrillError( "Collar data is missing.")

if self.property_names is not None:
if not isinstance (self.property_names, dict):
if self.properties is not None:
if not isinstance (self.properties, dict):
msg =(
"Drilling property names expect a dictionnary. Got"
f"{type (self.property_names).__name__!r}. Property"
Expand All @@ -1819,7 +1818,7 @@ def get_collar (self, data =None, reset_collar =False , **kws ):
)
warn(msg )
else:
self.collar_.rename (columns = self.property_names,
self.collar_.rename (columns = self.properties,
inplace =True )

self._create_sub_drill_object (self.collar_, 'collar')
Expand Down
6 changes: 4 additions & 2 deletions watex/models/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1095,8 +1095,10 @@ def get_scorers (*, scorer:str=None, check_scorer:bool=False,
` scorer` is not ``None``, or the tuple of scikit-metrics.
:mod:`sklearn.metrics`
"""
from sklearn import metrics
scorers = tuple(metrics.SCORERS.keys())
from sklearn import metrics
try:
scorers = tuple(metrics.SCORERS.keys())
except: scorers = tuple (metrics.get_scorer_names())

if check_scorer and scorer is None:
raise ValueError ("Can't check the scorer while the scorer is None."
Expand Down

0 comments on commit e6f5eda

Please sign in to comment.