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

IGNITE-11647: ML Vectors should work with all Serializable objects besides double #6378

Closed
wants to merge 7 commits into from

Conversation

avplatonov
Copy link
Contributor

No description provided.

}

/** {@inheritDoc} */
@Override public <T extends Serializable> T getRawX(int idx) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why somewhere you use checkIndex(idx), but somewhere not?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please read javadoc for get*X methods:
"Gets the value at specified index without checking for index boundaries"


Serializable v = rawData[i];
if (v == null)
return 0.0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use Double.NaN for missing values. Would it be better to use it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it wasn't documented but old API returned 0.0 and I don't want to change this behavior.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm, support for Double.NaN but not in this ticket, could you make TODO + ticket for this, @avplatonov ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, sure. But I think we should provide a way to use other user defined values for default values in Vector and use Double.NaN as default way in our code.


/** {@inheritDoc} */
@Override public <T extends Serializable> void setRaw(int i, T v) {
swap(false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to keep two keep both arrays "active" and bitset that tells for each index which array contains actual value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I don't want to save additional states in vector. From my point of view, vector can be numeric and if we try to save some Serializable object - vector change own state to Serializabled representation. Only "double[] data()" can cast vector to numeric representation. These casts won't be so frequently.

@avplatonov
Copy link
Contributor Author

@dmitrievanthony thanks for review
please, read my comments

* Tries to cast internal representation of data to array of Serializable objects if need.
*/
private void toGenericArray() {
A.ensure(data == null || rawData == null, "data == null || rawData == null");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is A.ensure?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a standard way for assertions in Ignite.Core


Serializable v = rawData[i];
if (v == null)
return 0.0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm, support for Double.NaN but not in this ticket, could you make TODO + ticket for this, @avplatonov ?

@dspavlov
Copy link
Contributor

dspavlov commented Aug 2, 2019

The ticket is resolved, closing PR.

Please close PRs for your resolved tickets and other non-needed PRs.

Alternatively, ask a committer

  • to use GitHub UI (committer can associate accounts here: https://gitbox.apache.org/setup/ )
  • or /scripts/apply_pull_request.sh from Apache Ignite source.
  • or mention in commit message 'Fixes #(a number of PR)'.

These methods will automatically close PR.

Feel free to reopen this PR if it is actual.

@dspavlov dspavlov closed this Aug 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants