楼主: Reader's
1551 9

【Github】Scala and Spark for Big Data Analytics [推广有奖]

  • 0关注
  • 0粉丝

已卖:1521份资源

博士生

59%

还不是VIP/贵宾

-

TA的文库  其他...

可解釋的機器學習

Operations Research(运筹学)

国际金融(Finance)

威望
0
论坛币
41198 个
通用积分
2.6173
学术水平
7 点
热心指数
5 点
信用等级
5 点
经验
2201 点
帖子
198
精华
1
在线时间
36 小时
注册时间
2015-6-1
最后登录
2024-3-3

楼主
Reader's 发表于 2017-8-13 04:41:57 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币

Scala and Spark for Big Data Analytics


This is the code repository for Scala and Spark for Big Data Analytics, published by Packt. It contains all the supporting project files necessary to work through the book from start to finish.

About the Book

This book is divided into three parts. In the first part, it will introduce you to Scala programming, helping you understand its fundamentals and be able to program with Spark. It will then move on to introducing you to Spark and the design choices beneath it and show you how to perform data analysis with it. Finally, to shake things up, the book moves on to Advanced Spark and teaches you advanced topics, such as monitoring, configuration, debugging, testing, and finally deployment.

Instructions and Navigation

All of the code is organized into folders. Each folder starts with a number followed by the application name. For example, Chapter02.

The code will look like the following:

package com.chapter11.SparkMachineLearningimport org.apache.spark.mllib.feature.StandardScalerModelimport org.apache.spark.mllib.linalg.{ Vector, Vectors }import org.apache.spark.sql.{ DataFrame }import org.apache.spark.sql.SparkSession

To follow this book, you need basic to medium-level knowledge of the Java programming language. A basic knowledge of concurrency concepts is welcome too.

Related ProductsSuggestions and Feedback

Click here if you have any feedback or suggestions.

https://github.com/PacktPublishing/Scala-and-Spark-for-Big-Data-Analytics




二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:Analytics Analytic Big data GitHub Spark

本帖被以下文库推荐

沙发
Reader's 发表于 2017-8-13 04:42:57
  1. package com.chapter3.ScalaFP
  2. import scala.collection._
  3. import scala.collection.mutable.Buffer
  4. import scala.collection.mutable.HashMap

  5. object CollectionExample {
  6.   def main(args: Array[String]) {
  7.     val x = 10
  8.     val y = 15
  9.     val z = 19
  10.    
  11.     Traversable(1, 2, 3)
  12.     Iterable("x", "y", "z")
  13.     Map("x" -> 10, "y" -> 13, "z" -> 17)
  14.     Set("Red", "Green", "Blue")
  15.     SortedSet("Hello,", "world!")
  16.     Buffer(x, y, z)
  17.     IndexedSeq(0.0, 1.0, 2.0)
  18.     LinearSeq(x, y, z)
  19.     List(2, 6, 10)
  20.     HashMap("x" -> 20, "y" -> 19, "z" -> 16)
  21.    
  22.     val list = List(1, 2, 3) map (_ + 1)
  23.     println(list)
  24.    
  25.     val set = Set(1, 2, 3) map (_ * 2)
  26.     println(set)
  27.    
  28.     val list2 = List(x, y, z).map(x => x * 3)
  29.     println(list2)
  30.   }
  31. }
复制代码

藤椅
Reader's 发表于 2017-8-13 04:43:41
  1. package com.chapter3.ScalaFP

  2. object ListScala {
  3.     def main(args: Array[String]) {
  4.       val eventList = List(2, 4, 6, 8, 10) // A simple list      
  5.       val mappedList = eventList.map(x => x*2) // Mapped each value by multiplying them by 2
  6.       println("Original list: "+ eventList)
  7.       println("Mapped list: "+ mappedList)
  8.       
  9.       //Use map to return a list from function      
  10.       def func(x: Int) = if (x > 4) Some(x) else None
  11.       val newList = eventList.map(x=> func(x))
  12.       println("New list: " + newList)
  13.     }  
  14. }
复制代码

板凳
Reader's 发表于 2017-8-13 04:44:14
  1. package com.chapter3.ScalaFP
  2. object MonadiacExample {
  3.   def main(args: Array[String]) {
  4.     //Monadiac example 1
  5.     for (x <- 10 until (0, -2))
  6.        yield x
  7.     //Monadiac example 2
  8.     for (x <- 1 to 10 if x % 2 == 0)
  9.       yield x
  10.     // Monodiac example 3
  11.     for (x <- 1 to 10; y <- 1 until x)
  12.       yield (x, y)
  13.     (1 to 10).flatMap(i => (1 until i).map(j => (i, j)))
  14.   }
  15. }
复制代码

报纸
Reader's 发表于 2017-8-13 04:44:57
  1. package com.chapter3.ScalaFP
  2. import java.io.IOException
  3. import java.io.FileReader
  4. import java.io.FileNotFoundException
  5. object TryCatch {
  6.   def main(args: Array[String]) {
  7.     try {
  8.       val f = new FileReader("data/data.txt")
  9.     } catch {
  10.       case ex: FileNotFoundException => println("File not found exception")
  11.       case ex: IOException => println("IO Exception")
  12.     } finally {
  13.       println("Finally block always executes");
  14.     }
  15.   }
  16. }
复制代码

地板
Reader's 发表于 2017-8-13 04:45:37
  1. package com.chapter3.ScalaFP
  2. object filterExample {
  3.     def main(args: Array[String]) {
  4.       val range = List.range(1, 10)
  5.       println(range)      
  6.       // Filter out only odd values
  7.       val odds = range.filter( x=> x % 2 != 0)
  8.       println("Odd values: " + odds)      
  9.       // Filter out only even values
  10.       val even = range.filter( x=> x % 2 == 0)
  11.       println("Odd values: " + even)
  12.     }
  13. }
复制代码

7
Reader's 发表于 2017-8-13 04:45:56
  1. package com.chapter3.ScalaFP
  2. object flatMapExample {
  3.     def main(args: Array[String]) {
  4.       val eventList = List(2, 4, 6, 8, 10) // A simple list      
  5.       println("Original list: "+ eventList)      
  6.       //Use map   
  7.       def around(x: Int) = List(x-1, x, x+1)
  8.       val newList1 = eventList.map(x=> around(x))
  9.       println("New list from map : " + newList1)      
  10.       //Use flatMap     
  11.       val newList2 = eventList.flatMap(x=> around(x))
  12.       println("New list from flatMap: " + newList2)
  13.     }  
  14. }
复制代码

8
Reader's 发表于 2017-8-13 04:46:46
  1. package com.chapter3.ScalaFP
  2. object mapExample {
  3.   implicit class MapReduceTraversable[T, N](val traversable: Traversable[(T, N)]) {
  4.     def reduceByKey(f: (N, N) => N) = traversable.par.groupBy(_._1).mapValues(_.map(_._2)).mapValues(_.reduce(f))
  5.   }
  6.   def main(args: Array[String]) {
  7.     val eventList = List(2, 4, 6, 8, 10) // A simple list      
  8.     println("Original list: " + eventList)
  9.     //Use map   
  10.     val newList1 = eventList.map(x => x * 2)
  11.     println(newList1)
  12.     def func(x: Int) = if (x > 4) Some(x) else None
  13.     val newList2 = eventList.map(x => func(x))
  14.     println(newList2)

  15.     val myList = List(1, 1, 1, 1, 1, 1, 1)
  16.     val reduce = myList.reduce { (x, y) => println(s"$x+$y=${x + y}"); x + y }
  17.     println()
  18.     val parReduce = myList.par.reduce { (x, y) => println(s"$x+$y=${x + y}"); x + y }
  19.     println()

  20.     val fruits = List("apple", "apple", "orange", "apple", "mango", "orange", "apple", "apple", "apple", "apple")
  21.     val reducebyKeyValue = fruits.map(f => (f, 1)).reduceByKey(_ + _)
  22.     println(reducebyKeyValue)
  23.   }
  24. }
复制代码

9
军旗飞扬 在职认证  发表于 2017-8-13 06:31:02
谢谢楼主分享!

10
lianqu 发表于 2017-8-15 10:32:39

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2026-1-7 07:22