numcodecs_wasm_fourier_network

Classes:

  • FourierNetwork

    Fourier network codec which trains and overfits a fourier feature neural

FourierNetwork

FourierNetwork(
    fourier_features,
    fourier_scale,
    learning_rate,
    mini_batch_size,
    num_blocks,
    num_epochs,
    seed,
    _version="0.1.0",
)

Fourier network codec which trains and overfits a fourier feature neural network on encoding and predicts during decoding.

The approach is based on the papers by Tancik et al. 2020 (https://dl.acm.org/doi/abs/10.5555/3495724.3496356) and by Huang and Hoefler 2020 (https://arxiv.org/abs/2210.12538).

Parameters:
  • fourier_features (...) –

    The number of Fourier features that the data coordinates are projected to

  • fourier_scale (...) –

    The standard deviation of the Fourier features

  • learning_rate (...) –

    The learning rate for the Adam optimizer

  • mini_batch_size (...) –

    The optional mini-batch size used during training

    Setting the mini-batch size to None disables the use of batching, i.e. the network is trained using one large batch that includes the full data.

  • num_blocks (...) –

    The number of blocks in the network

  • num_epochs (...) –

    The number of epochs for which the network is trained

  • seed (...) –

    The seed for the random number generator used during encoding

  • _version (..., default: = "0.1.0" ) –

    The codec's encoding format version. Do not provide this parameter explicitly.

Methods:

  • decode

    Decode the data in buf.

  • encode

    Encode the data in buf.

  • from_config

    Instantiate the codec from a configuration dict.

  • get_config

    Returns the configuration of the codec.

codec_id class-attribute instance-attribute

codec_id = 'fourier-network.rs'

decode

decode(buf, out=None)

Decode the data in buf.

Parameters:
  • buf (Buffer) –

    Encoded data. May be any object supporting the new-style buffer protocol.

  • out (Buffer, default: None ) –

    Writeable buffer to store decoded data. N.B. if provided, this buffer must be exactly the right size to store the decoded data.

Returns:
  • dec( Buffer ) –

    Decoded data. May be any object supporting the new-style buffer protocol.

encode

encode(buf)

Encode the data in buf.

Parameters:
  • buf (Buffer) –

    Data to be encoded. May be any object supporting the new-style buffer protocol.

Returns:
  • enc( Buffer ) –

    Encoded data. May be any object supporting the new-style buffer protocol.

from_config classmethod

from_config(config)

Instantiate the codec from a configuration dict.

Parameters:
  • config (dict) –

    Configuration of the codec.

Returns:
  • codec( Self ) –

    Instantiated codec.

get_config

get_config()

Returns the configuration of the codec.

numcodecs.registry.get_codec(config) can be used to reconstruct this codec from the returned config.

Returns:
  • config( dict ) –

    Configuration of the codec.