Skip to content

Commit

Permalink
mypy fixing basemodel 1
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdboom committed Oct 18, 2023
1 parent 77561a3 commit e40154f
Show file tree
Hide file tree
Showing 25 changed files with 761 additions and 836 deletions.
13 changes: 5 additions & 8 deletions atom/atom.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,12 @@ def missing(self, value: Sequence[Any]):
self._missing = list(value)

@property
def scaled(self) -> Bool:
def scaled(self) -> bool:
"""Whether the feature set is scaled.
A data set is considered scaled when it has mean=0 and std=1,
or when there is a scaler in the pipeline. Binary columns (only
0s and 1s) are excluded from the calculation.
zeros and ones) are excluded from the calculation.
"""
return check_scaling(self.X, pipeline=self.pipeline)
Expand All @@ -315,7 +315,7 @@ def nans(self) -> Series:
raise AttributeError("This property is unavailable for sparse datasets.")

@property
def n_nans(self) -> Int:
def n_nans(self) -> int:
"""Number of rows containing missing values.
This property is unavailable for [sparse datasets][].
Expand All @@ -333,7 +333,7 @@ def numerical(self) -> Index:
return self.X.select_dtypes(include=["number"]).columns

@property
def n_numerical(self) -> Int:
def n_numerical(self) -> int:
"""Number of numerical features in the dataset."""
return len(self.numerical)

Expand All @@ -343,7 +343,7 @@ def categorical(self) -> Index:
return self.X.select_dtypes(include=["object", "category", "string"]).columns

@property
def n_categorical(self) -> Int:
def n_categorical(self) -> int:
"""Number of categorical features in the dataset."""
return len(self.categorical)

Expand Down Expand Up @@ -1595,10 +1595,7 @@ def encode(
)

encoder = self._add_transformer(encoder, columns=columns)

# Add mapping of the encoded columns and reorder because of target col
self.branch._mapping.update(encoder.mapping_)

Check notice on line 1598 in atom/atom.py

View workflow job for this annotation

GitHub Actions / Qodana Community for Python

Accessing a protected member of a class or a module

Access to a protected member _mapping of a class
self.branch._mapping.reorder(self.columns)

@composed(crash, method_to_log)
def impute(
Expand Down
Loading

0 comments on commit e40154f

Please sign in to comment.