Page 293 - Touhpad Ai
P. 293

plt.show()


                        # Step 5: Print regression equation
                        slope = model.coef_[0]
                        intercept = model.intercept_
                        print("\nLinear  Regression  Equation:\nPackage  = ",round(slope,2),  "× CGPA  + ",
                        round(intercept,2))
                     Output:




























                     Linear Regression Equation:
                     Package =  0.57 × CGPA + -0.99


                       Next, let us test the above model by accepting a new CGPA from the user and then displaying the predicted salary
                     package:

                     # Step 6: Accept user input and predict package
                     cgpa_input = float(input("\nEnter CGPA to predict the placement package: "))
                     predicted_package = model.predict([[cgpa_input]])[0]
                     print("Predicted Package: ₹",round(predicted_package,2),"LPA")
                     Output:
                     Enter CGPA to predict the placement package: 9.24
                     Predicted Package: ₹ 4.28 LPA
                 Project 2
                 This project predicts used car prices using a dataset that contains different car attributes such as year, power, engine
                 size, and kilometers driven. After cleaning and performing visualization on the dataset, a simple linear regression model
                 is applied to determine how various features affect car prices after the data has been cleaned and visualized. Download
                 the dataset from - https://www.kaggle.com/datasets/nehalbirla/vehicle-dataset-from-cardekho or scan the QR code.
                 The folder contains multiple files. We will be using car details v4.csv as our dataset.

                     # Import libraries
                     import pandas as pd
                     import matplotlib.pyplot as plt
                     import seaborn as sns


                                                                                                     Project Work   291
   288   289   290   291   292   293   294   295   296   297   298