Machine Learning Lab Manual
Machine Learning Lab Manual
Python Code
# Display head
print(df.head())
# Pairplot
sns.pairplot(df, hue='species')
plt.show()
Expected Output
The output will display the first few rows of the Iris dataset and a pairplot visualizing the
relationships between features.
Python Code
# Load dataset
X, y = load_diabetes(return_X_y=True)
X = X[:, None, 2] # Use one feature
# Predict
y_pred = model.predict(X)
# Plot
plt.scatter(X, y, color='black')
plt.plot(X, y_pred, color='blue', linewidth=3)
plt.title("Simple Linear Regression")
plt.show()
Expected Output
The output is a scatter plot of the data with a fitted regression line.