Page 132 - Artificial Intellegence_v2.0_Class_12
P. 132

4                5 .0              3 .6               1 .4            0 .2    I r is- setosa

          5                5 .4              3 .9               1 .7            0 .4    I r is- setosa

          6                4 .6              3 .4               1 .4            0 .3    I r is- setosa
          7                5 .0              3 .4               1 .5            0 .2    I r is- setosa

          8                4 .4              2 .9               1 .4            0 .2    I r is- setosa
          9                4 .9              3 .1               1 .5            0 .1    I r is- setosa

          1 0              5 .4              3 .7               1 .5            0 .2    I r is- setosa
          1 1              4 .8              3 .4               1 .6            0 .2    I r is- setosa

          1 2              4 .8              3 .0               1 .4            0 .1    I r is- setosa
          1 3              4 .3              3 .0               1 .1            0 .1    I r is- setosa

          1 4              5 .8              4 .0               1 .2            0 .2    I r is- setosa
          1 5              5 .7              4 .4               1 .5            0 .4    I r is- setosa

          1 6              5 .4              3 .9               1 .3            0 .4    I r is- setosa
          1 7              5 .1              3 .5               1 .4            0 .3    I r is- setosa

          1 8              5 .7              3 .8               1 .7            0 .3    I r is- setosa
          1 9              5 .1              3 .8               1 .5            0 .3    I r is- setosa

                            sep al- length       sep al- w id th       p etal- length     p etal - w id th

          cou nt           1 5 0 .0 0 0 0 0 0     1 5 0 .0 0 0 0 0 0     1 5 0 .0 0 0 0 0 0    1 5 0 .0 0 0 0 0 0
          mean               5 .8 4 3 3 3 3          3 .0 5 4 0 0 0         3 .7 5 8 6 6 7     1 .1 9 8 6 6 7
          std                0 .8 2 8 0 6 6          0 .4 3 3 5 9 4         1 .7 6 4 4 2 0     0 .7 6 3 1 6 1

          min                4 .3 0 0 0 0 0          2 .0 0 0 0 0 0         1 .0 0 0 0 0 0     0 .1 0 0 0 0 0
          2 5 %              5 .1 0 0 0 0 0          2 .8 0 0 0 0 0         1 .6 0 0 0 0 0     0 .3 0 0 0 0 0

          5 0 %              5 .8 0 0 0 0 0          3 .0 0 0 0 0 0         4 .3 5 0 0 0 0     1 .3 0 0 0 0 0
          7 5 %              6 .4 0 0 0 0 0          3 .3 0 0 0 0 0         5 .1 0 0 0 0 0     1 .8 0 0 0 0 0
          max                7 .9 0 0 0 0 0          4 .4 0 0 0 0 0         6 .9 0 0 0 0 0     2 .5 0 0 0 0 0

        # sp lit- ou t v alid ation d ataset

        ar r ay = d ataset.v alu es
        # p r int( ar r ay )
        X = ar r ay [ : , 0 : 4 ]
        Y = ar r ay [ : , 4 ]
        X _ tr ain, X _ v alid ation, Y _ tr ain, Y _ v alid ation= tr ain_ test_ sp lit( X , Y , test_ siz e= 0 .2 , tr ain_
        siz e= 0 .8 ,shuffle=T r u e )
        # imp or t an algor ithm and  tr ain d ata
        mod elT oI mp lement= L ogisticRegr ession( solv er = ' lib linear ' , mu lti_ class= ' ov r ' )
        modelToImplement.fit(X_train,Y_train)  # p er f or m tr aining
        p r ed iction= mod elT oI mp lement.p r ed ict( [ [ 3 .0 , 2 .0 , 2 .5 , 0 .2 ] ] ) # p r ed iction w ith new  v alu es
        p r int p r ed iction)
              (
                      Touchpad Artificial Intelligence (Ver. 2.0)-XII
   127   128   129   130   131   132   133   134   135   136   137