def build(state: MLApplicationState = None) -> str:
     base_path = PathBuilder.build(state.path / "../HTML_output/")
     html_map = MLApplicationHTMLBuilder.make_html_map(state, base_path)
     result_file = base_path / "MLModelTraining_{state.name}.html"
     TemplateParser.parse(template_path=EnvironmentSettings.html_templates_path / "MLApplication.html",
                          template_map=html_map, result_path=result_file)
     return result_file
    def build(report_results: dict, result_path: Path, instruction_result_paths: dict) -> Path:
        html_map = MultiDatasetBenchmarkHTMLBuilder._make_html_map(report_results, result_path, instruction_result_paths)
        result_file = result_path / "index.html"

        TemplateParser.parse(template_path=EnvironmentSettings.html_templates_path / "MultiDatasetBenchmark.html",
                             template_map=html_map, result_path=result_file)

        return result_file
Beispiel #3
0
    def _make_document(presentations: List[InstructionPresentation], path: Path) -> Path:
        result_path = path / "index.html"
        if len(presentations) > 1:
            html_map = {"instructions": presentations, "css_path": EnvironmentSettings.html_templates_path / "css/custom.css",
                        "full_specs": Util.get_full_specs_path(path), 'immuneML_version': MLUtil.get_immuneML_version()}
            TemplateParser.parse(template_path=EnvironmentSettings.html_templates_path / "index.html",
                                 template_map=html_map, result_path=result_path)
        elif len(presentations) == 1:
            shutil.copyfile(str(presentations[0].path), str(result_path))
            HTMLBuilder._update_paths(result_path)
        else:
            result_path = None

        return result_path
Beispiel #4
0
    def build(state: DatasetExportState) -> Path:
        """
        Function that builds the HTML files based on the Simulation state.
        Arguments:
            state: SimulationState object including all details of the Simulation instruction
        Returns:
             path to the main HTML file (which is located under state.result_path)
        """
        base_path = PathBuilder.build(state.result_path / "../HTML_output/")
        html_map = DatasetExportHTMLBuilder.make_html_map(state, base_path)
        result_file = base_path / f"DatasetExport_{state.name}.html"

        TemplateParser.parse(template_path=EnvironmentSettings.html_templates_path / "DatasetExport.html",
                             template_map=html_map, result_path=result_file)

        return result_file
    def build(state: ExploratoryAnalysisState) -> Path:
        """
        Function that builds the HTML files based on the ExploratoryAnalysis state.
        Arguments:
            state: ExploratoryAnalysisState object with details and results of the instruction
        Returns:
             path to the main HTML file (which is located under state.result_path)
        """
        base_path = PathBuilder.build(state.result_path / "../HTML_output/")
        html_map = ExploratoryAnalysisHTMLBuilder.make_html_map(
            state, base_path)
        result_file = base_path / f"ExploratoryAnalysis_{state.name}.html"

        TemplateParser.parse(
            template_path=EnvironmentSettings.html_templates_path /
            "ExploratoryAnalysis.html",
            template_map=html_map,
            result_path=result_file)

        return result_file
Beispiel #6
0
    def _make_assessment_reports(state, i, hp_setting_key, assessment_state,
                                 label, base_path: Path):
        path = base_path / f"{state.name}_{label}_{hp_setting_key}_assessment_reports_split_{i + 1}.html"

        hp_item = assessment_state.label_states[label].assessment_items[
            hp_setting_key]
        data = {
            "split_index":
            i + 1,
            "hp_setting":
            hp_setting_key,
            "label":
            label,
            "css_style":
            Util.get_css_content(HPHTMLBuilder.CSS_PATH),
            "has_encoding_reports":
            len(hp_item.encoding_train_results) > 0
            or len(hp_item.encoding_test_results) > 0,
            "has_ml_reports":
            len(hp_item.model_report_results) > 0,
            "encoding_train_reports":
            Util.to_dict_recursive(hp_item.encoding_train_results, base_path)
            if len(hp_item.encoding_train_results) > 0 else None,
            "encoding_test_reports":
            Util.to_dict_recursive(hp_item.encoding_test_results, base_path)
            if len(hp_item.encoding_test_results) > 0 else None,
            "ml_reports":
            Util.to_dict_recursive(hp_item.model_report_results, base_path)
            if len(hp_item.model_report_results) > 0 else None
        }

        if data["has_ml_reports"] or data["has_encoding_reports"]:
            TemplateParser.parse(
                template_path=EnvironmentSettings.html_templates_path /
                "Reports.html",
                template_map=data,
                result_path=path)
            return path.name
        else:
            return None
Beispiel #7
0
    def build(state: TrainMLModelState = None) -> Path:
        """
        Function that builds the HTML files based on the HPOptimization state.
        Arguments:
            state: HPOptimizationState object with all details on the optimization
        Returns:
             path to the main HTML file (index.html which is located under state.result_path)
        """

        base_path = PathBuilder.build(state.path / "../HTML_output/")
        state = HPHTMLBuilder._move_reports_recursive(state, base_path)
        html_map = HPHTMLBuilder._make_main_html_map(state, base_path)
        result_file = base_path / f"TrainMLModelReport_{state.name}.html"

        TemplateParser.parse(template_path=EnvironmentSettings.html_templates_path / "HPOptimization.html",
                             template_map=html_map, result_path=result_file)

        for label in state.label_configuration.get_labels_by_name():
            for index, item in enumerate(HPHTMLBuilder._make_assessment_pages(state, base_path, label)):
                TemplateParser.parse(template_path=EnvironmentSettings.html_templates_path / "AssessmentSplitDetails.html",
                                     template_map=item,
                                     result_path=base_path / HPHTMLBuilder._make_assessment_split_path(index, state.name, label))

        for label in state.label_configuration.get_labels_by_name():
            for assessment_index in range(state.assessment.split_count):
                TemplateParser.parse(template_path=EnvironmentSettings.html_templates_path / "SelectionDetails.html",
                                     template_map=HPHTMLBuilder._make_selection(state, assessment_index, label, base_path),
                                     result_path=base_path / HPHTMLBuilder._make_selection_split_path(assessment_index, label, state.name))

        return result_file