Commit ·
8c7ecd7
1
Parent(s): 9015aef
modify json input
Browse files- catboost_info/catboost_training.json +100 -100
- catboost_info/learn/events.out.tfevents +1 -1
- catboost_info/time_left.tsv +100 -100
- model.ipynb +519 -0
- model.pickle +3 -0
- request.py +3 -4
- server.py +24 -0
- vercel.json +1 -1
catboost_info/catboost_training.json
CHANGED
|
@@ -1,104 +1,104 @@
|
|
| 1 |
{
|
| 2 |
"meta":{"test_sets":[],"test_metrics":[],"learn_metrics":[{"best_value":"Min","name":"MultiClass"}],"launch_mode":"Train","parameters":"","iteration_count":100,"learn_sets":["learn"],"name":"experiment"},
|
| 3 |
"iterations":[
|
| 4 |
-
{"learn":[0.8093705957],"iteration":0,"passed_time":0.
|
| 5 |
-
{"learn":[0.7672922146],"iteration":1,"passed_time":0.
|
| 6 |
-
{"learn":[0.7547201757],"iteration":2,"passed_time":0.
|
| 7 |
-
{"learn":[0.7451655309],"iteration":3,"passed_time":0.
|
| 8 |
-
{"learn":[0.74258066],"iteration":4,"passed_time":0.
|
| 9 |
-
{"learn":[0.7348963069],"iteration":5,"passed_time":
|
| 10 |
-
{"learn":[0.7305562094],"iteration":6,"passed_time":1.
|
| 11 |
-
{"learn":[0.7265356209],"iteration":7,"passed_time":1.
|
| 12 |
-
{"learn":[0.7236361022],"iteration":8,"passed_time":1.
|
| 13 |
-
{"learn":[0.7214462449],"iteration":9,"passed_time":1.
|
| 14 |
-
{"learn":[0.7199267171],"iteration":10,"passed_time":1.
|
| 15 |
-
{"learn":[0.7176381223],"iteration":11,"passed_time":1.
|
| 16 |
-
{"learn":[0.7126307582],"iteration":12,"passed_time":2.
|
| 17 |
-
{"learn":[0.7106341005],"iteration":13,"passed_time":2.
|
| 18 |
-
{"learn":[0.708089894],"iteration":14,"passed_time":2.
|
| 19 |
-
{"learn":[0.7062654231],"iteration":15,"passed_time":2.
|
| 20 |
-
{"learn":[0.7047084356],"iteration":16,"passed_time":2.
|
| 21 |
-
{"learn":[0.7034535432],"iteration":17,"passed_time":2.
|
| 22 |
-
{"learn":[0.6994372743],"iteration":18,"passed_time":
|
| 23 |
-
{"learn":[0.6973022131],"iteration":19,"passed_time":3.
|
| 24 |
-
{"learn":[0.6955342415],"iteration":20,"passed_time":3.
|
| 25 |
-
{"learn":[0.694220544],"iteration":21,"passed_time":3.
|
| 26 |
-
{"learn":[0.6924865817],"iteration":22,"passed_time":3.
|
| 27 |
-
{"learn":[0.6911943965],"iteration":23,"passed_time":3.
|
| 28 |
-
{"learn":[0.689440866],"iteration":24,"passed_time":3.
|
| 29 |
-
{"learn":[0.6876020287],"iteration":25,"passed_time":4.
|
| 30 |
-
{"learn":[0.6865187003],"iteration":26,"passed_time":4.
|
| 31 |
-
{"learn":[0.6854479168],"iteration":27,"passed_time":4.
|
| 32 |
-
{"learn":[0.684268993],"iteration":28,"passed_time":4.
|
| 33 |
-
{"learn":[0.6829424596],"iteration":29,"passed_time":4.
|
| 34 |
-
{"learn":[0.6816032958],"iteration":30,"passed_time":4.
|
| 35 |
-
{"learn":[0.6801754486],"iteration":31,"passed_time":
|
| 36 |
-
{"learn":[0.678293514],"iteration":32,"passed_time":5.
|
| 37 |
-
{"learn":[0.6776460329],"iteration":33,"passed_time":5.
|
| 38 |
-
{"learn":[0.6764592663],"iteration":34,"passed_time":5.
|
| 39 |
-
{"learn":[0.6753199683],"iteration":35,"passed_time":5.
|
| 40 |
-
{"learn":[0.6743207323],"iteration":36,"passed_time":5.
|
| 41 |
-
{"learn":[0.6735958623],"iteration":37,"passed_time":5.
|
| 42 |
-
{"learn":[0.6725859005],"iteration":38,"passed_time":
|
| 43 |
-
{"learn":[0.6713787854],"iteration":39,"passed_time":6.
|
| 44 |
-
{"learn":[0.6704214161],"iteration":40,"passed_time":6.
|
| 45 |
-
{"learn":[0.669515157],"iteration":41,"passed_time":6.
|
| 46 |
-
{"learn":[0.668514491],"iteration":42,"passed_time":6.
|
| 47 |
-
{"learn":[0.6672082962],"iteration":43,"passed_time":6.
|
| 48 |
-
{"learn":[0.6661076657],"iteration":44,"passed_time":6.
|
| 49 |
-
{"learn":[0.6652635966],"iteration":45,"passed_time":7.
|
| 50 |
-
{"learn":[0.6641843486],"iteration":46,"passed_time":7.
|
| 51 |
-
{"learn":[0.6631666312],"iteration":47,"passed_time":7.
|
| 52 |
-
{"learn":[0.661749352],"iteration":48,"passed_time":7.
|
| 53 |
-
{"learn":[0.660763127],"iteration":49,"passed_time":7.
|
| 54 |
-
{"learn":[0.6591692193],"iteration":50,"passed_time":7.
|
| 55 |
-
{"learn":[0.6581610862],"iteration":51,"passed_time":
|
| 56 |
-
{"learn":[0.6572886455],"iteration":52,"passed_time":8.
|
| 57 |
-
{"learn":[0.6561826198],"iteration":53,"passed_time":8.
|
| 58 |
-
{"learn":[0.6553215345],"iteration":54,"passed_time":8.
|
| 59 |
-
{"learn":[0.6548207326],"iteration":55,"passed_time":8.
|
| 60 |
-
{"learn":[0.6537602239],"iteration":56,"passed_time":8.
|
| 61 |
-
{"learn":[0.6527693841],"iteration":57,"passed_time":8.
|
| 62 |
-
{"learn":[0.6519938054],"iteration":58,"passed_time":9.
|
| 63 |
-
{"learn":[0.6512436197],"iteration":59,"passed_time":9.
|
| 64 |
-
{"learn":[0.650687857],"iteration":60,"passed_time":9.
|
| 65 |
-
{"learn":[0.649806812],"iteration":61,"passed_time":9.
|
| 66 |
-
{"learn":[0.649136969],"iteration":62,"passed_time":9.
|
| 67 |
-
{"learn":[0.6482225012],"iteration":63,"passed_time":9.
|
| 68 |
-
{"learn":[0.6475584421],"iteration":64,"passed_time":9.
|
| 69 |
-
{"learn":[0.646424677],"iteration":65,"passed_time":10.
|
| 70 |
-
{"learn":[0.6458628932],"iteration":66,"passed_time":10.
|
| 71 |
-
{"learn":[0.6450314803],"iteration":67,"passed_time":10.
|
| 72 |
-
{"learn":[0.6442996338],"iteration":68,"passed_time":10.
|
| 73 |
-
{"learn":[0.6437052777],"iteration":69,"passed_time":10.
|
| 74 |
-
{"learn":[0.6430089366],"iteration":70,"passed_time":10.
|
| 75 |
-
{"learn":[0.642453701],"iteration":71,"passed_time":10.
|
| 76 |
-
{"learn":[0.641534076],"iteration":72,"passed_time":11.
|
| 77 |
-
{"learn":[0.6406980233],"iteration":73,"passed_time":11.
|
| 78 |
-
{"learn":[0.6393859282],"iteration":74,"passed_time":11.
|
| 79 |
-
{"learn":[0.6385404645],"iteration":75,"passed_time":11.
|
| 80 |
-
{"learn":[0.6375529648],"iteration":76,"passed_time":11.
|
| 81 |
-
{"learn":[0.6368774255],"iteration":77,"passed_time":11.
|
| 82 |
-
{"learn":[0.6358629196],"iteration":78,"passed_time":11.
|
| 83 |
-
{"learn":[0.6349938235],"iteration":79,"passed_time":12.
|
| 84 |
-
{"learn":[0.6342169638],"iteration":80,"passed_time":12.
|
| 85 |
-
{"learn":[0.6334373298],"iteration":81,"passed_time":12.
|
| 86 |
-
{"learn":[0.6327819068],"iteration":82,"passed_time":12.
|
| 87 |
-
{"learn":[0.6321170518],"iteration":83,"passed_time":12.
|
| 88 |
-
{"learn":[0.6315885506],"iteration":84,"passed_time":12.
|
| 89 |
-
{"learn":[0.6308169636],"iteration":85,"passed_time":12.
|
| 90 |
-
{"learn":[0.629908256],"iteration":86,"passed_time":13.
|
| 91 |
-
{"learn":[0.6294236747],"iteration":87,"passed_time":13.
|
| 92 |
-
{"learn":[0.6286204177],"iteration":88,"passed_time":13.
|
| 93 |
-
{"learn":[0.6277610572],"iteration":89,"passed_time":13.
|
| 94 |
-
{"learn":[0.6269985187],"iteration":90,"passed_time":13.
|
| 95 |
-
{"learn":[0.6257763607],"iteration":91,"passed_time":13.
|
| 96 |
-
{"learn":[0.6250042283],"iteration":92,"passed_time":13.
|
| 97 |
-
{"learn":[0.6238682689],"iteration":93,"passed_time":14.
|
| 98 |
-
{"learn":[0.6232903582],"iteration":94,"passed_time":14.
|
| 99 |
-
{"learn":[0.6221232309],"iteration":95,"passed_time":14.
|
| 100 |
-
{"learn":[0.6214121653],"iteration":96,"passed_time":14.
|
| 101 |
-
{"learn":[0.6205984833],"iteration":97,"passed_time":14.
|
| 102 |
-
{"learn":[0.6196649498],"iteration":98,"passed_time":14.
|
| 103 |
-
{"learn":[0.6192072422],"iteration":99,"passed_time":14.
|
| 104 |
]}
|
|
|
|
| 1 |
{
|
| 2 |
"meta":{"test_sets":[],"test_metrics":[],"learn_metrics":[{"best_value":"Min","name":"MultiClass"}],"launch_mode":"Train","parameters":"","iteration_count":100,"learn_sets":["learn"],"name":"experiment"},
|
| 3 |
"iterations":[
|
| 4 |
+
{"learn":[0.8093705957],"iteration":0,"passed_time":0.1989915005,"remaining_time":19.70015855},
|
| 5 |
+
{"learn":[0.7672922146],"iteration":1,"passed_time":0.37643102,"remaining_time":18.44511998},
|
| 6 |
+
{"learn":[0.7547201757],"iteration":2,"passed_time":0.5284701137,"remaining_time":17.08720034},
|
| 7 |
+
{"learn":[0.7451655309],"iteration":3,"passed_time":0.6942486303,"remaining_time":16.66196713},
|
| 8 |
+
{"learn":[0.74258066],"iteration":4,"passed_time":0.8441136605,"remaining_time":16.03815955},
|
| 9 |
+
{"learn":[0.7348963069],"iteration":5,"passed_time":0.9931482445,"remaining_time":15.5593225},
|
| 10 |
+
{"learn":[0.7305562094],"iteration":6,"passed_time":1.188812134,"remaining_time":15.79421835},
|
| 11 |
+
{"learn":[0.7265356209],"iteration":7,"passed_time":1.356216662,"remaining_time":15.59649161},
|
| 12 |
+
{"learn":[0.7236361022],"iteration":8,"passed_time":1.501796682,"remaining_time":15.18483312},
|
| 13 |
+
{"learn":[0.7214462449],"iteration":9,"passed_time":1.647051529,"remaining_time":14.82346376},
|
| 14 |
+
{"learn":[0.7199267171],"iteration":10,"passed_time":1.793843323,"remaining_time":14.51382325},
|
| 15 |
+
{"learn":[0.7176381223],"iteration":11,"passed_time":1.937629336,"remaining_time":14.2092818},
|
| 16 |
+
{"learn":[0.7126307582],"iteration":12,"passed_time":2.119149291,"remaining_time":14.1819991},
|
| 17 |
+
{"learn":[0.7106341005],"iteration":13,"passed_time":2.258630027,"remaining_time":13.8744416},
|
| 18 |
+
{"learn":[0.708089894],"iteration":14,"passed_time":2.402790361,"remaining_time":13.61581205},
|
| 19 |
+
{"learn":[0.7062654231],"iteration":15,"passed_time":2.54198242,"remaining_time":13.34540771},
|
| 20 |
+
{"learn":[0.7047084356],"iteration":16,"passed_time":2.685016291,"remaining_time":13.10919719},
|
| 21 |
+
{"learn":[0.7034535432],"iteration":17,"passed_time":2.82398036,"remaining_time":12.86479942},
|
| 22 |
+
{"learn":[0.6994372743],"iteration":18,"passed_time":2.989577282,"remaining_time":12.74503999},
|
| 23 |
+
{"learn":[0.6973022131],"iteration":19,"passed_time":3.159417343,"remaining_time":12.63766937},
|
| 24 |
+
{"learn":[0.6955342415],"iteration":20,"passed_time":3.324903776,"remaining_time":12.50797135},
|
| 25 |
+
{"learn":[0.694220544],"iteration":21,"passed_time":3.484451973,"remaining_time":12.35396609},
|
| 26 |
+
{"learn":[0.6924865817],"iteration":22,"passed_time":3.675603295,"remaining_time":12.30528059},
|
| 27 |
+
{"learn":[0.6911943965],"iteration":23,"passed_time":3.837223531,"remaining_time":12.15120785},
|
| 28 |
+
{"learn":[0.689440866],"iteration":24,"passed_time":3.999477327,"remaining_time":11.99843198},
|
| 29 |
+
{"learn":[0.6876020287],"iteration":25,"passed_time":4.155909213,"remaining_time":11.82835699},
|
| 30 |
+
{"learn":[0.6865187003],"iteration":26,"passed_time":4.297452144,"remaining_time":11.61903728},
|
| 31 |
+
{"learn":[0.6854479168],"iteration":27,"passed_time":4.432224674,"remaining_time":11.39714916},
|
| 32 |
+
{"learn":[0.684268993],"iteration":28,"passed_time":4.589191254,"remaining_time":11.23560617},
|
| 33 |
+
{"learn":[0.6829424596],"iteration":29,"passed_time":4.728063936,"remaining_time":11.03214918},
|
| 34 |
+
{"learn":[0.6816032958],"iteration":30,"passed_time":4.880687137,"remaining_time":10.86346492},
|
| 35 |
+
{"learn":[0.6801754486],"iteration":31,"passed_time":5.015112357,"remaining_time":10.65711376},
|
| 36 |
+
{"learn":[0.678293514],"iteration":32,"passed_time":5.183329767,"remaining_time":10.52373013},
|
| 37 |
+
{"learn":[0.6776460329],"iteration":33,"passed_time":5.319766011,"remaining_time":10.32660461},
|
| 38 |
+
{"learn":[0.6764592663],"iteration":34,"passed_time":5.471744046,"remaining_time":10.16181037},
|
| 39 |
+
{"learn":[0.6753199683],"iteration":35,"passed_time":5.61695256,"remaining_time":9.98569344},
|
| 40 |
+
{"learn":[0.6743207323],"iteration":36,"passed_time":5.773438333,"remaining_time":9.830449054},
|
| 41 |
+
{"learn":[0.6735958623],"iteration":37,"passed_time":5.908518527,"remaining_time":9.640214439},
|
| 42 |
+
{"learn":[0.6725859005],"iteration":38,"passed_time":6.053992515,"remaining_time":9.469065217},
|
| 43 |
+
{"learn":[0.6713787854],"iteration":39,"passed_time":6.197987163,"remaining_time":9.296980744},
|
| 44 |
+
{"learn":[0.6704214161],"iteration":40,"passed_time":6.339856981,"remaining_time":9.123208826},
|
| 45 |
+
{"learn":[0.669515157],"iteration":41,"passed_time":6.473833088,"remaining_time":8.940055217},
|
| 46 |
+
{"learn":[0.668514491],"iteration":42,"passed_time":6.622002986,"remaining_time":8.778003958},
|
| 47 |
+
{"learn":[0.6672082962],"iteration":43,"passed_time":6.774260427,"remaining_time":8.621785998},
|
| 48 |
+
{"learn":[0.6661076657],"iteration":44,"passed_time":6.939011936,"remaining_time":8.481014588},
|
| 49 |
+
{"learn":[0.6652635966],"iteration":45,"passed_time":7.084857371,"remaining_time":8.317006479},
|
| 50 |
+
{"learn":[0.6641843486],"iteration":46,"passed_time":7.236644075,"remaining_time":8.160470979},
|
| 51 |
+
{"learn":[0.6631666312],"iteration":47,"passed_time":7.383318753,"remaining_time":7.998595315},
|
| 52 |
+
{"learn":[0.661749352],"iteration":48,"passed_time":7.544445225,"remaining_time":7.852381765},
|
| 53 |
+
{"learn":[0.660763127],"iteration":49,"passed_time":7.701200204,"remaining_time":7.701200204},
|
| 54 |
+
{"learn":[0.6591692193],"iteration":50,"passed_time":7.865628731,"remaining_time":7.557172702},
|
| 55 |
+
{"learn":[0.6581610862],"iteration":51,"passed_time":8.007267804,"remaining_time":7.391324127},
|
| 56 |
+
{"learn":[0.6572886455],"iteration":52,"passed_time":8.155821776,"remaining_time":7.232521197},
|
| 57 |
+
{"learn":[0.6561826198],"iteration":53,"passed_time":8.31306633,"remaining_time":7.081500948},
|
| 58 |
+
{"learn":[0.6553215345],"iteration":54,"passed_time":8.453326822,"remaining_time":6.916358309},
|
| 59 |
+
{"learn":[0.6548207326],"iteration":55,"passed_time":8.592555669,"remaining_time":6.75129374},
|
| 60 |
+
{"learn":[0.6537602239],"iteration":56,"passed_time":8.74441362,"remaining_time":6.596662906},
|
| 61 |
+
{"learn":[0.6527693841],"iteration":57,"passed_time":8.882341967,"remaining_time":6.432040735},
|
| 62 |
+
{"learn":[0.6519938054],"iteration":58,"passed_time":9.032510586,"remaining_time":6.27682939},
|
| 63 |
+
{"learn":[0.6512436197],"iteration":59,"passed_time":9.165471777,"remaining_time":6.110314518},
|
| 64 |
+
{"learn":[0.650687857],"iteration":60,"passed_time":9.317946469,"remaining_time":5.957375611},
|
| 65 |
+
{"learn":[0.649806812],"iteration":61,"passed_time":9.454146334,"remaining_time":5.794476785},
|
| 66 |
+
{"learn":[0.649136969],"iteration":62,"passed_time":9.602231653,"remaining_time":5.639405892},
|
| 67 |
+
{"learn":[0.6482225012],"iteration":63,"passed_time":9.743334623,"remaining_time":5.480625726},
|
| 68 |
+
{"learn":[0.6475584421],"iteration":64,"passed_time":9.886505564,"remaining_time":5.323502996},
|
| 69 |
+
{"learn":[0.646424677],"iteration":65,"passed_time":10.02292322,"remaining_time":5.163324084},
|
| 70 |
+
{"learn":[0.6458628932],"iteration":66,"passed_time":10.16243775,"remaining_time":5.005379789},
|
| 71 |
+
{"learn":[0.6450314803],"iteration":67,"passed_time":10.30415792,"remaining_time":4.849015491},
|
| 72 |
+
{"learn":[0.6442996338],"iteration":68,"passed_time":10.44946457,"remaining_time":4.694686982},
|
| 73 |
+
{"learn":[0.6437052777],"iteration":69,"passed_time":10.59744533,"remaining_time":4.541762286},
|
| 74 |
+
{"learn":[0.6430089366],"iteration":70,"passed_time":10.73943836,"remaining_time":4.386531159},
|
| 75 |
+
{"learn":[0.642453701],"iteration":71,"passed_time":10.87796623,"remaining_time":4.2303202},
|
| 76 |
+
{"learn":[0.641534076],"iteration":72,"passed_time":11.03318399,"remaining_time":4.080766681},
|
| 77 |
+
{"learn":[0.6406980233],"iteration":73,"passed_time":11.17465893,"remaining_time":3.926231517},
|
| 78 |
+
{"learn":[0.6393859282],"iteration":74,"passed_time":11.32780489,"remaining_time":3.775934964},
|
| 79 |
+
{"learn":[0.6385404645],"iteration":75,"passed_time":11.46354943,"remaining_time":3.62006824},
|
| 80 |
+
{"learn":[0.6375529648],"iteration":76,"passed_time":11.63757066,"remaining_time":3.47615747},
|
| 81 |
+
{"learn":[0.6368774255],"iteration":77,"passed_time":11.77737363,"remaining_time":3.321823331},
|
| 82 |
+
{"learn":[0.6358629196],"iteration":78,"passed_time":11.92677076,"remaining_time":3.170407417},
|
| 83 |
+
{"learn":[0.6349938235],"iteration":79,"passed_time":12.06519754,"remaining_time":3.016299384},
|
| 84 |
+
{"learn":[0.6342169638],"iteration":80,"passed_time":12.21135697,"remaining_time":2.864392377},
|
| 85 |
+
{"learn":[0.6334373298],"iteration":81,"passed_time":12.35122974,"remaining_time":2.711245552},
|
| 86 |
+
{"learn":[0.6327819068],"iteration":82,"passed_time":12.49751298,"remaining_time":2.559731574},
|
| 87 |
+
{"learn":[0.6321170518],"iteration":83,"passed_time":12.63505483,"remaining_time":2.406677111},
|
| 88 |
+
{"learn":[0.6315885506],"iteration":84,"passed_time":12.78347118,"remaining_time":2.255906679},
|
| 89 |
+
{"learn":[0.6308169636],"iteration":85,"passed_time":12.92425865,"remaining_time":2.103949083},
|
| 90 |
+
{"learn":[0.629908256],"iteration":86,"passed_time":13.0857357,"remaining_time":1.955339817},
|
| 91 |
+
{"learn":[0.6294236747],"iteration":87,"passed_time":13.22657087,"remaining_time":1.803623301},
|
| 92 |
+
{"learn":[0.6286204177],"iteration":88,"passed_time":13.37238543,"remaining_time":1.652766739},
|
| 93 |
+
{"learn":[0.6277610572],"iteration":89,"passed_time":13.51996475,"remaining_time":1.502218306},
|
| 94 |
+
{"learn":[0.6269985187],"iteration":90,"passed_time":13.67769956,"remaining_time":1.352739517},
|
| 95 |
+
{"learn":[0.6257763607],"iteration":91,"passed_time":13.81838832,"remaining_time":1.201598985},
|
| 96 |
+
{"learn":[0.6250042283],"iteration":92,"passed_time":13.97058854,"remaining_time":1.051549675},
|
| 97 |
+
{"learn":[0.6238682689],"iteration":93,"passed_time":14.13136544,"remaining_time":0.9020020491},
|
| 98 |
+
{"learn":[0.6232903582],"iteration":94,"passed_time":14.27466874,"remaining_time":0.7512983545},
|
| 99 |
+
{"learn":[0.6221232309],"iteration":95,"passed_time":14.4111697,"remaining_time":0.6004654041},
|
| 100 |
+
{"learn":[0.6214121653],"iteration":96,"passed_time":14.55666323,"remaining_time":0.4502060791},
|
| 101 |
+
{"learn":[0.6205984833],"iteration":97,"passed_time":14.69350069,"remaining_time":0.2998673609},
|
| 102 |
+
{"learn":[0.6196649498],"iteration":98,"passed_time":14.85811315,"remaining_time":0.150081951},
|
| 103 |
+
{"learn":[0.6192072422],"iteration":99,"passed_time":14.99739511,"remaining_time":0}
|
| 104 |
]}
|
catboost_info/learn/events.out.tfevents
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 5998
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:eb4a7aafbd3eb7e647c406a9716b6105873a453b74e6382be52d6577bf2ea87b
|
| 3 |
size 5998
|
catboost_info/time_left.tsv
CHANGED
|
@@ -1,101 +1,101 @@
|
|
| 1 |
iter Passed Remaining
|
| 2 |
-
0
|
| 3 |
-
1
|
| 4 |
-
2
|
| 5 |
-
3
|
| 6 |
-
4
|
| 7 |
-
5
|
| 8 |
-
6
|
| 9 |
-
7
|
| 10 |
-
8
|
| 11 |
-
9
|
| 12 |
-
10
|
| 13 |
-
11
|
| 14 |
-
12
|
| 15 |
-
13
|
| 16 |
-
14
|
| 17 |
-
15
|
| 18 |
-
16
|
| 19 |
-
17
|
| 20 |
-
18
|
| 21 |
-
19
|
| 22 |
-
20
|
| 23 |
-
21
|
| 24 |
-
22
|
| 25 |
-
23
|
| 26 |
-
24
|
| 27 |
-
25
|
| 28 |
-
26
|
| 29 |
-
27
|
| 30 |
-
28
|
| 31 |
-
29
|
| 32 |
-
30
|
| 33 |
-
31
|
| 34 |
-
32
|
| 35 |
-
33
|
| 36 |
-
34
|
| 37 |
-
35
|
| 38 |
-
36
|
| 39 |
-
37
|
| 40 |
-
38
|
| 41 |
-
39
|
| 42 |
-
40
|
| 43 |
-
41
|
| 44 |
-
42
|
| 45 |
-
43
|
| 46 |
-
44
|
| 47 |
-
45
|
| 48 |
-
46
|
| 49 |
-
47
|
| 50 |
-
48
|
| 51 |
-
49
|
| 52 |
-
50
|
| 53 |
-
51
|
| 54 |
-
52
|
| 55 |
-
53
|
| 56 |
-
54
|
| 57 |
-
55
|
| 58 |
-
56
|
| 59 |
-
57
|
| 60 |
-
58
|
| 61 |
-
59
|
| 62 |
-
60
|
| 63 |
-
61
|
| 64 |
-
62
|
| 65 |
-
63
|
| 66 |
-
64
|
| 67 |
-
65
|
| 68 |
-
66
|
| 69 |
-
67
|
| 70 |
-
68
|
| 71 |
-
69
|
| 72 |
-
70
|
| 73 |
-
71
|
| 74 |
-
72
|
| 75 |
-
73
|
| 76 |
-
74
|
| 77 |
-
75
|
| 78 |
-
76
|
| 79 |
-
77
|
| 80 |
-
78
|
| 81 |
-
79
|
| 82 |
-
80
|
| 83 |
-
81
|
| 84 |
-
82
|
| 85 |
-
83
|
| 86 |
-
84
|
| 87 |
-
85
|
| 88 |
-
86
|
| 89 |
-
87
|
| 90 |
-
88
|
| 91 |
-
89
|
| 92 |
-
90
|
| 93 |
-
91
|
| 94 |
-
92
|
| 95 |
-
93
|
| 96 |
-
94
|
| 97 |
-
95
|
| 98 |
-
96
|
| 99 |
-
97
|
| 100 |
-
98
|
| 101 |
-
99
|
|
|
|
| 1 |
iter Passed Remaining
|
| 2 |
+
0 198 19700
|
| 3 |
+
1 376 18445
|
| 4 |
+
2 528 17087
|
| 5 |
+
3 694 16661
|
| 6 |
+
4 844 16038
|
| 7 |
+
5 993 15559
|
| 8 |
+
6 1188 15794
|
| 9 |
+
7 1356 15596
|
| 10 |
+
8 1501 15184
|
| 11 |
+
9 1647 14823
|
| 12 |
+
10 1793 14513
|
| 13 |
+
11 1937 14209
|
| 14 |
+
12 2119 14181
|
| 15 |
+
13 2258 13874
|
| 16 |
+
14 2402 13615
|
| 17 |
+
15 2541 13345
|
| 18 |
+
16 2685 13109
|
| 19 |
+
17 2823 12864
|
| 20 |
+
18 2989 12745
|
| 21 |
+
19 3159 12637
|
| 22 |
+
20 3324 12507
|
| 23 |
+
21 3484 12353
|
| 24 |
+
22 3675 12305
|
| 25 |
+
23 3837 12151
|
| 26 |
+
24 3999 11998
|
| 27 |
+
25 4155 11828
|
| 28 |
+
26 4297 11619
|
| 29 |
+
27 4432 11397
|
| 30 |
+
28 4589 11235
|
| 31 |
+
29 4728 11032
|
| 32 |
+
30 4880 10863
|
| 33 |
+
31 5015 10657
|
| 34 |
+
32 5183 10523
|
| 35 |
+
33 5319 10326
|
| 36 |
+
34 5471 10161
|
| 37 |
+
35 5616 9985
|
| 38 |
+
36 5773 9830
|
| 39 |
+
37 5908 9640
|
| 40 |
+
38 6053 9469
|
| 41 |
+
39 6197 9296
|
| 42 |
+
40 6339 9123
|
| 43 |
+
41 6473 8940
|
| 44 |
+
42 6622 8778
|
| 45 |
+
43 6774 8621
|
| 46 |
+
44 6939 8481
|
| 47 |
+
45 7084 8317
|
| 48 |
+
46 7236 8160
|
| 49 |
+
47 7383 7998
|
| 50 |
+
48 7544 7852
|
| 51 |
+
49 7701 7701
|
| 52 |
+
50 7865 7557
|
| 53 |
+
51 8007 7391
|
| 54 |
+
52 8155 7232
|
| 55 |
+
53 8313 7081
|
| 56 |
+
54 8453 6916
|
| 57 |
+
55 8592 6751
|
| 58 |
+
56 8744 6596
|
| 59 |
+
57 8882 6432
|
| 60 |
+
58 9032 6276
|
| 61 |
+
59 9165 6110
|
| 62 |
+
60 9317 5957
|
| 63 |
+
61 9454 5794
|
| 64 |
+
62 9602 5639
|
| 65 |
+
63 9743 5480
|
| 66 |
+
64 9886 5323
|
| 67 |
+
65 10022 5163
|
| 68 |
+
66 10162 5005
|
| 69 |
+
67 10304 4849
|
| 70 |
+
68 10449 4694
|
| 71 |
+
69 10597 4541
|
| 72 |
+
70 10739 4386
|
| 73 |
+
71 10877 4230
|
| 74 |
+
72 11033 4080
|
| 75 |
+
73 11174 3926
|
| 76 |
+
74 11327 3775
|
| 77 |
+
75 11463 3620
|
| 78 |
+
76 11637 3476
|
| 79 |
+
77 11777 3321
|
| 80 |
+
78 11926 3170
|
| 81 |
+
79 12065 3016
|
| 82 |
+
80 12211 2864
|
| 83 |
+
81 12351 2711
|
| 84 |
+
82 12497 2559
|
| 85 |
+
83 12635 2406
|
| 86 |
+
84 12783 2255
|
| 87 |
+
85 12924 2103
|
| 88 |
+
86 13085 1955
|
| 89 |
+
87 13226 1803
|
| 90 |
+
88 13372 1652
|
| 91 |
+
89 13519 1502
|
| 92 |
+
90 13677 1352
|
| 93 |
+
91 13818 1201
|
| 94 |
+
92 13970 1051
|
| 95 |
+
93 14131 902
|
| 96 |
+
94 14274 751
|
| 97 |
+
95 14411 600
|
| 98 |
+
96 14556 450
|
| 99 |
+
97 14693 299
|
| 100 |
+
98 14858 150
|
| 101 |
+
99 14997 0
|
model.ipynb
ADDED
|
@@ -0,0 +1,519 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"id": "5ede69a1",
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"source": [
|
| 8 |
+
"# Classification Challenge using CatBoost\n",
|
| 9 |
+
"\n",
|
| 10 |
+
"## INF2179 Fall 2021\n",
|
| 11 |
+
"### Hamid Yuksel\n",
|
| 12 |
+
"\n",
|
| 13 |
+
"This submission uses [CatBoost](https://catboost.ai/).\n",
|
| 14 |
+
"CatBoost was chosen for its listed benefits, mainly in requiring less hyperparameter tuning and preprocessing of categorical and text features. It is also fast and fairly easy to set up.\n",
|
| 15 |
+
"\n",
|
| 16 |
+
"<img src=\"https://cdn.britannica.com/39/7139-050-A88818BB/Himalayan-chocolate-point.jpg\"\n",
|
| 17 |
+
" alt=\"Markdown Monster icon\"\n",
|
| 18 |
+
" style=\"float: left; margin-right: 10px;\" />\n"
|
| 19 |
+
]
|
| 20 |
+
},
|
| 21 |
+
{
|
| 22 |
+
"cell_type": "code",
|
| 23 |
+
"execution_count": 1,
|
| 24 |
+
"id": "ee82451e",
|
| 25 |
+
"metadata": {},
|
| 26 |
+
"outputs": [
|
| 27 |
+
{
|
| 28 |
+
"name": "stdout",
|
| 29 |
+
"output_type": "stream",
|
| 30 |
+
"text": [
|
| 31 |
+
"Requirement already satisfied: catboost in /Users/yuksel/.local/lib/python3.8/site-packages (1.0.3)\n",
|
| 32 |
+
"Requirement already satisfied: numpy>=1.16.0 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from catboost) (1.20.1)\n",
|
| 33 |
+
"Requirement already satisfied: scipy in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from catboost) (1.8.0)\n",
|
| 34 |
+
"Requirement already satisfied: matplotlib in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from catboost) (3.4.3)\n",
|
| 35 |
+
"Requirement already satisfied: plotly in /Users/yuksel/.local/lib/python3.8/site-packages (from catboost) (5.3.1)\n",
|
| 36 |
+
"Requirement already satisfied: pandas>=0.24.0 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from catboost) (1.2.4)\n",
|
| 37 |
+
"Requirement already satisfied: graphviz in /Users/yuksel/.local/lib/python3.8/site-packages (from catboost) (0.18)\n",
|
| 38 |
+
"Requirement already satisfied: six in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from catboost) (1.15.0)\n",
|
| 39 |
+
"Requirement already satisfied: python-dateutil>=2.7.3 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from pandas>=0.24.0->catboost) (2.8.1)\n",
|
| 40 |
+
"Requirement already satisfied: pytz>=2017.3 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from pandas>=0.24.0->catboost) (2021.1)\n",
|
| 41 |
+
"Requirement already satisfied: pyparsing>=2.2.1 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from matplotlib->catboost) (2.4.7)\n",
|
| 42 |
+
"Requirement already satisfied: cycler>=0.10 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from matplotlib->catboost) (0.10.0)\n",
|
| 43 |
+
"Requirement already satisfied: pillow>=6.2.0 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from matplotlib->catboost) (8.2.0)\n",
|
| 44 |
+
"Requirement already satisfied: kiwisolver>=1.0.1 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from matplotlib->catboost) (1.3.1)\n",
|
| 45 |
+
"Requirement already satisfied: tenacity>=6.2.0 in /Users/yuksel/.local/lib/python3.8/site-packages (from plotly->catboost) (8.0.1)\n",
|
| 46 |
+
"\u001b[33mWARNING: You are using pip version 21.3.1; however, version 22.2.1 is available.\n",
|
| 47 |
+
"You should consider upgrading via the '/Users/yuksel/opt/anaconda3/bin/python3 -m pip install --upgrade pip' command.\u001b[0m\n",
|
| 48 |
+
"Requirement already satisfied: ipywidgets in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (7.6.3)\n",
|
| 49 |
+
"Requirement already satisfied: traitlets>=4.3.1 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from ipywidgets) (5.0.5)\n",
|
| 50 |
+
"Requirement already satisfied: jupyterlab-widgets>=1.0.0 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from ipywidgets) (1.0.0)\n",
|
| 51 |
+
"Requirement already satisfied: ipykernel>=4.5.1 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from ipywidgets) (5.3.4)\n",
|
| 52 |
+
"Requirement already satisfied: ipython>=4.0.0 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from ipywidgets) (7.22.0)\n",
|
| 53 |
+
"Requirement already satisfied: nbformat>=4.2.0 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from ipywidgets) (5.1.3)\n",
|
| 54 |
+
"Requirement already satisfied: widgetsnbextension~=3.5.0 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from ipywidgets) (3.5.1)\n",
|
| 55 |
+
"Requirement already satisfied: tornado>=4.2 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from ipykernel>=4.5.1->ipywidgets) (6.1)\n",
|
| 56 |
+
"Requirement already satisfied: jupyter-client in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from ipykernel>=4.5.1->ipywidgets) (6.1.12)\n",
|
| 57 |
+
"Requirement already satisfied: appnope in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from ipykernel>=4.5.1->ipywidgets) (0.1.2)\n",
|
| 58 |
+
"Requirement already satisfied: pygments in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from ipython>=4.0.0->ipywidgets) (2.8.1)\n",
|
| 59 |
+
"Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from ipython>=4.0.0->ipywidgets) (3.0.17)\n",
|
| 60 |
+
"Requirement already satisfied: setuptools>=18.5 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from ipython>=4.0.0->ipywidgets) (52.0.0.post20210125)\n",
|
| 61 |
+
"Requirement already satisfied: backcall in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from ipython>=4.0.0->ipywidgets) (0.2.0)\n",
|
| 62 |
+
"Requirement already satisfied: jedi>=0.16 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from ipython>=4.0.0->ipywidgets) (0.17.2)\n",
|
| 63 |
+
"Requirement already satisfied: pexpect>4.3 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from ipython>=4.0.0->ipywidgets) (4.8.0)\n",
|
| 64 |
+
"Requirement already satisfied: pickleshare in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from ipython>=4.0.0->ipywidgets) (0.7.5)\n",
|
| 65 |
+
"Requirement already satisfied: decorator in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from ipython>=4.0.0->ipywidgets) (5.0.6)\n",
|
| 66 |
+
"Requirement already satisfied: ipython-genutils in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from nbformat>=4.2.0->ipywidgets) (0.2.0)\n",
|
| 67 |
+
"Requirement already satisfied: jupyter-core in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from nbformat>=4.2.0->ipywidgets) (4.7.1)\n",
|
| 68 |
+
"Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from nbformat>=4.2.0->ipywidgets) (3.2.0)\n",
|
| 69 |
+
"Requirement already satisfied: notebook>=4.4.1 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from widgetsnbextension~=3.5.0->ipywidgets) (6.3.0)\n",
|
| 70 |
+
"Requirement already satisfied: parso<0.8.0,>=0.7.0 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from jedi>=0.16->ipython>=4.0.0->ipywidgets) (0.7.0)\n",
|
| 71 |
+
"Requirement already satisfied: six>=1.11.0 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets) (1.15.0)\n",
|
| 72 |
+
"Requirement already satisfied: attrs>=17.4.0 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets) (20.3.0)\n",
|
| 73 |
+
"Requirement already satisfied: pyrsistent>=0.14.0 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets) (0.17.3)\n",
|
| 74 |
+
"Requirement already satisfied: nbconvert in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (6.0.7)\n",
|
| 75 |
+
"Requirement already satisfied: Send2Trash>=1.5.0 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (1.5.0)\n",
|
| 76 |
+
"Requirement already satisfied: pyzmq>=17 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (20.0.0)\n",
|
| 77 |
+
"Requirement already satisfied: terminado>=0.8.3 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (0.9.4)\n",
|
| 78 |
+
"Requirement already satisfied: argon2-cffi in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (20.1.0)\n",
|
| 79 |
+
"Requirement already satisfied: prometheus-client in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (0.10.1)\n",
|
| 80 |
+
"Requirement already satisfied: jinja2 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (2.11.3)\n",
|
| 81 |
+
"Requirement already satisfied: python-dateutil>=2.1 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from jupyter-client->ipykernel>=4.5.1->ipywidgets) (2.8.1)\n",
|
| 82 |
+
"Requirement already satisfied: ptyprocess>=0.5 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from pexpect>4.3->ipython>=4.0.0->ipywidgets) (0.7.0)\n",
|
| 83 |
+
"Requirement already satisfied: wcwidth in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=4.0.0->ipywidgets) (0.2.5)\n",
|
| 84 |
+
"Requirement already satisfied: cffi>=1.0.0 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (1.14.5)\n",
|
| 85 |
+
"Requirement already satisfied: MarkupSafe>=0.23 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from jinja2->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (2.0.1)\n",
|
| 86 |
+
"Requirement already satisfied: entrypoints>=0.2.2 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (0.3)\n",
|
| 87 |
+
"Requirement already satisfied: jupyterlab-pygments in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (0.1.2)\n",
|
| 88 |
+
"Requirement already satisfied: testpath in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (0.4.4)\n",
|
| 89 |
+
"Requirement already satisfied: defusedxml in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (0.7.1)\n",
|
| 90 |
+
"Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (0.5.3)\n",
|
| 91 |
+
"Requirement already satisfied: mistune<2,>=0.8.1 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (0.8.4)\n",
|
| 92 |
+
"Requirement already satisfied: pandocfilters>=1.4.1 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (1.4.3)\n",
|
| 93 |
+
"Requirement already satisfied: bleach in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (3.3.0)\n",
|
| 94 |
+
"Requirement already satisfied: pycparser in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (2.20)\n"
|
| 95 |
+
]
|
| 96 |
+
},
|
| 97 |
+
{
|
| 98 |
+
"name": "stdout",
|
| 99 |
+
"output_type": "stream",
|
| 100 |
+
"text": [
|
| 101 |
+
"Requirement already satisfied: async-generator in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from nbclient<0.6.0,>=0.5.0->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (1.10)\n",
|
| 102 |
+
"Requirement already satisfied: nest-asyncio in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from nbclient<0.6.0,>=0.5.0->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (1.5.1)\n",
|
| 103 |
+
"Requirement already satisfied: webencodings in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (0.5.1)\n",
|
| 104 |
+
"Requirement already satisfied: packaging in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (21.3)\n",
|
| 105 |
+
"Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /Users/yuksel/opt/anaconda3/lib/python3.8/site-packages (from packaging->bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (2.4.7)\n",
|
| 106 |
+
"\u001b[33mWARNING: You are using pip version 21.3.1; however, version 22.2.1 is available.\n",
|
| 107 |
+
"You should consider upgrading via the '/Users/yuksel/opt/anaconda3/bin/python3 -m pip install --upgrade pip' command.\u001b[0m\n",
|
| 108 |
+
"Enabling notebook extension jupyter-js-widgets/extension...\n",
|
| 109 |
+
" - Validating: \u001b[32mOK\u001b[0m\n"
|
| 110 |
+
]
|
| 111 |
+
}
|
| 112 |
+
],
|
| 113 |
+
"source": [
|
| 114 |
+
"#Installing and Importing required libraries\n",
|
| 115 |
+
"! pip3 install --user catboost\n",
|
| 116 |
+
"! pip3 install --user ipywidgets\n",
|
| 117 |
+
"! jupyter nbextension enable --py widgetsnbextension\n",
|
| 118 |
+
"\n",
|
| 119 |
+
"import pandas as pd \n",
|
| 120 |
+
"import numpy as np\n",
|
| 121 |
+
"from sklearn.neural_network import MLPClassifier\n",
|
| 122 |
+
"from sklearn.metrics import accuracy_score \n",
|
| 123 |
+
"from catboost import Pool, CatBoostClassifier"
|
| 124 |
+
]
|
| 125 |
+
},
|
| 126 |
+
{
|
| 127 |
+
"cell_type": "code",
|
| 128 |
+
"execution_count": 2,
|
| 129 |
+
"id": "1853f85d",
|
| 130 |
+
"metadata": {},
|
| 131 |
+
"outputs": [
|
| 132 |
+
{
|
| 133 |
+
"data": {
|
| 134 |
+
"text/plain": [
|
| 135 |
+
"Rock 24486\n",
|
| 136 |
+
"Pop 16251\n",
|
| 137 |
+
"Hip Hop 9263\n",
|
| 138 |
+
"unknown 5000\n",
|
| 139 |
+
"Name: Genre, dtype: int64"
|
| 140 |
+
]
|
| 141 |
+
},
|
| 142 |
+
"execution_count": 2,
|
| 143 |
+
"metadata": {},
|
| 144 |
+
"output_type": "execute_result"
|
| 145 |
+
}
|
| 146 |
+
],
|
| 147 |
+
"source": [
|
| 148 |
+
"# Reading data\n",
|
| 149 |
+
"df = pd.read_csv('data.csv')\n",
|
| 150 |
+
"\n",
|
| 151 |
+
"# Splitting\n",
|
| 152 |
+
"training = df.head(50000)\n",
|
| 153 |
+
"holdout_set = training.sample(5000, random_state=1) # pick 5000 observations randomly\n",
|
| 154 |
+
"training = training.drop(holdout_set.index) # Remove holdout from training data\n",
|
| 155 |
+
"testing = df.tail(5000)\n",
|
| 156 |
+
"\n",
|
| 157 |
+
"#Looking at counts per genre\n",
|
| 158 |
+
"df['Genre'].value_counts()"
|
| 159 |
+
]
|
| 160 |
+
},
|
| 161 |
+
{
|
| 162 |
+
"cell_type": "code",
|
| 163 |
+
"execution_count": 3,
|
| 164 |
+
"id": "f0a20f7a",
|
| 165 |
+
"metadata": {},
|
| 166 |
+
"outputs": [
|
| 167 |
+
{
|
| 168 |
+
"data": {
|
| 169 |
+
"text/html": [
|
| 170 |
+
"<div>\n",
|
| 171 |
+
"<style scoped>\n",
|
| 172 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 173 |
+
" vertical-align: middle;\n",
|
| 174 |
+
" }\n",
|
| 175 |
+
"\n",
|
| 176 |
+
" .dataframe tbody tr th {\n",
|
| 177 |
+
" vertical-align: top;\n",
|
| 178 |
+
" }\n",
|
| 179 |
+
"\n",
|
| 180 |
+
" .dataframe thead th {\n",
|
| 181 |
+
" text-align: right;\n",
|
| 182 |
+
" }\n",
|
| 183 |
+
"</style>\n",
|
| 184 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 185 |
+
" <thead>\n",
|
| 186 |
+
" <tr style=\"text-align: right;\">\n",
|
| 187 |
+
" <th></th>\n",
|
| 188 |
+
" <th>Lyric</th>\n",
|
| 189 |
+
" </tr>\n",
|
| 190 |
+
" </thead>\n",
|
| 191 |
+
" <tbody>\n",
|
| 192 |
+
" <tr>\n",
|
| 193 |
+
" <th>50000</th>\n",
|
| 194 |
+
" <td>Feels so good,. Feels so good,. Feels so good ...</td>\n",
|
| 195 |
+
" </tr>\n",
|
| 196 |
+
" <tr>\n",
|
| 197 |
+
" <th>50001</th>\n",
|
| 198 |
+
" <td>Shadow of a doubt. I heard your heart,. you he...</td>\n",
|
| 199 |
+
" </tr>\n",
|
| 200 |
+
" <tr>\n",
|
| 201 |
+
" <th>50002</th>\n",
|
| 202 |
+
" <td>Slaves. Hebrews born to serve to the pharaoh. ...</td>\n",
|
| 203 |
+
" </tr>\n",
|
| 204 |
+
" <tr>\n",
|
| 205 |
+
" <th>50003</th>\n",
|
| 206 |
+
" <td>You've been picked and it's over. What's the c...</td>\n",
|
| 207 |
+
" </tr>\n",
|
| 208 |
+
" <tr>\n",
|
| 209 |
+
" <th>50004</th>\n",
|
| 210 |
+
" <td>Magic happens. But only if you are open to the...</td>\n",
|
| 211 |
+
" </tr>\n",
|
| 212 |
+
" <tr>\n",
|
| 213 |
+
" <th>...</th>\n",
|
| 214 |
+
" <td>...</td>\n",
|
| 215 |
+
" </tr>\n",
|
| 216 |
+
" <tr>\n",
|
| 217 |
+
" <th>54995</th>\n",
|
| 218 |
+
" <td>I can't believe what you did to me. Down on my...</td>\n",
|
| 219 |
+
" </tr>\n",
|
| 220 |
+
" <tr>\n",
|
| 221 |
+
" <th>54996</th>\n",
|
| 222 |
+
" <td>Have all the songs been written?. Have all the...</td>\n",
|
| 223 |
+
" </tr>\n",
|
| 224 |
+
" <tr>\n",
|
| 225 |
+
" <th>54997</th>\n",
|
| 226 |
+
" <td>Everything you do you do so right. The clothes...</td>\n",
|
| 227 |
+
" </tr>\n",
|
| 228 |
+
" <tr>\n",
|
| 229 |
+
" <th>54998</th>\n",
|
| 230 |
+
" <td>(trecho). (Rule Number Two. Understanding what...</td>\n",
|
| 231 |
+
" </tr>\n",
|
| 232 |
+
" <tr>\n",
|
| 233 |
+
" <th>54999</th>\n",
|
| 234 |
+
" <td>As fall rides off in the Sunset. I sweep the S...</td>\n",
|
| 235 |
+
" </tr>\n",
|
| 236 |
+
" </tbody>\n",
|
| 237 |
+
"</table>\n",
|
| 238 |
+
"<p>5000 rows × 1 columns</p>\n",
|
| 239 |
+
"</div>"
|
| 240 |
+
],
|
| 241 |
+
"text/plain": [
|
| 242 |
+
" Lyric\n",
|
| 243 |
+
"50000 Feels so good,. Feels so good,. Feels so good ...\n",
|
| 244 |
+
"50001 Shadow of a doubt. I heard your heart,. you he...\n",
|
| 245 |
+
"50002 Slaves. Hebrews born to serve to the pharaoh. ...\n",
|
| 246 |
+
"50003 You've been picked and it's over. What's the c...\n",
|
| 247 |
+
"50004 Magic happens. But only if you are open to the...\n",
|
| 248 |
+
"... ...\n",
|
| 249 |
+
"54995 I can't believe what you did to me. Down on my...\n",
|
| 250 |
+
"54996 Have all the songs been written?. Have all the...\n",
|
| 251 |
+
"54997 Everything you do you do so right. The clothes...\n",
|
| 252 |
+
"54998 (trecho). (Rule Number Two. Understanding what...\n",
|
| 253 |
+
"54999 As fall rides off in the Sunset. I sweep the S...\n",
|
| 254 |
+
"\n",
|
| 255 |
+
"[5000 rows x 1 columns]"
|
| 256 |
+
]
|
| 257 |
+
},
|
| 258 |
+
"execution_count": 3,
|
| 259 |
+
"metadata": {},
|
| 260 |
+
"output_type": "execute_result"
|
| 261 |
+
}
|
| 262 |
+
],
|
| 263 |
+
"source": [
|
| 264 |
+
"# Splitting training/testing set to feature (X) and labels (y)\n",
|
| 265 |
+
"train_y = training.Genre\n",
|
| 266 |
+
"train_X = training.drop('Genre', axis=1)\n",
|
| 267 |
+
"\n",
|
| 268 |
+
"test_X = testing.drop('Genre', axis=1)\n",
|
| 269 |
+
"\n",
|
| 270 |
+
"test_X"
|
| 271 |
+
]
|
| 272 |
+
},
|
| 273 |
+
{
|
| 274 |
+
"cell_type": "code",
|
| 275 |
+
"execution_count": 5,
|
| 276 |
+
"id": "1c8eb420",
|
| 277 |
+
"metadata": {},
|
| 278 |
+
"outputs": [
|
| 279 |
+
{
|
| 280 |
+
"name": "stdout",
|
| 281 |
+
"output_type": "stream",
|
| 282 |
+
"text": [
|
| 283 |
+
"0:\tlearn: 0.8093706\ttotal: 204ms\tremaining: 20.2s\n",
|
| 284 |
+
"1:\tlearn: 0.7672922\ttotal: 383ms\tremaining: 18.8s\n",
|
| 285 |
+
"2:\tlearn: 0.7547202\ttotal: 538ms\tremaining: 17.4s\n",
|
| 286 |
+
"3:\tlearn: 0.7451655\ttotal: 725ms\tremaining: 17.4s\n",
|
| 287 |
+
"4:\tlearn: 0.7425807\ttotal: 874ms\tremaining: 16.6s\n",
|
| 288 |
+
"5:\tlearn: 0.7348963\ttotal: 1.03s\tremaining: 16.1s\n",
|
| 289 |
+
"6:\tlearn: 0.7305562\ttotal: 1.18s\tremaining: 15.7s\n",
|
| 290 |
+
"7:\tlearn: 0.7265356\ttotal: 1.35s\tremaining: 15.5s\n",
|
| 291 |
+
"8:\tlearn: 0.7236361\ttotal: 1.51s\tremaining: 15.2s\n",
|
| 292 |
+
"9:\tlearn: 0.7214462\ttotal: 1.66s\tremaining: 14.9s\n",
|
| 293 |
+
"10:\tlearn: 0.7199267\ttotal: 1.8s\tremaining: 14.6s\n",
|
| 294 |
+
"11:\tlearn: 0.7176381\ttotal: 1.95s\tremaining: 14.3s\n",
|
| 295 |
+
"12:\tlearn: 0.7126308\ttotal: 2.13s\tremaining: 14.3s\n",
|
| 296 |
+
"13:\tlearn: 0.7106341\ttotal: 2.27s\tremaining: 14s\n",
|
| 297 |
+
"14:\tlearn: 0.7080899\ttotal: 2.42s\tremaining: 13.7s\n",
|
| 298 |
+
"15:\tlearn: 0.7062654\ttotal: 2.57s\tremaining: 13.5s\n",
|
| 299 |
+
"16:\tlearn: 0.7047084\ttotal: 2.71s\tremaining: 13.2s\n",
|
| 300 |
+
"17:\tlearn: 0.7034535\ttotal: 2.85s\tremaining: 13s\n",
|
| 301 |
+
"18:\tlearn: 0.6994373\ttotal: 3.01s\tremaining: 12.8s\n",
|
| 302 |
+
"19:\tlearn: 0.6973022\ttotal: 3.17s\tremaining: 12.7s\n",
|
| 303 |
+
"20:\tlearn: 0.6955342\ttotal: 3.32s\tremaining: 12.5s\n",
|
| 304 |
+
"21:\tlearn: 0.6942205\ttotal: 3.46s\tremaining: 12.3s\n",
|
| 305 |
+
"22:\tlearn: 0.6924866\ttotal: 3.62s\tremaining: 12.1s\n",
|
| 306 |
+
"23:\tlearn: 0.6911944\ttotal: 3.76s\tremaining: 11.9s\n",
|
| 307 |
+
"24:\tlearn: 0.6894409\ttotal: 3.91s\tremaining: 11.7s\n",
|
| 308 |
+
"25:\tlearn: 0.6876020\ttotal: 4.06s\tremaining: 11.6s\n",
|
| 309 |
+
"26:\tlearn: 0.6865187\ttotal: 4.2s\tremaining: 11.4s\n",
|
| 310 |
+
"27:\tlearn: 0.6854479\ttotal: 4.34s\tremaining: 11.2s\n",
|
| 311 |
+
"28:\tlearn: 0.6842690\ttotal: 4.52s\tremaining: 11.1s\n",
|
| 312 |
+
"29:\tlearn: 0.6829425\ttotal: 4.66s\tremaining: 10.9s\n",
|
| 313 |
+
"30:\tlearn: 0.6816033\ttotal: 4.81s\tremaining: 10.7s\n",
|
| 314 |
+
"31:\tlearn: 0.6801754\ttotal: 4.94s\tremaining: 10.5s\n",
|
| 315 |
+
"32:\tlearn: 0.6782935\ttotal: 5.11s\tremaining: 10.4s\n",
|
| 316 |
+
"33:\tlearn: 0.6776460\ttotal: 5.24s\tremaining: 10.2s\n",
|
| 317 |
+
"34:\tlearn: 0.6764593\ttotal: 5.39s\tremaining: 10s\n",
|
| 318 |
+
"35:\tlearn: 0.6753200\ttotal: 5.54s\tremaining: 9.85s\n",
|
| 319 |
+
"36:\tlearn: 0.6743207\ttotal: 5.69s\tremaining: 9.7s\n",
|
| 320 |
+
"37:\tlearn: 0.6735959\ttotal: 5.83s\tremaining: 9.51s\n",
|
| 321 |
+
"38:\tlearn: 0.6725859\ttotal: 5.97s\tremaining: 9.34s\n",
|
| 322 |
+
"39:\tlearn: 0.6713788\ttotal: 6.11s\tremaining: 9.17s\n",
|
| 323 |
+
"40:\tlearn: 0.6704214\ttotal: 6.25s\tremaining: 9s\n",
|
| 324 |
+
"41:\tlearn: 0.6695152\ttotal: 6.41s\tremaining: 8.85s\n",
|
| 325 |
+
"42:\tlearn: 0.6685145\ttotal: 6.57s\tremaining: 8.71s\n",
|
| 326 |
+
"43:\tlearn: 0.6672083\ttotal: 6.72s\tremaining: 8.56s\n",
|
| 327 |
+
"44:\tlearn: 0.6661077\ttotal: 6.89s\tremaining: 8.42s\n",
|
| 328 |
+
"45:\tlearn: 0.6652636\ttotal: 7.03s\tremaining: 8.25s\n",
|
| 329 |
+
"46:\tlearn: 0.6641843\ttotal: 7.2s\tremaining: 8.11s\n",
|
| 330 |
+
"47:\tlearn: 0.6631666\ttotal: 7.36s\tremaining: 7.97s\n",
|
| 331 |
+
"48:\tlearn: 0.6617494\ttotal: 7.52s\tremaining: 7.83s\n",
|
| 332 |
+
"49:\tlearn: 0.6607631\ttotal: 7.68s\tremaining: 7.68s\n",
|
| 333 |
+
"50:\tlearn: 0.6591692\ttotal: 7.86s\tremaining: 7.55s\n",
|
| 334 |
+
"51:\tlearn: 0.6581611\ttotal: 8s\tremaining: 7.38s\n",
|
| 335 |
+
"52:\tlearn: 0.6572886\ttotal: 8.16s\tremaining: 7.24s\n",
|
| 336 |
+
"53:\tlearn: 0.6561826\ttotal: 8.33s\tremaining: 7.1s\n",
|
| 337 |
+
"54:\tlearn: 0.6553215\ttotal: 8.47s\tremaining: 6.93s\n",
|
| 338 |
+
"55:\tlearn: 0.6548207\ttotal: 8.61s\tremaining: 6.76s\n",
|
| 339 |
+
"56:\tlearn: 0.6537602\ttotal: 8.75s\tremaining: 6.6s\n",
|
| 340 |
+
"57:\tlearn: 0.6527694\ttotal: 8.89s\tremaining: 6.44s\n",
|
| 341 |
+
"58:\tlearn: 0.6519938\ttotal: 9.05s\tremaining: 6.29s\n",
|
| 342 |
+
"59:\tlearn: 0.6512436\ttotal: 9.18s\tremaining: 6.12s\n",
|
| 343 |
+
"60:\tlearn: 0.6506879\ttotal: 9.33s\tremaining: 5.97s\n",
|
| 344 |
+
"61:\tlearn: 0.6498068\ttotal: 9.47s\tremaining: 5.8s\n",
|
| 345 |
+
"62:\tlearn: 0.6491370\ttotal: 9.61s\tremaining: 5.64s\n",
|
| 346 |
+
"63:\tlearn: 0.6482225\ttotal: 9.75s\tremaining: 5.48s\n",
|
| 347 |
+
"64:\tlearn: 0.6475584\ttotal: 9.89s\tremaining: 5.33s\n",
|
| 348 |
+
"65:\tlearn: 0.6464247\ttotal: 10s\tremaining: 5.17s\n",
|
| 349 |
+
"66:\tlearn: 0.6458629\ttotal: 10.2s\tremaining: 5.01s\n",
|
| 350 |
+
"67:\tlearn: 0.6450315\ttotal: 10.3s\tremaining: 4.85s\n",
|
| 351 |
+
"68:\tlearn: 0.6442996\ttotal: 10.4s\tremaining: 4.69s\n",
|
| 352 |
+
"69:\tlearn: 0.6437053\ttotal: 10.6s\tremaining: 4.54s\n",
|
| 353 |
+
"70:\tlearn: 0.6430089\ttotal: 10.7s\tremaining: 4.38s\n",
|
| 354 |
+
"71:\tlearn: 0.6424537\ttotal: 10.9s\tremaining: 4.23s\n",
|
| 355 |
+
"72:\tlearn: 0.6415341\ttotal: 11s\tremaining: 4.07s\n",
|
| 356 |
+
"73:\tlearn: 0.6406980\ttotal: 11.2s\tremaining: 3.92s\n",
|
| 357 |
+
"74:\tlearn: 0.6393859\ttotal: 11.3s\tremaining: 3.77s\n",
|
| 358 |
+
"75:\tlearn: 0.6385405\ttotal: 11.4s\tremaining: 3.62s\n",
|
| 359 |
+
"76:\tlearn: 0.6375530\ttotal: 11.6s\tremaining: 3.47s\n",
|
| 360 |
+
"77:\tlearn: 0.6368774\ttotal: 11.8s\tremaining: 3.32s\n",
|
| 361 |
+
"78:\tlearn: 0.6358629\ttotal: 11.9s\tremaining: 3.17s\n",
|
| 362 |
+
"79:\tlearn: 0.6349938\ttotal: 12s\tremaining: 3.01s\n",
|
| 363 |
+
"80:\tlearn: 0.6342170\ttotal: 12.2s\tremaining: 2.86s\n",
|
| 364 |
+
"81:\tlearn: 0.6334373\ttotal: 12.3s\tremaining: 2.7s\n",
|
| 365 |
+
"82:\tlearn: 0.6327819\ttotal: 12.5s\tremaining: 2.55s\n",
|
| 366 |
+
"83:\tlearn: 0.6321171\ttotal: 12.6s\tremaining: 2.4s\n",
|
| 367 |
+
"84:\tlearn: 0.6315886\ttotal: 12.7s\tremaining: 2.25s\n",
|
| 368 |
+
"85:\tlearn: 0.6308170\ttotal: 12.9s\tremaining: 2.1s\n",
|
| 369 |
+
"86:\tlearn: 0.6299083\ttotal: 13s\tremaining: 1.95s\n",
|
| 370 |
+
"87:\tlearn: 0.6294237\ttotal: 13.2s\tremaining: 1.8s\n",
|
| 371 |
+
"88:\tlearn: 0.6286204\ttotal: 13.3s\tremaining: 1.65s\n",
|
| 372 |
+
"89:\tlearn: 0.6277611\ttotal: 13.5s\tremaining: 1.5s\n",
|
| 373 |
+
"90:\tlearn: 0.6269985\ttotal: 13.6s\tremaining: 1.35s\n",
|
| 374 |
+
"91:\tlearn: 0.6257764\ttotal: 13.8s\tremaining: 1.2s\n",
|
| 375 |
+
"92:\tlearn: 0.6250042\ttotal: 13.9s\tremaining: 1.05s\n",
|
| 376 |
+
"93:\tlearn: 0.6238683\ttotal: 14.1s\tremaining: 899ms\n",
|
| 377 |
+
"94:\tlearn: 0.6232904\ttotal: 14.2s\tremaining: 749ms\n",
|
| 378 |
+
"95:\tlearn: 0.6221232\ttotal: 14.4s\tremaining: 598ms\n",
|
| 379 |
+
"96:\tlearn: 0.6214122\ttotal: 14.5s\tremaining: 449ms\n",
|
| 380 |
+
"97:\tlearn: 0.6205985\ttotal: 14.6s\tremaining: 299ms\n",
|
| 381 |
+
"98:\tlearn: 0.6196649\ttotal: 14.8s\tremaining: 149ms\n",
|
| 382 |
+
"99:\tlearn: 0.6192072\ttotal: 14.9s\tremaining: 0us\n"
|
| 383 |
+
]
|
| 384 |
+
},
|
| 385 |
+
{
|
| 386 |
+
"data": {
|
| 387 |
+
"text/plain": [
|
| 388 |
+
"<catboost.core.CatBoostClassifier at 0x7fb6f45e2c70>"
|
| 389 |
+
]
|
| 390 |
+
},
|
| 391 |
+
"execution_count": 5,
|
| 392 |
+
"metadata": {},
|
| 393 |
+
"output_type": "execute_result"
|
| 394 |
+
}
|
| 395 |
+
],
|
| 396 |
+
"source": [
|
| 397 |
+
"# Build a classifier\n",
|
| 398 |
+
"text_features = ['Lyric']\n",
|
| 399 |
+
"\n",
|
| 400 |
+
"\n",
|
| 401 |
+
"train_dataset = Pool(data=train_X,\n",
|
| 402 |
+
" label=train_y,\n",
|
| 403 |
+
" text_features=text_features)\n",
|
| 404 |
+
"\n",
|
| 405 |
+
"model = CatBoostClassifier(iterations=100,\n",
|
| 406 |
+
" learning_rate=1,\n",
|
| 407 |
+
" depth=5,\n",
|
| 408 |
+
" loss_function='MultiClass')\n",
|
| 409 |
+
"\n",
|
| 410 |
+
"model.fit(train_dataset)"
|
| 411 |
+
]
|
| 412 |
+
},
|
| 413 |
+
{
|
| 414 |
+
"cell_type": "code",
|
| 415 |
+
"execution_count": 6,
|
| 416 |
+
"id": "f770a8f2",
|
| 417 |
+
"metadata": {},
|
| 418 |
+
"outputs": [
|
| 419 |
+
{
|
| 420 |
+
"name": "stdout",
|
| 421 |
+
"output_type": "stream",
|
| 422 |
+
"text": [
|
| 423 |
+
"0.6796\n"
|
| 424 |
+
]
|
| 425 |
+
}
|
| 426 |
+
],
|
| 427 |
+
"source": [
|
| 428 |
+
"# Estimate accuracy\n",
|
| 429 |
+
"pred = model.predict(holdout_set.drop('Genre',axis=1))\n",
|
| 430 |
+
"estimated_accuracy = accuracy_score(holdout_set['Genre'], pred)\n",
|
| 431 |
+
"print(estimated_accuracy)\n",
|
| 432 |
+
"pd.Series(estimated_accuracy).to_csv('ea.csv', index=False, header=False)"
|
| 433 |
+
]
|
| 434 |
+
},
|
| 435 |
+
{
|
| 436 |
+
"cell_type": "code",
|
| 437 |
+
"execution_count": 7,
|
| 438 |
+
"id": "035f58c6",
|
| 439 |
+
"metadata": {},
|
| 440 |
+
"outputs": [
|
| 441 |
+
{
|
| 442 |
+
"name": "stdout",
|
| 443 |
+
"output_type": "stream",
|
| 444 |
+
"text": [
|
| 445 |
+
"['Pop' 'Rock' 'Rock' ... 'Rock' 'Pop' 'Rock']\n"
|
| 446 |
+
]
|
| 447 |
+
}
|
| 448 |
+
],
|
| 449 |
+
"source": [
|
| 450 |
+
"# Predict testing set\n",
|
| 451 |
+
"pred = model.predict(test_X)\n",
|
| 452 |
+
"print(pred.flatten())\n",
|
| 453 |
+
"pred = pd.Series(pred.flatten()).to_csv('pred.csv', index=False, header=False)"
|
| 454 |
+
]
|
| 455 |
+
},
|
| 456 |
+
{
|
| 457 |
+
"cell_type": "code",
|
| 458 |
+
"execution_count": 8,
|
| 459 |
+
"id": "2137c958",
|
| 460 |
+
"metadata": {},
|
| 461 |
+
"outputs": [
|
| 462 |
+
{
|
| 463 |
+
"data": {
|
| 464 |
+
"text/plain": [
|
| 465 |
+
"(array(['Hip Hop', 'Pop', 'Rock'], dtype=object), array([ 821, 1385, 2794]))"
|
| 466 |
+
]
|
| 467 |
+
},
|
| 468 |
+
"execution_count": 8,
|
| 469 |
+
"metadata": {},
|
| 470 |
+
"output_type": "execute_result"
|
| 471 |
+
}
|
| 472 |
+
],
|
| 473 |
+
"source": [
|
| 474 |
+
"# to check number of instances of each genre in pred\n",
|
| 475 |
+
"np.unique(model.predict(test_X), return_counts=True)"
|
| 476 |
+
]
|
| 477 |
+
},
|
| 478 |
+
{
|
| 479 |
+
"cell_type": "code",
|
| 480 |
+
"execution_count": null,
|
| 481 |
+
"id": "83aa22c4",
|
| 482 |
+
"metadata": {},
|
| 483 |
+
"outputs": [],
|
| 484 |
+
"source": [
|
| 485 |
+
"import pickle\n",
|
| 486 |
+
"pickle.dump(model, open('model.pickle', 'wb'))"
|
| 487 |
+
]
|
| 488 |
+
},
|
| 489 |
+
{
|
| 490 |
+
"cell_type": "code",
|
| 491 |
+
"execution_count": null,
|
| 492 |
+
"id": "8c3b136d",
|
| 493 |
+
"metadata": {},
|
| 494 |
+
"outputs": [],
|
| 495 |
+
"source": []
|
| 496 |
+
}
|
| 497 |
+
],
|
| 498 |
+
"metadata": {
|
| 499 |
+
"kernelspec": {
|
| 500 |
+
"display_name": "Python 3",
|
| 501 |
+
"language": "python",
|
| 502 |
+
"name": "python3"
|
| 503 |
+
},
|
| 504 |
+
"language_info": {
|
| 505 |
+
"codemirror_mode": {
|
| 506 |
+
"name": "ipython",
|
| 507 |
+
"version": 3
|
| 508 |
+
},
|
| 509 |
+
"file_extension": ".py",
|
| 510 |
+
"mimetype": "text/x-python",
|
| 511 |
+
"name": "python",
|
| 512 |
+
"nbconvert_exporter": "python",
|
| 513 |
+
"pygments_lexer": "ipython3",
|
| 514 |
+
"version": "3.8.8"
|
| 515 |
+
}
|
| 516 |
+
},
|
| 517 |
+
"nbformat": 4,
|
| 518 |
+
"nbformat_minor": 5
|
| 519 |
+
}
|
model.pickle
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ff004a32317f1ed907d7aa6960746578c802f2ffff4b586b7bc73e38dd95c49f
|
| 3 |
+
size 7738041
|
request.py
CHANGED
|
@@ -1,10 +1,9 @@
|
|
| 1 |
import requests
|
| 2 |
import json
|
| 3 |
|
| 4 |
-
url = '
|
| 5 |
|
| 6 |
data = [["baby you can drive my car"]]
|
| 7 |
-
j_data = json.dumps(data)
|
| 8 |
headers = {'content-type': 'application/json', 'Accept-Charset': 'UTF-8'}
|
| 9 |
-
r = requests.post(url,
|
| 10 |
-
print(r, r.
|
|
|
|
| 1 |
import requests
|
| 2 |
import json
|
| 3 |
|
| 4 |
+
url = 'http://0.0.0.0:5000/api/'
|
| 5 |
|
| 6 |
data = [["baby you can drive my car"]]
|
|
|
|
| 7 |
headers = {'content-type': 'application/json', 'Accept-Charset': 'UTF-8'}
|
| 8 |
+
r = requests.post(url, json={'lyric':data,}, headers=headers)
|
| 9 |
+
print(r, r.json())
|
server.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from flask import Flask, request, redirect, url_for, flash, jsonify
|
| 2 |
+
import numpy as np
|
| 3 |
+
import pickle as p
|
| 4 |
+
import json
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
app = Flask(__name__)
|
| 8 |
+
|
| 9 |
+
@app.route("/")
|
| 10 |
+
def home():
|
| 11 |
+
return "<h1>Lyrics Classifier</h1>"
|
| 12 |
+
|
| 13 |
+
@app.route('/api/', methods=['POST'])
|
| 14 |
+
def makecalc():
|
| 15 |
+
data = request.get_json(force=True)
|
| 16 |
+
prediction = np.array2string(model.predict(data['lyric']))
|
| 17 |
+
print(prediction)
|
| 18 |
+
return jsonify(prediction)
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
if __name__ == '__main__':
|
| 22 |
+
modelfile = 'model.pickle'
|
| 23 |
+
model = p.load(open(modelfile, 'rb'))
|
| 24 |
+
app.run(debug=True, host='0.0.0.0')
|
vercel.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
"version": 2,
|
| 3 |
"builds": [
|
| 4 |
{
|
| 5 |
-
"src": "./
|
| 6 |
"use": "@vercel/python"
|
| 7 |
}
|
| 8 |
],
|
|
|
|
| 2 |
"version": 2,
|
| 3 |
"builds": [
|
| 4 |
{
|
| 5 |
+
"src": "./server.py",
|
| 6 |
"use": "@vercel/python"
|
| 7 |
}
|
| 8 |
],
|