Skip to content

Commit 90500dc

Browse files
committed
Remove commented code and add documentation for BaseScaler
1 parent bc3a020 commit 90500dc

1 file changed

Lines changed: 3 additions & 24 deletions

File tree

foqus_lib/framework/surrogate/scaling.py

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ def scale_log2(array_in, lo=None, hi=None):
7070
return result
7171

7272

73-
# fix expected values in test
74-
75-
7673
def scale_power(array_in, lo=None, hi=None):
7774
if lo is None:
7875
lo = np.min(array_in)
@@ -102,31 +99,15 @@ def unscale_linear(array_in, lo, hi):
10299

103100
def unscale_log(array_in, lo, hi):
104101
result = lo * np.power(hi / lo, array_in)
105-
106-
# result = ((np.log10(array_in) - np.log10(lo))
107-
# / (np.log10(hi) - np.log10(lo)))
108-
# out = math.pow(lo * (hi / lo), (array_in / 10.0))
109-
# out = (
110-
# 10
111-
# * (math.log10(array_in) - math.log10(lo))
112-
# / (math.log10(hi) - math.log10(lo))
113-
# )
114102
return result
115103

116104

117105
def unscale_log2(array_in, lo=None, hi=None):
118106
result = (np.power(10, array_in / 1.0) - 1) * (hi - lo) / 9.0 + lo
119-
# out = (math.pow(10, array_in / 10.0) - 1) * (
120-
# hi - lo
121-
# ) / 9.0 + lo
122-
123107
return result
124108

125109

126110
def unscale_power(array_in, lo, hi):
127-
# check if lo and hi were provided
128-
# result = np.log10((array_in / 10.0) * (np.power(10, hi) - np.power(10, lo))
129-
# + np.power(10, lo))
130111
result = np.log10(
131112
(array_in / 1.0) * (np.power(10, hi) - np.power(10, lo)) + np.power(10, lo)
132113
)
@@ -139,10 +120,9 @@ def unscale_power2(array_in, lo, hi):
139120

140121

141122
class BaseScaler:
142-
# def __init__(self, data_array: np.ndarray):
143-
# self.data = data_array
144-
# self.lo_ = np.min(data_array)
145-
# self.hi_ = np.max(data_array)
123+
"""BaseScaler is the base class for the scaler classes defined
124+
below. It exposes the transformer interface from scikit-learn,
125+
and is not supposed to be instantiated directly."""
146126

147127
def fit(self, X: np.ndarray):
148128
self.lo_ = np.min(X)
@@ -205,7 +185,6 @@ def inverse_transform(self, X: np.ndarray) -> np.ndarray:
205185
"Log2": LogScaler2(),
206186
"Power": PowerScaler(),
207187
"Power2": PowerScaler2(),
208-
# ...
209188
}
210189

211190

0 commit comments

Comments
 (0)