src.main ¶
Functions:
| Name | Description |
|---|---|
full_stack | Get the full stack trace as string. |
main | Main entry point of the Machine Learning training script. |
parse_args | Parse command line arguments. |
test | Test a model. |
train | Train a model. |
Attributes:
| Name | Type | Description |
|---|---|---|
logger | | |
message | |
Attributes¶
Functions¶
full_stack ¶
full_stack() -> str
Get the full stack trace as string.
Returns:
| Name | Type | Description |
|---|---|---|
str | str | stack trace |
Reference:
- https://stackoverflow.com/a/16589622 (source)
Source code in src/main.py
main ¶
Main entry point of the Machine Learning training script.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| Logger | logger instance | required |
Raises:
| Type | Description |
|---|---|
ValueError | Unknown action in command line arguments |
Source code in src/main.py
parse_args ¶
parse_args() -> Namespace
Parse command line arguments.
This function creates an argument parser for the main.py script, defines the necessary arguments, and parses the command line input.
Returns:
| Name | Type | Description |
|---|---|---|
Namespace | Namespace | The parsed command line arguments |
Source code in src/main.py
test ¶
Test a model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| Module | model to test | required |
| Config | training configuration and logging handle | required |
Returns:
| Type | Description |
|---|---|
dict[str, Any] | Dict[str, Any]: calculated metrics |
Source code in src/main.py
train ¶
Train a model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| Module | model to train | required |
| Config | training configuration and logging handle | required |
Returns:
| Type | Description |
|---|---|
tuple[Module, dict[str, Any], int] | Tuple[torch.nn.Module, Dict[str, Any], int]: trained model, calculated metrics, and sample size |