Skip to content

Commit

Permalink
Profile viewer fixes (#486)
Browse files Browse the repository at this point in the history
* Add NotebookProfileViewer notebook with wine quality dataset
* - Constraints report now shows all constraints for given feature
- Distinct count in feature_statistics now shows a percentage
- Added warning for missing pybars dependency

Co-authored-by: Jamie Broomall <88007022+jamie256@users.noreply.github.com>
  • Loading branch information
FelipeAdachi and jamie256 committed Mar 23, 2022
1 parent cdf4037 commit f2604f6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -548,10 +548,14 @@ <h1 class="no-responsive__title">Hold on! :)</h1>
return column.properties.tags.name
});


Handlebars.registerHelper("alertLIst", function (column) {
let alertListItem = column.map((value) => {
if (value[1][0]) {
return alertListElement(value[0], value[1][0][0], value[1][0][value[1][0].length - 1] === 0 || (failedConstraints++, false))
let alertListValue = value[1].map((cstr)=>{
return alertListElement(value[0],cstr[0],cstr[cstr.length - 1] === 0 || (failedConstraints++, false))
})
return alertListValue.join(' ')
} else {
return alertListElement('', value[0], value[value.length - 1] === 0 || (failedConstraints++, false))
}
Expand All @@ -563,6 +567,7 @@ <h1 class="no-responsive__title">Hold on! :)</h1>
})
return alertListItem.join(' ')
});

}

function openFilter() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ <h1 class="no-responsive__title">Hold on! :)</h1>
const feature = Object.values(column)[1]

if (feature.numberSummary && feature.numberSummary.uniqueCount) {
return feature.numberSummary.uniqueCount.estimate;
return (feature.numberSummary.uniqueCount.estimate/feature.numberSummary.count)*100;
}
return "0";
});
Expand Down
3 changes: 1 addition & 2 deletions src/whylogs/viz/browser_viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ def profile_viewer(profiles: List[DatasetProfile] = None, reference_profiles: Li
except ImportError as e:
Compiler = None
logger.debug(str(e))
logger.debug("Unable to load pybars; install pybars3 to load profile from directly from the current session ")

logger.warning("Unable to load pybars; install pybars3 to load profile directly from the current session ")
index_path = os.path.abspath(os.path.join(_MY_DIR, os.pardir, "viewer/templates", "index.html"))
webbrowser.open_new_tab(f"file:{index_path}#")
return None
Expand Down
3 changes: 2 additions & 1 deletion src/whylogs/viz/jupyter_notebook_viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ def __get_compiled_template(self, template_name):
except ImportError as e:
Compiler = None
logger.debug(str(e))
logger.debug("Unable to load pybars; install pybars3 to load profile from directly from the current session ")
logger.warning("Unable to load pybars; install pybars3 to load profile directly from the current session ")

with open(template_path, "r") as file_with_template:
source = file_with_template.read()
compiler = Compiler()
Expand Down

0 comments on commit f2604f6

Please sign in to comment.