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

Outputs changes #21

Merged
merged 2 commits into from
Jan 7, 2025
Merged
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
34 changes: 16 additions & 18 deletions tools/ludwig_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
from utils import (
encode_image_to_base64,
get_html_closing,
get_html_template,
json_to_html_table
get_html_template
)

import yaml
Expand Down Expand Up @@ -207,21 +206,21 @@ def convert_parquet_to_csv(ludwig_output_directory_name):


def generate_html_report(title, ludwig_output_directory_name):
ludwig_output_directory = os.path.join(
output_directory, ludwig_output_directory_name)

test_statistics_html = ""
# Read test statistics JSON and convert to HTML table
try:
test_statistics_path = os.path.join(
ludwig_output_directory, TEST_STATISTICS_FILE_NAME)
with open(test_statistics_path, "r") as f:
test_statistics = json.load(f)
test_statistics_html = "<h2>Test Statistics</h2>"
test_statistics_html += json_to_html_table(
test_statistics)
except Exception as e:
LOG.info(f"Error reading test statistics: {e}")
# ludwig_output_directory = os.path.join(
# output_directory, ludwig_output_directory_name)

# test_statistics_html = ""
# # Read test statistics JSON and convert to HTML table
# try:
# test_statistics_path = os.path.join(
# ludwig_output_directory, TEST_STATISTICS_FILE_NAME)
# with open(test_statistics_path, "r") as f:
# test_statistics = json.load(f)
# test_statistics_html = "<h2>Test Statistics</h2>"
# test_statistics_html += json_to_html_table(
# test_statistics)
# except Exception as e:
# LOG.info(f"Error reading test statistics: {e}")

# Convert visualizations to HTML
plots_html = ""
Expand All @@ -244,7 +243,6 @@ def generate_html_report(title, ludwig_output_directory_name):
{get_html_template()}
<h1>{title}</h1>
{plots_html}
{test_statistics_html}
{get_html_closing()}
"""

Expand Down
2 changes: 1 addition & 1 deletion tools/ludwig_experiment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
<outputs>
<data format="ludwig_model" name="output_model" label="${tool.name} trained model on ${on_string}" />
<data format="html" name="output_report" from_work_dir="ludwig_experiment_report.html" label="${tool.name} report on ${on_string}" />
<collection type="list" name="output_pred_csv" label="${tool.name} predictions CSV on ${on_string}" >
<collection type="list" name="output_pred_csv" label="${tool.name} predictions CSVs/experiment stats on ${on_string}" >
<discover_datasets pattern="(?P&lt;designation&gt;predictions_parquet\.csv)" format="csv" directory="experiment_run" />
<discover_datasets pattern="(?P&lt;designation&gt;.+)\.json" format="json" directory="experiment_run" />
</collection>
Expand Down
2 changes: 2 additions & 0 deletions tools/ludwig_hyperopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def generate_html_report(title):
with open(hyperopt_hiplot_path, "r", encoding="utf-8") as file:
hyperopt_hiplot_html = file.read()
plots_html += f'<div class="hiplot">{hyperopt_hiplot_html}</div>'
plots_html += "uid is the identifier for different hyperopt runs"
plots_html += "<br><br>"

# Iterate through other files in viz_output_directory
for plot_file in sorted(os.listdir(viz_output_directory)):
Expand Down
2 changes: 1 addition & 1 deletion tools/ludwig_hyperopt.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
<param name="raw_data" type="data" format="zip" optional="true" label="Raw data" help="Optional. Needed for images."/>
</inputs>
<outputs>
<data format="ludwig_model" name="output_model" label="${tool.name} best model on ${on_string}" >
<data format="ludwig_model" name="output_model" label="${tool.name} best model files on ${on_string}" >
</data>
<data format="html" name="output_hyperopt" from_work_dir="ludwig_hyperopt_report.html" label="${tool.name} report on ${on_string}" />
<data format="json" name="output_hyperopt_stats" from_work_dir="hyperopt/hyperopt_statistics.json" label="${tool.name} statistics on ${on_string}" />
Expand Down
1 change: 0 additions & 1 deletion tools/test-data/ludwig_experiment_report_test.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions tools/test-data/ludwig_hyperopt_report_test.html

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion tools/test-data/ludwig_train_report_test.html

Large diffs are not rendered by default.

Binary file modified tools/test-data/temp_hyperopt_training.learning_rate.pdf
Binary file not shown.
Loading