Skip to content

Commit

Permalink
fix: incorrect type hint for number_of_bins parameter (#567)
Browse files Browse the repository at this point in the history
### Summary of Changes

Change the type of the `number_of_bins` parameter of
`Discretizer.__init__` from `float` to `int`.
  • Loading branch information
lars-reimann committed Mar 4, 2024
1 parent b1e308d commit b434e53
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/safeds/data/tabular/transformation/_discretizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Discretizer(TableTransformer):
Parameters
----------
number_of_bins: float
number_of_bins
The number of bins to be created.
Raises
Expand All @@ -28,7 +28,7 @@ class Discretizer(TableTransformer):
If the given number_of_bins is less than 2.
"""

def __init__(self, number_of_bins: float = 5):
def __init__(self, number_of_bins: int = 5):
self._column_names: list[str] | None = None
self._wrapped_transformer: sk_KBinsDiscretizer | None = None

Expand All @@ -44,14 +44,14 @@ def fit(self, table: Table, column_names: list[str] | None) -> Discretizer:
Parameters
----------
table : Table
table
The table used to fit the transformer.
column_names : list[str] | None
column_names
The list of columns from the table used to fit the transformer. If `None`, all columns are used.
Returns
-------
fitted_transformer : TableTransformer
fitted_transformer :
The fitted transformer.
Raises
Expand Down Expand Up @@ -99,12 +99,12 @@ def transform(self, table: Table) -> Table:
Parameters
----------
table : Table
table
The table to which the learned transformation is applied.
Returns
-------
transformed_table : Table
transformed_table :
The transformed table.
Raises
Expand Down Expand Up @@ -150,7 +150,7 @@ def is_fitted(self) -> bool:
Returns
-------
is_fitted : bool
is_fitted :
Whether the transformer is fitted.
"""
return self._wrapped_transformer is not None
Expand All @@ -161,7 +161,7 @@ def get_names_of_added_columns(self) -> list[str]:
Returns
-------
added_columns : list[str]
added_columns :
A list of names of the added columns, ordered as they will appear in the table.
Raises
Expand All @@ -180,7 +180,7 @@ def get_names_of_changed_columns(self) -> list[str]:
Returns
-------
changed_columns : list[str]
changed_columns :
The list of (potentially) changed column names, as passed to fit.
Raises
Expand All @@ -198,7 +198,7 @@ def get_names_of_removed_columns(self) -> list[str]:
Returns
-------
removed_columns : list[str]
removed_columns :
A list of names of the removed columns, ordered as they appear in the table the Discretizer was fitted on.
Raises
Expand Down

0 comments on commit b434e53

Please sign in to comment.