Skip to content

Random state not passed in randomized svd initialization case #615

@MrBones1102

Description

@MrBones1102

Describe the bug

initialize_cp() in _cp.py does not pass rng to svd_interface() in the init == "svd" case, meaning there is no way to fix the random state when using the "randomized_svd" initialization method.

Steps or Code to Reproduce

I was using the parafac2 method but anything that calls initialize_cp() would be effected.
The lack of fixed state should be apparent by specifying init="svd", svd="randomized_svd", and random_state=42 when calling the parafac2() method.

Expected behavior

I would expect resulting factor matrices to be equal when fixed state is specified

Actual result

Factor matrices experience run-to-run variation.

Versions

Linux-6.17.0-8-generic-x86_64-with-glibc2.42
Python 3.12.6 (main, Sep 9 2024, 22:11:19) [Clang 18.1.8 ]
NumPy 2.3.5
SciPy 1.16.3
TensorLy 0.9.0
CuPy 13.6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions