Using scikit learn for Multiple Linear Regression in Hindi for Data Science and Machine Learning

Posted by


Multiple linear regression is a widely used statistical technique for understanding the relationship between multiple independent variables and a dependent variable. In this tutorial, we will be using the scikit-learn library in Python to build a multiple linear regression model.

हमारे इस वीडियो में हम scikit-learn लाइब्रेरी का उपयोग करके कैसे #7 मल्टिपल लीनियर रीग्रेशन बना सकते हैं, इसके बारे में जानकारी देगें |

Step 1: Importing the necessary libraries

हम पहले सभी जरूरी लाइब्रेरीज़ को इम्पोर्ट करेंगे।

import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error

Step 2: Loading the dataset

अगला कदम है डेटासेट को लोड करना। आप किसी भी डेटासेट का उपयोग कर सकते हैं, लेकिन यहां हम एक उदाहरण के रूप में न्यूमेरिकल डेटासेट का उपयोग करेंगे।

url = "url_of_your_dataset.csv"
data = pd.read_csv(url)

Step 3: Preprocessing the data

अब हम डेटा को प्रीप्रोसेस करने के लिए उपयुक्त मेथड का उपयोग करेंगे।

X = data.drop('target_column_name', axis=1)
y = data['target_column_name']

Step 4: Splitting the data into training and testing sets

डेटा को ट्रेनिंग और टेस्ट सेट में विभाजित करना है।

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

Step 5: Building the multiple linear regression model

अब हम scikit-learn में लिनियर रीग्रेशन मॉडल बनाने के लिए तैयार हैं।

model = LinearRegression()
model.fit(X_train, y_train)

Step 6: Making predictions

भविष्यवाणियों बनाने के लिए टेस्ट डेटा पर मॉडल का उपयोग करें।

predictions = model.predict(X_test)

Step 7: Evaluating the model

अंतिम कदम मॉडल का मूल्यांकन करना है।

mse = mean_squared_error(y_test, predictions)
print("Mean Squared Error:", mse)

इस तरह से हमने scikit-learn लाइब्रेरी का उपयोग करके मल्टिपल लीनियर रीग्रेशन मॉडल बनाया। यह एक बहुत ही मानक प्रक्रिया है और ज्यादातर डेटा साइंटिस्ट और मशीन लर्निंग ईंजीनियर्स इसे अपने प्रोजेक्ट्स में उपयोग करते हैं।

मैं आशा करता हूँ कि यह ट्यूटोरियल आपके लिए उपयोगी होगा। धन्यवाद।

0 0 votes
Article Rating
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
@saharshnigam6526
1 month ago

Hello sir..
I am doing your instagram clone course on udemy
although i am new to reactjs still its easy to understand.
Thank u