本文簡要介紹
pyspark.mllib.regression.IsotonicRegressionModel
的用法。用法:
class pyspark.mllib.regression.IsotonicRegressionModel(boundaries, predictions, isotonic)
等滲回歸的回歸模型。
1.4.0 版中的新函數。
- boundaries:ndarray
預測已知的邊界數組。邊界必須按升序排序。
- predictions:ndarray
與同一索引處的邊界關聯的預測數組。等滲回歸的結果,因此是單調的。
- isotonic:真的
指示這是等滲的還是反滲的。
參數:
例子:
>>> data = [(1, 0, 1), (2, 1, 1), (3, 2, 1), (1, 3, 1), (6, 4, 1), (17, 5, 1), (16, 6, 1)] >>> irm = IsotonicRegression.train(sc.parallelize(data)) >>> irm.predict(3) 2.0 >>> irm.predict(5) 16.5 >>> irm.predict(sc.parallelize([3, 5])).collect() [2.0, 16.5] >>> import os, tempfile >>> path = tempfile.mkdtemp() >>> irm.save(sc, path) >>> sameModel = IsotonicRegressionModel.load(sc, path) >>> sameModel.predict(3) 2.0 >>> sameModel.predict(5) 16.5 >>> from shutil import rmtree >>> try: ... rmtree(path) ... except OSError: ... pass
相關用法
- Python pyspark IsotonicRegression用法及代碼示例
- Python pyspark Index.is_monotonic_decreasing用法及代碼示例
- Python pyspark Index.values用法及代碼示例
- Python pyspark Index.drop_duplicates用法及代碼示例
- Python pyspark IndexedRowMatrix.computeGramianMatrix用法及代碼示例
- Python pyspark Index.value_counts用法及代碼示例
- Python pyspark IDF用法及代碼示例
- Python pyspark Index.map用法及代碼示例
- Python pyspark Index.equals用法及代碼示例
- Python pyspark Index.argmin用法及代碼示例
- Python pyspark Index.argmax用法及代碼示例
- Python pyspark Index.item用法及代碼示例
- Python pyspark Index.insert用法及代碼示例
- Python pyspark Index.nlevels用法及代碼示例
- Python pyspark Index.min用法及代碼示例
- Python pyspark Index.copy用法及代碼示例
- Python pyspark Int64Index用法及代碼示例
- Python pyspark Index用法及代碼示例
- Python pyspark Index.difference用法及代碼示例
- Python pyspark Index.to_list用法及代碼示例
- Python pyspark Index.shape用法及代碼示例
- Python pyspark Index.dropna用法及代碼示例
- Python pyspark Index.repeat用法及代碼示例
- Python pyspark Index.notna用法及代碼示例
- Python pyspark Index.has_duplicates用法及代碼示例
注:本文由純淨天空篩選整理自spark.apache.org大神的英文原創作品 pyspark.mllib.regression.IsotonicRegressionModel。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。