Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Native Bayes] Fix error when converting Vector to CSRNumericTable #177

Closed
minmingzhu opened this issue Feb 21, 2022 · 0 comments · Fixed by #176
Closed

[Native Bayes] Fix error when converting Vector to CSRNumericTable #177

minmingzhu opened this issue Feb 21, 2022 · 0 comments · Fixed by #176
Labels
bug Something isn't working

Comments

@minmingzhu
Copy link
Collaborator

minmingzhu commented Feb 21, 2022

When converting Vector to CSRNumericTable, If multiple rows without non-zero elements , we only calculated once for rowOffsets Array.

// Converted to one CSRNumericTable
    for (row <- 0 until vectors.length) {
      val rowVector = vectors(row)
      rowVector.foreachActive { (column, value) =>
        values(indexValues) = value
        // one-based indexValues
        columnIndices(indexValues) = column + 1

        if (row > curRow) {
          curRow = row
          // one-based indexValues
          rowOffsets += indexValues + 1
        }

        indexValues = indexValues + 1
      }
    }
    // one-based row indexValues
    rowOffsets += indexValues + 1
@minmingzhu minmingzhu changed the title [Native Bayes] Fix error when converting Vector to CSRNumericTable [ML-$176][Native Bayes] Fix error when converting Vector to CSRNumericTable Feb 21, 2022
@minmingzhu minmingzhu changed the title [ML-$176][Native Bayes] Fix error when converting Vector to CSRNumericTable [Native Bayes] Fix error when converting Vector to CSRNumericTable Feb 21, 2022
@xwu99 xwu99 closed this as completed Feb 24, 2022
@haojinIntel haojinIntel added the bug Something isn't working label Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants