Skip to content

Commit

Permalink
Merge pull request #61 from musicinmybrain/np-builtin-aliases
Browse files Browse the repository at this point in the history
Eschew deprecated numpy aliases for builtins
  • Loading branch information
lukapecnik authored Nov 29, 2021
2 parents 1b00dd1 + 90b23a8 commit e5ab79a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion niaaml/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ def evaluate_pipeline(
)
if (
i[0][key].param_type is np.intc
or i[0][key].param_type is np.int
or i[0][key].param_type is int
or i[0][key].param_type is np.uintc
or i[0][key].param_type is np.uint
):
Expand Down
4 changes: 2 additions & 2 deletions niaaml/preprocessing/feature_selection/select_k_best.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ def select_features(self, x, y, **kwargs):
"""
if self.__k is None:
self.__k = x.shape[1]
self._params["k"] = ParameterDefinition(MinMax(1, self.__k), np.int)
val = np.int(np.around(np.random.uniform(1, self.__k)))
self._params["k"] = ParameterDefinition(MinMax(1, self.__k), int)
val = int(np.around(np.random.uniform(1, self.__k)))
self.__select_k_best.set_params(k=val)

self.__select_k_best.fit(x, y)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class VarianceThreshold(FeatureSelectionAlgorithm):

def __init__(self, **kwargs):
r"""Initialize VarianceThreshold feature selection algorithm."""
self._params = dict(threshold=ParameterDefinition(MinMax(0, 0.1), np.float))
self._params = dict(threshold=ParameterDefinition(MinMax(0, 0.1), float))
self.__variance_threshold = VarThr()

def set_parameters(self, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion niaaml/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def get_bin_index(value, number_of_bins):
Returns:
uint: Calculated index.
"""
bin_index = np.int(np.floor(value / (1.0 / number_of_bins)))
bin_index = int(np.floor(value / (1.0 / number_of_bins)))
if bin_index >= number_of_bins:
bin_index -= 1
return bin_index
Expand Down

0 comments on commit e5ab79a

Please sign in to comment.