In [1]:
import graphlab


A newer version of GraphLab Create (v1.7.1) is available! Your current version is v1.6.1.

You can use pip to upgrade the graphlab-create package. For more information see https://dato.com/products/create/upgrade.

In [3]:
pr=graphlab.SFrame('data/data_balanced.csv')


PROGRESS: Finished parsing file C:\Users\brahul\data\data_balanced.csv
PROGRESS: Parsing completed. Parsed 100 lines in 1.05906 secs.
------------------------------------------------------
Inferred types from first line of file as 
column_type_hints=[str,str,str,str,str,str,str,long,long,str,str,str,str,str,str,str,str,str,str,str,str,long,str,long,long,long,str,float,str,long]
If parsing fails due to incorrect types, you can correct
the inferred type list above and pass it to read_csv in
the column_type_hints argument
------------------------------------------------------
PROGRESS: Finished parsing file C:\Users\brahul\data\data_balanced.csv
PROGRESS: Parsing completed. Parsed 107232 lines in 1.02706 secs.

In [6]:
model=graphlab.logistic_classifier.create(train_data,target='Outcome',features=['TrafficType','PublisherId','AppSiteId','AppSiteCategory','DeviceType','Country','CampaignId','CreativeCategory','ExchangeBid'],validation_set=test_data,max_iterations=500)


PROGRESS: Logistic regression:
PROGRESS: --------------------------------------------------------
PROGRESS: Number of examples          : 85764
PROGRESS: Number of classes           : 3
PROGRESS: Number of feature columns   : 9
PROGRESS: Number of unpacked features : 9
PROGRESS: Number of coefficients    : 5850
PROGRESS: Starting L-BFGS
PROGRESS: --------------------------------------------------------
PROGRESS: +-----------+----------+-----------+--------------+-------------------+---------------------+
PROGRESS: | Iteration | Passes   | Step size | Elapsed Time | Training-accuracy | Validation-accuracy |
PROGRESS: +-----------+----------+-----------+--------------+-------------------+---------------------+
PROGRESS: | 1         | 3        | 0.000012  | 1.160002     | 0.874434          | 0.872089            |
PROGRESS: | 2         | 5        | 1.000000  | 1.394007     | 0.755772          | 0.753400            |
PROGRESS: | 3         | 6        | 1.000000  | 1.626018     | 0.862891          | 0.858720            |
PROGRESS: | 4         | 7        | 1.000000  | 1.847027     | 0.871613          | 0.868129            |
PROGRESS: | 5         | 8        | 1.000000  | 2.058035     | 0.872336          | 0.867896            |
PROGRESS: | 6         | 9        | 1.000000  | 2.274043     | 0.873572          | 0.869620            |
PROGRESS: | 10        | 14       | 1.000000  | 3.170079     | 0.873280          | 0.869108            |
PROGRESS: | 11        | 15       | 1.000000  | 3.388086     | 0.873490          | 0.868362            |
PROGRESS: | 15        | 19       | 1.000000  | 4.238123     | 0.882783          | 0.877399            |
PROGRESS: | 20        | 24       | 1.000000  | 5.290167     | 0.883040          | 0.878284            |
PROGRESS: | 25        | 29       | 1.000000  | 6.336213     | 0.883471          | 0.878098            |
PROGRESS: | 30        | 34       | 1.000000  | 7.376259     | 0.883238          | 0.877399            |
PROGRESS: | 35        | 39       | 1.000000  | 8.442306     | 0.883611          | 0.877911            |
PROGRESS: | 40        | 44       | 1.000000  | 9.520346     | 0.883611          | 0.877911            |
PROGRESS: | 45        | 49       | 1.000000  | 10.630399    | 0.883331          | 0.877166            |
PROGRESS: | 50        | 54       | 1.000000  | 11.791449    | 0.883284          | 0.876887            |
PROGRESS: | 51        | 55       | 1.000000  | 12.022459    | 0.883191          | 0.877026            |
PROGRESS: | 55        | 59       | 1.000000  | 12.892500    | 0.883179          | 0.877306            |
PROGRESS: | 60        | 64       | 1.000000  | 13.984548    | 0.883273          | 0.877259            |
PROGRESS: | 65        | 69       | 1.000000  | 15.107593    | 0.883378          | 0.876840            |
PROGRESS: | 70        | 75       | 1.000000  | 16.252651    | 0.883343          | 0.877213            |
PROGRESS: | 75        | 80       | 1.000000  | 17.319698    | 0.883191          | 0.877213            |
PROGRESS: | 80        | 85       | 1.000000  | 18.383747    | 0.883308          | 0.876980            |
PROGRESS: | 85        | 90       | 1.000000  | 19.424792    | 0.883354          | 0.876980            |
PROGRESS: | 90        | 95       | 1.000000  | 20.522836    | 0.883226          | 0.877352            |
PROGRESS: | 95        | 100      | 1.000000  | 21.657882    | 0.883308          | 0.877026            |
PROGRESS: | 100       | 105      | 1.000000  | 22.712927    | 0.883296          | 0.876980            |
PROGRESS: | 101       | 106      | 1.000000  | 22.926932    | 0.883261          | 0.876980            |
PROGRESS: | 105       | 110      | 1.000000  | 23.757974    | 0.883354          | 0.877119            |
PROGRESS: | 110       | 115      | 1.000000  | 24.817018    | 0.883319          | 0.876933            |
PROGRESS: | 115       | 120      | 1.000000  | 25.873076    | 0.883284          | 0.876980            |
PROGRESS: | 120       | 125      | 1.000000  | 26.945119    | 0.883319          | 0.877073            |
PROGRESS: | 125       | 130      | 1.000000  | 27.994165    | 0.883296          | 0.876933            |
PROGRESS: | 130       | 135      | 1.000000  | 29.131218    | 0.883389          | 0.876933            |
PROGRESS: | 135       | 140      | 1.000000  | 30.397270    | 0.883401          | 0.877166            |
PROGRESS: | 140       | 145      | 1.000000  | 31.732320    | 0.883494          | 0.877026            |
PROGRESS: | 145       | 150      | 1.000000  | 33.087380    | 0.883599          | 0.877073            |
PROGRESS: | 150       | 155      | 1.000000  | 34.405427    | 0.883611          | 0.877073            |
PROGRESS: | 155       | 160      | 1.000000  | 35.711479    | 0.883588          | 0.877166            |
PROGRESS: | 160       | 165      | 1.000000  | 37.080526    | 0.883576          | 0.876933            |
PROGRESS: | 165       | 170      | 1.000000  | 38.457576    | 0.883541          | 0.876980            |
PROGRESS: | 170       | 176      | 1.000000  | 39.870628    | 0.883599          | 0.877259            |
PROGRESS: | 175       | 181      | 1.000000  | 41.095679    | 0.883553          | 0.876980            |
PROGRESS: | 180       | 186      | 1.000000  | 42.348726    | 0.883622          | 0.876933            |
PROGRESS: | 185       | 191      | 1.000000  | 43.727777    | 0.883681          | 0.877166            |
PROGRESS: | 190       | 196      | 1.000000  | 45.032830    | 0.883657          | 0.877213            |
PROGRESS: | 195       | 201      | 1.000000  | 46.410881    | 0.883576          | 0.876887            |
PROGRESS: | 200       | 206      | 1.000000  | 47.682930    | 0.883599          | 0.877026            |
PROGRESS: | 205       | 211      | 1.000000  | 48.937984    | 0.883669          | 0.877166            |
PROGRESS: | 210       | 216      | 1.000000  | 50.017025    | 0.883692          | 0.876933            |
PROGRESS: | 215       | 222      | 1.000000  | 51.105069    | 0.883681          | 0.877026            |
PROGRESS: | 220       | 227      | 1.000000  | 52.176120    | 0.883669          | 0.876980            |
PROGRESS: | 225       | 232      | 1.000000  | 53.256166    | 0.883681          | 0.877119            |
PROGRESS: | 230       | 237      | 1.000000  | 54.373213    | 0.883634          | 0.876933            |
PROGRESS: | 235       | 242      | 1.000000  | 55.479261    | 0.883692          | 0.876980            |
PROGRESS: | 240       | 247      | 1.000000  | 56.577310    | 0.883622          | 0.877073            |
PROGRESS: | 245       | 252      | 1.000000  | 57.668360    | 0.883692          | 0.876933            |
PROGRESS: | 250       | 257      | 1.000000  | 58.711412    | 0.883657          | 0.877026            |
PROGRESS: | 255       | 262      | 1.000000  | 59.794461    | 0.883692          | 0.877119            |
PROGRESS: | 260       | 267      | 1.000000  | 60.836511    | 0.883681          | 0.877119            |
PROGRESS: | 265       | 272      | 1.000000  | 61.906558    | 0.883692          | 0.876933            |
PROGRESS: | 270       | 277      | 1.000000  | 62.944599    | 0.883739          | 0.877026            |
PROGRESS: | 275       | 282      | 1.000000  | 64.034645    | 0.883692          | 0.877166            |
PROGRESS: | 280       | 287      | 1.000000  | 65.092691    | 0.883739          | 0.877119            |
PROGRESS: | 285       | 292      | 1.000000  | 66.156738    | 0.883692          | 0.876980            |
PROGRESS: | 290       | 297      | 1.000000  | 67.220785    | 0.883704          | 0.877026            |
PROGRESS: | 295       | 302      | 1.000000  | 68.281823    | 0.883716          | 0.877119            |
PROGRESS: | 300       | 307      | 1.000000  | 69.330872    | 0.883681          | 0.876980            |
PROGRESS: | 305       | 312      | 1.000000  | 70.408919    | 0.883739          | 0.877119            |
PROGRESS: | 310       | 317      | 1.000000  | 71.488972    | 0.883716          | 0.877026            |
PROGRESS: | 315       | 322      | 1.000000  | 72.605012    | 0.883727          | 0.876980            |
PROGRESS: | 320       | 327      | 1.000000  | 73.662069    | 0.883681          | 0.876980            |
PROGRESS: | 325       | 332      | 1.000000  | 74.751109    | 0.883704          | 0.877073            |
PROGRESS: | 330       | 337      | 1.000000  | 75.825158    | 0.883704          | 0.877119            |
PROGRESS: | 335       | 342      | 1.000000  | 76.866208    | 0.883669          | 0.876980            |
PROGRESS: | 340       | 347      | 1.000000  | 77.953253    | 0.883739          | 0.877026            |
PROGRESS: | 345       | 352      | 1.000000  | 79.079297    | 0.883669          | 0.877026            |
PROGRESS: | 350       | 358      | 1.000000  | 80.244339    | 0.883716          | 0.877026            |
PROGRESS: | 355       | 364      | 1.000000  | 81.457393    | 0.883751          | 0.877026            |
PROGRESS: | 360       | 369      | 1.000000  | 82.697440    | 0.883692          | 0.877073            |
PROGRESS: | 365       | 374      | 1.000000  | 83.939490    | 0.883692          | 0.877026            |
PROGRESS: | 370       | 379      | 1.000000  | 85.133541    | 0.883716          | 0.876980            |
PROGRESS: | 375       | 384      | 1.000000  | 86.209579    | 0.883727          | 0.877026            |
PROGRESS: | 380       | 389      | 1.000000  | 87.289622    | 0.883727          | 0.877073            |
PROGRESS: | 385       | 394      | 1.000000  | 88.374665    | 0.883739          | 0.877073            |
PROGRESS: | 390       | 399      | 1.000000  | 89.453711    | 0.883704          | 0.876980            |
PROGRESS: | 395       | 404      | 1.000000  | 90.653758    | 0.883716          | 0.877026            |
PROGRESS: | 400       | 409      | 1.000000  | 91.994810    | 0.883692          | 0.877026            |
PROGRESS: | 405       | 414      | 1.000000  | 93.362867    | 0.883739          | 0.877026            |
PROGRESS: | 410       | 420      | 1.000000  | 94.723922    | 0.883716          | 0.877026            |
PROGRESS: | 415       | 426      | 1.000000  | 96.062973    | 0.883727          | 0.876980            |
PROGRESS: | 420       | 431      | 1.000000  | 97.388027    | 0.883692          | 0.876980            |
PROGRESS: | 425       | 436      | 1.000000  | 98.784079    | 0.883716          | 0.876980            |
PROGRESS: | 430       | 441      | 1.000000  | 100.096134   | 0.883692          | 0.877026            |
PROGRESS: | 435       | 447      | 1.000000  | 101.510190   | 0.883692          | 0.877026            |
PROGRESS: | 440       | 452      | 1.000000  | 102.819240   | 0.883716          | 0.876980            |
PROGRESS: | 445       | 457      | 1.000000  | 104.132295   | 0.883704          | 0.876980            |
PROGRESS: | 450       | 462      | 1.000000  | 105.473347   | 0.883704          | 0.876980            |
PROGRESS: | 455       | 468      | 1.000000  | 106.931395   | 0.883727          | 0.877026            |
PROGRESS: | 460       | 473      | 1.000000  | 108.227452   | 0.883716          | 0.877026            |
PROGRESS: | 465       | 478      | 1.000000  | 109.479506   | 0.883692          | 0.877026            |
PROGRESS: | 470       | 483      | 1.000000  | 110.629552   | 0.883716          | 0.876980            |
PROGRESS: | 475       | 488      | 1.000000  | 111.668603   | 0.883727          | 0.876980            |
PROGRESS: | 480       | 493      | 1.000000  | 112.760656   | 0.883692          | 0.876980            |
PROGRESS: | 485       | 498      | 1.000000  | 113.910704   | 0.883692          | 0.877026            |
PROGRESS: | 490       | 503      | 1.000000  | 115.009746   | 0.883716          | 0.877026            |
PROGRESS: | 495       | 508      | 1.000000  | 116.059785   | 0.883716          | 0.876980            |
PROGRESS: | 500       | 513      | 1.000000  | 117.147836   | 0.883704          | 0.876980            |
PROGRESS: +-----------+----------+-----------+--------------+-------------------+---------------------+

In [5]:
train_data,test_data = pr.random_split(.8)

In [7]:
model


Out[7]:
Class                         : LogisticClassifier

Schema
------
Number of coefficients        : 5850
Number of examples            : 85764
Number of classes             : 3
Number of feature columns     : 9
Number of unpacked features   : 9

Hyperparameters
---------------
L1 penalty                    : 0.0
L2 penalty                    : 0.01

Training Summary
----------------
Solver                        : auto
Solver iterations             : 500
Solver status                 : TERMINATED: Iteration limit reached.
Training time (sec)           : 117.3298

Settings
--------
Log-likelihood                : 23898.9743

Highest Positive Coefficients
-----------------------------
Country[MDA]                  : 29.4726
AppSiteId[66f161f9d43df83109c8c2e710194b2d695c169c]: 27.3681
AppSiteId[4551a2608684d6b66bf8eaa55b8819e7866c65d5]: 22.7308
AppSiteId[f8ed3d18079e62af1263f632a6f91af777bf9b3a]: 21.7491
CreativeCategory[American Cuisine#Barbecues & Grilling]: 18.8337

Lowest Negative Coefficients
----------------------------
AppSiteId[9c76a5c7ebeaa1adbf4be04bf03417c604f7a5c1]: -25.4386
AppSiteId[970f66f8cdbbc54a2eefd432617325cebb903d5d]: -24.3822
AppSiteId[9f9742baac7e7d247f50dab42f62f25ac5a9e47a]: -21.8575
AppSiteId[3673bce9e7fe67199f46e77e2679af0480a91c4b]: -21.5934
AppSiteId[ea7852ea7b123ab849c673171871d73c222c830b]: -20.5113

In [8]:
model=graphlab.logistic_classifier.create(train_data,target='Outcome',features=['TrafficType','PublisherId','AppSiteId','AppSiteCategory','DeviceType','Country','CampaignId','CreativeCategory','ExchangeBid'],validation_set=test_data,max_iterations=500)


PROGRESS: Logistic regression:
PROGRESS: --------------------------------------------------------
PROGRESS: Number of examples          : 85764
PROGRESS: Number of classes           : 2
PROGRESS: Number of feature columns   : 15
PROGRESS: Number of unpacked features : 15
PROGRESS: Number of coefficients    : 61226
PROGRESS: Starting L-BFGS
PROGRESS: --------------------------------------------------------
PROGRESS: +-----------+----------+-----------+--------------+-------------------+---------------------+
PROGRESS: | Iteration | Passes   | Step size | Elapsed Time | Training-accuracy | Validation-accuracy |
PROGRESS: +-----------+----------+-----------+--------------+-------------------+---------------------+
PROGRESS: | 1         | 3        | 0.000012  | 0.170004     | 0.711756          | 0.680688            |
PROGRESS: | 2         | 5        | 1.000000  | 0.306008     | 0.905473          | 0.815819            |
PROGRESS: | 3         | 6        | 1.000000  | 0.412011     | 0.950807          | 0.858394            |
PROGRESS: | 4         | 7        | 1.000000  | 0.521015     | 0.967702          | 0.862679            |
PROGRESS: | 5         | 8        | 1.000000  | 0.602015     | 0.973322          | 0.874697            |
PROGRESS: | 6         | 9        | 1.000000  | 0.704017     | 0.973765          | 0.862120            |
PROGRESS: | 10        | 13       | 1.000000  | 1.134030     | 0.978452          | 0.871902            |
PROGRESS: | 11        | 14       | 1.000000  | 1.256032     | 0.978511          | 0.872881            |
PROGRESS: | 20        | 23       | 1.000000  | 2.256062     | 0.980283          | 0.864915            |
PROGRESS: | 30        | 33       | 1.000000  | 3.322088     | 0.982592          | 0.858580            |
PROGRESS: | 40        | 43       | 1.000000  | 4.424117     | 0.983233          | 0.846702            |
PROGRESS: | 50        | 53       | 1.000000  | 5.489140     | 0.983373          | 0.837013            |
PROGRESS: | 51        | 54       | 1.000000  | 5.590143     | 0.983361          | 0.836454            |
PROGRESS: | 60        | 63       | 1.000000  | 6.508171     | 0.983501          | 0.832262            |
PROGRESS: | 70        | 73       | 1.000000  | 7.544197     | 0.983723          | 0.838597            |
PROGRESS: | 80        | 83       | 1.000000  | 8.559230     | 0.983909          | 0.843208            |
PROGRESS: | 90        | 93       | 1.000000  | 9.585251     | 0.984061          | 0.843488            |
PROGRESS: | 100       | 103      | 1.000000  | 10.654278    | 0.984026          | 0.844885            |
PROGRESS: | 101       | 104      | 1.000000  | 10.748282    | 0.983944          | 0.844932            |
PROGRESS: | 110       | 113      | 1.000000  | 11.663308    | 0.984038          | 0.845864            |
PROGRESS: | 120       | 123      | 1.000000  | 12.737333    | 0.983874          | 0.846516            |
PROGRESS: | 130       | 133      | 1.000000  | 13.729362    | 0.983933          | 0.846655            |
PROGRESS: | 140       | 144      | 1.000000  | 14.776393    | 0.984154          | 0.845538            |
PROGRESS: | 150       | 154      | 1.000000  | 15.782417    | 0.984084          | 0.845491            |
PROGRESS: | 160       | 164      | 1.000000  | 16.709442    | 0.984154          | 0.845398            |
PROGRESS: | 170       | 174      | 1.000000  | 17.557460    | 0.984084          | 0.844187            |
PROGRESS: | 180       | 184      | 1.000000  | 18.405974    | 0.984154          | 0.843721            |
PROGRESS: | 190       | 194      | 1.000000  | 19.263995    | 0.983991          | 0.846516            |
PROGRESS: | 200       | 204      | 1.000000  | 20.144016    | 0.983933          | 0.849730            |
PROGRESS: | 210       | 215      | 1.000000  | 21.147042    | 0.983979          | 0.852758            |
PROGRESS: | 220       | 225      | 1.000000  | 22.133062    | 0.984049          | 0.854015            |
PROGRESS: | 230       | 235      | 1.000000  | 23.058085    | 0.984014          | 0.854248            |
PROGRESS: | 240       | 245      | 1.000000  | 24.006108    | 0.984073          | 0.854900            |
PROGRESS: | 250       | 255      | 1.000000  | 24.896129    | 0.984259          | 0.855785            |
PROGRESS: | 260       | 265      | 1.000000  | 25.819153    | 0.984294          | 0.855413            |
PROGRESS: | 270       | 275      | 1.000000  | 26.714174    | 0.984259          | 0.856344            |
PROGRESS: | 280       | 285      | 1.000000  | 27.582194    | 0.984178          | 0.856950            |
PROGRESS: | 290       | 295      | 1.000000  | 28.450214    | 0.984201          | 0.857649            |
PROGRESS: | 300       | 305      | 1.000000  | 29.375238    | 0.984236          | 0.857881            |
PROGRESS: | 310       | 315      | 1.000000  | 30.352266    | 0.984143          | 0.858953            |
PROGRESS: | 320       | 325      | 1.000000  | 31.288291    | 0.984247          | 0.859791            |
PROGRESS: | 330       | 336      | 1.000000  | 32.206312    | 0.984212          | 0.860676            |
PROGRESS: | 340       | 346      | 1.000000  | 33.228340    | 0.984247          | 0.860956            |
PROGRESS: | 350       | 356      | 1.000000  | 34.268359    | 0.984259          | 0.861235            |
PROGRESS: | 360       | 366      | 1.000000  | 35.166387    | 0.984201          | 0.861515            |
PROGRESS: | 370       | 376      | 1.000000  | 36.034408    | 0.984224          | 0.862679            |
PROGRESS: | 380       | 386      | 1.000000  | 36.944434    | 0.984236          | 0.862912            |
PROGRESS: | 390       | 396      | 1.000000  | 37.822454    | 0.984178          | 0.863331            |
PROGRESS: | 400       | 406      | 1.000000  | 38.682476    | 0.984189          | 0.863099            |
PROGRESS: | 410       | 416      | 1.000000  | 39.568493    | 0.984271          | 0.862167            |
PROGRESS: | 420       | 426      | 1.000000  | 40.486517    | 0.984236          | 0.861748            |
PROGRESS: | 430       | 436      | 1.000000  | 41.388537    | 0.984236          | 0.861655            |
PROGRESS: | 440       | 446      | 1.000000  | 42.258557    | 0.984259          | 0.861142            |
PROGRESS: | 450       | 457      | 1.000000  | 43.163580    | 0.984236          | 0.860537            |
PROGRESS: | 460       | 467      | 1.000000  | 44.072604    | 0.984259          | 0.860537            |
PROGRESS: | 470       | 477      | 1.000000  | 44.958624    | 0.984294          | 0.860956            |
PROGRESS: | 480       | 487      | 1.000000  | 45.856645    | 0.984282          | 0.860583            |
PROGRESS: | 490       | 497      | 1.000000  | 46.754664    | 0.984282          | 0.860816            |
PROGRESS: | 500       | 507      | 1.000000  | 47.647684    | 0.984271          | 0.861096            |
PROGRESS: +-----------+----------+-----------+--------------+-------------------+---------------------+

In [ ]:
model=graphlab.logistic_classifier.create(train_data,target='Outcome',features=['TrafficType','PublisherId','AppSiteId','AppSiteCategory','DeviceType','Country','CampaignId','CreativeCategory','ExchangeBid'],validation_set=test_data,max_iterations=500)

In [10]:
model=graphlab.logistic_classifier.create(train_data,target='sentiment',features=['TrafficType','PublisherId','AppSiteId','AppSiteCategory','DeviceType','Country','CampaignId','CreativeCategory','ExchangeBid'],validation_set=test_data,max_iterations=500)


PROGRESS: Logistic regression:
PROGRESS: --------------------------------------------------------
PROGRESS: Number of examples          : 85764
PROGRESS: Number of classes           : 2
PROGRESS: Number of feature columns   : 9
PROGRESS: Number of unpacked features : 9
PROGRESS: Number of coefficients    : 2925
PROGRESS: Starting L-BFGS
PROGRESS: --------------------------------------------------------
PROGRESS: +-----------+----------+-----------+--------------+-------------------+---------------------+
PROGRESS: | Iteration | Passes   | Step size | Elapsed Time | Training-accuracy | Validation-accuracy |
PROGRESS: +-----------+----------+-----------+--------------+-------------------+---------------------+
PROGRESS: | 1         | 3        | 0.000012  | 0.090001     | 0.681580          | 0.678126            |
PROGRESS: | 2         | 5        | 1.000000  | 0.174001     | 0.767571          | 0.763695            |
PROGRESS: | 3         | 6        | 1.000000  | 0.222002     | 0.873059          | 0.869061            |
PROGRESS: | 4         | 7        | 1.000000  | 0.282002     | 0.873338          | 0.869387            |
PROGRESS: | 5         | 8        | 1.000000  | 0.337004     | 0.875379          | 0.871390            |
PROGRESS: | 6         | 10       | 1.000000  | 0.414006     | 0.874609          | 0.870552            |
PROGRESS: | 11        | 15       | 1.000000  | 0.696011     | 0.875286          | 0.868688            |
PROGRESS: | 25        | 29       | 1.000000  | 1.476021     | 0.885360          | 0.878983            |
PROGRESS: | 50        | 54       | 1.000000  | 2.880049     | 0.884847          | 0.878470            |
PROGRESS: | 51        | 55       | 1.000000  | 2.940049     | 0.884917          | 0.878377            |
PROGRESS: | 75        | 80       | 1.000000  | 4.310066     | 0.884987          | 0.877865            |
PROGRESS: | 100       | 107      | 1.000000  | 5.750084     | 0.885045          | 0.878051            |
PROGRESS: | 101       | 108      | 1.000000  | 5.796086     | 0.885068          | 0.878051            |
PROGRESS: | 125       | 132      | 1.000000  | 7.090102     | 0.884987          | 0.877818            |
PROGRESS: | 150       | 157      | 1.000000  | 8.424127     | 0.885162          | 0.878004            |
PROGRESS: | 175       | 183      | 1.000000  | 9.798145     | 0.885371          | 0.878237            |
PROGRESS: | 200       | 208      | 1.000000  | 11.236166    | 0.885418          | 0.878237            |
PROGRESS: | 225       | 233      | 1.000000  | 12.719188    | 0.885383          | 0.878144            |
PROGRESS: | 250       | 259      | 1.000000  | 14.520216    | 0.885371          | 0.878098            |
PROGRESS: | 275       | 284      | 1.000000  | 16.234234    | 0.885348          | 0.878098            |
PROGRESS: | 300       | 309      | 1.000000  | 17.986263    | 0.885360          | 0.878098            |
PROGRESS: | 325       | 334      | 1.000000  | 19.890296    | 0.885348          | 0.878098            |
PROGRESS: | 350       | 359      | 1.000000  | 21.634314    | 0.885337          | 0.878098            |
PROGRESS: | 375       | 384      | 1.000000  | 23.448335    | 0.885337          | 0.878098            |
PROGRESS: | 400       | 409      | 1.000000  | 25.244369    | 0.885337          | 0.878098            |
PROGRESS: | 425       | 434      | 1.000000  | 27.015398    | 0.885337          | 0.878098            |
PROGRESS: | 450       | 460      | 1.000000  | 28.716420    | 0.885337          | 0.878098            |
PROGRESS: | 475       | 486      | 1.000000  | 30.504445    | 0.885337          | 0.878051            |
PROGRESS: | 500       | 513      | 1.000000  | 32.094463    | 0.885337          | 0.878144            |
PROGRESS: +-----------+----------+-----------+--------------+-------------------+---------------------+

In [12]:
model


Out[12]:
Class                         : LogisticClassifier

Schema
------
Number of coefficients        : 2925
Number of examples            : 85764
Number of classes             : 2
Number of feature columns     : 9
Number of unpacked features   : 9

Hyperparameters
---------------
L1 penalty                    : 0.0
L2 penalty                    : 0.01

Training Summary
----------------
Solver                        : auto
Solver iterations             : 500
Solver status                 : TERMINATED: Iteration limit reached.
Training time (sec)           : 29.0924

Settings
--------
Log-likelihood                : 23197.0483

Highest Positive Coefficients
-----------------------------
Country[MDA]                  : 24.7432
AppSiteId[66f161f9d43df83109c8c2e710194b2d695c169c]: 23.8477
AppSiteId[f8ed3d18079e62af1263f632a6f91af777bf9b3a]: 22.2534
AppSiteId[c1952009179b2073b96040d98111c22ab89c544b]: 17.409
CreativeCategory[Financial Planning#Options]: 15.8339

Lowest Negative Coefficients
----------------------------
AppSiteId[813a85a06f66bd5cc64a065c9a92cfe974d85346]: -24.0515
AppSiteId[6adc879c3e8b6056688381ba06a14c4d0290ad17]: -23.0711
AppSiteId[93c5f967739b16d9e154b3399970e44c7070ded5]: -22.4148
CreativeCategory[Beauty]      : -22.0531
CreativeCategory[Adventure Travel#Television]: -21.3993

In [14]:
model=graphlab.logistic_classifier.create(train_data,target='sentiment',features=['TrafficType','DeviceType','CampaignId','CreativeCategory','ExchangeBid'],validation_set=test_data,max_iterations=500)


PROGRESS: Logistic regression:
PROGRESS: --------------------------------------------------------
PROGRESS: Number of examples          : 85764
PROGRESS: Number of classes           : 2
PROGRESS: Number of feature columns   : 5
PROGRESS: Number of unpacked features : 5
PROGRESS: Number of coefficients    : 87
PROGRESS: Starting Newton Method
PROGRESS: --------------------------------------------------------
PROGRESS: +-----------+----------+--------------+-------------------+---------------------+
PROGRESS: | Iteration | Passes   | Elapsed Time | Training-accuracy | Validation-accuracy |
PROGRESS: +-----------+----------+--------------+-------------------+---------------------+
PROGRESS: | 1         | 2        | 0.083002     | 0.879775          | 0.882756            |
PROGRESS: | 2         | 3        | 0.142004     | 0.880673          | 0.882663            |
PROGRESS: | 3         | 4        | 0.194005     | 0.880416          | 0.882337            |
PROGRESS: | 4         | 5        | 0.256006     | 0.879961          | 0.881917            |
PROGRESS: | 5         | 6        | 0.318007     | 0.879950          | 0.881917            |
PROGRESS: | 6         | 7        | 0.390009     | 0.879950          | 0.881917            |
PROGRESS: | 11        | 12       | 0.686018     | 0.879950          | 0.881917            |
PROGRESS: +-----------+----------+--------------+-------------------+---------------------+

In [15]:
model


Out[15]:
Class                         : LogisticClassifier

Schema
------
Number of coefficients        : 87
Number of examples            : 85764
Number of classes             : 2
Number of feature columns     : 5
Number of unpacked features   : 5

Hyperparameters
---------------
L1 penalty                    : 0.0
L2 penalty                    : 0.01

Training Summary
----------------
Solver                        : auto
Solver iterations             : 13
Solver status                 : SUCCESS: Optimal solution found.
Training time (sec)           : 0.844

Settings
--------
Log-likelihood                : 24218.683

Highest Positive Coefficients
-----------------------------
CreativeCategory[Investing]   : 10.0249
CreativeCategory[Board Games/Puzzles#Card Games]: 9.9306
CreativeCategory[American Cuisine#Barbecues & Grilling]: 9.7159
CreativeCategory[Financial Planning#Options]: 9.7068
CreativeCategory[Buying/Selling Cars]: 9.6643

Lowest Negative Coefficients
----------------------------
CreativeCategory[American Cuisine#Barbecues & Grilling#Board Games/Puzzles]: -16.7284
CreativeCategory[Pickup#Air Travel]: -15.7733
CreativeCategory[Beauty]      : -15.6791
CreativeCategory[Adventure Travel#Television]: -15.1703
CreativeCategory[Video & Computer Games#Roleplaying Games]: -15.1591

In [16]:
model.evaluate(test_data)


Out[16]:
{'accuracy': 0.8819172722191169, 'confusion_matrix': Columns:
 	target_label	int
 	predicted_label	int
 	count	int
 
 Rows: 4
 
 Data:
 +--------------+-----------------+-------+
 | target_label | predicted_label | count |
 +--------------+-----------------+-------+
 |      1       |        0        |  785  |
 |      1       |        1        |  6345 |
 |      0       |        1        |  1750 |
 |      0       |        0        | 12588 |
 +--------------+-----------------+-------+
 [4 rows x 3 columns]}

In [19]:
model.save('mymodel')

In [20]:
model.evaluate(test_data, metric='roc_curve')


Out[20]:
{'roc_curve': Columns:
 	threshold	float
 	fpr	float
 	tpr	float
 	p	int
 	n	int
 
 Rows: 1001
 
 Data:
 +------------------+----------------+------------------+------+-------+
 |    threshold     |      fpr       |       tpr        |  p   |   n   |
 +------------------+----------------+------------------+------+-------+
 |       0.0        | 0.442381517415 | 0.00294654132173 | 7127 | 14327 |
 | 0.0010000000475  | 0.557618482585 |  0.997053458678  | 7127 | 14327 |
 | 0.00200000009499 | 0.539959516996 |  0.996913147187  | 7127 | 14327 |
 | 0.00300000002608 | 0.539959516996 |  0.996913147187  | 7127 | 14327 |
 | 0.00400000018999 | 0.539959516996 |  0.996913147187  | 7127 | 14327 |
 | 0.00499999988824 | 0.539959516996 |  0.996913147187  | 7127 | 14327 |
 | 0.00600000005215 | 0.539959516996 |  0.996913147187  | 7127 | 14327 |
 | 0.00700000021607 | 0.539959516996 |  0.996913147187  | 7127 | 14327 |
 | 0.00800000037998 | 0.539959516996 |  0.996913147187  | 7127 | 14327 |
 | 0.00899999961257 | 0.539959516996 |  0.996913147187  | 7127 | 14327 |
 +------------------+----------------+------------------+------+-------+
 [1001 rows x 5 columns]
 Note: Only the head of the SFrame is printed.
 You can use print_rows(num_rows=m, num_columns=n) to print more rows and columns.}

In [21]:
model.show(view='Evaluation')


Canvas is accessible via web browser at the URL: http://localhost:62135/index.html
Opening Canvas in default web browser.

In [ ]: