- 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)
推薦閱讀
- Redis使用手冊
- Game Development with Swift
- MongoDB管理與開發精要
- 文本數據挖掘:基于R語言
- 數據結構與算法(C語言版)
- Live Longer with AI
- 3D計算機視覺:原理、算法及應用
- 數據驅動:從方法到實踐
- Learn Unity ML-Agents:Fundamentals of Unity Machine Learning
- 網站數據庫技術
- 數據中心數字孿生應用實踐
- 云數據中心網絡與SDN:技術架構與實現
- Mastering LOB Development for Silverlight 5:A Case Study in Action
- 從實踐中學習sqlmap數據庫注入測試
- 改進的群智能算法及其應用