-
Notifications
You must be signed in to change notification settings - Fork 28.4k
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
[WIP] [SPARK-1328] Add vector statistics #268
Closed
+230
−76
Closed
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
8c6c0e1
add basic statistics
yinxusen 54b19ab
add new API to shrink RDD[Vector]
yinxusen 28cf060
fix error of column means
yinxusen 8ef3377
pass all tests
yinxusen e09d5d2
add scala docs and refine shrink method
yinxusen ad6c82d
add shrink test
yinxusen 9af2e95
refine the code style
yinxusen cc65810
add parallel mean and variance
yinxusen 1338ea1
all-in-one version test passed
yinxusen c4651bb
remove row-wise APIs and refine code
yinxusen d816ac7
remove useless APIs
yinxusen 9a75ebd
add case class to wrap return values
yinxusen 62a2c3e
use axpy and in-place if possible
yinxusen 3980287
rename variables
yinxusen a6d5a2e
rewrite for only computing non-zero elements
yinxusen 4e4fbd1
separate seqop and combop out as independent functions
yinxusen 4cfbadf
fix bug of min max
yinxusen f6e8e9a
add sparse vectors test
yinxusen 036b7a5
fix the bug of Nan occur
yinxusen 4a5c38d
add scala doc, refine code and comments
yinxusen 1376ff4
rename variables and adjust code
yinxusen 138300c
add new Aggregator class
yinxusen 967d041
full revision with Aggregator class
yinxusen f7a3ca2
fix the corner case of maxmin
yinxusen 18cf072
change def to lazy val to make sure that the computations in function…
yinxusen dc77e38
test sparse vector RDD
yinxusen 86522c4
add comments on functions
yinxusen 548e9de
minor revision
yinxusen 69e1f37
remove lazy eval, and minor memory footprint
yinxusen 1fba230
merge while loop together
yinxusen e624f93
fix scala style error
yinxusen 48ee053
fix minor error
yinxusen 4eaf28a
merge VectorRDDStatistics into RowMatrix
yinxusen cbbefdb
update multivariate statistical summary interface and clean tests
mengxr b064714
remove computeStat in MLUtils
yinxusen 10cf5d3
refine some return type
yinxusen 16ae684
fix minor error and remove useless method
yinxusen d61363f
rebase to latest master
yinxusen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
mllib/src/main/scala/org/apache/spark/mllib/stat/MultivariateStatisticalSummary.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.spark.mllib.stat | ||
|
||
import org.apache.spark.mllib.linalg.Vector | ||
|
||
/** | ||
* Trait for multivariate statistical summary of a data matrix. | ||
*/ | ||
trait MultivariateStatisticalSummary { | ||
|
||
/** | ||
* Sample mean vector. | ||
*/ | ||
def mean: Vector | ||
|
||
/** | ||
* Sample variance vector. Should return a zero vector if the sample size is 1. | ||
*/ | ||
def variance: Vector | ||
|
||
/** | ||
* Sample size. | ||
*/ | ||
def count: Long | ||
|
||
/** | ||
* Number of nonzero elements (including explicitly presented zero values) in each column. | ||
*/ | ||
def numNonzeros: Vector | ||
|
||
/** | ||
* Maximum value of each column. | ||
*/ | ||
def max: Vector | ||
|
||
/** | ||
* Minimum value of each column. | ||
*/ | ||
def min: Vector | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method has a few too many blank lines, e.g. there's no need to have one at the beginning. Probably fine if we merge this as is but if you make another pass fix these.