pyspark線性SVC

from pyspark.ml.classification import LinearSVC from pyspark.sql import SparkSession spark = SparkSession\ .builder\ .appName("linearSVC Example")\ .getOrCreate() training = spark.read.format("libsvm").load("sample_libsvm_data.txt") # threshold:用於二分類的閾值 # aggregationDepth:這個參數在很多地方見過,treeAggregate相比Aggregate更高效, # 它避免一次性將所有分區的結果傳到彙總端(可能內存不足,可能分區太多),所以它先對分區做些整理、合併等操作,再傳遞結果。 lsvc = LinearSVC(maxIter=10, regParam=0.1) # Fit the model lsvcModel = lsvc.fit(training) # Print the coefficients and intercept for linear SVC print("Coefficients: " + str(lsvcModel.coefficients)) print("Intercept: " + str(lsvcModel.intercept))
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章