flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-1745) Add exact k-nearest-neighbours algorithm to machine learning library
Date Mon, 02 Nov 2015 17:42:27 GMT

    [ https://issues.apache.org/jira/browse/FLINK-1745?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14985595#comment-14985595
] 

ASF GitHub Bot commented on FLINK-1745:
---------------------------------------

Github user chiwanpark commented on the pull request:

    https://github.com/apache/flink/pull/1220#issuecomment-153096308
  
    I would suggest logic like following:
    
    ```scala
    val useQuadTree = ~~~
    
    if (useQuadTree) {
      knnQueryWithQuadTree(training, testing, out)
    } else {
      knnQueryBasic(training, testing, out)
    }
    ```
    
    Or to reduce duplicated code in L257-L266, we can use following:
    
    ```scala
    val useQuadTree = ~~~
    val quadTree: Option[QuadTree] = if (useQuadTree) {
      Some(buildQuadTree(training, testing))
    } else {
      None
    }
    
    for (a <- testing.values) {
      val trainingFiltered: Seq[Vector] = quadTree match {
        case Some(tree) => getSibilingsFromQuadTree(a, tree)
        case None => training.values
      }
    
      for (b <- trainingFiltered) {
        // (training vector, input vector, input key, distance)
        queue.enqueue((b, a._2, a._1, metric.distance(b, a._2)))
        if (queue.size > k) {
          queue.dequeue()
        }
      }
      for (v <- queue) {
        out.collect(v)
      }
    }
    ```
    
    In this case, we create methods about quadtree operation.


> Add exact k-nearest-neighbours algorithm to machine learning library
> --------------------------------------------------------------------
>
>                 Key: FLINK-1745
>                 URL: https://issues.apache.org/jira/browse/FLINK-1745
>             Project: Flink
>          Issue Type: New Feature
>          Components: Machine Learning Library
>            Reporter: Till Rohrmann
>            Assignee: Daniel Blazevski
>              Labels: ML, Starter
>
> Even though the k-nearest-neighbours (kNN) [1,2] algorithm is quite trivial it is still
used as a mean to classify data and to do regression. This issue focuses on the implementation
of an exact kNN (H-BNLJ, H-BRJ) algorithm as proposed in [2].
> Could be a starter task.
> Resources:
> [1] [http://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm]
> [2] [https://www.cs.utah.edu/~lifeifei/papers/mrknnj.pdf]



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message