Skip to content

Commit

Permalink
Add number of iterations
Browse files Browse the repository at this point in the history
  • Loading branch information
fcharras committed Jan 15, 2024
1 parent 50a2cd5 commit ca4077f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
12 changes: 5 additions & 7 deletions benchmarks/ridge/consolidate_result_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@
SYSTEM_PROCESSOR = "Cpu name"
SYSTEM_RAM = "RAM (GB)"
SYSTEM_GPU = "Gpu name"
# TODO: add number of iterations once iteration-based solvers are
# added to the benchmark.
# RESULT_NB_ITERATIONS = "Result nb iterations"
RESULT_NB_ITERATIONS = "Result nb iterations"
OBJECTIVE_FUNCTION_VALUE = "Result objective value"
VERSION_INFO = "Version info"
RUN_DATE = "Run date"
Expand Down Expand Up @@ -80,7 +78,7 @@
RUN_DATE,
VERSION_INFO,
COMMENT,
# RESULT_NB_ITERATIONS,
RESULT_NB_ITERATIONS,
OBJECTIVE_FUNCTION_VALUE,
DATA_RANDOM_STATE,
SOLVER_RANDOM_STATE,
Expand All @@ -96,7 +94,7 @@
BACKEND_PROVIDER: str,
COMPUTE_DEVICE: str,
COMPUTE_RUNTIME: str,
# RESULT_NB_ITERATIONS: np.int64,
RESULT_NB_ITERATIONS: np.int64,
OBJECTIVE_FUNCTION_VALUE: np.float64,
SOLVER: str,
PLATFORM: str,
Expand Down Expand Up @@ -146,7 +144,7 @@
(BACKEND_PROVIDER, True),
(COMPUTE_DEVICE, True),
(COMPUTE_RUNTIME, True),
# (RESULT_NB_ITERATIONS, True),
(RESULT_NB_ITERATIONS, True),
(OBJECTIVE_FUNCTION_VALUE, False),
(SOLVER, True),
(SYSTEM_GPU, True),
Expand All @@ -168,7 +166,7 @@
PARQUET_TABLE_DISPLAY_MAPPING = dict(
time=WALLTIME,
objective_value=OBJECTIVE_FUNCTION_VALUE,
# objective_n_iter=RESULT_NB_ITERATIONS,
objective_n_iter=RESULT_NB_ITERATIONS,
objective_dataset_param_n_samples=NB_DATA_SAMPLES,
objective_dataset_param_n_features=NB_DATA_FEATURES,
objective_dataset_param_n_targets=NB_DATA_TARGETS,
Expand Down
3 changes: 2 additions & 1 deletion benchmarks/ridge/objective.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def set_data(self, X, y, **dataset_parameters):
self.sample_weight_ = sample_weight
self.dataset_parameters = dataset_parameters

def evaluate_result(self, weights, intercept, **solver_parameters):
def evaluate_result(self, weights, intercept, n_iter, **solver_parameters):
# NB: weights, intercept expected to be numpy arrays

X, y = self.X, self.y
Expand Down Expand Up @@ -89,6 +89,7 @@ def evaluate_result(self, weights, intercept, **solver_parameters):
)
return dict(
value=value,
n_iter=n_iter,
objective_param___name=self.name,
**all_parameters,
)
Expand Down

0 comments on commit ca4077f

Please sign in to comment.