Skip to content

Error in plot_NMFk.plot_consensus_mat: ValueError: Argument must be an image or collection in this Axes matplotlib #52

@MaksimEkin

Description

@MaksimEkin

Irregular error when plotting consensus matrix in TELF.factorization.utilities.plot_NMFk.plot_consesnsus_mat at plt.imshow(C).

Error: ValueError: Argument must be an image or collection in this Axes matplotlib

I believe might be caused by some issue in matplotlib. Added temporary hot-fix where plotting is skipped. If we re-run the code the missing plots are generated without error.

Replicate:

import os
os.environ["OMP_NUM_THREADS"] = "1" # export OMP_NUM_THREADS=1
os.environ["OPENBLAS_NUM_THREADS"] = "1" # export OPENBLAS_NUM_THREADS=1
os.environ["MKL_NUM_THREADS"] = "1" # export MKL_NUM_THREADS=1
os.environ["VECLIB_MAXIMUM_THREADS"] = "1" # export VECLIB_MAXIMUM_THREADS=1
os.environ["NUMEXPR_NUM_THREADS"] = "1" # export NUMEXPR_NUM_THREADS=1
from TELF.factorization import NMFk
import sys; sys.path.append("../../scripts/")
from generate_X import gen_data,gen_data_sparse

X = gen_data(R=4, shape=[100, 200])["X"]

params = {
    "n_perturbs":12,
    "n_iters":100,
    "epsilon":0.015,
    "n_jobs":-1,
    "init":"nnsvd", 
    "use_gpu":False,
    "save_path":"../../results/", 
    "save_output":True,
    "collect_output":True,
    "predict_k_method":"sill",
    "verbose":True,
    "nmf_verbose":False,
    "transpose":False,
    "sill_thresh":0.8,
    "pruned":True,
    'nmf_method':'nmf_fro_mu', # nmf_fro_mu, nmf_recommender
    "calculate_error":True,
    "predict_k":True,
    "use_consensus_stopping":0,
    "calculate_pac":True,
    "consensus_mat":True,
    "perturb_type":"uniform",
    "perturb_multiprocessing":False,
    "perturb_verbose":False,
    "simple_plot":True
}
Ks = range(1,9,1)
name = "Example_NMFk"
note = "This is an example run of NMFk"

model = NMFk(**params)
results = model.fit(X, Ks, name, note)

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions