AI流程和常见的机器学习算法

AI流程和常见的机器学习算法

AI流程和常见的机器学习算法

AI操作流程

1 通常的机器学习算法流程如下:

  • 选择模型函数mx_fun,mx_fun是我们自定义的机器学习函数借口
  • 把训练的特征集x_train和对于的特征结果数据集y_train输入到模型函数mx_fun中。
  • 系统内置的机器学习函数,会自动分析特征数据与结果数据之间的关系,这样的一个过程就是机器学习的过程,也是算法建模的过程。
  • 通过对训练数据的机器学习和数据分析,系统会生成一个AI机器学习模型,我们将其保持到mx中
  • 把测试数据x_test输入到模型变量mx中,mx会调用内置的分析函数predict,生成的最终分析结果y_pred。
  • 如果是实盘,输入最新的数据,,系统会自动生成相关的预测数据,
  • 在运行实盘之前,我们会对y_pred和正确的y_test进行对比,以判断模型的准确度,并通过一些优化措施和结果调整参数进行迭代算法或者其他模型提高最终结果的准确度。

2 流程图

PHN2ZyBpZD0iZHlkbDRncmhkZTQiIHdpZHRoPSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHN0eWxlPSJtYXgtd2lkdGg6IDIyNy4zMTI1cHg7IiB2aWV3Qm94PSIwIDAgMjI3LjMxMjUgNDgzLjY4NzUiPjxzdHlsZT4KCgojZHlkbDRncmhkZTQgLmxhYmVsIHsKICBmb250LWZhbWlseTogJ3RyZWJ1Y2hldCBtcycsIHZlcmRhbmEsIGFyaWFsOwogIGNvbG9yOiAjMzMzOyB9CgojZHlkbDRncmhkZTQgLm5vZGUgcmVjdCwKI2R5ZGw0Z3JoZGU0IC5ub2RlIGNpcmNsZSwKI2R5ZGw0Z3JoZGU0IC5ub2RlIGVsbGlwc2UsCiNkeWRsNGdyaGRlNCAubm9kZSBwb2x5Z29uIHsKICBmaWxsOiAjRUNFQ0ZGOwogIHN0cm9rZTogIzkzNzBEQjsKICBzdHJva2Utd2lkdGg6IDFweDsgfQoKI2R5ZGw0Z3JoZGU0IC5ub2RlLmNsaWNrYWJsZSB7CiAgY3Vyc29yOiBwb2ludGVyOyB9CgojZ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jgxMjUiPjwvcmVjdD48ZyBjbGFzcz0ibGFiZWwiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAsMCkiPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKC02MS44MTI1LC04LjE0MDYyNSkiPjx0ZXh0Pjx0c3BhbiB4bWw6c3BhY2U9InByZXNlcnZlIiBkeT0iMWVtIiB4PSIxIj7nlJ/miJDliIbmnpDnu5Pmnpx5X3ByZWQ8L3RzcGFuPjwvdGV4dD48L2c+PC9nPjwvZz48L2c+PC9nPjwvZz48L3N2Zz4=

3 sklearn中经典的机器学习算法

算法 sklern函数 说明
线性回归 LinearRegression
朴素贝叶斯 Multinomialnb
KNN k近邻 KNeighborsClassifier
逻辑回归 LogisticRegression
随机森林 RandomForestClassifier
决策树 tree.DecisionTreeClassifier
GBDT迭代决策树 GradientBoostingClassifier
SVM向量支持机 SVC
SVM-Croess向量机交叉算法 SVC

4 数据分割函数

对于小型的数据而言,Sklearn内置的train_test_split函数可以对数据进行分割,这属于数据预处理阶段。

x_train,x_test,y_train,y_test = train_test_split(x,y,test_size=0.2,random_state=0)
  • x是训练参数的数据集合
  • y是训练参数x对于的结果数据集合
  • test_size 是样本占比,如果是整数,那就是样本的数量
  • random_state是随机数的种子

sklearn模块中的各种机器学习函数,基本上都是调用fit命令自动学习,建立模型

115 页 June 2, 2019 pdlibrary

FutureTech