Question
use the attached data set to plot graph using regression in python

4 1 fixed acid volatile ac citric acid residual sichlorides free sulfu total sulfu density pHsulphates alcoholquality type 34
0 0
Add a comment Improve this question Transcribed image text
Answer #1

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression

# read data to datsframe
data = pd.read_csv("alchol.csv")
# linear regression class instance
model = LinearRegression()
# fit the model training
model.fit(data[["fixed acid","volatie acid","citric acid","residual sulfur","chlorides","free sulfur","total sulfur","density","pH","sulphates"]],data.quality)
# coefficients of function
print(model.coef_)
# plotting the graphs with each variants to qulaity
plt.subplot(2,5,1)
plt.title("quality vs fixed acid")
plt.plot(data["fixed acid"],model.coef_[0]*data["fixed acid"])
plt.subplot(2,5,2)
plt.title("quality vs volatie acid")
plt.plot(data["volatie acid"],model.coef_[1]*data["volatie acid"])
plt.subplot(2,5,3)
plt.title("quality vs citric acid")
plt.plot(data["citric acid"],model.coef_[2]*data["citric acid"])
plt.subplot(2,5,4)
plt.title("quality vs residual sulfur")
plt.plot(data["residual sulfur"],model.coef_[3]*data["residual sulfur"])
plt.subplot(2,5,5)
plt.title("quality vs chlorides")
plt.plot(data["chlorides"],model.coef_[4]*data["chlorides"])
plt.subplot(2,5,6)
plt.title("quality vs free sulfur")
plt.plot(data["free sulfur"],model.coef_[5]*data["free sulfur"])
plt.subplot(2,5,7)
plt.title("quality vs total sulfur")
plt.plot(data["total sulfur"],model.coef_[6]*data["total sulfur"])
plt.subplot(2,5,8)
plt.title("quality vs density")
plt.plot(data["density"],model.coef_[7]*data["density"])
plt.subplot(2,5,9)
plt.title("quality vs pH")
plt.plot(data["pH"],model.coef_[8]*data["pH"])
plt.subplot(2,5,10)
plt.title("quality vs sulphates")
plt.plot(data["sulphates"],model.coef_[9]*data["sulphates"])
plt.show()

quality vs fixed acid quality vs volatie acid quality vs citric acid quality vs residual sulfur quality vs chlorides 0.10 0.5

Add a comment
Know the answer?
Add Answer to:
use the attached data set to plot graph using regression in python 4 1 fixed acid volatile ac citric acid residual s...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Use the sample data and confidence level given below to complete parts (a) through (d). A...

    Use the sample data and confidence level given below to complete parts (a) through (d). A research institute poll asked respondents if they felt vulnerable to identity theft. In the poll, n=924 and x = 540 who said "yes." Use a 90% confidence level. E Click the icon to view a table of z scores. a) Find the best point estimate of the population proportion p (Round to three decimal places as needed.) b) Identify the value of the margin...

  • Suppose 1000 coins are tossed. Use the normal curve approximation to the binomial distribution to find...

    Suppose 1000 coins are tossed. Use the normal curve approximation to the binomial distribution to find the probability of getting the following result. Exactly 495 heads Use the table of areas under the standard normal curve given below. Click here to view page 1. Click here to view page 2. Click here to view page 3. Click here to view page 4. Click here to view page 5. Click here to view page 6. The probability of getting exactly 495...

  • Suppose 16 coins are tossed. Use the normal curve approximation to the binomial distribution to find...

    Suppose 16 coins are tossed. Use the normal curve approximation to the binomial distribution to find the probability of getting the following result. More than 11 tails. Use the table of areas under the standard normal curve given below. Click here to view page 1. Click here to view page 2. Click here to view page 3. Click here to view page 4. Click here to view page 5. Click here to view page 6. Binomial probability = (Round to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT