/
githubmirror
/
spark
Обзор
Документация
Войти
/
githubmirror
/
spark
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
python/pyspark/ml/tests/typing/test_regression.yml
53 строки
2 KB
zero323
[SPARK-37397][PYTHON] Inline annotations for pyspark.ml.base
02 фев 2022, 10:22
02 фев 2022, 10:22
8559e94
Код
Авторство
О чём код?
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # - case: linearRegressionMethodChaining main: | from pyspark.ml.regression import LinearRegression, LinearRegressionModel lr = LinearRegression() reveal_type(lr.setFeaturesCol("foo").setLabelCol("bar")) lrm = LinearRegressionModel.load("/foo") reveal_type(lrm.setPredictionCol("baz")) out: | main:4: note: Revealed type is "pyspark.ml.regression.LinearRegression" main:7: note: Revealed type is "pyspark.ml.regression.LinearRegressionModel" - case: loadFMRegressor main: | from pyspark.ml.regression import FMRegressor, FMRegressionModel fm = FMRegressor.load("/foo") fm.setMiniBatchFraction(0.1) fm_model = FMRegressionModel.load("/bar") fm_model.factors.numCols fm_model.foo() # E: "FMRegressionModel" has no attribute "foo" [attr-defined] - case: loadLinearRegressor main: | from pyspark.ml.regression import LinearRegressionModel lr_model = LinearRegressionModel.load("/foo") lr_model.getLabelCol().upper() lr_model.foo # E: "LinearRegressionModel" has no attribute "foo" [attr-defined]