Recap: Wine Dataset
Part of the Data and Plots section of Coddy's Machine Learning journey. Lesson 56 of 60.
Challenge
MediumA lab measured 13 chemical features of wines from three grape cultivars. scikit-learn ships them as load_wine:
Before training a model, the lab wants three facts. The program reads a feature name, like hue. Load the wines with as_frame=True, split them into X and y, then print:
- The class with the most wines, and how many.
- The class with the highest mean of the feature.
- How many wines of that class are above the feature's mean over all wines.
For the input malic_acid:
Most wines: class_1 (71)
Highest malic_acid: class_2
class_2 wines above the average malic_acid: 41Try it yourself
from sklearn.datasets import load_wine
feature = input()
# Write your code below
All lessons in Data and Plots
2NumPy Arrays
Creating ArraysShape and SizeRanges of NumbersIndexing and SlicingRecap: Temperature Grid5Line and Scatter Plots
Labels and TitlesScatter PlotsSeveral Lines and LegendsColors and MarkersFigures and AxesRecap: Weekly Steps11Datasets for ML
Built-in DatasetsFeatures and LabelsExploring by ClassPlotting the ClassesRecap: Wine DatasetPractice on your own: Online Python compiler