[GitHub] spark pull request: [SPARK-5802][MLLIB] cache transformed data in ...

2015-02-23 Thread joshdevins
Github user joshdevins commented on the pull request:

https://github.com/apache/spark/pull/4593#issuecomment-75540678
  
I have the same concern as @dbtsai in his comment. Most consumers of this 
API will already be caching their dataset before the learning phase. Without 
user care, this will introduce effectively double caching (in terms of data 
size of cached RDDs) and will cause many jobs to fail after upgrading by 
exceeding available heap for RDD cache. Furthermore, we are making assumptions 
about how to cache -- in-memory only in this case. Should we parameterise this? 
Perhaps that will help send the message in the API that there is caching also 
done before learning. (FWIW, in-memory is definitely the right default choice 
here.)

See email thread on dev for my specific encountering of this bug: 

http://mail-archives.apache.org/mod_mbox/spark-dev/201502.mbox/%3CCAH5MZvMBjqOST-9Nr9k1z1rUODfSiczr_fV9kwqDFqAMNLC2Zw%40mail.gmail.com%3E



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-5802][MLLIB] cache transformed data in ...

2015-02-23 Thread petro-rudenko
Github user petro-rudenko commented on the pull request:

https://github.com/apache/spark/pull/4593#issuecomment-75550855
  
@dbtsai, @joshdevins  here's an issue i have. I'm using new ml pipeline 
with hyperparameter grid search. Because folds doesn't depend from 
hyperparameter, i've reimplemented a bit LogisticRegression to not unpersist 
data:
```scala
class CustomLogisticRegression extends LogisticRegression {
  var oldInstances: RDD[LabeledPoint] = null
  
  override def fit(dataset: SchemaRDD, paramMap: ParamMap): 
LogisticRegressionModel = {
println(sFitting dataset ${dataset.id} with ParamMap $paramMap.)
transformSchema(dataset.schema, paramMap, logging = true)
import dataset.sqlContext._
val map = this.paramMap ++ paramMap
val instances = dataset.select(map(labelCol).attr, 
map(featuresCol).attr)
  .map {
case Row(label: Double, features: Vector) =
  LabeledPoint(label, features)
  }

//For parallel grid search 
this.synchronized({
  if (oldInstances == null || oldInstances.id != instances.id) {
if (oldInstances != null) {
  oldInstances.unpersist()
}
oldInstances = instances
instances.setName(sInstances for LR with ParamMap $paramMap and 
RDD ${dataset.id})
instances.persist(StorageLevel.MEMORY_AND_DISK)
  }
})

val lr = (new LogisticRegressionWithLBFGS)
  .setValidateData(false)

lr.optimizer
  .setRegParam(map(regParam))
  .setNumIterations(map(maxIter))
val lrOldModel = lr.run(instances)
val lrm = new LogisticRegressionModel(this, map, 
lr.run(instances).weights)
//instances.unpersist()
// copy model params
Params.inheritValues(map, this, lrm)
lrm
  }
}
```

Then for 3 folds in crossvalidation and 3 hyperparameters to 
LogisticRegression i got something like this:

```
Fitting dataset 11 with ParamMap {
CustomLogisticRegression-f35ae4d3-regParam: 0.5
}
Fitting dataset 11 with ParamMap {
CustomLogisticRegression-f35ae4d3-regParam: 0.1
}
Fitting dataset 11 with ParamMap {
CustomLogisticRegression-f35ae4d3-regParam: 0.01
}

Fitting dataset 12 with ParamMap {
CustomLogisticRegression-f35ae4d3-regParam: 0.5
}
Fitting dataset 12 with ParamMap {
CustomLogisticRegression-f35ae4d3-regParam: 0.1
}
Fitting dataset 12 with ParamMap {
CustomLogisticRegression-f35ae4d3-regParam: 0.01
}
```

So persistence on the model level need to cache folds for hyperparameters 
grid search, but persistence on GLM level need to speed-up Standart scalar 
transformation etc. Don't know yet how to do this efficiently without double 
caching.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-5802][MLLIB] cache transformed data in ...

2015-02-17 Thread dbtsai
Github user dbtsai commented on the pull request:

