Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sqltransformer function to execute SQL statements in the Pipeline #61

Closed
johnnyzheng1986 opened this issue Mar 25, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@johnnyzheng1986
Copy link

johnnyzheng1986 commented Mar 25, 2020

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);

@wangyu4882
Copy link

I expect this feature so much and it really helpful for a machine learning solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants