Question: The question below based on the [cataloguemkting.csv] Create a python program that implement the simplest prediction process using linear regression in scikit-learn that predict the

The question below based on the [cataloguemkting.csv]

The question below based on the [cataloguemkting.csv] Create a python program that

implement the simplest prediction process using linear regression in scikit-learn that predict

Create a python program that implement the simplest prediction process using linear regression in scikit-learn that predict the AmountSpent a customer make base on his/her age, salary, and children. Print out the coefficients of the estimated model and apply the model onto the data X_new=[[21, 2, 12345]] (corresponding to age, salary, and children) to predict. [Involved Concepts: Linear regression, Sci-kit learn, fit, coef_, predict]

I did part of it

import pandas as pd trans=pd.read_csv("cataloguemkting.csv") y=trans["AmountSpent"] X=trans[["Children","Salary","Age"]]

A 1 ID 2 3 4 5 6 7 8 9 10 B Gender 1 Male 2 Male 3 Female 4 Male 5 Male 6 Female 7 Female 8 Male 9 Female C D E F G Own Hom Married Salary Children Age Yes Married 97300 1 No Single 11200 0 No Single 34700 0 Yes Single 60300 0 No Single 52600 1 Yes Married 82200 1 No Single 12400 1 Yes Single 53900 0 No Single 15900 0 H I J Catalogs AmountSpent 51 12 3048 57 6 106 33 18 1615 62 24 2091 45 18 1773 53 12 1517 43 12 229 69 12 1186 71 18 406 299 300 301 302 303 304 305 298 Male Yes 299 Female No 300 Male Yes 301 Male Yes 302 Female Yes 303 Female No Single Single Single Unknown Unknown Single 62200 13200 64300 70000 123600 14100 0 0 0 1 1 3 65 25 44 50 55 30 12 24 6 6 12 6 1583 358 1325 1227 1892 153

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!