package neural_nets_lib
Install
    
    dune-project
 Dependency
Authors
Maintainers
Sources
md5=5beaaa0b377bec3badffffbf9f4dec4a
    
    
  sha512=a37a67452746143f0f5ba2e81f98d6fed31fb4397e0a85f4a35aedc805b4e0405ea89d465c6f80941c465fb61d5d6119806cb73b5c5ead925797eb80d19c5ade
    
    
  doc/neural_nets_lib.datasets/Datasets/Dataset_utils/index.html
Module Datasets.Dataset_utilsSource
Utilities for downloading and managing datasets.
Return the platform-specific cache directory path for the given dataset.
The default location is "~/.cache/ocannl/datasets/dataset_name/".
Parameters
- dataset_name: the name of the dataset.
 
Returns
- the cache directory path, including trailing slash.
 
Download a file from a URL to a destination path.
Creates parent directories as needed, downloads the file from url, and saves it to dest_path.
Parameters
- url: the source URL of the file.
 - dest_path: local path to save the downloaded file.
 
Raises
Failureon download or write error.
Ensure a file exists at the given path, downloading if necessary.
Checks if dest_path exists. If not, downloads the file from url.
Parameters
- url: the source URL of the file.
 - dest_path: local path to ensure the file exists.
 
Raises
Failureon download or write error.
val ensure_extracted_archive : 
  url:string ->
  archive_path:string ->
  extract_dir:string ->
  check_file:string ->
  unitEnsure an archive is downloaded, extracted, and a file exists.
Checks if check_file (relative to extract_dir) exists. If not, downloads the archive from url to archive_path, extracts it into extract_dir, and verifies check_file is present. Currently supports only .tar.gz archives.
Parameters
- url: the source URL of the archive.
 - archive_path: local path for the downloaded archive.
 - extract_dir: directory to extract the archive into.
 - check_file: relative path under 
extract_dirto verify extraction. 
Raises
Failureon download, extraction, or missingcheck_file.
Ensure a gzip-compressed file is decompressed to a target path.
If target_path exists, does nothing and returns true. Otherwise, if gz_path exists, decompresses it to target_path.
Parameters
- gz_path: the path to the .gz file to decompress.
 - target_path: the destination path for the decompressed file.
 
Returns
trueiftarget_pathexists after the operation.falseifgz_pathdoes not exist.
Raises
Failureon gzip decompression error.
Parse a CSV cell as a float.
Attempts to convert value to a float. On failure, raises Failure with a descriptive message including context ().
Parameters
- context: a function returning context information for error messages.
 - value: the string to parse as a float.
 
Returns
- the parsed float.
 
Raises
Failureifvaluecannot be parsed as a float.
Parse a CSV cell as an integer.
Attempts to convert value to an int. On failure, raises Failure with a descriptive message including context ().
Parameters
- context: a function returning context information for error messages.
 - value: the string to parse as an int.
 
Returns
- the parsed integer.
 
Raises
Failureifvaluecannot be parsed as an int.
Recursively create a directory and its parents.
Creates the directory at path, along with any missing parent directories. If path already exists as a directory, does nothing.
Parameters
- path: the directory path to create.
 
Raises
Unix.Unix_errorif creation fails for other reasons.