Last active
January 21, 2019 06:49
-
-
Save gkhayes/dbc36174d58adff0106e15f94854dbe4 to your computer and use it in GitHub Desktop.
Load and explore Iris dataset
This file contains hidden or 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
| from sklearn.datasets import load_iris | |
| # Load the Iris dataset | |
| data = load_iris() | |
| # Get feature values | |
| print('The feature values for Obs 0 are: ', data.data[0]) | |
| # Get feature names | |
| print('The feature names are: ', data.feature_names) | |
| # Get target value of first observation | |
| print('The target value for Obs 0 is:', data.target[0]) | |
| # Get target name of first observation | |
| print('The target name for Obs 0 is:', data.target_names[data.target[0]]) | |
| # Get minimum feature values | |
| print('The minimum values of the four features are:', np.min(data.data, axis = 0)) | |
| # Get maximum feature values | |
| print('The maximum values of the four features are:', np.max(data.data, axis = 0)) | |
| # Get unique target values | |
| print('The unique target values are:', np.unique(data.target)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment