ray.data.preprocessors.StandardScaler.serialize#

StandardScaler.serialize() str | bytes#

Serialize this preprocessor to a string or bytes.

⚠️ DO NOT OVERRIDE THIS METHOD IN SUBCLASSES ⚠️

This method is marked as @final in the concrete implementation and handles the complete serialization orchestration. Subclasses should implement the abstract methods instead: _get_serializable_fields() and _get_stats().

Serialization Process:

  1. Extracts fields via _get_serializable_fields()

  2. Extracts statistics via _get_stats()

  3. Packages data with metadata (type, version, format)

  4. Delegates to SerializationHandlerFactory for format-specific handling

  5. Returns serialized data with magic bytes for format identification

Supported Formats:

  • CloudPickle (default):

  • Pickle (legacy): Backward compatibility for existing serialized data

Returns:

Serialized preprocessor data (bytes for CloudPickle, str for legacy Pickle)

Raises:

ValueError – If the serialization format is invalid or unsupported

DeveloperAPI: This API may change across minor Ray releases.