You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During machine learning training, we typically process raw data (mainly SQL operations) and then build pipelines for training. However, when we use the LocalPredictor loading model for prediction, the original data still needs to go through data processing, so the code of data processing part needs to be repeatedly written in the prediction program.
Can Alink provide functions similar to Spark sqltransformer and perform SQL calculations in the Pipeline to simplify the code in the prediction stage?
The following is an example of Alink, Can we put this part of the processing into the Pipeline as well:
Imputer imputer = new Imputer()
.setSelectedCols("Age","Fare")
.setStrategy("mean");
ImputerModel imputerModel = imputer.fit(source);
String fields1 = "PassengerId,Survived,Pclass,Name,Sex,Age,SibSp,Parch,Fare,Embarked,Family,Title," +
"case when Age<16 then 1 else 0 end as Child," +
"case when Age>17 and Sex ='female' and Parch >0 and Name like '%Miss%' then 1 else 0 end as Mom," +
"case when Age>0 and Age <20 then 1 when Age>=20 and Age<30 then 2 when Age>=30 and Age <50 then 3 when Age>=50 then 4 end as AgeCat";
BatchOperator res = imputerModel.transform(source).select(fields1);
The text was updated successfully, but these errors were encountered:
During machine learning training, we typically process raw data (mainly SQL operations) and then build pipelines for training. However, when we use the LocalPredictor loading model for prediction, the original data still needs to go through data processing, so the code of data processing part needs to be repeatedly written in the prediction program.
Can Alink provide functions similar to Spark sqltransformer and perform SQL calculations in the Pipeline to simplify the code in the prediction stage?
The following is an example of Alink, Can we put this part of the processing into the Pipeline as well:
Imputer imputer = new Imputer()
.setSelectedCols("Age","Fare")
.setStrategy("mean");
ImputerModel imputerModel = imputer.fit(source);
String fields1 = "PassengerId,Survived,Pclass,Name,Sex,Age,SibSp,Parch,Fare,Embarked,Family,Title," +
"case when Age<16 then 1 else 0 end as Child," +
"case when Age>17 and Sex ='female' and Parch >0 and Name like '%Miss%' then 1 else 0 end as Mom," +
"case when Age>0 and Age <20 then 1 when Age>=20 and Age<30 then 2 when Age>=30 and Age <50 then 3 when Age>=50 then 4 end as AgeCat";
BatchOperator res = imputerModel.transform(source).select(fields1);
The text was updated successfully, but these errors were encountered: