• 协同过滤算法


    package Spark_MLlib
    
    import org.apache.spark.ml.evaluation.RegressionEvaluator
    import org.apache.spark.ml.recommendation.ALS
    import org.apache.spark.sql.SparkSession
    
    /**
      *
      * numBlocks 是用于并行化计算的用户和商品的分块个数 (默认为10)。
      * rank 是模型中隐语义因子的个数(默认为10)。
      *  maxIter 是迭代的次数(默认为10)。
      *  regParam 是ALS的正则化参数(默认为1.0)。
      *  implicitPrefs 决定了是用显性反馈ALS的版本还是用适用隐性反馈数据集的版本(默认是false,即用显性反馈)。
      *  alpha 是一个针对于隐性反馈 ALS 版本的参数,这个参数决定了偏好行为强度的基准(默认为1.0)。
      *  nonnegative 决定是否对最小二乘法使用非负的限制(默认为false)。
    
      */
    case class schema_data(userId:Int,movieId:Int,score:Float,timestamp:Long)
    
    object 协同过滤算法 {
      val spark=SparkSession.builder().master("local[2]").getOrCreate()
      import spark.implicits._
      def main(args: Array[String]): Unit = {
            val data=spark.sparkContext.textFile("file:///usr/local2/spark/data/mllib/als/sample_movielens_ratings.txt")
                       .map(_.split("::")).map(x=>schema_data(x(0).toInt,x(1).toInt,x(2).toFloat,x(3).toLong)).toDF()
            data.show()
          val Array(trainData,testData)=data.randomSplit(Array(0.9,0.1))
        //ALS建立推荐模型,显性反馈--->显性反馈数值代表偏好程度
        val als_Explicit=new ALS().setMaxIter(5).setRegParam(0.02).setNonnegative(true).setUserCol("userId").setItemCol("movieId").setRatingCol("score")
        //ALS建立推荐模型,隐性反馈--->隐性反馈数值代表置信度,隐性反馈的数值通常是动作的频次,频次越多,并不代表偏好值越大.
        val als_Implicit=new ALS().setMaxIter(5).setRegParam(0.02).setImplicitPrefs(true).setNonnegative(true).setUserCol("userId").setItemCol("movieId").setRatingCol("score")
        //训练模型(显性)
        val modelExplicit=als_Explicit.fit(trainData)
        //冷启动处理:Spark允许用户将coldStartStrategy参数设置为“drop”,以便在包含NaN值的预测的DataFrame中删除任何行
         modelExplicit.setColdStartStrategy("drop")
        //训练模型(隐性)
        val modelImplicit=als_Implicit.fit(trainData)
        //冷启动处理:Spark允许用户将coldStartStrategy参数设置为“drop”,以便在包含NaN值的预测的DataFrame中删除任何行
        modelImplicit.setColdStartStrategy("drop")
        //测试数据
        val predictionExplicit=modelExplicit.transform(testData)
        val predictionImplicit=modelImplicit.transform(testData)
    
          predictionExplicit.show(100)
          predictionImplicit.show(100)
        //模型评估
        val evaluator=new RegressionEvaluator().setMetricName("rmse").setLabelCol("score").setPredictionCol("prediction")
        val rmseExplicit=evaluator.evaluate(predictionExplicit)
        val rmseImplicit=evaluator.evaluate(predictionImplicit)
        println("显性反馈-->均方根误差为:"+rmseExplicit)
        println("隐性反馈-->均方根误差为:"+rmseImplicit)
        //为每个用户提供十大电影推荐
        val userRecs=modelExplicit.recommendForAllUsers(10)
        //为每部电影推荐十个候选用户
        val moviesRescs=modelExplicit.recommendForAllItems(10)
        userRecs.show(false)
        moviesRescs.show(false)
      }
    
    }

    结果:

    +------+-------+-----+----------+
    |userId|movieId|score| timestamp|
    +------+-------+-----+----------+
    |     0|      2|  3.0|1424380312|
    |     0|      3|  1.0|1424380312|
    |     0|      5|  2.0|1424380312|
    |     0|      9|  4.0|1424380312|
    |     0|     11|  1.0|1424380312|
    |     0|     12|  2.0|1424380312|
    |     0|     15|  1.0|1424380312|
    |     0|     17|  1.0|1424380312|
    |     0|     19|  1.0|1424380312|
    |     0|     21|  1.0|1424380312|
    |     0|     23|  1.0|1424380312|
    |     0|     26|  3.0|1424380312|
    |     0|     27|  1.0|1424380312|
    |     0|     28|  1.0|1424380312|
    |     0|     29|  1.0|1424380312|
    |     0|     30|  1.0|1424380312|
    |     0|     31|  1.0|1424380312|
    |     0|     34|  1.0|1424380312|
    |     0|     37|  1.0|1424380312|
    |     0|     41|  2.0|1424380312|
    +------+-------+-----+----------+
    only showing top 20 rows
    
    +------+-------+-----+----------+----------+
    |userId|movieId|score| timestamp|prediction|
    +------+-------+-----+----------+----------+
    |     5|     31|  1.0|1424380312|  1.840973|
    |    24|     31|  1.0|1424380312| 1.0787864|
    |     0|     31|  1.0|1424380312|   1.50683|
    |    26|     85|  1.0|1424380312| 1.3818506|
    |     6|     85|  3.0|1424380312|  3.844798|
    |     3|     65|  2.0|1424380312|0.79877776|
    |     5|     65|  2.0|1424380312| 2.1158671|
    |    15|     65|  2.0|1424380312| 2.5152833|
    |     4|     65|  1.0|1424380312| 0.6035564|
    |    20|     53|  3.0|1424380312| 1.9084975|
    |    14|     53|  3.0|1424380312| 5.1863747|
    |    15|     34|  1.0|1424380312|0.92592824|
    |     0|     34|  1.0|1424380312|0.96434075|
    |     7|     81|  1.0|1424380312| 1.2863399|
    |    21|     81|  1.0|1424380312|0.78413194|
    |    11|     81|  4.0|1424380312| 2.1801503|
    |     5|     28|  1.0|1424380312|  1.076296|
    |    13|     26|  1.0|1424380312|0.94539475|
    |    27|     27|  3.0|1424380312| 2.5037022|
    |     5|     27|  1.0|1424380312|  3.667132|
    |    21|     27|  1.0|1424380312| 1.1859739|
    |     0|     27|  1.0|1424380312|0.61888385|
    |     0|     44|  1.0|1424380312| 1.1808492|
    |    14|     12|  1.0|1424380312| 1.0993241|
    |     0|     12|  2.0|1424380312| 2.6924894|
    |    12|     91|  3.0|1424380312| 2.2997293|
    |     1|     91|  1.0|1424380312| 2.7597535|
    |    20|     91|  1.0|1424380312| 2.3208883|
    |    12|     22|  2.0|1424380312| 1.7274178|
    |     6|     22|  1.0|1424380312|  1.092643|
    |     7|     22|  1.0|1424380312|0.99847233|
    |    14|     93|  3.0|1424380312| 2.3156812|
    |     7|     47|  4.0|1424380312| 3.2377052|
    |    27|     52|  1.0|1424380312|  0.871236|
    |     2|     52|  2.0|1424380312| 2.1473994|
    |    28|     13|  2.0|1424380312| 0.7953429|
    |    26|     13|  3.0|1424380312| 1.2214372|
    |    17|     13|  2.0|1424380312| 2.7198553|
    |    21|     13|  1.0|1424380312| 1.1033195|
    |    22|      6|  2.0|1424380312| 2.5011625|
    |    12|     86|  1.0|1424380312|0.75444543|
    |    27|     94|  2.0|1424380312| 3.0402317|
    |    11|     94|  2.0|1424380312| 4.3604407|
    |     2|     54|  1.0|1424380312| 1.7088501|
    |    26|     48|  1.0|1424380312| 1.5795356|
    |     0|     48|  1.0|1424380312|0.63295746|
    |    18|     48|  1.0|1424380312| 1.4226551|
    |    22|     19|  1.0|1424380312| 1.2505732|
    |    16|     19|  1.0|1424380312| 1.5920734|
    |    11|     64|  1.0|1424380312| 3.5224037|
    |    13|     15|  1.0|1424380312| 0.6379286|
    |     5|     15|  1.0|1424380312| 0.7728117|
    |     4|     15|  1.0|1424380312|0.33519894|
    |     8|     15|  1.0|1424380312| 1.0217338|
    |    24|     15|  1.0|1424380312|0.33844748|
    |     2|     15|  2.0|1424380312|0.62683123|
    |    27|     43|  1.0|1424380312|0.86471236|
    |    23|     43|  1.0|1424380312| 2.4126542|
    |    15|     37|  1.0|1424380312|  1.439664|
    |    23|     37|  1.0|1424380312| 1.8335408|
    |     5|     61|  1.0|1424380312| 0.7829978|
    |     9|     61|  1.0|1424380312|0.53741616|
    |    23|     61|  1.0|1424380312|0.74035454|
    |    16|      9|  1.0|1424380312|0.89022946|
    |     5|      9|  3.0|1424380312| 1.9372939|
    |     4|      9|  1.0|1424380312| 0.6358023|
    |    14|      9|  1.0|1424380312|0.83004904|
    |     0|      9|  4.0|1424380312| 0.9371788|
    |     6|     17|  1.0|1424380312| 1.2296195|
    |    15|     17|  2.0|1424380312| 1.8057513|
    |     4|     17|  1.0|1424380312|0.63463604|
    |    10|     17|  1.0|1424380312| 1.0520277|
    |     1|     72|  1.0|1424380312| 1.0465134|
    |     5|     72|  1.0|1424380312|0.95224863|
    |    23|     72|  1.0|1424380312| 2.4493558|
    |     7|      4|  1.0|1424380312| 1.8681313|
    |    20|     55|  1.0|1424380312| 2.3069491|
    |     2|     55|  1.0|1424380312| 2.6359193|
    |    26|     23|  5.0|1424380312| 3.3886886|
    |     5|     23|  3.0|1424380312|  2.261154|
    |    20|     39|  1.0|1424380312| 0.7566974|
    |    14|      7|  1.0|1424380312| 1.3507195|
    |    22|     84|  1.0|1424380312| 1.3260347|
    |    19|     87|  2.0|1424380312|  1.194166|
    |    14|     51|  1.0|1424380312| 1.8242279|
    |     0|     51|  1.0|1424380312|   1.25799|
    |    19|     69|  2.0|1424380312| 2.3473766|
    |    11|     69|  5.0|1424380312| 2.2135828|
    |    26|     97|  1.0|1424380312| 1.7413694|
    |    23|     97|  1.0|1424380312| 2.2850246|
    |    12|     63|  1.0|1424380312| 1.6935554|
    |     6|     63|  3.0|1424380312|  2.248004|
    |     4|     10|  1.0|1424380312| 0.5119103|
    |    29|     10|  3.0|1424380312|  1.779428|
    |    14|     10|  1.0|1424380312| 0.9699054|
    |     7|     77|  1.0|1424380312|  1.298023|
    |    16|     50|  1.0|1424380312| 1.9320694|
    |    15|     50|  2.0|1424380312| 1.3610632|
    |    24|     50|  1.0|1424380312| 2.2945905|
    |     2|     50|  1.0|1424380312| 1.6233714|
    +------+-------+-----+----------+----------+
    only showing top 100 rows
    
    +------+-------+-----+----------+------------+
    |userId|movieId|score| timestamp|  prediction|
    +------+-------+-----+----------+------------+
    |     5|     31|  1.0|1424380312|  0.09929418|
    |    24|     31|  1.0|1424380312|  0.34993026|
    |     0|     31|  1.0|1424380312|    0.536124|
    |    26|     85|  1.0|1424380312|   0.9634161|
    |     6|     85|  3.0|1424380312|   0.3895451|
    |     3|     65|  2.0|1424380312| 0.060586136|
    |     5|     65|  2.0|1424380312|  0.60077626|
    |    15|     65|  2.0|1424380312|  0.32053047|
    |     4|     65|  1.0|1424380312|  0.12699035|
    |    20|     53|  3.0|1424380312|  0.21146572|
    |    14|     53|  3.0|1424380312|  0.60893524|
    |    15|     34|  1.0|1424380312|  0.49167675|
    |     0|     34|  1.0|1424380312|  0.62419796|
    |     7|     81|  1.0|1424380312|  0.45796674|
    |    21|     81|  1.0|1424380312|  0.20833728|
    |    11|     81|  4.0|1424380312|   0.6037335|
    |     5|     28|  1.0|1424380312|    0.556639|
    |    13|     26|  1.0|1424380312| 0.013839987|
    |    27|     27|  3.0|1424380312|   0.4268512|
    |     5|     27|  1.0|1424380312|  0.48776346|
    |    21|     27|  1.0|1424380312|   0.5412798|
    |     0|     27|  1.0|1424380312|  0.64557505|
    |     0|     44|  1.0|1424380312|  0.38951802|
    |    14|     12|  1.0|1424380312|   0.5550236|
    |     0|     12|  2.0|1424380312|  0.45508265|
    |    12|     91|  3.0|1424380312|   0.6044633|
    |     1|     91|  1.0|1424380312|   0.4265149|
    |    20|     91|  1.0|1424380312|  0.20009243|
    |    12|     22|  2.0|1424380312|  0.49837476|
    |     6|     22|  1.0|1424380312|   0.6143004|
    |     7|     22|  1.0|1424380312|  0.55806553|
    |    14|     93|  3.0|1424380312|   0.3049203|
    |     7|     47|  4.0|1424380312|   0.6177729|
    |    27|     52|  1.0|1424380312|   0.5623982|
    |     2|     52|  2.0|1424380312|   0.2959741|
    |    28|     13|  2.0|1424380312|   0.4202898|
    |    26|     13|  3.0|1424380312|   0.7375625|
    |    17|     13|  2.0|1424380312|  0.52627224|
    |    21|     13|  1.0|1424380312|0.0141871255|
    |    22|      6|  2.0|1424380312|  0.50307125|
    |    12|     86|  1.0|1424380312|  0.38326162|
    |    27|     94|  2.0|1424380312|  0.44009215|
    |    11|     94|  2.0|1424380312|  0.60547274|
    |     2|     54|  1.0|1424380312|  0.05252012|
    |    26|     48|  1.0|1424380312|   0.6104486|
    |     0|     48|  1.0|1424380312|   0.5815558|
    |    18|     48|  1.0|1424380312|   0.5555368|
    |    22|     19|  1.0|1424380312|   0.7120537|
    |    16|     19|  1.0|1424380312|   0.8909184|
    |    11|     64|  1.0|1424380312|   0.5683132|
    |    13|     15|  1.0|1424380312|  0.10735524|
    |     5|     15|  1.0|1424380312|  0.47927082|
    |     4|     15|  1.0|1424380312|  0.37785834|
    |     8|     15|  1.0|1424380312|  0.30135292|
    |    24|     15|  1.0|1424380312|  0.51422495|
    |     2|     15|  2.0|1424380312| 0.035021875|
    |    27|     43|  1.0|1424380312|  0.81566215|
    |    23|     43|  1.0|1424380312|   0.9698969|
    |    15|     37|  1.0|1424380312|  0.40806082|
    |    23|     37|  1.0|1424380312|  0.37508062|
    |     5|     61|  1.0|1424380312|  0.04411153|
    |     9|     61|  1.0|1424380312|  0.79208994|
    |    23|     61|  1.0|1424380312|  0.60650265|
    |    16|      9|  1.0|1424380312|  0.20528911|
    |     5|      9|  3.0|1424380312|   0.3971194|
    |     4|      9|  1.0|1424380312|  0.42986745|
    |    14|      9|  1.0|1424380312|   0.3357755|
    |     0|      9|  4.0|1424380312|  0.31857634|
    |     6|     17|  1.0|1424380312|  0.10792195|
    |    15|     17|  2.0|1424380312|    0.708068|
    |     4|     17|  1.0|1424380312|  0.57599187|
    |    10|     17|  1.0|1424380312|  0.20264292|
    |     1|     72|  1.0|1424380312|    0.704078|
    |     5|     72|  1.0|1424380312|  0.07555515|
    |    23|     72|  1.0|1424380312|  0.16891822|
    |     7|      4|  1.0|1424380312|  0.47165263|
    |    20|     55|  1.0|1424380312|  0.44639456|
    |     2|     55|  1.0|1424380312|  0.60543674|
    |    26|     23|  5.0|1424380312|  0.36487472|
    |     5|     23|  3.0|1424380312|  0.09637666|
    |    20|     39|  1.0|1424380312|  0.95166934|
    |    14|      7|  1.0|1424380312|  0.71591306|
    |    22|     84|  1.0|1424380312|   0.4125934|
    |    19|     87|  2.0|1424380312|   0.4782898|
    |    14|     51|  1.0|1424380312|  0.62181115|
    |     0|     51|  1.0|1424380312|  0.42729497|
    |    19|     69|  2.0|1424380312|  0.76677346|
    |    11|     69|  5.0|1424380312|   0.5861151|
    |    26|     97|  1.0|1424380312|  0.57997453|
    |    23|     97|  1.0|1424380312|  0.55219173|
    |    12|     63|  1.0|1424380312|    0.610266|
    |     6|     63|  3.0|1424380312|  0.31094292|
    |     4|     10|  1.0|1424380312|  0.46597156|
    |    29|     10|  3.0|1424380312|    0.839095|
    |    14|     10|  1.0|1424380312|  0.48205912|
    |     7|     77|  1.0|1424380312|  0.46649498|
    |    16|     50|  1.0|1424380312|  0.62278056|
    |    15|     50|  2.0|1424380312|  0.29483482|
    |    24|     50|  1.0|1424380312|  0.60383016|
    |     2|     50|  1.0|1424380312|   0.8296596|
    +------+-------+-----+----------+------------+
    only showing top 100 rows
    
    [Stage 393:===============================================>     (179 + 2) / 200]显性反馈-->均方根误差为:0.9445437355858267
    隐性反馈-->均方根误差为:1.6823844381701756

    为每个用户推荐十部电影:
    +------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+ |userId|recommendations | +------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+ |28 |[[92,5.0983157], [12,4.598954], [81,4.476298], [89,4.182845], [2,3.9234986], [82,3.8571196], [49,3.8124385], [16,3.6531403], [19,3.3253133], [37,3.1170714]] | |26 |[[51,6.102162], [75,5.8304787], [94,5.11983], [22,5.0601068], [88,4.990194], [24,4.8964915], [7,4.530246], [98,4.281957], [30,4.0976753], [8,4.0757837]] | |27 |[[34,3.4125116], [7,3.314028], [18,3.3051038], [30,3.201357], [51,3.1810951], [32,3.0433266], [94,3.0402317], [23,2.9906392], [75,2.9714317], [38,2.962653]] | |12 |[[55,5.270858], [27,5.1677623], [17,5.006566], [64,4.812997], [35,4.60517], [32,4.473792], [13,4.2783904], [48,4.140034], [94,3.9392931], [50,3.8620284]] | |22 |[[75,5.243106], [74,4.9511943], [30,4.9132504], [88,4.892466], [22,4.7604437], [51,4.646963], [77,4.6219788], [94,4.0616746], [53,3.9926505], [32,3.9078906]] | |1 |[[22,3.9506853], [46,3.2753491], [98,3.1755204], [77,3.137111], [62,3.0944433], [20,2.966539], [68,2.937019], [90,2.8543637], [91,2.7597535], [94,2.690843]] | |13 |[[30,3.6332712], [93,3.5307932], [72,3.0017724], [74,2.93855], [1,2.9347591], [46,2.8185806], [53,2.795983], [18,2.794303], [76,2.5068393], [29,2.4414868]] | |6 |[[85,3.844798], [58,3.5195704], [43,3.3479555], [31,3.3161528], [47,3.04695], [29,2.8022027], [25,2.7257915], [61,2.7089], [76,2.6829338], [64,2.5252964]] | |16 |[[90,4.912488], [85,4.823761], [54,4.525241], [51,4.349716], [29,3.900838], [8,3.4726274], [69,3.2819238], [58,3.2687707], [43,3.1854987], [96,3.0706573]] | |3 |[[51,4.7775908], [75,4.52605], [30,4.2417297], [88,3.790906], [74,3.6995573], [18,3.5465877], [7,3.4613945], [24,3.2510872], [69,3.1902487], [94,3.1627612]] | |20 |[[22,4.6548405], [98,3.7508168], [94,3.6012595], [46,3.5126224], [68,3.5081453], [77,3.4868553], [75,3.4367645], [62,3.0410223], [32,3.0196898], [20,2.9789605]]| |5 |[[55,4.630348], [17,4.5733714], [90,4.093168], [32,3.9765522], [94,3.9211383], [27,3.667132], [46,3.5167294], [49,3.4865777], [68,3.257322], [13,3.1736424]] | |19 |[[90,3.914407], [94,3.6261058], [22,3.5484557], [98,3.423531], [51,3.2547069], [68,3.2058926], [54,3.0062537], [32,2.9392016], [46,2.8968444], [20,2.7734218]] | |15 |[[46,4.6416917], [1,3.1753883], [49,2.6534677], [93,2.5309358], [65,2.5152833], [10,2.3962762], [64,2.3436584], [92,2.2433295], [43,2.2069016], [23,2.205879]] | |17 |[[46,5.097472], [90,5.044071], [17,4.8069673], [94,4.431543], [32,4.253389], [55,4.2508135], [22,4.190283], [68,3.957674], [20,3.835051], [98,3.8123603]] | |9 |[[46,7.756304], [1,6.342198], [93,5.47401], [65,5.431714], [49,4.7963214], [48,4.6406856], [18,4.5046268], [7,4.4747753], [30,4.4606166], [87,3.8963184]] | |4 |[[53,4.060764], [62,4.037588], [29,3.8246064], [52,3.77816], [41,3.6326118], [70,3.5782375], [2,3.5586195], [93,3.2432747], [74,3.0608544], [77,2.878175]] | |8 |[[29,5.227355], [52,4.8253264], [85,4.518177], [53,4.309183], [76,4.225484], [62,4.180079], [58,3.9577186], [63,3.7724485], [43,3.4845204], [25,3.4038467]] | |23 |[[46,6.5736036], [32,5.144175], [55,5.0692563], [48,5.0379715], [17,5.0153174], [27,4.8894634], [65,4.842442], [49,4.7520447], [90,4.679768], [1,4.6568594]] | |7 |[[25,4.1084957], [85,3.8953774], [29,3.6264148], [58,3.4385662], [47,3.2377052], [31,2.9206622], [62,2.8975565], [67,2.8916044], [95,2.7941542], [76,2.724658]] | +------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+ only showing top 20 rows
    为每部电影推荐十个候选用户:
    +-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+ |movieId|recommendations | +-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+ |31 |[[12,3.4594746], [6,3.3161528], [14,3.083882], [8,2.993418], [7,2.9206622], [16,2.5415351], [11,2.4148295], [23,2.1971178], [25,2.193626], [21,1.9980735]] | |85 |[[16,4.823761], [14,4.5787725], [8,4.518177], [7,3.8953774], [6,3.844798], [24,3.3000665], [21,2.938549], [22,2.352202], [1,2.3502924], [19,2.2939112]] | |65 |[[9,5.431714], [23,4.842442], [11,3.4941888], [12,2.786085], [15,2.5152833], [17,2.4770505], [5,2.1158671], [13,2.1014814], [29,1.9842424], [27,1.5008173]] | |53 |[[24,6.1711597], [14,5.1863747], [21,5.1504893], [8,4.309183], [4,4.060764], [22,3.9926505], [13,2.795983], [3,2.488299], [16,2.2673397], [18,2.0359666]] | |78 |[[22,1.1940867], [23,1.1708361], [9,1.1576071], [2,1.1517711], [11,1.0952846], [17,1.0582489], [24,1.0521772], [26,1.05149], [14,1.0410485], [21,1.0178156]] | |34 |[[2,3.8074708], [27,3.4125116], [26,3.3873892], [25,3.066997], [11,3.002815], [18,2.904939], [3,2.6826212], [10,2.6081514], [7,2.3699164], [22,2.2166972]] | |81 |[[28,4.476298], [2,4.2211657], [18,2.7173178], [26,2.638442], [29,2.4594424], [25,2.4035954], [0,2.3696287], [11,2.1801503], [27,2.1503515], [12,2.0741906]] | |28 |[[18,4.552335], [25,3.3994784], [13,2.3083718], [1,2.2168252], [0,1.9407845], [20,1.7820798], [15,1.7403098], [22,1.6494246], [17,1.6293736], [9,1.4119273]] | |76 |[[14,4.841398], [8,4.225484], [21,3.929272], [24,3.7911506], [22,2.9201262], [16,2.8898907], [7,2.724658], [6,2.6829338], [18,2.6383157], [4,2.5906591]] | |26 |[[28,2.8381732], [15,2.082985], [0,2.0178013], [6,1.7403066], [18,1.721652], [25,1.6927128], [26,1.6069947], [1,1.5817455], [17,1.4188398], [20,1.4116641]] | |27 |[[12,5.1677623], [11,4.9544406], [23,4.8894634], [29,3.711397], [5,3.667132], [17,3.2135687], [9,3.2000802], [24,2.881887], [27,2.5037022], [16,2.1295547]] | |44 |[[18,3.7828002], [25,3.3312376], [11,2.8302445], [27,2.4153981], [2,2.2561316], [12,2.094188], [29,1.7559719], [23,1.650434], [24,1.6288797], [13,1.6084089]]| |12 |[[28,4.598954], [2,3.3080924], [0,2.6924894], [18,2.3275723], [25,2.313998], [29,2.241183], [12,2.2385948], [6,2.0936615], [15,2.0133774], [7,1.5621763]] | |91 |[[25,3.3030632], [18,3.2800071], [1,2.7597535], [17,2.5178885], [2,2.423686], [28,2.366045], [20,2.3208883], [12,2.2997293], [0,2.2707045], [23,2.2619593]] | |22 |[[26,5.0601068], [22,4.7604437], [20,4.6548405], [17,4.190283], [1,3.9506853], [19,3.5484557], [5,3.0979736], [3,2.9593568], [29,2.3272212], [28,2.2654362]] | |93 |[[9,5.47401], [2,4.8106575], [13,3.5307932], [21,3.3460832], [23,3.264933], [4,3.2432747], [24,3.1217763], [28,2.9521174], [10,2.559741], [15,2.5309358]] | |47 |[[7,3.2377052], [6,3.04695], [8,3.0094035], [14,2.8532794], [16,2.7172682], [25,2.5207503], [12,2.2804565], [21,1.706414], [11,1.6326886], [18,1.5291028]] | |1 |[[9,6.342198], [23,4.6568594], [15,3.1753883], [11,3.1032243], [13,2.9347591], [25,1.9986253], [17,1.906729], [2,1.900861], [12,1.7952665], [27,1.6515436]] | |52 |[[14,5.3406544], [24,4.9338098], [21,4.89181], [8,4.8253264], [4,3.77816], [22,3.5162592], [16,2.7635403], [7,2.645031], [3,2.6148405], [6,2.381413]] | |13 |[[12,4.2783904], [23,3.991661], [11,3.952318], [5,3.1736424], [9,2.894327], [17,2.7198553], [29,2.650311], [27,2.3568263], [25,2.027948], [2,1.5425134]] | +-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+ only showing top 20 rows
  • 相关阅读:
    java语法基础
    向linux内核增加一个系统调用-1
    dp-矩阵连乘
    struct和typedef struct
    Ubuntu安装Chrome及hosts修改
    c++primer-p100.用迭代器进行二分法搜索
    c++primer-p101.ex3.24
    c++ vector用法和迭代器
    Bytes和bits的区别(字节和位的区别)
    基于R语言的数据分析和挖掘方法总结——中位数检验
  • 原文地址:https://www.cnblogs.com/soyo/p/7821923.html
Copyright © 2020-2023  润新知