Skip to content
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

adding test_pipeline to see flow and ease debugging #22

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
File renamed without changes.
31 changes: 31 additions & 0 deletions test_pipeline.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from datasets.simulated import Dataset
from objective import Objective
from solvers.python_gd import Solver

# In general the test requires having installed the dependencies before
# For the original template having benchopt installed is sufficient
def test_pipeline():
# We add manually attributes of dataset, objective, solver for the test

dataset = Dataset()
dataset.n_samples = 1000
dataset.n_features = 500
dataset.random_state = 27
dataset_params = dataset.get_data()
objective = Objective()
objective.whiten_y = True
objective.set_data(**dataset_params)
objective_params = objective.get_objective()

solver = Solver()
solver.scale_step = 1.
solver.set_objective(**objective_params)
solver.run(n_iter=10)
results = solver.get_result()

metrics = objective.compute(results)
assert 'value' in metrics.keys()
print('Pipeline functional')

if __name__ == '__main__':
test_pipeline()