sharkpy.reporting
Functions
|
Create a temporary plot and return its path |
|
Generate feature importance section for the report and a DataFrame for DOCX table |
|
Generate statistical details section for the report |
|
Helper function to add a pandas DataFrame as a table to DOCX |
|
Export report as Word document with enhanced formatting, tables, and plots. |
|
Export report as text file |
|
Convert DOCX to PDF using available tools |
|
Generate comprehensive model performance report including cross-validation. |
Module Contents
- sharkpy.reporting._create_temp_plot(shark: Any, kind: str, width: int = 8, height: int = 6) str | None[source]
Create a temporary plot and return its path
- sharkpy.reporting._get_feature_importance_section(shark: Any) Tuple[List[str], pandas.DataFrame | None][source]
Generate feature importance section for the report and a DataFrame for DOCX table
- sharkpy.reporting._get_statistical_details_section(shark: Any) List[str][source]
Generate statistical details section for the report
- sharkpy.reporting._add_table_to_doc(doc: docx.Document, df: pandas.DataFrame, title: str)[source]
Helper function to add a pandas DataFrame as a table to DOCX
- sharkpy.reporting._export_docx_report(path: str, shark: Any, cv_metrics_df: pandas.DataFrame, train_metrics_df: pandas.DataFrame, problem_type: str)[source]
Export report as Word document with enhanced formatting, tables, and plots.
- sharkpy.reporting._export_txt_report(path: str, lines: List[str])[source]
Export report as text file
- sharkpy.reporting._convert_docx_to_pdf(docx_path: str, pdf_path: str) None[source]
Convert DOCX to PDF using available tools
- sharkpy.reporting.report(self, cv_folds: int = 5, export_path: str | None = None, format: str = 'txt') Tuple[Dict[str, numpy.ndarray], Dict[str, float]][source]
Generate comprehensive model performance report including cross-validation.
- Parameters:
self (Any) – The Shark instance
cv_folds (int, optional) – Number of folds for K-Fold cross-validation (default: 5)
export_path (str, optional) – Path to export the report. If None, report is only printed. If a directory is provided, a timestamped file will be created.
format (str, optional) – Export format: ‘txt’, ‘pdf’, or ‘docx’ (default: ‘txt’)
- Returns:
- cv_resultsdict
Dictionary containing cross-validation results
- train_metricsdict
Dictionary containing training set metrics
- Return type:
tuple
Notes
For PDF export, ensure Microsoft Word or LibreOffice is installed for docx2pdf conversion.
Visualizations include feature importance, predictions/residuals (regression), or confusion matrix/ROC/PR curves (classification).