NumpySerializer: NumpySerializer Class

NumpySerializerR Documentation

NumpySerializer Class

Description

Serialize data of various formats to a numpy npy file format. This serializer class uses python numpy package to serialize, R objects through the use of the 'reticulate' package.

Super classes

sagemaker.mlcore::BaseSerializer -> sagemaker.mlcore::SimpleBaseSerializer -> NumpySerializer

Public fields

dtype

The dtype of the data

np

Initialized python numpy package

Methods

Public methods

Inherited methods

Method new()

Initialize a NumpySerializer instance.

Usage
NumpySerializer$new(dtype = NULL, content_type = "application/x-npy")
Arguments
dtype

(str): The 'dtype' of the data. 'reticulate' auto maps to python, please set R class to be serialized.

content_type

(str): The MIME type to signal to the inference endpoint when sending request data (default: "application/x-npy").


Method serialize()

Serialize data to a buffer using the .npy format.

Usage
NumpySerializer$serialize(data)
Arguments
data

(object): Data to be serialized. Can be a NumPy array, list, file, or buffer.

Returns

(raw): A buffer containing data serialized in the .npy format.


Method clone()

The objects of this class are cloneable with this method.

Usage
NumpySerializer$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

Other serializer: BaseDeserializer, BaseSerializer, BytesDeserializer, CSVDeserializer, CSVSerializer, DataTableDeserializer, IdentitySerializer, JSONDeserializer, JSONLinesDeserializer, JSONLinesSerializer, JSONSerializer, LibSVMSerializer, NumpyDeserializer, SimpleBaseDeserializer, SimpleBaseSerializer, SparseMatrixSerializer, StringDeserializer, TibbleDeserializer


DyfanJones/sagemaker-r-mlcore documentation built on May 3, 2022, 10:08 a.m.