Skip to content

Dimension mismatch #310

Open
Open
@BJWiley233

Description

@BJWiley233

Describe the bug
A clear and concise description of what the bug is.

Here's a quick checklist in what to include:

  • Include a detailed description of the bug or suggestion
  • pip list or conda list of the environment you are using (please attach a txt file to the issue).
  • deeptime and operating system versions
  • Minimal example if possible, a Python script, zipped input data (if not too large)

I am not sure what type of multiplication we want to do here , i.e. is it element-wise multplication, or are we doing matrix multiplication, but I get an error when it tries to multiply pi0[:, np.newaxis] which for me is a numpy array with shape (11343, 1) and sums to 1 with P0 which is a csr_matrix of shape (11343, 11343) and each row sums to 1.

pi0[:, np.newaxis] * P0

gives ValueError: dimension mismatch

So instead which do we want?

V0 = P0.multiply(pi0[:, np.newaxis])  # Element-wise multiplication

which will be shape (11343, 11343) then each row will then add up to each corresponding entry in pi0[:, np.newaxis]

or matrix-multiplication which gives the sum of each row as a 1D vector, i.e. not a row but the row sum which again totals to 1.

pi0[:, np.newaxis].T * P0
# or
pi0[:, np.newaxis].T @ P0

(pi0[:, np.newaxis].T * P0).shape is (1, 11343)

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