- Artificial Intelligence for Big Data
- Anand Deshpande Manish Kumar
- 84字
- 2021-06-25 21:57:12
The transformer function
This is something that can transform one DataFrame into another. For instance, an ML model can transform a DataFrame with features into a DataFrame with predictions. A transformer contains feature transformer and learned model. This uses the transform() method to transform one DataFrame into another. The code for this is given for your reference:
import org.apache.spark.ml.feature.Tokenizer
val df = spark.createDataFrame(Seq( ("This is the Transformer", 1.0), ("Transformer is pipeline component", 0.0))).toDF( "text", "label") val tokenizer = new Tokenizer().setInputCol("text").setOutputCol("words") val tokenizedDF = tokenizer.transform(df)
推薦閱讀
- 計算機綜合設計實驗指導
- Google Visualization API Essentials
- Developing Mobile Games with Moai SDK
- 使用GitOps實現Kubernetes的持續部署:模式、流程及工具
- Oracle RAC 11g實戰指南
- 揭秘云計算與大數據
- iOS and OS X Network Programming Cookbook
- 大數據:從概念到運營
- 數亦有道:Python數據科學指南
- SQL應用及誤區分析
- Python數據分析與數據化運營
- Google Cloud Platform for Developers
- SQL Server深入詳解
- 商業智能工具應用與數據可視化
- openGauss數據庫核心技術