Repository navigation
Conversation
…eraged by docs, micro and per-class precision and recall averaged by class
… macro measures, bunch of tests
|
Can one of the admins verify this patch? |
There was a problem hiding this comment.
As the intersect is called multiple times in different metrics, how about take it out so it is only calculated once.
There was a problem hiding this comment.
Do you suggest to extract "labels.intersect(predictions).size" as a lazy val? Will it then be calculated only once? The operation is made with Scala Set (not with RDD). Another option might be to store in RDD all intermediate calculations (including intersection) that are used in six different measures. In this case, I will need to make fold on the six-element tuple, which will look kind of scary, but it will be the most effective way to compute everything at once.
|
@avulanov Cool Alexander. Are you working on a multi-label classifier? We are expecting a multi-class multi-label classifier. I'm planning to implement the MultiBoost.MH on Spark, not sure if you've already started working on it. |
|
@BaiGang Thanks! I'm implementing the decomposition of multiclass and multilabel problems to binary classification problems that can be solved with built-in MLLib classifiers. I use one-vs-one and one-vs-all approaches. As far as I understand, MultiBoost.MH is a C++ implementation of Adaboost.MH and the latter uses another kind of problem decomposition in addition to boosting. So, our efforts are complimentary. Lets stay in touch. Btw, I would be glad to benchmark your classifier with the classification tasks that I'm solving. |
|
@avulanov Thanks Alexander! I just started to implement the base learner. The algorithms described in the MultiBoost document and the paper are straightforward but it will take some efforts to implement optimally on Apache Spark. I will keep you notified when I get the skeletons up. |
|
Jenkins, test this please. |
|
QA tests have started for PR 1270. This patch merges cleanly. |
|
QA results for PR 1270: |
|
@mengxr I've fixed Scala style |
There was a problem hiding this comment.
Another feasible representation of predictions/labels is mllib.linalg.Vector. It's basically a Vector of +1s and -1s, either dense or sparse. So it will be great if we add another function to do the transformation.
It's up to you. Transforming the data outside this evaluation module is also OK. : )
There was a problem hiding this comment.
RDD[(Set[Double], Set[Double])] may be hard for Java users. We can ask users to input RDD[(Array[Double], Array[Double])], requiring that the labels are ordered. It is easier for Java users and faster to compute intersection and other set operations.
There was a problem hiding this comment.
@mengxr We need to ensure that they don't contain repeating elements as well. It should be an optional constructor, I think.
There was a problem hiding this comment.
Both Set and Double are Scala types. It is very hard for Java users to construct such RDDs. Also, the input labels and output predictions are usually stored as Array[Double]. Shall we change the input to RDD[(Array[Double], Array[Double])] and internally convert it to RDD[(Set[Double], Set[Double])] and cache? We can put a contract that both labels and predictions are unique and ordered within a single instance. We don't need it if we use Set internally. But later we can switch to Array[Double] based solution for speed, because those are very small arrays.
There was a problem hiding this comment.
@mengxr Can we have RDD[(java.util.HashSet[Double], java.util.HashSet[Double])] as an optional constructor? Internally, we will use scala.collection.JavaConversions.asScalaSet.
There was a problem hiding this comment.
@avulanov Let's think what is more natural for the input data to a multi-label classifier and the output from the model it produces. They should match the input type here, so we can chain them easily. If we use either Java or Scala Set, we are going to have compatibility issues on the other. Also, set stores small objects, which increase GC pressure. These are the reasons I recommend using Array[Double].
|
this is ok to test |
|
test this please |
|
QA tests have started for PR 1270 at commit
|
|
@avulanov Sorry for getting back late! For the implementation, shall we define an aggregator and then compute all necessary information in a single pass, instead of trigger a job for each? For the metric names, I think our reference is Mining Multi-label Data and we should follow the naming there:
|
|
QA tests have finished for PR 1270 at commit
|
|
@mengxr Thank you for comments!
|
…rns the list of labels
|
QA tests have started for PR 1270 at commit
|
|
QA tests have finished for PR 1270 at commit
|
There was a problem hiding this comment.
This may be faster: labels.size + predictions.size - 2 * labels.intersect(labels).size
There was a problem hiding this comment.
move } to next line and add () to count (same in other places)
|
QA tests have started for PR 1270 at commit
|
|
QA tests have finished for PR 1270 at commit
|
|
@avulanov Just want to check with you on the input type. I still feel |
|
@avulanov We are close to the feature freeze deadline. Do you plan to update the PR? If you are busy, do you mind me taking it over? Thanks! |
|
Welcome to the bay area! The deadline (soft for MLlib) is this Saturday. But since the only thing that needs to change is the input type, it should be trivial to update. Using |
|
@mengxr Thanks! I've replaced Set with Array, fixed two functions that didn't pass test (due to union working differently on Arrays) and added a note that Arrays must have unique elements. |
|
Test build #22624 has started for PR 1270 at commit
|
|
Test build #22624 has finished for PR 1270 at commit
|
|
Test FAILed. |
|
test this please |
|
Test build #22659 has started for PR 1270 at commit
|
|
Test build #22659 has finished for PR 1270 at commit
|
|
Test PASSed. |
|
LGTM. Merged into master. Thanks! |
|
@mengxr Thank you! |
### What changes were proposed in this pull request? This PR bumps the ADT version to 1.1.0. ### Why are the changes needed? These changes are needed to avoid dependencies on a preview release. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Locally.
* Only test range join and outer join * fix
…pache#1270) ### What changes were proposed in this pull request? This PR plans the milestone's remaining unplanned rows and adds three new rows. It changes plan files only. Each plan reads the current code first, says where the row's text no longer matches it, and lists its questions for the owner with a recommendation each: - **Types:** - 540, the scalar 128-bit decimal for x86 hosts at two long lanes; - 541, the fallback's hoisted subexpressions, which comes after 386's upstream sync; - 543, floating filters at two lanes on x86; - 414, `ym / -1`, whose cause a debugging run must first establish. - **Fuzzers and harness:** 430 to 437. Three pairs share a file, because they are one mechanism each. 435 is re-scoped, because a mixed-lane kernel never materializes a prefix. 434 is sized medium. - **Test infrastructure and CI:** 404, 442, 472, 477, 495, and 531, which is sized medium. - **Math and writing:** 367, the extended math probe, and 511, the post for Spark application developers. **New row 544.** Over an Arrow source that is not Spark's cache, Varka reads a small decimal by the double rule, where vanilla's compiled stage copies rows and answers by the exact one. Varka must follow vanilla on well-formed data. The row turns on the decimal view only where Spark would compile the replaced node into a stage with copied rows. **From the Comet and SQLancer readings** (in their own pull request, merged into this branch): test cases added to rows 341 (`greatest` and `least` in one projection over both zeros, codegen on and off), 346 (two `round` values, one JDK-dependent) and 350 and 364 (ANSI casts at `Int.MinValue` and `Long.MinValue`); fuzzer edits to rows 352 and 541; new row 545, rerunning a disagreement on Spark with codegen off to label whether Varka matches Spark's interpreted path; and m9 scope item 128. The owner's answers given today are recorded in the plans of rows 352, 367, 430, 436, 511 and 531. **New row 546**, moved from m9's scope by the owner's word: generated files that concurrent pull requests do not hand-merge, since each merge to master now sends most open type branches through a regeneration and a new CI round. ### Why are the changes needed? So that every remaining row of the milestone has a plan read against the current code before its build starts, and the owner's open questions are visible in one place. ### Does this PR introduce _any_ user-facing change? No. Plan files only. ### How was this patch tested? The plan lint and the quote check are clean, as are the pre-commit hooks. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (Opus 5.5)
Implementation of various multi-label classification measures, including: Hamming-loss, strict and default Accuracy, macro-averaged Precision, Recall and F1-measure based on documents and labels, micro-averaged measures: https://issues.apache.org/jira/browse/SPARK-2329
Multi-class measures are currently in the following pull request: #1155