python-qds / qdscreen

Quasi-determinism screening for fast Bayesian Network Structure Learning (from T.Rahier's PhD thesis, 2018)
https://python-qds.github.io/qdscreen/
BSD 3-Clause "New" or "Revised" License
2 stars 0 forks source link

UserWarning: object dtype is not supported by sparse matrices #20

Closed smarie closed 2 years ago

smarie commented 2 years ago

From the gallery example

from qdscreen import qd_screen

# detect strict deterministic relationships
qd_forest = qd_screen(df)

# Fit selector model
qd_forest.fit_selector_model(df)

yields

UserWarning: object dtype is not supported by sparse matrices
  warnings.warn("object dtype is not supported by sparse matrices")

It seems that this is not supported but works... https://stackoverflow.com/questions/47845327/convert-numpy-object-array-to-sparse-matrix

smarie commented 2 years ago

Fixed by #11 but apparently this also happens in the sklearn adapter:

from qdscreen.sklearn import QDScreen

X = [[0, 2, 0, 3],
     [0, 1, 4, 3],
     [0, 1, 1, 3]]

selector = QDScreen()
Xsel = selector.fit_transform(X)