https://github.com/apache/spark/pull/4593#issuecomment-74805610
  
Sorry for the late reply since I'm traveling recently. My concern is that 
will this cause caching twice in the new ML api? For example, in 
ml/classification/LogisticRegression.scala, the data is persisted before any 
transformation, and then we cache the data again after the feature 
transformation. Should we remove the persist in ml package and just cache it 
after feature transformation here?




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-5802][MLLIB] cache transformed data in ...

2015-02-16 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/spark/pull/4593


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-5802][MLLIB] cache transformed data in ...

2015-02-16 Thread mengxr
Github user mengxr commented on the pull request:

https://github.com/apache/spark/pull/4593#issuecomment-74621554
  
Merged into master and branch-1.3.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-5802][MLLIB] cache transformed data in ...

2015-02-13 Thread mengxr
GitHub user mengxr opened a pull request:

https://github.com/apache/spark/pull/4593

[SPARK-5802][MLLIB] cache transformed data in glm

If we need to transform the input data, we should cache the output to avoid 
re-computing feature vectors every iteration. @dbtsai

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mengxr/spark SPARK-5802

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/spark/pull/4593.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #4593


commit ae3be842d42c563f351a83a9d016371b4b0008bb
Author: Xiangrui Meng m...@databricks.com
Date:   2015-02-13T18:12:45Z

cache transformed data in glm




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-5802][MLLIB] cache transformed data in ...

2015-02-13 Thread SparkQA
Github user SparkQA commented on the pull request:

https://github.com/apache/spark/pull/4593#issuecomment-74299914
  
  [Test build #27445 has 
started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/27445/consoleFull)
 for   PR 4593 at commit 
[`ae3be84`](https://github.com/apache/spark/commit/ae3be842d42c563f351a83a9d016371b4b0008bb).
 * This patch merges cleanly.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-5802][MLLIB] cache transformed data in ...

2015-02-13 Thread SparkQA
Github user SparkQA commented on the pull request:

https://github.com/apache/spark/pull/4593#issuecomment-74306433
  
  [Test build #27445 has 
finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/27445/consoleFull)
 for   PR 4593 at commit 
[`ae3be84`](https://github.com/apache/spark/commit/ae3be842d42c563f351a83a9d016371b4b0008bb).
 * This patch **fails Spark unit tests**.
 * This patch merges cleanly.
 * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-5802][MLLIB] cache transformed data in ...

2015-02-13 Thread AmplabJenkins
Github user AmplabJenkins commented on the pull request:

https://github.com/apache/spark/pull/4593#issuecomment-74306448
  
Test FAILed.
Refer to this link for build results (access rights to CI server needed): 
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/27445/
Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-5802][MLLIB] cache transformed data in ...

2015-02-13 Thread SparkQA
Github user SparkQA commented on the pull request:

https://github.com/apache/spark/pull/4593#issuecomment-74353892
  
  [Test build #27466 has 
started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/27466/consoleFull)
 for   PR 4593 at commit 
[`ae3be84`](https://github.com/apache/spark/commit/ae3be842d42c563f351a83a9d016371b4b0008bb).
 * This patch merges cleanly.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-5802][MLLIB] cache transformed data in ...

2015-02-13 Thread mengxr
Github user mengxr commented on the pull request:

https://github.com/apache/spark/pull/4593#issuecomment-74353784
  
test this please


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-5802][MLLIB] cache transformed data in ...

2015-02-13 Thread AmplabJenkins
Github user AmplabJenkins commented on the pull request:

https://github.com/apache/spark/pull/4593#issuecomment-74357608
  
Test PASSed.
Refer to this link for build results (access rights to CI server needed): 
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/27466/
Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request: [SPARK-5802][MLLIB] cache transformed data in ...

2015-02-13 Thread SparkQA
Github user SparkQA commented on the pull request:

https://github.com/apache/spark/pull/4593#issuecomment-74357607
  
  [Test build #27466 has 
finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/27466/consoleFull)
 for   PR 4593 at commit 
[`ae3be84`](https://github.com/apache/spark/commit/ae3be842d42c563f351a83a9d016371b4b0008bb).
 * This patch **passes all tests**.
 * This patch merges cleanly.
 * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org