Skip to content

Commit ce48301

Browse files
committed
Comment out usage examples in validation.py
1 parent 8c03d10 commit ce48301

File tree

1 file changed

+47
-47
lines changed

1 file changed

+47
-47
lines changed

Scripts/utils/validation.py

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -447,50 +447,50 @@ def _bar_plot(df: pd.DataFrame) -> str:
447447

448448
return _bar_plot
449449

450-
# Usage example
451-
test_valid = Validation()
452-
453-
# Create a group without default error terms
454-
group = test_valid.create_group("test", add_default_error_terms=False)
455-
456-
# Add sample predictions to the group
457-
# use arbitrary "example1" and "example2" columns for grouping
458-
group.add_item('s1', 1, 1, example1='a' , example2=1)
459-
group.add_item('s2', 2, 2.5, example1='a' , example2=2)
460-
group.add_item('s3', 3, 4, example1='b')
461-
group.add_item('s4', 4, 6, example1='c' , example2=2)
462-
group.add_item('s5', 5, 7, example1='b' , example2=1)
463-
464-
# Add error terms
465-
group.add_error_terms({'squared_error': squared_error})
466-
467-
# Add aggregations to the group
468-
# Mean absolute error for all items
469-
group.add_aggregation('mae', mae)
470-
# Maximum error for all items, grouped by test_val
471-
group.add_aggregation('max', max_error, group_by='example2')
472-
473-
# mean squared error for predictions >= 3, grouped by test1
474-
group.add_aggregation("mse_error", mse, filter='prediction>=3', group_by='example1')
475-
# Same as above but using a precalculated error term
476-
group.add_aggregation('mse_error2', mean('squared_error'), filter='prediction>=3', group_by='example1')
477-
478-
group2 = test_valid.create_group("test2")
479-
# Add larget dataset of random points
480-
for i in range(1, 1000):
481-
group2.add_item(f'point{i}', i**1.02 + random.random()*200-150, i, even='even' if i % 2 == 0 else 'odd')
482-
group2.add_aggregation('mse', mean('squared_error'), group_by='even')
483-
484-
group.add_visualization('test bar plot', bar_plot(y=['prediction', 'expected', 'squared_error']))
485-
group2.add_visualization('test scatter plot', scatter_plot(color='absolute_error'))
486-
487-
# Run all aggregations and print the results
488-
test_valid.to_html('test_validation.html')
489-
# Save the validation object to a file
490-
test_valid.save_to_file('test_validation.pklz')
491-
# Load the validation object from a file
492-
loaded_valid = Validation.load_from_file('test_validation.pklz')
493-
loaded_valid.to_html('test_validation_loaded.html')
494-
# Open the generated HTML file in the default web browser
495-
import webbrowser
496-
webbrowser.open('test_validation.html')
450+
# # Usage example
451+
# test_valid = Validation()
452+
453+
# # Create a group without default error terms
454+
# group = test_valid.create_group("test", add_default_error_terms=False)
455+
456+
# # Add sample predictions to the group
457+
# # use arbitrary "example1" and "example2" columns for grouping
458+
# group.add_item('s1', 1, 1, example1='a' , example2=1)
459+
# group.add_item('s2', 2, 2.5, example1='a' , example2=2)
460+
# group.add_item('s3', 3, 4, example1='b')
461+
# group.add_item('s4', 4, 6, example1='c' , example2=2)
462+
# group.add_item('s5', 5, 7, example1='b' , example2=1)
463+
464+
# # Add error terms
465+
# group.add_error_terms({'squared_error': squared_error})
466+
467+
# # Add aggregations to the group
468+
# # Mean absolute error for all items
469+
# group.add_aggregation('mae', mae)
470+
# # Maximum error for all items, grouped by test_val
471+
# group.add_aggregation('max', max_error, group_by='example2')
472+
473+
# # mean squared error for predictions >= 3, grouped by test1
474+
# group.add_aggregation("mse_error", mse, filter='prediction>=3', group_by='example1')
475+
# # Same as above but using a precalculated error term
476+
# group.add_aggregation('mse_error2', mean('squared_error'), filter='prediction>=3', group_by='example1')
477+
478+
# group2 = test_valid.create_group("test2")
479+
# # Add larget dataset of random points
480+
# for i in range(1, 1000):
481+
# group2.add_item(f'point{i}', i**1.02 + random.random()*200-150, i, even='even' if i % 2 == 0 else 'odd')
482+
# group2.add_aggregation('mse', mean('squared_error'), group_by='even')
483+
484+
# group.add_visualization('test bar plot', bar_plot(y=['prediction', 'expected', 'squared_error']))
485+
# group2.add_visualization('test scatter plot', scatter_plot(color='absolute_error'))
486+
487+
# # Run all aggregations and print the results
488+
# test_valid.to_html('test_validation.html')
489+
# # Save the validation object to a file
490+
# test_valid.save_to_file('test_validation.pklz')
491+
# # Load the validation object from a file
492+
# loaded_valid = Validation.load_from_file('test_validation.pklz')
493+
# loaded_valid.to_html('test_validation_loaded.html')
494+
# # Open the generated HTML file in the default web browser
495+
# import webbrowser
496+
# webbrowser.open('test_validation.html')

0 commit comments

Comments
 (0)