Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Dc evaluate perf #2932

Merged
merged 2 commits into from
Jan 16, 2020
Merged

Dc evaluate perf #2932

merged 2 commits into from
Jan 16, 2020

Conversation

jakesabathia2
Copy link
Collaborator

fix #2803

@jakesabathia2 jakesabathia2 changed the title Dc evaluate Dc evaluate perf Jan 15, 2020
flex_list class_labels = read_state<flex_list>("classes");
auto max_prob_label = [=](const flexible_type& ft) {
const flex_vec& prob_vec = ft.get<flex_vec>();
auto max_it = std::max_element(prob_vec.begin(), prob_vec.end());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the use of auto here increasing readability?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes. And also follow other code's style.

@jakesabathia2
Copy link
Collaborator Author

pass internal test.

@jakesabathia2 jakesabathia2 merged commit 2bce012 into apple:master Jan 16, 2020
@jakesabathia2 jakesabathia2 deleted the dc_evaluate branch January 16, 2020 21:37
hoytak pushed a commit to hoytak/turicreate that referenced this pull request Jan 17, 2020
gl_sarray predictions_prob = predict(data, "probability_vector");

flex_list class_labels = read_state<flex_list>("classes");
auto max_prob_label = [=](const flexible_type& ft) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

The indentation level is not correct. Run clang-format if possible.

class_label = evaluation_result["prediction_class"]
probability_vector = evaluation_result["prediction_prob"]

del evaluation_result["prediction_class"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

you don't have to delete those. They will be collected by GC.

@guihao-liang
Copy link
Collaborator

Sorry for this late review. @jakesabathia2, I think it's better to discover why predict class is slower than before.

@jakesabathia2
Copy link
Collaborator Author

Sorry for this late review. @jakesabathia2, I think it's better to discover why predict class is slower than before.

Predict is faster tam 5.8 tbh.
But we run here three times,
hays why it is slower (but fixed now hah.)

@guihao-liang
Copy link
Collaborator

Duplicate the logic inside is not an optimal design. Besides, be careful about the code style.

@jakesabathia2
Copy link
Collaborator Author

Duplicate the logic inside is not an optimal design. Besides, be careful about the code style.

I am not duplicating that logic. The duplication in previous code is what I fixed in this PR.

@guihao-liang
Copy link
Collaborator

Duplicate the logic inside is not an optimal design. Besides, be careful about the code style.

I am not duplicating that logic. The duplication in previous code is what I fixed in this PR.

That's what I mean. A better way to do it is to have a subroutine (inline function, for example) to wrap the same logic so that you will have only one place to edit in the future if there's a need to modify that logic.

@jakesabathia2
Copy link
Collaborator Author

Duplicate the logic inside is not an optimal design. Besides, be careful about the code style.

I am not duplicating that logic. The duplication in previous code is what I fixed in this PR.

That's what I mean. A better way to do it is to have a subroutine (inline function, for example) to wrap the same logic so that you will have only one place to edit in the future if there's a need to modify that logic.

good!

@guihao-liang
Copy link
Collaborator

To put it in a simple way, make it more maintainable is also a key point for good code.

@jakesabathia2
Copy link
Collaborator Author

To put it in a simple way, make it more maintainable is also a key point for good code.

good! will put an other pr.

@jakesabathia2 jakesabathia2 mentioned this pull request Jan 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Drawing Classifier Evaluation is 20% slower.
3 participants