前言
利用IRIS数据集,基于pytorch,练习构建简单的ANN网络
(又名:放假了把作业整理一下,复习一遍课程
Task
学习用pytorch搭建ANN模型
Dataset
IRIS
1.导入包和数据
from sklearn import datasets
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
url = "https://raw.githubusercontent.com/callxpert/datasets/master/iris.data.txt"
names = ['sepal-length', 'sepal-width', 'petal-length', 'petal-width', 'class']
dataset = pd.read_csv(url, names=names)
2.Exploratory Data Analysis (EDA)数据探索
# shape
print(dataset.shape)
#Find out the statistical summary of the data
#including the count, mean, the min and max values as well as some percentiles.
print(dataset.describe())
print(dataset.info)
#class distribution
print(dataset.groupby('class').size())
# box and whisker plots
dataset.plot(kind='box', subplots=True, layout=(2,2), sharex=False, sharey=False)
plt.show()
ax = sns.boxplot(x="class", y="sepal-length", data=dataset)
ax = sns.stripplot(x