Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
zhonglangjiang committed Dec 5, 2019
1 parent 7ad8df1 commit 9849643
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 81 deletions.
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
package com.atguigu.content
package com.bigdata

import org.apache.spark.SparkConf
import org.apache.spark.ml.feature.{HashingTF, IDF, Tokenizer}
import org.apache.spark.ml.linalg.SparseVector
import org.apache.spark.sql.SparkSession
import org.jblas.DoubleMatrix

/**
* Copyright (c) 2018-2028 尚硅谷 All Rights Reserved
*
* Project: ECommerceRecommendSystem
* Package: com.atguigu.content
* Version: 1.0
*
* Created by wushengran on 2019/4/29 9:08
*/

case class Product( productId: Int, name: String, imageUrl: String, categories: String, tags: String )
case class MongoConfig( uri: String, db: String )

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
package com.atguigu.recommender
package com.bigdata

import com.mongodb.casbah.commons.MongoDBObject
import com.mongodb.casbah.{MongoClient, MongoClientURI}
import org.apache.spark.SparkConf
import org.apache.spark.sql.{DataFrame, SparkSession}

/**
* Copyright (c) 2018-2028 尚硅谷 All Rights Reserved
*
* Project: ECommerceRecommendSystem
* Package: com.atguigu.recommender
* Version: 1.0
*
* Created by wushengran on 2019/4/26 15:43
*/

/**
* Product数据集
* 3982 商品ID
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
package com.atguigu.itemcf
package com.bigdata

import org.apache.spark.SparkConf
import org.apache.spark.sql.SparkSession

/**
* Copyright (c) 2018-2028 尚硅谷 All Rights Reserved
*
* Project: ECommerceRecommendSystem
* Package: com.atguigu.itemcf
* Version: 1.0
*
* Created by wushengran on 2019/4/29 10:48
*/

case class ProductRating( userId: Int, productId: Int, score: Double, timestamp: Int )
case class MongoConfig( uri: String, db: String )

Expand Down
2 changes: 1 addition & 1 deletion recommender/KafkaStreaming/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<configuration>
<archive>
<manifest>
<mainClass>com.atguigu.kafkastream.Application</mainClass>
<mainClass>com.bigdata.Application</mainClass>
</manifest>
</archive>
<descriptorRefs>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
package com.atguigu.kafkastream;/**
* Copyright (c) 2018-2028 尚硅谷 All Rights Reserved
* <p>
* Project: ECommerceRecommendSystem
* Package: com.atguigu.kafkastream
* Version: 1.0
* <p>
* Created by wushengran on 2019/4/28 14:59
*/
package com.bigdata;

import org.apache.kafka.streams.KafkaStreams;
import org.apache.kafka.streams.StreamsConfig;
import org.apache.kafka.streams.processor.TopologyBuilder;

import java.util.Properties;

/**
* @ClassName: Application
* @Description:
* @Author: wushengran on 2019/4/28 14:59
* @Version: 1.0
*/
public class Application {
public static void main(String[] args) {
String brokers = "localhost:9092";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.atguigu.kafkastream;/**
package com.bigdata;/**
* Copyright (c) 2018-2028 尚硅谷 All Rights Reserved
* <p>
* Project: ECommerceRecommendSystem
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.atguigu.offline
package com.bigdata

import breeze.numerics.sqrt
import com.atguigu.offline.OfflineRecommender.MONGODB_RATING_COLLECTION
Expand All @@ -7,15 +7,6 @@ import org.apache.spark.mllib.recommendation.{ALS, MatrixFactorizationModel, Rat
import org.apache.spark.rdd.RDD
import org.apache.spark.sql.SparkSession

/**
* Copyright (c) 2018-2028 尚硅谷 All Rights Reserved
*
* Project: ECommerceRecommendSystem
* Package: com.atguigu.offline
* Version: 1.0
*
* Created by wushengran on 2019/4/27 11:24
*/
object ALSTrainer {
def main(args: Array[String]): Unit = {
val config = Map(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
package com.atguigu.offline
package com.bigdata

import org.apache.spark.SparkConf
import org.apache.spark.mllib.recommendation.{ALS, Rating}
import org.apache.spark.sql.SparkSession
import org.jblas.DoubleMatrix

/**
* Copyright (c) 2018-2028 尚硅谷 All Rights Reserved
*
* Project: ECommerceRecommendSystem
* Package: com.atguigu.offline
* Version: 1.0
*
* Created by wushengran on 2019/4/27 10:19
*/

case class ProductRating( userId: Int, productId: Int, score: Double, timestamp: Int )
case class MongoConfig( uri: String, db: String )

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.atguigu.online
package com.bigdata

import com.mongodb.casbah.commons.MongoDBObject
import com.mongodb.casbah.{MongoClient, MongoClientURI}
Expand All @@ -9,15 +9,6 @@ import org.apache.spark.streaming.kafka010.{ConsumerStrategies, KafkaUtils, Loca
import org.apache.spark.streaming.{Seconds, StreamingContext}
import redis.clients.jedis.Jedis

/**
* Copyright (c) 2018-2028 尚硅谷 All Rights Reserved
*
* Project: ECommerceRecommendSystem
* Package: com.atguigu.online
* Version: 1.0
*
* Created by wushengran on 2019/4/28 9:18
*/
// 定义一个连接助手对象,建立到redis和mongodb的连接
object ConnHelper extends Serializable{
// 懒变量定义,使用的时候才初始化
Expand Down

0 comments on commit 9849643

Please sign in to comment.