- 首页 > it技术 > >
package zqr.com;
import breeze.optimize.linear.LinearProgram;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaPairRDD;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.mllib.recommendation.ALS;
import org.apache.spark.mllib.recommendation.MatrixFactorizationModel;
import scala.Tuple2;
import org.apache.spark.mllib.recommendation.Rating;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.util.*;
public class AlsAddFp {public static String k="";
public static Map,String>map=new HashMap<>();
public static SetNotbygoods=new HashSet();
public static Setbygoods=new HashSet();
public static Map,String> md=new HashMap();
public static List d=new ArrayList();
public static void main(String args []) {// 输入用户id
System.out.println("输入用户id:");
Scanner scan=new Scanner(System.in);
String number=scan.nextLine();
SparkConf conf = new SparkConf().setAppName("Spark WordCount written by Java").setMaster("local");
JavaSparkContext sc = new JavaSparkContext(conf);
// 其底层实际上就是Scala的SparkContext
//
//// 加载并解析数据
//String path = "/usr/local/spark/data/mllib/sample_fpgrowth.txt";
//
//JavaRDD data = https://www.it610.com/article/sc.textFile(path);
//data.collect().forEach(System.out::println);
//
//
//JavaRDD
推荐阅读