[
https://issues.apache.org/jira/browse/FLINK-1992?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14553963#comment-14553963
]
ASF GitHub Bot commented on FLINK-1992:
---------------------------------------
Github user thvasilo commented on a diff in the pull request:
https://github.com/apache/flink/pull/692#discussion_r30785863
--- Diff:
flink-staging/flink-ml/src/main/scala/org/apache/flink/ml/optimization/Solver.scala
---
@@ -40,6 +44,32 @@ abstract class Solver extends Serializable with
WithParameters {
data: DataSet[LabeledVector],
initialWeights: Option[DataSet[WeightVector]]): DataSet[WeightVector]
+ /** Creates initial weights vector, creating a DataSet with a
WeightVector element
+ *
+ * @param initialWeights An Option that may contain an initial set of
weights
+ * @param data The data for which we optimize the weights
+ * @return A DataSet containing a single WeightVector element
+ */
+ def createInitialWeightsDS(initialWeights: Option[DataSet[WeightVector]],
+ data: DataSet[LabeledVector]):
DataSet[WeightVector] = {
+ // TODO: Faster way to do this?
+ val dimensionsDS = data.map(_.vector.size).reduce((a, b) => b)
+
+ initialWeights match {
+ // Ensure provided weight vector is a DenseVector
+ case Some(wvDS) =>
+ wvDS.map { wv => {
+ val denseWeights = wv.weights match {
+ case dv: DenseVector => dv
+ case sv: SparseVector => sv.toDenseVector
+ }
+ WeightVector(denseWeights, wv.intercept)
--- End diff --
Not sure what you mean here, is it `WeightVector(denseWeights,
wv.intercept)` that is off?
> Add convergence criterion to SGD optimizer
> ------------------------------------------
>
> Key: FLINK-1992
> URL: https://issues.apache.org/jira/browse/FLINK-1992
> Project: Flink
> Issue Type: Improvement
> Components: Machine Learning Library
> Reporter: Till Rohrmann
> Assignee: Theodore Vasiloudis
> Priority: Minor
> Labels: ML
> Fix For: 0.9
>
>
> Currently, Flink's SGD optimizer runs for a fixed number of iterations. It
> would be good to support a dynamic convergence criterion, too.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)