Statement of Completion#3ec6eee8
Introduction to Supervised Learning with scikit-learn
easy
Intro to Scikit Learn
Resolution
Activities
In [1]:
import numpy as np
import matplotlib.pyplot as plt
2) We will generate synthetic data to simulate a linear regression problem. Then, we will create an instance of the linear regression model.¶
In [2]:
from sklearn.linear_model import LinearRegression
# Generate synthetic data for the linear regression example
np.random.seed(42)
X = 2 * np.random.rand(100, 1)
y = 4 + 3 * X + np.random.randn(100, 1)
# Create an instance of the linear regression model
regression_model = LinearRegression()
3) We'll generate synthetic data for a binary classification problem and use a classification model¶
In [3]:
import numpy as np
from sklearn.datasets import make_classification
from sklearn.linear_model import LogisticRegression
# Generate synthetic data for the binary classification example
np.random.seed(42)
X, y = make_classification(n_samples=100, n_features=2, n_informative=2, n_redundant=0, random_state=42)
# Create an instance of the logistic regression model
classification_model = LogisticRegression()
In [ ]: