每日总结
机器学习决策树
决策树(decision tree):是一种基本的分类与回归方法
决策树通常有三个步骤:特征选择、决策树的生成、决策树的修剪。
使用sklearn构建决策树:例子:
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
import pandas as pd
def datasets_demo():
iris = load_iris()
print("鸢尾花数据集\n", iris)
print("查看数据集描述:\n", iris["DESCR"])
# print("查看特征值描述:\n", iris.feature_names)
# print("特征值:\n", iris.data)
# x_train, x_test, y_train, y_test=train_test_split(iris.data, iris.target, test_size=0.2, random_state=22)
# print(x_train, x_train.shape)
return None
def minmax_demo():
data = pd.read_csv("nsrxx1.csv")
print(data)
return None
if __name__ == "__main__":
minmax_demo()