Lab5_Spark.pdf - Lab 5 – Apache Spark 1 2 3 4 5 After Lab 1 you have learned how to implement k-means.using Python In this lab you are asked to

# Lab5_Spark.pdf - Lab 5 – Apache Spark 1 2 3 4 5 After Lab...

• Lab Report
• 1

This preview shows page 1 out of 1 page.

1. After Lab 1, you have learned how to implement k-means.using Python. 2. In this lab, you are asked to implement k-means using Scala commonly found in Apache Spark. 3. You are given the k- means template file “ kmeans.scala ”. 4. In the file, there are several spark functions to be implemented by yourself. 5. The following table summarizes the meanings of those functions. Function Description def distance(p:Vector[Double], q:Vector[Double]) : Double It calculates the distance between two points “p” and “q”. def clostestpoint(q: Vector[Double], candidates: Array[Vector[Double]]): Vector[Double] Given a query point “q”, it finds t he nearest point among “candidates” . def add_vec(v1: Vector[Double], v2: Vector[Double]): Vector[Double] = It performs the addition of two points

#### You've reached the end of your free preview.

Want to read the whole page?

• Fall '16
• cheng

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
Ask Expert Tutors