Skip to content

Module wtracker.neural.train_results

View Source
from typing import List, NamedTuple

class BatchResult(NamedTuple):

    """

    Represents the result of training for a single batch: the loss

    and number of correct classifications.

    """

    loss: float

    num_correct: int

class EpochResult(NamedTuple):

    """

    Represents the result of training for a single epoch: the loss per batch

    and accuracy on the dataset (train or test).

    """

    losses: List[float]

    accuracy: float

class FitResult(NamedTuple):

    """

    Represents the result of fitting a model for multiple epochs given a

    training and test (or validation) set.

    The losses are for each batch and the accuracies are per epoch.

    """

    num_epochs: int

    train_loss: List[float]

    train_acc: List[float]

    test_loss: List[float]

    test_acc: List[float]

Classes

BatchResult

class BatchResult(
    /,
    *args,
    **kwargs
)

Represents the result of training for a single batch: the loss

and number of correct classifications.

View Source
class BatchResult(NamedTuple):

    """

    Represents the result of training for a single batch: the loss

    and number of correct classifications.

    """

    loss: float

    num_correct: int

Ancestors (in MRO)

  • builtins.tuple

Class variables

loss
num_correct

Methods

count

def count(
    self,
    value,
    /
)

Return number of occurrences of value.

index

def index(
    self,
    value,
    start=0,
    stop=9223372036854775807,
    /
)

Return first index of value.

Raises ValueError if the value is not present.

EpochResult

class EpochResult(
    /,
    *args,
    **kwargs
)

Represents the result of training for a single epoch: the loss per batch

and accuracy on the dataset (train or test).

View Source
class EpochResult(NamedTuple):

    """

    Represents the result of training for a single epoch: the loss per batch

    and accuracy on the dataset (train or test).

    """

    losses: List[float]

    accuracy: float

Ancestors (in MRO)

  • builtins.tuple

Class variables

accuracy
losses

Methods

count

def count(
    self,
    value,
    /
)

Return number of occurrences of value.

index

def index(
    self,
    value,
    start=0,
    stop=9223372036854775807,
    /
)

Return first index of value.

Raises ValueError if the value is not present.

FitResult

class FitResult(
    /,
    *args,
    **kwargs
)

Represents the result of fitting a model for multiple epochs given a

training and test (or validation) set. The losses are for each batch and the accuracies are per epoch.

View Source
class FitResult(NamedTuple):

    """

    Represents the result of fitting a model for multiple epochs given a

    training and test (or validation) set.

    The losses are for each batch and the accuracies are per epoch.

    """

    num_epochs: int

    train_loss: List[float]

    train_acc: List[float]

    test_loss: List[float]

    test_acc: List[float]

Ancestors (in MRO)

  • builtins.tuple

Class variables

num_epochs
test_acc
test_loss
train_acc
train_loss

Methods

count

def count(
    self,
    value,
    /
)

Return number of occurrences of value.

index

def index(
    self,
    value,
    start=0,
    stop=9223372036854775807,
    /
)

Return first index of value.

Raises ValueError if the value is not present.