O'Reilly logo

Effective Amazon Machine Learning by Alexis Perrier

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Wrapping up

We can combine all these queries while also selecting the original attributes. Since the data is still ordered by pclass and passenger name in alphabetical order, we should also randomize the results. We end up with the following query:

SELECT pclass, survived, name, sex, COALESCE(age, 28) as age, sibsp, parch, ticket, COALESCE(fare, 14.5) as fare, cabin, embarked, boat, body, home_dest, CASE  WHEN age is null THEN 0 ELSE 1 END as is_age_missing, log(fare + 1, 2) as log_fare,split(name, ' ')[2] as title,substr(cabin, 1, 1) as deck,sibsp + parch + 1 as family_size FROM titanicORDER BY RAND();

Let us run that query. The results will be displayed in the results panel and also written in a CSV file in the query result location on ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required