Skip to content

Fixes for Unresolved comment '# TODO: remove placeholding zeroed y' and Unresolved comment '# TODO: add float values'. #172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion sklbench/datasets/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,8 @@ def load_ann_dataset_template(url, raw_data_cache):
}
del x_train, x_test
# TODO: remove placeholding zeroed y
y = np.zeros((x.shape[0],))
#y = np.zeros((x.shape[0],))
y = np.zeros(x.shape[0])
return {"x": x, "y": y}, data_desc


Expand Down
13 changes: 10 additions & 3 deletions sklbench/utils/special_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
def is_special_value(value) -> bool:
return isinstance(value, str) and value.startswith(SP_VALUE_STR)

def float_range(start,stop,step):
while start < stop:
yield start
start += step

def explain_range(range_str: str) -> List:
def check_range_values_size(range_values: List[int], size: int):
Expand All @@ -47,13 +51,15 @@ def check_range_values_size(range_values: List[int], size: int):
range_values = range_str.replace("[RANGE]", "").split(":")
# TODO: add float values
range_type = range_values[0]
range_values = list(map(int, range_values[1:]))
#range_values = list(map(int, range_values[1:]))
range_values = list(map(float, range_values[1:]))
# - add:start{int}:end{int}:step{int} - Arithmetic progression
# Sequence: start + step * i <= end
if range_type == "add":
check_range_values_size(range_values, 3)
start, end, step = range_values
return list(range(start, end + step, step))
#return list(range(start, end + step, step))
return list(float_range(start, end + step, step))
# - mul:current{int}:end{int}:step{int} - Geometric progression
# Sequence: current * step <= end
elif range_type == "mul":
Expand All @@ -71,7 +77,8 @@ def check_range_values_size(range_values: List[int], size: int):
range_values.append(1)
check_range_values_size(range_values, 4)
base, start, end, step = range_values
return [base**i for i in range(start, end + step, step)]
#return [base**i for i in range(start, end + step, step)]
return [base**i for i in float_range(start, end + step, step)]
else:
raise ValueError(f'Unknown "{range_type}" range type')

Expand Down
Loading