Skip to content

arkas.section

arkas.section

Contain sections.

arkas.section.AccuracySection

Bases: BaseSection

Implement a section that analyze accuracy results.

Parameters:

Name Type Description Default
result BaseResult

The data structure containing the results.

required

Example usage:

>>> import numpy as np
>>> from arkas.section import AccuracySection
>>> from arkas.result import AccuracyResult
>>> section = AccuracySection(
...     result=AccuracyResult(
...         y_true=np.array([1, 0, 0, 1, 1]), y_pred=np.array([1, 0, 0, 1, 1])
...     )
... )
>>> section
AccuracySection(
  (result): AccuracyResult(y_true=(5,), y_pred=(5,), nan_policy='propagate')
)
>>> section.generate_html_body()

arkas.section.BaseSection

Bases: ABC

Define the base class to manage sections.

arkas.section.BaseSection.equal abstractmethod
equal(other: Any) -> bool

Indicate if two sections are equal or not.

Parameters:

Name Type Description Default
other Any

The other section to compare.

required

Returns:

Type Description
bool

True if the two sections are equal, otherwise False.

arkas.section.BaseSection.generate_html_body abstractmethod
generate_html_body(
    number: str = "",
    tags: Sequence[str] = (),
    depth: int = 0,
) -> str

Return the HTML body associated to the section.

Parameters:

Name Type Description Default
number str

The section number.

''
tags Sequence[str]

The tags associated to the section.

()
depth int

The depth in the report.

0

Returns:

Type Description
str

The HTML body associated to the section.

arkas.section.BaseSection.generate_html_toc abstractmethod
generate_html_toc(
    number: str = "",
    tags: Sequence[str] = (),
    depth: int = 0,
    max_depth: int = 1,
) -> str

Return the HTML table of content (TOC) associated to the section.

Parameters:

Name Type Description Default
number str

The section number associated to the section.

''
tags Sequence[str]

The tags associated to the section.

()
depth int

The depth in the report.

0
max_depth int

The maximum depth to generate in the TOC.

1

Returns:

Type Description
str

The HTML table of content associated to the section.

arkas.section.BinaryPrecisionSection

Bases: BaseSection

Implement a section that analyze precision results.

Parameters:

Name Type Description Default
result BaseResult

The data structure containing the results.

required

Example usage:

>>> import numpy as np
>>> from arkas.section import BinaryPrecisionSection
>>> from arkas.result import BinaryPrecisionResult
>>> section = BinaryPrecisionSection(
...     result=BinaryPrecisionResult(
...         y_true=np.array([1, 0, 0, 1, 1]), y_pred=np.array([1, 0, 0, 1, 1])
...     )
... )
>>> section
BinaryPrecisionSection(
  (result): BinaryPrecisionResult(y_true=(5,), y_pred=(5,), nan_policy='propagate')
)
>>> section.generate_html_body()

arkas.section.ContentSection

Bases: BaseSection

Implement a section that generates the given custom content.

Parameters:

Name Type Description Default
content str

The content to use in the HTML code.

required

Example usage:

>>> from arkas.section import ContentSection
>>> section = ContentSection(content="meow")
>>> section
ContentSection()
>>> section.generate_html_body()

arkas.section.ResultSection

Bases: BaseSection

Implement a section that show the results in a HTML format.

Parameters:

Name Type Description Default
result BaseResult

The data structure containing the results.

required

Example usage:

>>> import numpy as np
>>> from arkas.section import ResultSection
>>> from arkas.result import AccuracyResult
>>> section = ResultSection(
...     result=AccuracyResult(
...         y_true=np.array([1, 0, 0, 1, 1]), y_pred=np.array([1, 0, 0, 1, 1])
...     )
... )
>>> section
ResultSection(
  (result): AccuracyResult(y_true=(5,), y_pred=(5,), nan_policy='propagate')
)
>>> section.generate_html_body()