factor_analyzer icon indicating copy to clipboard operation
factor_analyzer copied to clipboard

FactorAnalyzer(method="principal") throws sklearn FutureWarning in randomized_svd()

Open FlorinAndrei opened this issue 3 years ago • 0 comments

Describe the bug FactorAnalyzer(method="principal") triggers a FutureWarning in sklearn's randomized_svd().

To Reproduce Use this dataset:

ifanmot.csv

Code:

import pandas as pd
from factor_analyzer import FactorAnalyzer

ifanmot = pd.read_csv('ifanmot.csv')
ifanmot_mat = ifanmot.iloc[:, 0:42].to_numpy()
fa_vari3 = FactorAnalyzer(
    n_factors=3, rotation="varimax", method="principal"
)
fa_vari3.fit(ifanmot_mat)

Warning:

C:\Users\someuser\AppData\Roaming\Python\Python39\site-packages\sklearn\utils\extmath.py:369: FutureWarning: If 'random_state' is not supplied, the current default is to use 0 as a fixed seed. This will change to  None in version 1.2 leading to non-deterministic results that better reflect nature of the randomized_svd solver. If you want to silence this warning, set 'random_state' to an integer seed or to None explicitly depending if you want your code to be deterministic or not.
  warnings.warn(

I cannot find a way to turn this warning off.

Expected behavior There should be no warning.

Desktop (please complete the following information): Windows 10 Python 3.9.9 Jupyter Notebook Latest versions of all libraries involved here.

FlorinAndrei avatar Jun 14 '22 03:06 FlorinAndrei