PS Project - Jupyter Notebook
PS Project - Jupyter Notebook
Out[5]: No 1274
Yes 416
Name: RainTomorrow, dtype: int64
In [7]:
# Step 4: Data Preprocessing
X = pd.get_dummies(df.drop('RainTomorrow', axis=1)) # One-hot encodin
y = df['RainTomorrow'].map({'Yes': 1, 'No': 0}) # Convert target vari
In [8]:
# Step 5: Data Splitting
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.
Out[14]: LogisticRegression(max_iter=1000)
In a Jupyter environment, please rerun this cell to show the HTML representation or
trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page
with nbviewer.org.
In [15]:
# Step 6: Choose a Classification Model
model = LogisticRegression()
In [16]:
# Step 7: Model Training
model.fit(X_train, y_train)
/opt/anaconda3/lib/python3.9/site-packages/sklearn/linear_model/_log
istic.py:458: ConvergenceWarning: lbfgs failed to converge (status=
1):
STOP: TOTAL NO. of ITERATIONS REACHED LIMIT.
Out[16]: LogisticRegression()
In a Jupyter environment, please rerun this cell to show the HTML representation or
trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page
with nbviewer.org.
Precision: 1.0
Recall: 0.9473684210526315
F1 Score: 0.972972972972973
AUC-ROC Score: 0.9998267273121074
Accuracy: 0.985207100591716
Classification Report:
precision recall f1-score support
In [ ]:
# Step 10: Fine-Tuning and Optimization
# For logistic regression, fine-tuning may involve adjusting regulariz
# Step 11: Deployment (Not shown in code, as it depends on your deploy
# Step 12: Continuous Monitoring and Updating
# Monitor model performance over time and update as needed
In [ ]: