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

Uploading the nonlinear data to Redshift

We first need to create the table that will host the data. We will call that table nonlinear. It only has three columns: an index, the predictor X, and the outcome y:

CREATE TABLE IF NOT EXISTS nonlinear (  id integer primary key,  x1 real,  y real);

Once the table is created, we can upload the CSV file to S3, connect to the database, and import the data in the non-linear table with the command:

copy nonlinear from 's3://aml.packt/data/ch9/nonlinear.csv' CREDENTIALS 'aws_access_key_id=<access key id>;aws_secret_access_key=<access secret key>' CSV;

We can verify that the nonlinear table now has a thousand rows with the query:

$ psql $REDSHIFT_CONNECT -c "select count(*) from nonlinear" > count> 1000 ...

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