Skip to content

Use csr_matrix() constructor in hash_graph_kernel.py #1

@jomora

Description

@jomora

Hey,
executing wl.weisfeiler_lehman_subtree_kernel with use_gram_matrix = True and kernel_parameters_wl = [3, True, False, 0] gives the following error.

Traceback (most recent call last):
  File "hash_graph_kernels.py", line 156, in <module>
    main()
  File "hash_graph_kernels.py", line 130, in main
    scale_attributes=True, lsh_bin_width=1.0, sigma=1.0, use_gram_matrices=True)
  File "/media/sf_SEML/code/examples/hashgraphkernel/graphkernel/hash_graph_kernel.py", line 52, in hash_graph_kernel
    feature_vectors = feature_vectors.tocsr()
AttributeError: 'numpy.ndarray' object has no attribute 'tocsr'

By using feature_vectors = sparse.csr_matrix(feature_vectors) this works out.
@chrsmrrs , what do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions