Skip to content

Commit

Permalink
fix links for model in report (#714)
Browse files Browse the repository at this point in the history
  • Loading branch information
pplonski committed Mar 8, 2024
1 parent e9ebbd3 commit d94397a
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 2 deletions.
4 changes: 2 additions & 2 deletions supervised/base_automl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2287,7 +2287,7 @@ def from_json(self, json_data):
.styled-table td, .styled-table th {{
border: 1px solid #ddd;
padding: 8px;
{{
}}
.styled-table tr:nth-child(even){{background-color: #f2f2f2;}}
Expand Down Expand Up @@ -2389,7 +2389,7 @@ def _md_to_html(self, md_fname, page_type, dir_path, me=None):
content_html = "\n".join(new_content)

# change links
if page_type == "main":
if page_type == "automl-report-main":
for f in os.listdir(dir_path):
if os.path.exists(os.path.join(dir_path, f, "README.md")):
old = f'href="{f}/README.html"'
Expand Down
49 changes: 49 additions & 0 deletions tests/tests_automl/test_automl_report.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import os
import shutil
import unittest
from pathlib import Path

import numpy as np
import pandas as pd
import pytest
from sklearn import datasets
from sklearn.decomposition import PCA
from sklearn.pipeline import make_pipeline

from supervised import AutoML
from supervised.exceptions import AutoMLException

iris = datasets.load_iris()

class AutoMLReportTest(unittest.TestCase):
automl_dir = "AutoMLTest"

def tearDown(self):
shutil.rmtree(self.automl_dir, ignore_errors=True)

def setUp(self):
shutil.rmtree(self.automl_dir, ignore_errors=True)

def test_report(self):
"""Tests AutoML in the iris dataset (Multiclass classification)"""
model = AutoML(
algorithms=["Baseline"],
explain_level=0, verbose=0, random_state=1, results_path=self.automl_dir
)
model.fit(iris.data, iris.target)
model.report()

report_path = os.path.join(self.automl_dir, "README.html")
self.assertTrue(os.path.exists(report_path))

content = None
with open(report_path, "r") as fin:
content = fin.read()


#print(content)
link = '<a href="1_Baseline/README.html">'
self.assertFalse(link in content)



0 comments on commit d94397a

Please sign in to comment.