Scikit-learn Tutorial in Hindi: AI ?????? ML ?????? ????????? Step-by-Step Guide
Scikit-learn (???????????????-????????????) ?????? ??????????????????????????? ?????? ?????????-??????????????? Python ??????????????????????????? ??????, ?????? Artificial Intelligence (AI) ?????? Machine Learning (ML) ????????? ???????????? ????????????????????? ?????????????????? ?????? ???????????????, ??????????????? ????????????, ?????? ??????????????????????????? ???????????? ?????? ????????? ?????????????????? ????????? ?????? ??????????????? ?????? ???????????? ????????? ?????? ??????????????????????????? ???????????? ??????????????????????????????????????????, ???????????? ????????????????????????, ?????? ?????????????????????????????? ?????????????????????????????? ?????? ????????? ???????????????-???????????????????????? ??????????????? ?????????????????? ???????????? ????????? ?????? ??????????????? ?????????, ?????? Scikit-learn ?????? ??????????????? ?????? ?????????????????????????????? ????????????????????????????????? ?????? ??????????????? ??????????????????????????? ??????????????????, ???????????? ????????????????????????????????????, ????????????????????????, ???????????? ????????????????????????, ?????? ???????????? ?????????????????????????????????
?????? ??????????????? ?????? ???????????????????????? ???????????????????????? ?????? ?????????????????????????????? ????????????????????? ?????? Scikit-learn ?????? ?????????????????? ????????????????????????????????? ?????????????????? ??????, ?????? AI/ML ????????????????????????????????? ????????? ???????????? ????????????????????? ?????????????????? ?????? ???????????? ???????????? ???????????? ?????? ?????? ??????????????????????????? ?????? ????????? ????????????????????????????????????, AI/ML ????????? ???????????? ???????????? ?????????, ?????? ?????????????????????????????? ??????????????? ?????? ????????? ????????? ?????????????????????
???????????????-???????????? ???????????? ??????? - What is Scikit-learn in Hindi?
Scikit-learn (?????? sklearn) ?????? Python ??????????????????????????? ??????, ?????? ???????????? ????????????????????? ????????????????????????????????? ?????? ???????????? ???????????? ?????? ????????? ????????????????????? ?????? ?????? ????????? ????????? 2007 ????????? David Cournapeau ?????? ???????????? ???????????? ??????, ?????? ?????? ?????? ???????????? ??????????????? ?????? ML ??????????????????????????? ????????? ???????????? ?????????????????? ?????????????????????????????? ????????? ?????? ?????? ????????? Scikit-learn NumPy ?????? Pandas ?????? ????????? ??????????????????????????? ???????????? ??????, ?????? ?????? ????????????????????????????????????, ????????????????????????, ??????????????????????????????, ?????? ???????????????????????????????????? ????????????????????? ???????????? ????????????????????? ?????? ?????????????????? ???????????? ?????????
Scikit-learn ?????? ?????????????????? ??????????????????:
- ?????????????????????????????????: ?????????????????? ????????????????????????, ?????????????????? ??????????????????, SVM, ?????? K-Means ???????????? ????????????????????????????????????
- ??????????????????????????????????????????: ???????????? ????????????????????????, ????????????????????????, ?????? ???????????? ???????????????????????????
- ???????????? ??????????????????????????????: ???????????????????????????, ????????????????????????, ???????????????, ?????? ???????????????-???????????????????????? ???????????? ??????????????????
- ??????????????????????????????: ???????????? ?????????????????????????????????????????? ?????? ???????????? ???????????????????????? ?????? ?????????????????? ???????????? ?????? ?????????????????????
AI/ML ????????? ???????????? ?????????: Scikit-learn ?????? ??????????????? ???????????????????????????????????? ?????????????????? (???????????? ??????????????? ????????????????????????), ???????????????????????? ?????????????????? (???????????? ?????????????????? ??????????????????????????????), ?????? ???????????? ?????????????????????????????????????????? (???????????? ???????????? ????????????????????????) ?????? ????????? ???????????? ?????????
???????????????-???????????? ??????????????? - Scikit-learn Setup in Hindi
???????????????-???????????? ?????? ????????? AI/ML ???????????? ???????????? ?????? ????????? ???????????? ???????????? ????????? ????????????????????? ???????????? ?????????????????? ?????????
1. Scikit-learn ?????????????????????????????? - Installation
-
???????????????: ????????????????????? ?????? ??????????????? ??????????????????????????? ????????? ?????????????????????????????? ??????????????? ?????? ????????????:
pip install scikit-learn
-
??????????????????????????????: Python ????????? Scikit-learn ????????????????????? ???????????? ????????? ????????????:
import sklearn
print("Scikit-learn Version:", sklearn.__version__)
??????????????????:
Scikit-learn Version: 1.2.2
2. ????????????????????????????????? ??????????????? - Environment Setup
- Jupyter Notebook: Scikit-learn ?????? ????????? ???????????? ???????????????????????? ?????? ???????????????????????? ?????? ????????? ??????????????????
- Anaconda: Scikit-learn ????????????-??????????????????????????? ????????? ?????????
- VS Code: Scikit-learn ????????? ??????????????? ?????? ??????????????? ???????????? ?????? ????????? ????????????????????????
AI/ML ????????? ????????????: Scikit-learn ?????? ??????????????? ???????????? ????????????????????????, ???????????? ??????????????????????????????????????????, ?????? ?????????????????????????????? ?????????????????????????????? ????????? ???????????? ?????????
???????????????-???????????? ?????? ??????????????? ????????????????????????????????? - Basic Concepts of Scikit-learn in Hindi
1. ???????????? ?????????????????????????????????????????? - Data Preprocessing
???????????????-???????????? ???????????? ?????? ML ?????????????????? ?????? ????????? ??????????????? ???????????? ?????? ????????? ?????? ?????????????????????????????????????????? ??????????????? ?????????????????? ???????????? ??????, ???????????? ???????????????????????? ?????? ???????????????????????????
????????? ??????????????????????????????: ???????????? ???????????????????????????
import numpy as np
from sklearn.preprocessing import StandardScaler
# Data
data = np.array([[1, 2], [3, 4], [5, 6]])
# Standard scaling
scaler = StandardScaler()
scaled_data = scaler.fit_transform(data)
print("Scaled Data:\n", scaled_data)
??????????????????:
Scaled Data:
[[-1.22474487 -1.22474487]
[ 0. 0. ]
[ 1.22474487 1.22474487]]
AI/ML ????????? ????????????: ???????????? ???????????????????????? ?????? ???????????? ?????????????????? ?????? ?????????????????????????????? ???????????? ?????? ????????? ???????????? ??????, ?????? ???????????? ?????? ?????????????????????????????? ?????? ??????????????? ??????????????? ?????????
2. ???????????????????????????????????? - Classification
???????????????????????????????????? ?????????????????? ???????????? ?????? ??????????????????????????? ????????? ?????????????????? ?????? ????????? ?????????????????? ?????????, ???????????? ??????????????? ???????????? ?????????-??????????????????
????????? ??????????????????????????????: ??????????????????????????? ???????????????????????? ?????? ????????? ???????????????????????????????????????
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
import numpy as np
# Data
X = np.array([[1, 2], [2, 3], [3, 4], [4, 5]])
y = np.array([0, 0, 1, 1])
# Data split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=42)
# Model training
model = LogisticRegression()
model.fit(X_train, y_train)
# Prediction
predictions = model.predict(X_test)
print("Predictions:", predictions)
??????????????????:
Predictions: [1]
AI/ML ????????? ????????????: ???????????????????????????????????? ?????? ???????????? ??????????????? ????????????????????????, ??????????????????????????? ????????????????????????, ?????? ???????????? ???????????????????????????????????? ???????????? ????????????????????? ????????? ???????????? ?????????
3. ???????????????????????? - Regression
???????????????????????? ?????????????????? ?????????????????? (continuous) ???????????????????????? ?????? ?????????????????????????????? ?????? ????????? ?????????????????? ?????????, ???????????? ???????????? ?????????????????? ?????????????????????????????????
????????? ??????????????????????????????: ?????????????????? ???????????????????????????
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
import numpy as np
# Data
X = np.array([[1], [2], [3], [4]])
y = np.array([2, 4, 6, 8])
# Data split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=42)
# Model training
model = LinearRegression()
model.fit(X_train, y_train)
# Prediction
predictions = model.predict(X_test)
print("Predictions:", predictions)
??????????????????:
Predictions: [4.]
AI/ML ????????? ????????????: ???????????????????????? ?????? ???????????? ?????????????????? ??????????????????????????????, ?????????????????? ?????????????????????????????????, ?????? ???????????? ?????????????????? ???????????????????????? ????????? ???????????? ?????????
4. ???????????? ?????????????????????????????? - Model Evaluation
Scikit-learn ?????????????????? ?????? ?????????????????????????????? ?????? ??????????????? ?????? ????????? ?????? ??????????????????????????? ?????????????????? ???????????? ??????, ???????????? ??????????????????????????? ?????? MSE???
????????? ??????????????????????????????: ???????????? ??????????????????????????? ????????? ???????????????
from sklearn.metrics import accuracy_score
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
import numpy as np
# Data
X = np.array([[1, 2], [2, 3], [3, 4], [4, 5]])
y = np.array([0, 0, 1, 1])
# Data split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=42)
# Model training
model = LogisticRegression()
model.fit(X_train, y_train)
# Prediction and accuracy
predictions = model.predict(X_test)
accuracy = accuracy_score(y_test, predictions)
print("Accuracy:", accuracy)
??????????????????:
Accuracy: 1.0
AI/ML ????????? ????????????: ???????????? ?????????????????????????????? ?????? ???????????? ?????????????????? ?????? ?????????????????????????????? (???????????? ???????????????????????????, ????????????????????????) ?????? ??????????????? ?????? ????????????????????? ?????? ????????? ???????????? ?????????
AI ?????? ML ????????? ???????????????-???????????? ?????? ??????????????? - Advantages of Scikit-learn in AI & ML in Hindi
- ???????????????-????????????????????????: ????????? ?????? ?????????????????????????????? API ?????? ???????????????????????? ?????? ????????? ???????????? ?????????
- ??????????????????????????????: ?????? ????????? ?????? ML ????????????????????????????????? ?????? ??????????????? ?????? ?????????????????? ???????????? ?????????
- ??????????????????????????????: NumPy, Pandas, ?????? Matplotlib ?????? ????????? ??????????????? ?????? ????????? ???????????? ?????????
- ??????????????????????????? ??????????????????: X, GitHub, ?????? Stack Overflow ?????? ????????? ???????????? ??????????????????????????????
AI ?????? ML ????????? ???????????????-???????????? ?????? ???????????? ????????? - Use Cases of Scikit-learn in AI & ML in Hindi
- ????????????????????????????????????: ??????????????? ????????????????????????, ??????????????????????????? ????????????????????????, ?????? ?????????????????? ?????????????????????????????????
- ????????????????????????: ???????????? ?????????????????? ?????????????????????????????? ?????? ?????????????????? ????????????????????????????????????
- ??????????????????????????????????????????: ???????????? ????????????????????????, ????????????????????????, ?????? ???????????? ???????????????????????????
- ???????????? ????????????????????????: ???????????????-???????????????????????? ?????? ??????????????????????????????????????? ???????????????????????????
???????????? ??????????????????????????? ??????????????????: ?????? ?????????????????? ????????????????????? ?????? ?????????????????? ???????????????????????? ???????????? ??????????????? ?????? ???????????? ??????????????????????????? ????????? ???????????????
# Mini Project: Linear Regression Model
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error
import numpy as np
# Data
X = np.array([[1], [2], [3], [4], [5]])
y = np.array([2.1, 3.9, 6.2, 7.8, 10.1])
# Model training
model = LinearRegression()
model.fit(X, y)
# Prediction and MSE
predictions = model.predict(X)
mse = mean_squared_error(y, predictions)
print("Predictions:", predictions)
print("Mean Squared Error:", mse)
??????????????????:
Predictions: [ 2.12 4.08 6.04 8. 9.96]
Mean Squared Error: 0.0136
???????????????-??????????????????????? ??????????????? ????????????????????????????????? - Best Practices in Scikit-learn in Hindi
- ???????????? ??????????????????????????????????????????: ??????????????? ???????????? ?????? ??????????????? ?????? ??????????????? ???????????????
- ???????????????-????????????????????????: ???????????? ?????? ????????????????????????????????? ?????? ????????? ???????????? ?????? ????????? ???????????????-???????????????????????? ???????????? ???????????????
- ???????????????????????????????????????: ????????? ????????? ????????????????????? ?????? ??????????????????????????????????????? ??????????????? ?????????????????????
- ???????????????????????????: Kaggle ?????? Scikit-learn ?????? ????????? ML ????????????????????????????????? ???????????????
???????????????????????? - Conclusion
Scikit-learn ?????? ??????????????????????????? ??????????????????????????? ?????? ?????? AI ?????? ML ????????? ???????????? ????????????????????? ?????????????????? ?????? ??????????????? ?????? ??????????????????????????? ???????????? ?????? ???????????? ??????????????? ????????? ?????? ??????????????? ????????? ???????????? Scikit-learn ?????? ??????????????? ????????????????????????????????? ???????????? ???????????? ??????????????????????????????????????????, ????????????????????????????????????, ????????????????????????, ?????? ???????????? ?????????????????????????????? ?????? ??????????????? ??????????????????????????? ????????????, ????????? ?????? AI/ML ????????? ???????????? ???????????? ????????? ?????? ?????? ????????? ???????????????
???????????? ????????????????????? ????????? ?????? TensorFlow, PyTorch, ?????? ???????????? AI/ML ?????????????????????????????? ?????? ??????????????? ??????????????????????????? ??????????????????, ?????? ?????????????????????????????? ????????????????????????????????? ?????? ??????????????????????????? ??????????????????????????? ???????????? ???????????? ?????? ???????????? AI/ML ????????????????????????????????? ????????? Scikit-learn ?????? ??????????????? ????????????!
Also Read:??