sharkpy.reporting ================= .. py:module:: sharkpy.reporting Functions --------- .. autoapisummary:: sharkpy.reporting._create_temp_plot sharkpy.reporting._get_feature_importance_section sharkpy.reporting._get_statistical_details_section sharkpy.reporting._add_table_to_doc sharkpy.reporting._export_docx_report sharkpy.reporting._export_txt_report sharkpy.reporting._convert_docx_to_pdf sharkpy.reporting.report Module Contents --------------- .. py:function:: _create_temp_plot(shark: Any, kind: str, width: int = 8, height: int = 6) -> Optional[str] Create a temporary plot and return its path .. py:function:: _get_feature_importance_section(shark: Any) -> Tuple[List[str], Optional[pandas.DataFrame]] Generate feature importance section for the report and a DataFrame for DOCX table .. py:function:: _get_statistical_details_section(shark: Any) -> List[str] Generate statistical details section for the report .. py:function:: _add_table_to_doc(doc: docx.Document, df: pandas.DataFrame, title: str) Helper function to add a pandas DataFrame as a table to DOCX .. py:function:: _export_docx_report(path: str, shark: Any, cv_metrics_df: pandas.DataFrame, train_metrics_df: pandas.DataFrame, problem_type: str) Export report as Word document with enhanced formatting, tables, and plots. .. py:function:: _export_txt_report(path: str, lines: List[str]) Export report as text file .. py:function:: _convert_docx_to_pdf(docx_path: str, pdf_path: str) -> None Convert DOCX to PDF using available tools .. py:function:: report(self, cv_folds: int = 5, export_path: Optional[str] = None, format: str = 'txt') -> Tuple[Dict[str, numpy.ndarray], Dict[str, float]] Generate comprehensive model performance report including cross-validation. :param self: The Shark instance :type self: Any :param cv_folds: Number of folds for K-Fold cross-validation (default: 5) :type cv_folds: int, optional :param export_path: Path to export the report. If None, report is only printed. If a directory is provided, a timestamped file will be created. :type export_path: str, optional :param format: Export format: 'txt', 'pdf', or 'docx' (default: 'txt') :type format: str, optional :returns: - cv_results : dict Dictionary containing cross-validation results - train_metrics : dict Dictionary containing training set metrics :rtype: tuple .. rubric:: 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).