Last active
December 13, 2019 10:50
-
-
Save vihar/d8eb696c2ecbaf7626003d62f099cdab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Importing Modules | |
from sklearn import datasets | |
import matplotlib.pyplot as plt | |
# Loading dataset | |
iris_df = datasets.load_iris() | |
# Available methods on dataset | |
print(dir(iris_df)) | |
# Features | |
print(iris_df.feature_names) | |
# Targets | |
print(iris_df.target) | |
# Target Names | |
print(iris_df.target_names) | |
label = {0: 'red', 1: 'blue', 2: 'green'} | |
# Dataset Slicing | |
x_axis = iris_df.data[:, 0] # Sepal Length | |
y_axis = iris_df.data[:, 2] # Sepal Width | |
# Plotting | |
plt.scatter(x_axis, y_axis, c=iris_df.target) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have run the above code. But it shows the below error message
from sklearn import datasets
ModuleNotFoundError: No module named 'sklearn'