zoukankan      html  css  js  c++  java
  • 机器学习实战读书笔记(1)

    机器学习的主要任务:

    分类:将实例数据划分到合适的分类中

    回归:主要用于预测数值型数据

    分类和回归属于监督学习,监督学习必须知道预测什么,即目标变量的分类信息

    无监督学习:数据没有类别信息,也不会给定目标值。

    在无监督学习中,将数据集合分成由类似的对象组成的多个类的过程称为聚类;

    将寻找描述数据统计值的过程称之为密度估计。

                                             监督学习的用途

    k-近邻算法                                                                           线性回归

    朴素贝叶斯算法                                                          局部加权线性回归

    支持向量机                                                                         Ridge回归

    决策树                                                            Lassso最小回归系数估计

    无监督学习的用途

    k-均值                                                                            最大期望算法

    DBSCAN                                                                        Parzen窗设计

    1. 输入任意数组:

    from numpy import *
    print(random.rand(4,4))

    输出:

    [[0.83142886 0.37192316 0.25799572 0.01936341]
     [0.70383839 0.10545903 0.31602348 0.26564487]
     [0.62372209 0.8856153  0.04425143 0.09811542]
     [0.03086031 0.70999438 0.50756522 0.89523833]]

    2. 矩阵

    from numpy import *
    rd=random.rand(4,4)
    #打印随机数组
    print(rd)
    rm=mat(rd)
    #打印数组转化后的矩阵
    print(rm)
    #打印矩阵的逆运算
    print(rm.I)

    输出

    [[0.32618362 0.88181772 0.73023717 0.71091901]
     [0.75438306 0.55220343 0.21725572 0.83780348]
     [0.48311814 0.99230996 0.75381116 0.23627349]
     [0.22763927 0.70057059 0.81020161 0.88443622]]
    [[0.32618362 0.88181772 0.73023717 0.71091901]
     [0.75438306 0.55220343 0.21725572 0.83780348]
     [0.48311814 0.99230996 0.75381116 0.23627349]
     [0.22763927 0.70057059 0.81020161 0.88443622]]
    [[-5.21507507  1.46536287  2.26699771  2.19821216]
     [ 7.10337898 -0.59340981 -1.65174532 -4.70639109]
     [-6.54479433 -0.26247007  2.55419703  4.8270615 ]
     [ 1.71107913  0.33332533 -1.61493618 -0.12904628]]


  • 相关阅读:
    T4模板+Web.config连接SqlServer+DBManage.cs+DbHelper.cs
    MVCApplication
    MVC路由(Route)
    过滤器+用session验证是否登陆过
    前台.cshtml得到session值方法
    C++ sort() method with 1.default operator,2 stand library compare ,3custom function,4,lambda expression
    C++ boost serialize struct to text
    C++ multi thread via pthread to retrieve returned result
    C++ pthread create and join
    C++ write and read file via fstream in ios::out,ios::in,ios::app mode
  • 原文地址:https://www.cnblogs.com/davidwang456/p/8579277.html
Copyright © 2011-2022 走看看