Skip to content

Commit

Permalink
Adress review
Browse files Browse the repository at this point in the history
Co-authored-by: Olivier Grisel <[email protected]>
  • Loading branch information
fcharras and ogrisel committed Jan 12, 2024
1 parent 0ce2013 commit 6bb0aa5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
8 changes: 1 addition & 7 deletions benchmarks/ridge/consolidate_result_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
COMPUTE_DEVICE = "Compute device"
COMPUTE_RUNTIME = "Compute runtime"
DATA_RANDOM_STATE = "Data random state"
DATA_SAMPLE_WEIGHTS = "Data sample weights"
DTYPE = "Dtype"
NB_DATA_FEATURES = "Nb data features"
NB_DATA_SAMPLES = "Nb data samples"
Expand Down Expand Up @@ -66,7 +65,6 @@
NB_DATA_SAMPLES,
NB_DATA_FEATURES,
NB_DATA_TARGETS,
DATA_SAMPLE_WEIGHTS,
WALLTIME,
BACKEND_PROVIDER,
COMPUTE_DEVICE,
Expand Down Expand Up @@ -94,7 +92,6 @@
NB_DATA_SAMPLES: np.int64,
NB_DATA_FEATURES: np.int64,
NB_DATA_TARGETS: np.int64,
DATA_SAMPLE_WEIGHTS: str,
WALLTIME: np.float64,
BACKEND_PROVIDER: str,
COMPUTE_DEVICE: str,
Expand All @@ -116,7 +113,7 @@
COMMENT: str,
}

COLUMNS_WITH_NONE_STRING = [DATA_SAMPLE_WEIGHTS]
COLUMNS_WITH_NONE_STRING = []

# If all those fields have equal values for two given benchmarks, then the oldest
# benchmark (given by RUN_DATE) will be discarded
Expand All @@ -126,7 +123,6 @@
NB_DATA_SAMPLES,
NB_DATA_FEATURES,
NB_DATA_TARGETS,
DATA_SAMPLE_WEIGHTS,
BACKEND_PROVIDER,
SOLVER,
COMPUTE_DEVICE,
Expand All @@ -146,7 +142,6 @@
(NB_DATA_SAMPLES, False),
(NB_DATA_FEATURES, False),
(NB_DATA_TARGETS, False),
(DATA_SAMPLE_WEIGHTS, True),
(WALLTIME, True),
(BACKEND_PROVIDER, True),
(COMPUTE_DEVICE, True),
Expand Down Expand Up @@ -180,7 +175,6 @@
objective_dataset_param_dtype=DTYPE,
objective_dataset_param_random_state=DATA_RANDOM_STATE,
objective_objective_param_random_state=SOLVER_RANDOM_STATE,
objective_objective_param_sample_weight=DATA_SAMPLE_WEIGHTS,
objective_objective_param_solver=SOLVER,
objective_solver_param___name=BACKEND_PROVIDER,
objective_solver_param_device=COMPUTE_DEVICE,
Expand Down
7 changes: 3 additions & 4 deletions benchmarks/ridge/datasets/simulated_blobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ class Dataset(BaseDataset):

parameters = {
"n_samples, n_features": [
(20_000_000, 100),
(10_000_000, 100),
(5000, 5000),
(20_000_000, 10),
(10_000_000, 10),
(2_000_000, 100),
(1500, 1500),
],
"n_targets": [1, 5, 20],
"n_targets": [1, 10],
"dtype": ["float32"],
"random_state": [123],
}
Expand Down
16 changes: 14 additions & 2 deletions benchmarks/ridge/objective.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Objective(BaseObjective):
"alpha": [1.0],
"fit_intercept": [True],
"solver, max_iter, tol": [("svd", None, 0)],
"sample_weight": ["None", "random"],
"sample_weight": ["None"], # NB: add "random" to test non None weights
"random_state": [123],
}

Expand Down Expand Up @@ -86,7 +86,19 @@ def evaluate_result(self, weights, intercept, **solver_parameters):
)

def get_one_result(self):
return dict(objective=1)
n_features = self.dataset_parameters["n_features"]
n_targets = self.dataset_parameters["n_targets"]
if n_targets == 1:
weights = np.ones((n_features,))
else:
weights = np.ones(
(
n_targets,
n_features,
)
)

return dict(weights=weights, intercept=np.ones((n_targets,)))

def get_objective(self):
# Copy the data before sending to the solver, to ensure that no unfortunate
Expand Down

0 comments on commit 6bb0aa5

Please sign in to comment.