{"id":283760,"date":"2017-03-22T18:25:02","date_gmt":"2017-03-22T15:25:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=283760"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=283760","title":{"rendered":"\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u043a\u0440\u0435\u0434\u0438\u0442\u043d\u043e\u0433\u043e \u0441\u043a\u043e\u0440\u0438\u043d\u0433\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u043b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438"},"content":{"rendered":"<p>\u041e\u0442\u0443\u0447\u0438\u0432\u0448\u0438\u0441\u044c \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043e\u043d\u043b\u0430\u0439\u043d-\u043a\u0443\u0440\u0441\u0430\u0445, \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0437\u0430\u043d\u044f\u0442\u044c \u043f\u043e\u0437\u0438\u0446\u0438\u044e, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0443\u044e \u0441 Machine Learning \u2014 \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u043e \u043a\u0440\u0435\u0434\u0438\u0442\u043d\u043e\u043c \u0441\u043a\u043e\u0440\u0438\u043d\u0433\u0435. \u0421\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u0434\u0435\u0441\u044c \u0438 \u043f\u0440\u0438\u0432\u043e\u0436\u0443:<\/p>\n<p>  <\/p>\n<h1 id=\"zadanie\">\u0417\u0430\u0434\u0430\u043d\u0438\u0435<\/h1>\n<p>  <\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0432\u044b\u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u0440\u0435\u0434\u0438\u0442\u0430\u0445, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u043a\u0440\u0435\u0434\u0438\u0442\u0430.<\/p>\n<p>  <\/p>\n<p>\u0422\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u0430\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u0435 <strong>train.csv<\/strong>, \u0442\u0435\u0441\u0442\u043e\u0432\u0430\u044f \u2014 <strong>test.csv<\/strong>.<\/p>\n<p>  <\/p>\n<p>\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u0435 <strong>feature_descr.xlsx<\/strong>.<\/p>\n<p>  <\/p>\n<p>\u0426\u0435\u043b\u0435\u0432\u043e\u0439 \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u2014 <strong>loan_status<\/strong> (\u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439). 1 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0447\u0442\u043e \u043a\u0440\u0435\u0434\u0438\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u0435\u0440\u043d\u0443\u043b\u0438.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0432\u0430\u043c \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041e\u0431\u0443\u0447\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0430\u0439\u0442\u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438.<\/li>\n<li>\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f (\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438) \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0432 \u0444\u0430\u0439\u043b <strong>results.csv<\/strong><\/li>\n<li>\u041f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0432 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0432\u0438\u0434\u0435 (ROC-curve)<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0422\u0449\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u044b\u0431\u043e\u0440 \u0444\u0438\u0447 \u0438 \u043f\u043e\u0434\u0431\u043e\u0440 \u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h1 id=\"reshenie\">\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/h1>\n<p>  <\/p>\n<pre><code class=\"python\">import pandas as pd<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">import sys print &quot;Python version: {}&quot;.format(sys.version) print &quot;Pandas version: {}&quot;.format(pd.__version__)<\/code><\/pre>\n<p>  <\/p>\n<pre><code>Python version: 2.7.13 |Anaconda 4.3.1 (64-bit)| (default, Dec 19 2016, 13:29:36) [MSC v.1500 64 bit (AMD64)] Pandas version: 0.19.2<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0443\u0442 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f Python 2.7<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">pd.set_option('display.max_columns', 500) pd.set_option('display.width', 1000)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0427\u0438\u0442\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 train.csv, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f record_id \u043a\u0430\u043a \u0438\u043d\u0434\u0435\u043a\u0441:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">train = pd.read_csv('train.csv', index_col='record_id') train.head()<\/code><\/pre>\n<p>  <\/p>\n<table border=\"1\">\n<thead>\n<tr>\n<th><\/th>\n<th>loan_amnt<\/th>\n<th>term<\/th>\n<th>int_rate<\/th>\n<th>installment<\/th>\n<th>grade<\/th>\n<th>sub_grade<\/th>\n<th>emp_title<\/th>\n<th>emp_length<\/th>\n<th>home_ownership<\/th>\n<th>annual_inc<\/th>\n<th>verification_status<\/th>\n<th>issue_d<\/th>\n<th>loan_status<\/th>\n<th>pymnt_plan<\/th>\n<th>purpose<\/th>\n<th>zip_code<\/th>\n<th>addr_state<\/th>\n<th>dti<\/th>\n<th>delinq_2yrs<\/th>\n<th>earliest_cr_line<\/th>\n<th>inq_last_6mths<\/th>\n<th>mths_since_last_delinq<\/th>\n<th>open_acc<\/th>\n<th>pub_rec<\/th>\n<th>revol_bal<\/th>\n<th>revol_util<\/th>\n<th>total_acc<\/th>\n<th>initial_list_status<\/th>\n<th>collections_12_mths_ex_med<\/th>\n<th>policy_code<\/th>\n<th>application_type<\/th>\n<th>acc_now_delinq<\/th>\n<th>tot_coll_amt<\/th>\n<th>tot_cur_bal<\/th>\n<th>total_rev_hi_lim<\/th>\n<\/tr>\n<tr>\n<th>record_id<\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th>453246940<\/th>\n<td>15000.0<\/td>\n<td>36 months<\/td>\n<td>11.99<\/td>\n<td>498.15<\/td>\n<td>B<\/td>\n<td>B3<\/td>\n<td>Quality Assurance Specialist<\/td>\n<td>4 years<\/td>\n<td>MORTGAGE<\/td>\n<td>70000.0<\/td>\n<td>Verified<\/td>\n<td>Oct-2013<\/td>\n<td>1<\/td>\n<td>n<\/td>\n<td>debt_consolidation<\/td>\n<td>156xx<\/td>\n<td>PA<\/td>\n<td>13.85<\/td>\n<td>0.0<\/td>\n<td>Dec-1991<\/td>\n<td>1.0<\/td>\n<td>NaN<\/td>\n<td>17.0<\/td>\n<td>3.0<\/td>\n<td>12540.0<\/td>\n<td>61.2<\/td>\n<td>32.0<\/td>\n<td>f<\/td>\n<td>0.0<\/td>\n<td>1.0<\/td>\n<td>INDIVIDUAL<\/td>\n<td>0.0<\/td>\n<td>0.0<\/td>\n<td>295215.0<\/td>\n<td>20500.0<\/td>\n<\/tr>\n<tr>\n<th>453313687<\/th>\n<td>3725.0<\/td>\n<td>36 months<\/td>\n<td>6.03<\/td>\n<td>113.38<\/td>\n<td>A<\/td>\n<td>A1<\/td>\n<td>NaN<\/td>\n<td>n\/a<\/td>\n<td>MORTGAGE<\/td>\n<td>52260.0<\/td>\n<td>Source Verified<\/td>\n<td>Oct-2012<\/td>\n<td>1<\/td>\n<td>n<\/td>\n<td>credit_card<\/td>\n<td>339xx<\/td>\n<td>FL<\/td>\n<td>19.43<\/td>\n<td>0.0<\/td>\n<td>Oct-2000<\/td>\n<td>0.0<\/td>\n<td>NaN<\/td>\n<td>7.0<\/td>\n<td>0.0<\/td>\n<td>3730.0<\/td>\n<td>26.3<\/td>\n<td>9.0<\/td>\n<td>f<\/td>\n<td>0.0<\/td>\n<td>1.0<\/td>\n<td>INDIVIDUAL<\/td>\n<td>0.0<\/td>\n<td>0.0<\/td>\n<td>25130.0<\/td>\n<td>14200.0<\/td>\n<\/tr>\n<tr>\n<th>453283543<\/th>\n<td>16000.0<\/td>\n<td>36 months<\/td>\n<td>11.14<\/td>\n<td>524.89<\/td>\n<td>B<\/td>\n<td>B2<\/td>\n<td>KIPP NYC<\/td>\n<td>3 years<\/td>\n<td>RENT<\/td>\n<td>67500.0<\/td>\n<td>Source Verified<\/td>\n<td>Apr-2013<\/td>\n<td>1<\/td>\n<td>n<\/td>\n<td>debt_consolidation<\/td>\n<td>104xx<\/td>\n<td>NY<\/td>\n<td>14.77<\/td>\n<td>0.0<\/td>\n<td>Jul-2001<\/td>\n<td>0.0<\/td>\n<td>NaN<\/td>\n<td>9.0<\/td>\n<td>0.0<\/td>\n<td>11769.0<\/td>\n<td>60.5<\/td>\n<td>22.0<\/td>\n<td>f<\/td>\n<td>0.0<\/td>\n<td>1.0<\/td>\n<td>INDIVIDUAL<\/td>\n<td>0.0<\/td>\n<td>193.0<\/td>\n<td>41737.0<\/td>\n<td>19448.0<\/td>\n<\/tr>\n<tr>\n<th>453447199<\/th>\n<td>4200.0<\/td>\n<td>36 months<\/td>\n<td>13.33<\/td>\n<td>142.19<\/td>\n<td>C<\/td>\n<td>C3<\/td>\n<td>Receptionist<\/td>\n<td>&lt; 1 year<\/td>\n<td>MORTGAGE<\/td>\n<td>21600.0<\/td>\n<td>Not Verified<\/td>\n<td>Mar-2015<\/td>\n<td>0<\/td>\n<td>n<\/td>\n<td>major_purchase<\/td>\n<td>982xx<\/td>\n<td>WA<\/td>\n<td>39.00<\/td>\n<td>0.0<\/td>\n<td>May-2003<\/td>\n<td>0.0<\/td>\n<td>47.0<\/td>\n<td>9.0<\/td>\n<td>0.0<\/td>\n<td>6797.0<\/td>\n<td>46.9<\/td>\n<td>19.0<\/td>\n<td>w<\/td>\n<td>0.0<\/td>\n<td>1.0<\/td>\n<td>INDIVIDUAL<\/td>\n<td>0.0<\/td>\n<td>165.0<\/td>\n<td>28187.0<\/td>\n<td>14500.0<\/td>\n<\/tr>\n<tr>\n<th>453350283<\/th>\n<td>6500.0<\/td>\n<td>36 months<\/td>\n<td>12.69<\/td>\n<td>218.05<\/td>\n<td>B<\/td>\n<td>B5<\/td>\n<td>Medtox Laboratories<\/td>\n<td>10+ years<\/td>\n<td>RENT<\/td>\n<td>41000.0<\/td>\n<td>Not Verified<\/td>\n<td>Jan-2012<\/td>\n<td>1<\/td>\n<td>n<\/td>\n<td>credit_card<\/td>\n<td>551xx<\/td>\n<td>MN<\/td>\n<td>18.35<\/td>\n<td>0.0<\/td>\n<td>Sep-1990<\/td>\n<td>0.0<\/td>\n<td>NaN<\/td>\n<td>8.0<\/td>\n<td>0.0<\/td>\n<td>14674.0<\/td>\n<td>82.4<\/td>\n<td>12.0<\/td>\n<td>f<\/td>\n<td>0.0<\/td>\n<td>1.0<\/td>\n<td>INDIVIDUAL<\/td>\n<td>0.0<\/td>\n<td>NaN<\/td>\n<td>NaN<\/td>\n<td>NaN<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<pre><code class=\"python\">train.shape<\/code><\/pre>\n<p>  <\/p>\n<pre><code>(200189, 35)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a\u0438\u0435 \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u0442\u043e\u043b\u0431\u0446\u0430\u0445:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">train.dtypes<\/code><\/pre>\n<p>  <\/p>\n<pre><code>loan_amnt                     float64 term                           object int_rate                      float64 installment                   float64 grade                          object sub_grade                      object emp_title                      object emp_length                     object home_ownership                 object annual_inc                    float64 verification_status            object issue_d                        object loan_status                     int64 pymnt_plan                     object purpose                        object zip_code                       object addr_state                     object dti                           float64 delinq_2yrs                   float64 earliest_cr_line               object inq_last_6mths                float64 mths_since_last_delinq        float64 open_acc                      float64 pub_rec                       float64 revol_bal                     float64 revol_util                    float64 total_acc                     float64 initial_list_status            object collections_12_mths_ex_med    float64 policy_code                   float64 application_type               object acc_now_delinq                float64 tot_coll_amt                  float64 tot_cur_bal                   float64 total_rev_hi_lim              float64 dtype: object<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418\u0441\u0441\u043b\u0435\u0434\u0443\u0435\u043c \u043f\u043e\u043b\u044f \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">train.isnull().sum()<\/code><\/pre>\n<p>  <\/p>\n<pre><code>loan_amnt                          0 term                               0 int_rate                           0 installment                        0 grade                              0 sub_grade                          0 emp_title                      11124 emp_length                         0 home_ownership                     0 annual_inc                         0 verification_status                0 issue_d                            0 loan_status                        0 pymnt_plan                         0 purpose                            0 zip_code                           0 addr_state                         0 dti                                0 delinq_2yrs                        0 earliest_cr_line                   0 inq_last_6mths                     0 mths_since_last_delinq        110568 open_acc                           0 pub_rec                            0 revol_bal                          0 revol_util                       154 total_acc                          0 initial_list_status                0 collections_12_mths_ex_med        44 policy_code                        0 application_type                   0 acc_now_delinq                     0 tot_coll_amt                   47957 tot_cur_bal                    47957 total_rev_hi_lim               47957 dtype: int64<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u0438\u043c\u0435\u044e\u0442 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0438:<\/p>\n<p>  <\/p>\n<h3 id=\"emp_title---the-job-title-supplied-by-the-borrower-when-applying-for-the-loan\">emp_title \u2014 The job title supplied by the Borrower when applying for the loan<\/h3>\n<p>  <\/p>\n<p> \u2014 \u0414\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0435\u043c\u0449\u0438\u043a\u0430, \u0432\u0435\u0449\u044c \u0432\u0440\u043e\u0434\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f, \u043d\u043e \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0430, \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439; \u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u044d\u0442\u043e\u0442 \u0441\u0442\u043e\u043b\u0431\u0435\u0446, \u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0444\u043b\u0430\u0433, \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u043b\u0438 \u0431\u044b\u043b\u0430 \u0434\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u043e\u043e\u0431\u0449\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">train['is_title_known'] = train['emp_title'].map(lambda x: 0 if x == 'n\/a' else 1) train.drop('emp_title', axis=1, inplace=True)<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"mths_since_last_delinq---the-number-of-months-since-the-borrowers-last-delinquency\">mths_since_last_delinq \u2014 The number of months since the borrower&#8217;s last delinquency<\/h3>\n<p>  <\/p>\n<p> \u2014 \u043a\u043e\u043b-\u0432\u043e \u043c\u0435\u0441\u044f\u0446\u0435\u0432 \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u043d\u0435\u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043b\u0430\u0442\u0435\u0436\u0430 \u0432 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0441\u0440\u043e\u043a. \u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0438 \u043d\u0430 0 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0437\u0430\u043c\u0435\u043d\u0438\u043c \u0438\u0445 \u043d\u0430 max \u0432 \u044d\u0442\u043e\u043c \u0441\u0442\u043e\u043b\u0431\u0446\u0435 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u0442\u043e\u043b\u0431\u0435\u0446 is_delinq_occurs \u0441 \u0444\u043b\u0430\u0433\u043e\u043c, \u0431\u044b\u043b \u043b\u0438 \u0444\u0430\u043a\u0442 \u043d\u0435\u043f\u043b\u0430\u0442\u0435\u0436\u0430 \u0440\u0430\u043d\u0435\u0435<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import numpy as np import math train['is_delinq_occurs'] = train['mths_since_last_delinq'].map(lambda x: 0 if math.isnan(x) else 1)  max_mths_since_last_delinq = np.nanmax(train.mths_since_last_delinq.values) train['mths_since_last_delinq'].fillna(max_mths_since_last_delinq, inplace=True)<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"revol_util---revolving-line-utilization-rate-or-the-amount-of-credit-the-borrower-is-using-relative-to-all-available-revolving-credit\">revol_util \u2014 Revolving line utilization rate, or the amount of credit the borrower is using relative to all available revolving credit<\/h3>\n<p>  <\/p>\n<h3 id=\"collections_12_mths_ex_med---number-of-collections-in-12-months-excluding-medical-collections\">collections_12_mths_ex_med \u2014 Number of collections in 12 months excluding medical collections<\/h3>\n<p>  <\/p>\n<h3 id=\"tot_coll_amt---total-collection-amounts-ever-owed\">tot_coll_amt \u2014 Total collection amounts ever owed<\/h3>\n<p>  <\/p>\n<h3 id=\"tot_cur_bal---total-current-balance-of-all-accounts\">tot_cur_bal \u2014 Total current balance of all accounts<\/h3>\n<p>  <\/p>\n<h3 id=\"total_rev_hi_lim---total-revolving-high-creditcredit-limit\">total_rev_hi_lim \u2014 Total revolving high credit\/credit limit<\/h3>\n<p>  <\/p>\n<p>\u041c\u043d\u0435 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b \u0442\u043e\u043d\u043a\u043e\u0441\u0442\u0438 \u044d\u0442\u043e\u0433\u043e \u0431\u0438\u0437\u043d\u0435\u0441-\u0434\u043e\u043c\u0435\u043d\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0438 \u043d\u0430 \u043d\u0443\u043b\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 fillna():<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">train.fillna(0, inplace=True) train.isnull().sum()<\/code><\/pre>\n<p>  <\/p>\n<pre><code>loan_amnt                     0 term                          0 int_rate                      0 installment                   0 grade                         0 sub_grade                     0 emp_length                    0 home_ownership                0 annual_inc                    0 verification_status           0 issue_d                       0 loan_status                   0 pymnt_plan                    0 purpose                       0 zip_code                      0 addr_state                    0 dti                           0 delinq_2yrs                   0 earliest_cr_line              0 inq_last_6mths                0 mths_since_last_delinq        0 open_acc                      0 pub_rec                       0 revol_bal                     0 revol_util                    0 total_acc                     0 initial_list_status           0 collections_12_mths_ex_med    0 policy_code                   0 application_type              0 acc_now_delinq                0 tot_coll_amt                  0 tot_cur_bal                   0 total_rev_hi_lim              0 is_title_known                0 is_delinq_occurs              0 dtype: int64<\/code><\/pre>\n<p>  <\/p>\n<p> \u2014 \u041f\u0440\u043e\u043f\u0443\u0441\u043a\u043e\u0432 \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u0442<\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 X \u0438 Y:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">def extract_XY(data):     X = data.drop(['loan_status'], axis=1)     Y = data['loan_status']     return X, Y  X, Y = extract_XY(train)  print X.shape, Y.shape<\/code><\/pre>\n<p>  <\/p>\n<pre><code>(200189, 35) (200189L,)<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"predvaritelno-nado-razobratsya-s-nechislovymi-stolbcami\">\u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u0434\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u043d\u0435\u0447\u0438\u0441\u043b\u043e\u0432\u044b\u043c\u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u0430\u043c\u0438<\/h2>\n<p>  <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f LabelEncoder \u0438 OneHotEncoder:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from sklearn.preprocessing import LabelEncoder from sklearn.preprocessing import OneHotEncoder  # \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 DataFrame df \u043d\u043e\u0432\u044b\u0439 \u0441\u0442\u043e\u043b\u0431\u0435\u0446 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c column_name+'_le', \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u043d\u043e\u043c\u0435\u0440\u0430 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439,  # \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u043e\u043b\u0431\u0446\u0443 column_name. \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0441\u0442\u043e\u043b\u0431\u0435\u0446 column_name \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f # def encode_with_LabelEncoder(df, column_name):     label_encoder = LabelEncoder()     label_encoder.fit(df[column_name])     df[column_name+'_le'] = label_encoder.transform(df[column_name])     df.drop([column_name], axis=1, inplace=True)     return label_encoder  # \u041a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e LabelEncoder # def encode_with_existing_LabelEncoder(df, column_name, label_encoder):     df[column_name+'_le'] = label_encoder.transform(df[column_name])     df.drop([column_name], axis=1, inplace=True)  # \u0412\u043d\u0430\u0447\u0430\u043b\u0435 \u043a\u043e\u0434\u0438\u0440\u0443\u0435\u0442 \u0441\u0442\u043e\u043b\u0431\u0435\u0446 column_name \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 LabelEncoder, \u043f\u043e\u0442\u043e\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 DataFrame df \u043d\u043e\u0432\u044b\u0435 \u0441\u0442\u043e\u043b\u0431\u0446\u044b  # \u0441 \u0438\u043c\u0435\u043d\u0430\u043c\u0438 column_name=&lt;\u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f_i&gt;. \u0421\u0442\u043e\u043b\u0431\u0446\u044b column_name \u0438 column_name+'_le' \u0443\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f # Usage: df, label_encoder = encode_with_OneHotEncoder_and_delete_column(df, column_name) # def encode_with_OneHotEncoder_and_delete_column(df, column_name):     le_encoder = encode_with_LabelEncoder(df, column_name)     return perform_dummy_coding_and_delete_column(df, column_name, le_encoder), le_encoder  # \u0422\u043e \u0436\u0435, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434, \u043d\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e LabelEncoder # def encode_with_OneHotEncoder_using_existing_LabelEncoder_and_delete_column(df, column_name, le_encoder):     encode_with_existing_LabelEncoder(df, column_name, le_encoder)     return perform_dummy_coding_and_delete_column(df, column_name, le_encoder)  # \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 Dummy-\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 # def perform_dummy_coding_and_delete_column(df, column_name, le_encoder):     oh_encoder = OneHotEncoder(sparse=False)     oh_features = oh_encoder.fit_transform(df[column_name+'_le'].values.reshape(-1,1))     ohe_columns=[column_name + '=' + le_encoder.classes_[i] for i in range(oh_features.shape[1])]      df.drop([column_name+'_le'], axis=1, inplace=True)      df_with_features = pd.DataFrame(oh_features, columns=ohe_columns)     df_with_features.index = df.index     return pd.concat([df, df_with_features], axis=1)<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"term---the-number-of-payments-on-the-loan-values-are-in-months-and-can-be-either-36-or-60\">term \u2014 The number of payments on the loan. Values are in months and can be either 36 or 60.<\/h3>\n<p>  <\/p>\n<p> \u2014 \u041a\u043e\u043b-\u0432\u043e \u043f\u043b\u0430\u0442\u0435\u0436\u0435\u0439, \u0441\u0442\u043e\u0438\u0442 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import numpy as np print np.unique(X['term'])<\/code><\/pre>\n<p>  <\/p>\n<pre><code>[' 36 months' ' 60 months']<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">term_le_encoder = encode_with_LabelEncoder(X,'term')<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"grade-sub_grade---loan-grade--subgrade\">grade, sub_grade \u2014 loan grade &amp; subgrade<\/h3>\n<p>  <\/p>\n<p> \u2014 \u041d\u0435\u043a\u0438\u0435 &quot;\u043a\u043b\u0430\u0441\u0441 \u0438 \u043f\u043e\u0434\u043a\u043b\u0430\u0441\u0441 \u0437\u0430\u0435\u043c\u0430&quot;, grade \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0440\u0438\u0441\u043a\u0443 \u0437\u0430\u0439\u043c\u0430 (\u0441 \u043d\u0430\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u0435\u043c \u0440\u0438\u0441\u043a\u0430 \u043e\u0442 A \u043a G), sub_grade \u2014 \u0442\u043e \u0436\u0435, \u0442\u043e\u043b\u044c\u043a\u043e c \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u0435\u0442\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439, \u2014 \u0441\u0442\u043e\u0438\u0442 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">print np.unique(X['grade']) print np.unique(X['sub_grade'])<\/code><\/pre>\n<p>  <\/p>\n<pre><code>['A' 'B' 'C' 'D' 'E' 'F' 'G'] ['A1' 'A2' 'A3' 'A4' 'A5' 'B1' 'B2' 'B3' 'B4' 'B5' 'C1' 'C2' 'C3' 'C4' 'C5'  'D1' 'D2' 'D3' 'D4' 'D5' 'E1' 'E2' 'E3' 'E4' 'E5' 'F1' 'F2' 'F3' 'F4' 'F5'  'G1' 'G2' 'G3' 'G4' 'G5']<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">grade_le_encoder = encode_with_LabelEncoder(X,'grade') sub_grade_le_encoder = encode_with_LabelEncoder(X,'sub_grade')<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"emp_length---employment-length-in-years-possible-values-are-between-0-and-10-where-0-means-less-than-one-year-and-10-means-ten-or-more-years\">emp_length \u2014 Employment length in years. Possible values are between 0 and 10 where 0 means less than one year and 10 means ten or more years<\/h3>\n<p>  <\/p>\n<p> \u2014 \u0421\u0440\u043e\u043a \u0437\u0430\u043d\u044f\u0442\u043e\u0441\u0442\u0438 \u2014 \u0441\u0442\u043e\u0438\u0442 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">print np.unique(X['emp_length'])<\/code><\/pre>\n<p>  <\/p>\n<pre><code>['1 year' '10+ years' '2 years' '3 years' '4 years' '5 years' '6 years'  '7 years' '8 years' '9 years' '&lt; 1 year' 'n\/a']<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">X, emp_length_le_encoder = encode_with_OneHotEncoder_and_delete_column(X,'emp_length')<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"home_ownership---the-home-ownership-status-provided-by-the-borrower-during-registration-our-values-are-rent-own-mortgage-other\">home_ownership \u2014 The home ownership status provided by the borrower during registration. Our values are: RENT, OWN, MORTGAGE, OTHER<\/h3>\n<p>  <\/p>\n<p> \u2014 \u0424\u043b\u0430\u0436\u043e\u043a, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u043b\u0438 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0443 \u0435\u0433\u043e \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0434\u043e\u043c \u2014 \u0441\u0442\u043e\u0438\u0442 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">print np.unique(X['home_ownership'])<\/code><\/pre>\n<p>  <\/p>\n<pre><code>['ANY' 'MORTGAGE' 'NONE' 'OTHER' 'OWN' 'RENT']<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">X, home_ownership_le_encoder = encode_with_OneHotEncoder_and_delete_column(X,'home_ownership')<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"verification_status\">verification_status<\/h3>\n<p>  <\/p>\n<p> \u2014 \u0412 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u043d\u0435\u0442\u0443, \u043d\u043e \u0441\u0443\u0434\u044f \u0438\u0437 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u2014 \u044d\u0442\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0442\u043e\u043c, \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0437\u0430\u0435\u043c\u0449\u0438\u043a\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u043c\u0438. \u0421\u0442\u043e\u0438\u0442 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">print np.unique(X['verification_status'])<\/code><\/pre>\n<p>  <\/p>\n<pre><code>['Not Verified' 'Source Verified' 'Verified']<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">X, verification_status_le_encoder = encode_with_OneHotEncoder_and_delete_column(X,'verification_status')<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"issue_d---the-month-which-the-loan-was-funded\">issue_d \u2014 The month which the loan was funded<\/h3>\n<p>  <\/p>\n<p> \u2014 \u041c\u0435\u0441\u044f\u0446 (\u0438 \u0433\u043e\u0434), \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u043b\u0441\u044f \u0437\u0430\u0435\u043c (\u0432\u0440\u043e\u0434\u0435 \u043a\u0430\u043a). \u0412 \u043f\u0435\u0440\u0438\u043e\u0434 \u0441\u043f\u0430\u0434\u0430 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u043a\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0439\u043c\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u043f\u0430\u0434\u0430\u0442\u044c \u2014 \u0441\u0442\u043e\u0438\u0442 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">print np.unique(X['issue_d'])<\/code><\/pre>\n<p>  <\/p>\n<pre><code>['Apr-2008' 'Apr-2009' 'Apr-2010' 'Apr-2011' 'Apr-2012' 'Apr-2013'  'Apr-2014' 'Apr-2015' 'Aug-2007' 'Aug-2008' 'Aug-2009' 'Aug-2010'  'Aug-2011' 'Aug-2012' 'Aug-2013' 'Aug-2014' 'Aug-2015' 'Dec-2007'  'Dec-2008' 'Dec-2009' 'Dec-2010' 'Dec-2011' 'Dec-2012' 'Dec-2013'  'Dec-2014' 'Dec-2015' 'Feb-2008' 'Feb-2009' 'Feb-2010' 'Feb-2011'  'Feb-2012' 'Feb-2013' 'Feb-2014' 'Feb-2015' 'Jan-2008' 'Jan-2009'  'Jan-2010' 'Jan-2011' 'Jan-2012' 'Jan-2013' 'Jan-2014' 'Jan-2015'  'Jul-2007' 'Jul-2008' 'Jul-2009' 'Jul-2010' 'Jul-2011' 'Jul-2012'  'Jul-2013' 'Jul-2014' 'Jul-2015' 'Jun-2007' 'Jun-2008' 'Jun-2009'  'Jun-2010' 'Jun-2011' 'Jun-2012' 'Jun-2013' 'Jun-2014' 'Jun-2015'  'Mar-2008' 'Mar-2009' 'Mar-2010' 'Mar-2011' 'Mar-2012' 'Mar-2013'  'Mar-2014' 'Mar-2015' 'May-2008' 'May-2009' 'May-2010' 'May-2011'  'May-2012' 'May-2013' 'May-2014' 'May-2015' 'Nov-2007' 'Nov-2008'  'Nov-2009' 'Nov-2010' 'Nov-2011' 'Nov-2012' 'Nov-2013' 'Nov-2014'  'Nov-2015' 'Oct-2007' 'Oct-2008' 'Oct-2009' 'Oct-2010' 'Oct-2011'  'Oct-2012' 'Oct-2013' 'Oct-2014' 'Oct-2015' 'Sep-2007' 'Sep-2008'  'Sep-2009' 'Sep-2010' 'Sep-2011' 'Sep-2012' 'Sep-2013' 'Sep-2014'  'Sep-2015']<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u0442\u0430\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0447\u0438\u0441\u043b\u0430 \u0442\u0430\u043a, \u0447\u0442\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0437\u0434\u043d\u0435\u0439 \u0434\u0430\u0442\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435\u0435 \u0447\u0438\u0441\u043b\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">def month_to_decimal(month):     month_dict = {'Jan':0, 'Feb':1\/12., 'Mar':2\/12., 'Apr':3\/12., 'May':4\/12., 'Jun':5\/12.,       'Jul':6\/12., 'Aug':7\/12., 'Sep':8\/12., 'Oct':9\/12., 'Nov':10\/12., 'Dec':11\/12.}     return month_dict[month]  def convert_date(month_year):     month_and_year = month_year.split('-')     return float(month_and_year[1]) + month_to_decimal(month_and_year[0])  # Some check convert_date('Mar-2011')<\/code><\/pre>\n<p>  <\/p>\n<pre><code>2011.1666666666667<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">def encode_with_func(df, column_name, func_name):     df[column_name+'_le'] = df[column_name].map(func_name)     df.drop(column_name, axis=1, inplace=True)  encode_with_func(X, 'issue_d', convert_date)<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"pymnt_plan---indicates-if-a-payment-plan-has-been-put-in-place-for-the-loan\">pymnt_plan \u2014 Indicates if a payment plan has been put in place for the loan<\/h3>\n<p>  <\/p>\n<p> \u2014 \u0424\u043b\u0430\u0436\u043e\u043a \u0431\u044b\u043b \u043b\u0438 \u043f\u043b\u0430\u043d \u043f\u043b\u0430\u0442\u0435\u0436\u0435\u0439, \u0441\u0442\u043e\u0438\u0442 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">print np.unique(X['pymnt_plan'])<\/code><\/pre>\n<p>  <\/p>\n<pre><code>['n' 'y']<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">pymnt_plan_le_encoder = encode_with_LabelEncoder(X,'pymnt_plan')<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"purpose---a-category-provided-by-the-borrower-for-the-loan-request\">purpose \u2014 A category provided by the borrower for the loan request<\/h3>\n<p>  <\/p>\n<p> \u2014 \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f, \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u0431\u0440\u0430\u043b\u0441\u044f \u0437\u0430\u0435\u043c, \u0441\u0442\u043e\u0438\u0442 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">print np.unique(X['purpose'])<\/code><\/pre>\n<p>  <\/p>\n<pre><code>['car' 'credit_card' 'debt_consolidation' 'educational' 'home_improvement'  'house' 'major_purchase' 'medical' 'moving' 'other' 'renewable_energy'  'small_business' 'vacation' 'wedding']<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">X,purpose_le_encoder = encode_with_OneHotEncoder_and_delete_column(X,'purpose')<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"zip_code---the-first-3-numbers-of-the-zip-code-provided-by-the-borrower-in-the-loan-application\">zip_code \u2014 The first 3 numbers of the zip code provided by the borrower in the loan application<\/h3>\n<p>  <\/p>\n<h3 id=\"addr_state---the-state-provided-by-the-borrower-in-the-loan-application\">addr_state \u2014 The state provided by the borrower in the loan application<\/h3>\n<p>  <\/p>\n<p> \u2014 \u041f\u043e\u0447\u0442\u043e\u0432\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u0438 \u0430\u0434\u0440\u0435\u0441<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">print len(np.unique(X['zip_code'])) print len(np.unique(X['addr_state']))<\/code><\/pre>\n<p>  <\/p>\n<pre><code>877 51<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">X.drop(['zip_code'], axis=1, inplace=True) addr_state_le_encoder = encode_with_LabelEncoder(X,'addr_state')<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"earliest_cr_line---the-month-the-borrowers-earliest-reported-credit-line-was-opened\">earliest_cr_line \u2014 The month the borrower&#8217;s earliest reported credit line was opened<\/h3>\n<p>  <\/p>\n<pre><code class=\"python\">print np.unique(X['earliest_cr_line'])<\/code><\/pre>\n<p>  <\/p>\n<pre><code>['Apr-1964' 'Apr-1965' 'Apr-1966' 'Apr-1967' 'Apr-1968' 'Apr-1969'  'Apr-1970' 'Apr-1971' 'Apr-1972' 'Apr-1973' 'Apr-1974' 'Apr-1975'  'Apr-1976' 'Apr-1977' 'Apr-1978' 'Apr-1979' 'Apr-1980' 'Apr-1981'  'Apr-1982' 'Apr-1983' 'Apr-1984' 'Apr-1985' 'Apr-1986' 'Apr-1987'  'Apr-1988' 'Apr-1989' 'Apr-1990' 'Apr-1991' 'Apr-1992' 'Apr-1993'  'Apr-1994' 'Apr-1995' 'Apr-1996' 'Apr-1997' 'Apr-1998' 'Apr-1999'  'Apr-2000' 'Apr-2001' 'Apr-2002' 'Apr-2003' 'Apr-2004' 'Apr-2005'  'Apr-2006' 'Apr-2007' 'Apr-2008' 'Apr-2009' 'Apr-2010' 'Apr-2011'  'Apr-2012' 'Aug-1959' 'Aug-1960' 'Aug-1965' 'Aug-1966' 'Aug-1967'  'Aug-1968' 'Aug-1969' 'Aug-1970' 'Aug-1971' 'Aug-1972' 'Aug-1973'  'Aug-1974' 'Aug-1975' 'Aug-1976' 'Aug-1977' 'Aug-1978' 'Aug-1979'  'Aug-1980' 'Aug-1981' 'Aug-1982' 'Aug-1983' 'Aug-1984' 'Aug-1985'  'Aug-1986' 'Aug-1987' 'Aug-1988' 'Aug-1989' 'Aug-1990' 'Aug-1991'  'Aug-1992' 'Aug-1993' 'Aug-1994' 'Aug-1995' 'Aug-1996' 'Aug-1997'  'Aug-1998' 'Aug-1999' 'Aug-2000' 'Aug-2001' 'Aug-2002' 'Aug-2003'  'Aug-2004' 'Aug-2005' 'Aug-2006' 'Aug-2007' 'Aug-2008' 'Aug-2009'  'Aug-2010' 'Aug-2011' 'Dec-1950' 'Dec-1956' 'Dec-1958' 'Dec-1960'  'Dec-1961' 'Dec-1962' 'Dec-1963' 'Dec-1964' 'Dec-1965' 'Dec-1966'  'Dec-1967' 'Dec-1968' 'Dec-1969' 'Dec-1970' 'Dec-1971' 'Dec-1972'  'Dec-1973' 'Dec-1974' 'Dec-1975' 'Dec-1976' 'Dec-1977' 'Dec-1978'  'Dec-1979' 'Dec-1980' 'Dec-1981' 'Dec-1982' 'Dec-1983' 'Dec-1984'  'Dec-1985' 'Dec-1986' 'Dec-1987' 'Dec-1988' 'Dec-1989' 'Dec-1990'  'Dec-1991' 'Dec-1992' 'Dec-1993' 'Dec-1994' 'Dec-1995' 'Dec-1996'  'Dec-1997' 'Dec-1998' 'Dec-1999' 'Dec-2000' 'Dec-2001' 'Dec-2002'  'Dec-2003' 'Dec-2004' 'Dec-2005' 'Dec-2006' 'Dec-2007' 'Dec-2008'  'Dec-2009' 'Dec-2010' 'Dec-2011' 'Feb-1957' 'Feb-1964' 'Feb-1965'  'Feb-1966' 'Feb-1967' 'Feb-1968' 'Feb-1969' 'Feb-1970' 'Feb-1971'  'Feb-1972' 'Feb-1973' 'Feb-1974' 'Feb-1975' 'Feb-1976' 'Feb-1977'  'Feb-1978' 'Feb-1979' 'Feb-1980' 'Feb-1981' 'Feb-1982' 'Feb-1983'  'Feb-1984' 'Feb-1985' 'Feb-1986' 'Feb-1987' 'Feb-1988' 'Feb-1989'  'Feb-1990' 'Feb-1991' 'Feb-1992' 'Feb-1993' 'Feb-1994' 'Feb-1995'  'Feb-1996' 'Feb-1997' 'Feb-1998' 'Feb-1999' 'Feb-2000' 'Feb-2001'  'Feb-2002' 'Feb-2003' 'Feb-2004' 'Feb-2005' 'Feb-2006' 'Feb-2007'  'Feb-2008' 'Feb-2009' 'Feb-2010' 'Feb-2011' 'Feb-2012' 'Jan-1946'  'Jan-1954' 'Jan-1955' 'Jan-1956' 'Jan-1959' 'Jan-1960' 'Jan-1961'  'Jan-1962' 'Jan-1963' 'Jan-1964' 'Jan-1965' 'Jan-1966' 'Jan-1967'  'Jan-1968' 'Jan-1969' 'Jan-1970' 'Jan-1971' 'Jan-1972' 'Jan-1973'  'Jan-1974' 'Jan-1975' 'Jan-1976' 'Jan-1977' 'Jan-1978' 'Jan-1979'  'Jan-1980' 'Jan-1981' 'Jan-1982' 'Jan-1983' 'Jan-1984' 'Jan-1985'  'Jan-1986' 'Jan-1987' 'Jan-1988' 'Jan-1989' 'Jan-1990' 'Jan-1991'  'Jan-1992' 'Jan-1993' 'Jan-1994' 'Jan-1995' 'Jan-1996' 'Jan-1997'  'Jan-1998' 'Jan-1999' 'Jan-2000' 'Jan-2001' 'Jan-2002' 'Jan-2003'  'Jan-2004' 'Jan-2005' 'Jan-2006' 'Jan-2007' 'Jan-2008' 'Jan-2009'  'Jan-2010' 'Jan-2011' 'Jan-2012' 'Jul-1958' 'Jul-1961' 'Jul-1963'  'Jul-1964' 'Jul-1965' 'Jul-1966' 'Jul-1967' 'Jul-1968' 'Jul-1969'  'Jul-1970' 'Jul-1971' 'Jul-1972' 'Jul-1973' 'Jul-1974' 'Jul-1975'  'Jul-1976' 'Jul-1977' 'Jul-1978' 'Jul-1979' 'Jul-1980' 'Jul-1981'  'Jul-1982' 'Jul-1983' 'Jul-1984' 'Jul-1985' 'Jul-1986' 'Jul-1987'  'Jul-1988' 'Jul-1989' 'Jul-1990' 'Jul-1991' 'Jul-1992' 'Jul-1993'  'Jul-1994' 'Jul-1995' 'Jul-1996' 'Jul-1997' 'Jul-1998' 'Jul-1999'  'Jul-2000' 'Jul-2001' 'Jul-2002' 'Jul-2003' 'Jul-2004' 'Jul-2005'  'Jul-2006' 'Jul-2007' 'Jul-2008' 'Jul-2009' 'Jul-2010' 'Jul-2011'  'Jul-2012' 'Jun-1957' 'Jun-1959' 'Jun-1963' 'Jun-1964' 'Jun-1965'  'Jun-1966' 'Jun-1967' 'Jun-1968' 'Jun-1969' 'Jun-1970' 'Jun-1971'  'Jun-1972' 'Jun-1973' 'Jun-1974' 'Jun-1975' 'Jun-1976' 'Jun-1977'  'Jun-1978' 'Jun-1979' 'Jun-1980' 'Jun-1981' 'Jun-1982' 'Jun-1983'  'Jun-1984' 'Jun-1985' 'Jun-1986' 'Jun-1987' 'Jun-1988' 'Jun-1989'  'Jun-1990' 'Jun-1991' 'Jun-1992' 'Jun-1993' 'Jun-1994' 'Jun-1995'  'Jun-1996' 'Jun-1997' 'Jun-1998' 'Jun-1999' 'Jun-2000' 'Jun-2001'  'Jun-2002' 'Jun-2003' 'Jun-2004' 'Jun-2005' 'Jun-2006' 'Jun-2007'  'Jun-2008' 'Jun-2009' 'Jun-2010' 'Jun-2011' 'Jun-2012' 'Mar-1960'  'Mar-1961' 'Mar-1963' 'Mar-1964' 'Mar-1965' 'Mar-1966' 'Mar-1967'  'Mar-1968' 'Mar-1969' 'Mar-1970' 'Mar-1971' 'Mar-1972' 'Mar-1973'  'Mar-1974' 'Mar-1975' 'Mar-1976' 'Mar-1977' 'Mar-1978' 'Mar-1979'  'Mar-1980' 'Mar-1981' 'Mar-1982' 'Mar-1983' 'Mar-1984' 'Mar-1985'  'Mar-1986' 'Mar-1987' 'Mar-1988' 'Mar-1989' 'Mar-1990' 'Mar-1991'  'Mar-1992' 'Mar-1993' 'Mar-1994' 'Mar-1995' 'Mar-1996' 'Mar-1997'  'Mar-1998' 'Mar-1999' 'Mar-2000' 'Mar-2001' 'Mar-2002' 'Mar-2003'  'Mar-2004' 'Mar-2005' 'Mar-2006' 'Mar-2007' 'Mar-2008' 'Mar-2009'  'Mar-2010' 'Mar-2011' 'Mar-2012' 'May-1959' 'May-1960' 'May-1962'  'May-1963' 'May-1964' 'May-1965' 'May-1966' 'May-1967' 'May-1968'  'May-1969' 'May-1970' 'May-1971' 'May-1972' 'May-1973' 'May-1974'  'May-1975' 'May-1976' 'May-1977' 'May-1978' 'May-1979' 'May-1980'  'May-1981' 'May-1982' 'May-1983' 'May-1984' 'May-1985' 'May-1986'  'May-1987' 'May-1988' 'May-1989' 'May-1990' 'May-1991' 'May-1992'  'May-1993' 'May-1994' 'May-1995' 'May-1996' 'May-1997' 'May-1998'  'May-1999' 'May-2000' 'May-2001' 'May-2002' 'May-2003' 'May-2004'  'May-2005' 'May-2006' 'May-2007' 'May-2008' 'May-2009' 'May-2010'  'May-2011' 'May-2012' 'Nov-1954' 'Nov-1955' 'Nov-1956' 'Nov-1958'  'Nov-1959' 'Nov-1960' 'Nov-1961' 'Nov-1962' 'Nov-1964' 'Nov-1965'  'Nov-1966' 'Nov-1967' 'Nov-1968' 'Nov-1969' 'Nov-1970' 'Nov-1971'  'Nov-1972' 'Nov-1973' 'Nov-1974' 'Nov-1975' 'Nov-1976' 'Nov-1977'  'Nov-1978' 'Nov-1979' 'Nov-1980' 'Nov-1981' 'Nov-1982' 'Nov-1983'  'Nov-1984' 'Nov-1985' 'Nov-1986' 'Nov-1987' 'Nov-1988' 'Nov-1989'  'Nov-1990' 'Nov-1991' 'Nov-1992' 'Nov-1993' 'Nov-1994' 'Nov-1995'  'Nov-1996' 'Nov-1997' 'Nov-1998' 'Nov-1999' 'Nov-2000' 'Nov-2001'  'Nov-2002' 'Nov-2003' 'Nov-2004' 'Nov-2005' 'Nov-2006' 'Nov-2007'  'Nov-2008' 'Nov-2009' 'Nov-2010' 'Nov-2011' 'Oct-1954' 'Oct-1958'  'Oct-1959' 'Oct-1960' 'Oct-1961' 'Oct-1962' 'Oct-1963' 'Oct-1964'  'Oct-1965' 'Oct-1966' 'Oct-1967' 'Oct-1968' 'Oct-1969' 'Oct-1970'  'Oct-1971' 'Oct-1972' 'Oct-1973' 'Oct-1974' 'Oct-1975' 'Oct-1976'  'Oct-1977' 'Oct-1978' 'Oct-1979' 'Oct-1980' 'Oct-1981' 'Oct-1982'  'Oct-1983' 'Oct-1984' 'Oct-1985' 'Oct-1986' 'Oct-1987' 'Oct-1988'  'Oct-1989' 'Oct-1990' 'Oct-1991' 'Oct-1992' 'Oct-1993' 'Oct-1994'  'Oct-1995' 'Oct-1996' 'Oct-1997' 'Oct-1998' 'Oct-1999' 'Oct-2000'  'Oct-2001' 'Oct-2002' 'Oct-2003' 'Oct-2004' 'Oct-2005' 'Oct-2006'  'Oct-2007' 'Oct-2008' 'Oct-2009' 'Oct-2010' 'Oct-2011' 'Oct-2012'  'Sep-1956' 'Sep-1959' 'Sep-1960' 'Sep-1962' 'Sep-1963' 'Sep-1964'  'Sep-1965' 'Sep-1966' 'Sep-1967' 'Sep-1968' 'Sep-1969' 'Sep-1970'  'Sep-1971' 'Sep-1972' 'Sep-1973' 'Sep-1974' 'Sep-1975' 'Sep-1976'  'Sep-1977' 'Sep-1978' 'Sep-1979' 'Sep-1980' 'Sep-1981' 'Sep-1982'  'Sep-1983' 'Sep-1984' 'Sep-1985' 'Sep-1986' 'Sep-1987' 'Sep-1988'  'Sep-1989' 'Sep-1990' 'Sep-1991' 'Sep-1992' 'Sep-1993' 'Sep-1994'  'Sep-1995' 'Sep-1996' 'Sep-1997' 'Sep-1998' 'Sep-1999' 'Sep-2000'  'Sep-2001' 'Sep-2002' 'Sep-2003' 'Sep-2004' 'Sep-2005' 'Sep-2006'  'Sep-2007' 'Sep-2008' 'Sep-2009' 'Sep-2010' 'Sep-2011']<\/code><\/pre>\n<p>  <\/p>\n<p>\u0424\u043e\u0440\u043c\u0430\u0442 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u0435\u043d \u0441\u0442\u043e\u043b\u0431\u0446\u0443 issue_d, \u043a\u043e\u0434\u0438\u0440\u0443\u0435\u043c \u0442\u043e\u0439 \u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 convert_date:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">encode_with_func(X, 'earliest_cr_line', convert_date)<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"initial_list_status---the-initial-listing-status-of-the-loan-possible-values-are--w-f\">initial_list_status \u2014 The initial listing status of the loan. Possible values are \u2013 W, F<\/h3>\n<p>  <\/p>\n<p> \u2014 \u041d\u0435\u043a\u0438\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0437\u0430\u0435\u043c\u0430, \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">print np.unique(X['initial_list_status'])<\/code><\/pre>\n<p>  <\/p>\n<pre><code>['f' 'w']<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">initial_list_status_le_encoder = encode_with_LabelEncoder(X,'initial_list_status')<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"application_type---indicates-whether-the-loan-is-an-individual-application-or-a-joint-application-with-two-co-borrowers\">application_type \u2014 Indicates whether the loan is an individual application or a joint application with two co-borrowers<\/h3>\n<p>  <\/p>\n<p> \u2014 \u0418\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440, \u0437\u0430\u0435\u043c \u0431\u0440\u0430\u043b\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u043e\u043c \u0438\u043b\u0438 \u0432 \u0433\u0440\u0443\u043f\u043f\u0435 \u0441 \u043a\u0435\u043c-\u0442\u043e. \u0421\u0442\u043e\u0438\u0442 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">print np.unique(X['application_type'])<\/code><\/pre>\n<p>  <\/p>\n<pre><code>['INDIVIDUAL' 'JOINT']<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">application_type_le_encoder = encode_with_LabelEncoder(X,'application_type')<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0441\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u043c\u0438: <\/p>\n<p>  <\/p>\n<pre><code class=\"python\">X.dtypes<\/code><\/pre>\n<p>  <\/p>\n<pre><code>loan_amnt                              float64 int_rate                               float64 installment                            float64 annual_inc                             float64 dti                                    float64 delinq_2yrs                            float64 inq_last_6mths                         float64 mths_since_last_delinq                 float64 open_acc                               float64 pub_rec                                float64 revol_bal                              float64 revol_util                             float64 total_acc                              float64 collections_12_mths_ex_med             float64 policy_code                            float64 acc_now_delinq                         float64 tot_coll_amt                           float64 tot_cur_bal                            float64 total_rev_hi_lim                       float64 is_title_known                           int64 is_delinq_occurs                         int64 term_le                                  int64 grade_le                                 int64 sub_grade_le                             int64 emp_length=1 year                      float64 emp_length=10+ years                   float64 emp_length=2 years                     float64 emp_length=3 years                     float64 emp_length=4 years                     float64 emp_length=5 years                     float64                                         ...    emp_length=n\/a                         float64 home_ownership=ANY                     float64 home_ownership=MORTGAGE                float64 home_ownership=NONE                    float64 home_ownership=OTHER                   float64 home_ownership=OWN                     float64 home_ownership=RENT                    float64 verification_status=Not Verified       float64 verification_status=Source Verified    float64 verification_status=Verified           float64 issue_d_le                             float64 pymnt_plan_le                            int64 purpose=car                            float64 purpose=credit_card                    float64 purpose=debt_consolidation             float64 purpose=educational                    float64 purpose=home_improvement               float64 purpose=house                          float64 purpose=major_purchase                 float64 purpose=medical                        float64 purpose=moving                         float64 purpose=other                          float64 purpose=renewable_energy               float64 purpose=small_business                 float64 purpose=vacation                       float64 purpose=wedding                        float64 addr_state_le                            int64 earliest_cr_line_le                    float64 initial_list_status_le                   int64 application_type_le                      int64 dtype: object<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">X.shape<\/code><\/pre>\n<p>  <\/p>\n<pre><code>(200189, 65)<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"priznaki-podgotovleny\">\u041f\u0440\u0438\u0437\u043d\u0430\u043a\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u044b<\/h2>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432\u044b\u0431\u0440\u0430\u043b \u043b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044e \u2014 \u043e\u043d\u0430 \u0434\u0430\u0435\u0442 \u043e\u0442\u0432\u0435\u0442 \u0432 \u0432\u0438\u0434\u0435 \u043d\u0430\u0431\u043e\u0440\u0430 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u043a\u0440\u043e\u0441\u0441-\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u043f\u043e 5 \u0431\u043b\u043e\u043a\u0430\u043c \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0438\u0432\u0430\u043d\u0438\u0435\u043c<\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043f\u043b\u043e\u0449\u0430\u0434\u044c \u043f\u043e\u0434 ROC-\u043a\u0440\u0438\u0432\u043e\u0439 \u2014 AUC-ROC \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from sklearn.cross_validation import KFold from sklearn.metrics import roc_auc_score from sklearn.cross_validation import cross_val_score from sklearn.preprocessing import StandardScaler from sklearn.linear_model import LogisticRegression  records_count = Y.count() kf = KFold(n=records_count, n_folds=5, shuffle=True)  def my_scorer(estimator, testX, testY):     predicted_testY = estimator.predict_proba(testX)[:, 1]     return roc_auc_score(testY, predicted_testY)  scaler = StandardScaler() scaledX = scaler.fit_transform(X)  def LogR_teach(C_value):     clf = LogisticRegression(penalty='l2', C=C_value)     return cross_val_score(clf, scaledX, Y, cv=kf, scoring=my_scorer).mean()  def check_quality_for_different_C():     for power in range(-4, 2):         C = math.pow(10, power)         quality = LogR_teach(C)         print 'C=', C, ', quality=', quality<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">check_quality_for_different_C()<\/code><\/pre>\n<p>  <\/p>\n<pre><code>C= 0.0001 , quality= 0.707991113828 C= 0.001 , quality= 0.709654648448 C= 0.01 , quality= 0.709779198127 C= 0.1 , quality= 0.709776206257 C= 1.0 , quality= 0.709775629602 C= 10.0 , quality= 0.709775731556<\/code><\/pre>\n<p>  <\/p>\n<p>\u041b\u0443\u0447\u0448\u0435\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e <strong>0.71<\/strong> \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 <strong>\u0421=0.1<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from sklearn.model_selection import train_test_split  X_train, X_test, y_train, y_test = train_test_split(scaledX, Y, test_size=.2, random_state=0) clf = LogisticRegression(penalty='l2', C=0.1) clf.fit(X_train, y_train) y_score = clf.predict_proba(X_test)[:, 1]<\/code><\/pre>\n<p>  <\/p>\n<p>\u0427\u0435\u0440\u0442\u0438\u043c ROC-\u043a\u0440\u0438\u0432\u0443\u044e:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import matplotlib.pyplot as plt from sklearn.metrics import roc_curve  plt.figure() line_width = 2 fpr, tpr, thresholds = roc_curve(y_test, y_score) plt.plot(fpr, tpr, color='darkorange', lw=line_width, label='LogRegression, C=0.1') plt.plot([0, 1], [0, 1], color='navy', lw=line_width, linestyle='--') plt.xlim([0.0, 1.0]) plt.ylim([0.0, 1.0]) plt.xlabel('False Positive Rate') plt.ylabel('True Positive Rate') plt.title('Receiver operating characteristic') plt.legend(loc=&quot;lower right&quot;) plt.show()<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/6fa\/98a\/196\/6fa98a196aff4a14890e2cd84c1d2933.png\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<h2 id=\"vychislim-predskazaniya-dlya-testovogo-nabora\">\u0412\u044b\u0447\u0438\u0441\u043b\u0438\u043c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430<\/h2>\n<p>  <\/p>\n<p>\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">test = pd.read_csv('test.csv', index_col='record_id')<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0435\u043b\u0430\u0435\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0435 \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u043d\u043d\u044b\u043c \u0441 train \u043d\u0430\u0431\u043e\u0440\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">test['is_title_known'] = test['emp_title'].map(lambda x: 0 if x == 'n\/a' else 1) test.drop('emp_title', axis=1, inplace=True)  test['is_delinq_occurs'] = test['mths_since_last_delinq'].map(lambda x: 0 if math.isnan(x) else 1) max_mths_since_last_delinq = np.nanmax(test.mths_since_last_delinq.values) test['mths_since_last_delinq'].fillna(max_mths_since_last_delinq, inplace=True)  test.fillna(0, inplace=True) test.isnull().sum()<\/code><\/pre>\n<p>  <\/p>\n<pre><code>loan_amnt                     0 term                          0 int_rate                      0 installment                   0 grade                         0 sub_grade                     0 emp_length                    0 home_ownership                0 annual_inc                    0 verification_status           0 issue_d                       0 loan_status                   0 pymnt_plan                    0 purpose                       0 zip_code                      0 addr_state                    0 dti                           0 delinq_2yrs                   0 earliest_cr_line              0 inq_last_6mths                0 mths_since_last_delinq        0 open_acc                      0 pub_rec                       0 revol_bal                     0 revol_util                    0 total_acc                     0 initial_list_status           0 collections_12_mths_ex_med    0 policy_code                   0 application_type              0 acc_now_delinq                0 tot_coll_amt                  0 tot_cur_bal                   0 total_rev_hi_lim              0 is_title_known                0 is_delinq_occurs              0 dtype: int64<\/code><\/pre>\n<p>  <\/p>\n<p> \u2014 \u041f\u0440\u043e\u043f\u0443\u0441\u043a\u043e\u0432 \u043d\u0435\u0442\u0443, \u043a\u0430\u043a \u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u043c<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">print test.shape<\/code><\/pre>\n<p>  <\/p>\n<pre><code>(66730, 36)<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"podgotovim-nechislovye-stolbcy\">\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u043d\u0435\u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0435 \u0441\u0442\u043e\u043b\u0431\u0446\u044b:<\/h3>\n<p>  <\/p>\n<pre><code class=\"python\">encode_with_existing_LabelEncoder(test, 'term', term_le_encoder) encode_with_existing_LabelEncoder(test, 'grade', grade_le_encoder) encode_with_existing_LabelEncoder(test, 'sub_grade', sub_grade_le_encoder)  test = encode_with_OneHotEncoder_using_existing_LabelEncoder_and_delete_column(test, 'emp_length', emp_length_le_encoder) test = encode_with_OneHotEncoder_using_existing_LabelEncoder_and_delete_column(test, 'home_ownership', home_ownership_le_encoder) test = encode_with_OneHotEncoder_using_existing_LabelEncoder_and_delete_column(test, 'verification_status', verification_status_le_encoder)  encode_with_func(test, 'issue_d', convert_date) encode_with_existing_LabelEncoder(test, 'pymnt_plan', pymnt_plan_le_encoder)  test = encode_with_OneHotEncoder_using_existing_LabelEncoder_and_delete_column(test, 'purpose', purpose_le_encoder)  test.drop(['zip_code'], axis=1, inplace=True) encode_with_existing_LabelEncoder(test, 'addr_state', addr_state_le_encoder) encode_with_func(test, 'earliest_cr_line', convert_date) encode_with_existing_LabelEncoder(test, 'initial_list_status', initial_list_status_le_encoder) encode_with_existing_LabelEncoder(test, 'application_type', application_type_le_encoder)  X.dtypes<\/code><\/pre>\n<p>  <\/p>\n<pre><code>loan_amnt                              float64 int_rate                               float64 installment                            float64 annual_inc                             float64 dti                                    float64 delinq_2yrs                            float64 inq_last_6mths                         float64 mths_since_last_delinq                 float64 open_acc                               float64 pub_rec                                float64 revol_bal                              float64 revol_util                             float64 total_acc                              float64 collections_12_mths_ex_med             float64 policy_code                            float64 acc_now_delinq                         float64 tot_coll_amt                           float64 tot_cur_bal                            float64 total_rev_hi_lim                       float64 is_title_known                           int64 is_delinq_occurs                         int64 term_le                                  int64 grade_le                                 int64 sub_grade_le                             int64 emp_length=1 year                      float64 emp_length=10+ years                   float64 emp_length=2 years                     float64 emp_length=3 years                     float64 emp_length=4 years                     float64 emp_length=5 years                     float64                                         ...    emp_length=n\/a                         float64 home_ownership=ANY                     float64 home_ownership=MORTGAGE                float64 home_ownership=NONE                    float64 home_ownership=OTHER                   float64 home_ownership=OWN                     float64 home_ownership=RENT                    float64 verification_status=Not Verified       float64 verification_status=Source Verified    float64 verification_status=Verified           float64 issue_d_le                             float64 pymnt_plan_le                            int64 purpose=car                            float64 purpose=credit_card                    float64 purpose=debt_consolidation             float64 purpose=educational                    float64 purpose=home_improvement               float64 purpose=house                          float64 purpose=major_purchase                 float64 purpose=medical                        float64 purpose=moving                         float64 purpose=other                          float64 purpose=renewable_energy               float64 purpose=small_business                 float64 purpose=vacation                       float64 purpose=wedding                        float64 addr_state_le                            int64 earliest_cr_line_le                    float64 initial_list_status_le                   int64 application_type_le                      int64 dtype: object<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">print test.shape<\/code><\/pre>\n<p>  <\/p>\n<pre><code>(66730, 65)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">scaled_test = scaler.transform(test)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">clf = LogisticRegression(penalty='l2', C=0.1) clf.fit(scaledX, Y)<\/code><\/pre>\n<p>  <\/p>\n<pre><code>LogisticRegression(C=0.1, class_weight=None, dual=False, fit_intercept=True,           intercept_scaling=1, max_iter=100, multi_class='ovr', n_jobs=1,           penalty='l2', random_state=None, solver='liblinear', tol=0.0001,           verbose=0, warm_start=False)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">prediction = clf.predict_proba(scaled_test)[:, 1]<\/code><\/pre>\n<p>  <\/p>\n<p>\u0423\u0431\u0435\u0434\u0438\u043c\u0441\u044f, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u043d\u0430 \u043e\u0442\u0440\u0435\u0437\u043a\u0435 [0,1] \u0438 \u043d\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442 \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 (\u0442.\u0435. \u0447\u0442\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043d\u043e\u0439):<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">print min(prediction), max(prediction)<\/code><\/pre>\n<p>  <\/p>\n<pre><code>0.0 0.999999996487<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c prediction \u0432 DataFrame:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">result = pd.DataFrame(np.array(prediction), columns=['prob1'], index=test.index) print result[result['prob1']&gt;0.5].count() print result.count()<\/code><\/pre>\n<p>  <\/p>\n<pre><code>prob1    711 dtype: int64 prob1    66730 dtype: int64<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0447\u0442\u043e \u0438\u0437 67\u041a \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u0443 0.7\u041a \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 0.5<\/p>\n<p>  <\/p>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">result.to_csv('result.csv', encoding='utf8')<\/code><\/pre>\n<p>  <\/p>\n<h1 id=\"prilozhenie\">\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/h1>\n<p>  <\/p>\n<p>\u041a\u043e\u0434 \u0437\u0434\u0435\u0441\u044c: <a href=\"https:\/\/bitbucket.org\/andrei_punko\/credit-scoring-test-task\">https:\/\/bitbucket.org\/andrei_punko\/credit-scoring-test-task<\/a><\/p>\n<p>  <\/p>\n<p>\u0421\u0443\u0434\u044f \u043f\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u2014 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e 70-80% \u0434\u043b\u044f \u0441\u043a\u043e\u0440\u0438\u043d\u0433\u0430 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0445\u043e\u0440\u043e\u0448\u0438\u043c, \u043d\u043e \u0432\u0441\u0435 \u0436\u0435 \u0435\u0441\u0442\u044c \u0441\u043e\u043c\u043d\u0435\u043d\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b\u0441\u043b\u0443\u0448\u0430\u044e \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0435\u0433\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c<\/p>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/324614\/\"> https:\/\/habrahabr.ru\/post\/324614\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041e\u0442\u0443\u0447\u0438\u0432\u0448\u0438\u0441\u044c \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043e\u043d\u043b\u0430\u0439\u043d-\u043a\u0443\u0440\u0441\u0430\u0445, \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0437\u0430\u043d\u044f\u0442\u044c \u043f\u043e\u0437\u0438\u0446\u0438\u044e, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0443\u044e \u0441 Machine Learning \u2014 \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u043e \u043a\u0440\u0435\u0434\u0438\u0442\u043d\u043e\u043c \u0441\u043a\u043e\u0440\u0438\u043d\u0433\u0435. \u0421\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u0434\u0435\u0441\u044c \u0438 \u043f\u0440\u0438\u0432\u043e\u0436\u0443:<\/p>\n<p>  <\/p>\n<h1 id=\"zadanie\">\u0417\u0430\u0434\u0430\u043d\u0438\u0435<\/h1>\n<p>  <\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0432\u044b\u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u0440\u0435\u0434\u0438\u0442\u0430\u0445, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u043a\u0440\u0435\u0434\u0438\u0442\u0430.<\/p>\n<p>  <\/p>\n<p>\u0422\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u0430\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u0435 <strong>train.csv<\/strong>, \u0442\u0435\u0441\u0442\u043e\u0432\u0430\u044f \u2014 <strong>test.csv<\/strong>.<\/p>\n<p>  <\/p>\n<p>\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u0445 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u0435 <strong>feature_descr.xlsx<\/strong>.<\/p>\n<p>  <\/p>\n<p>\u0426\u0435\u043b\u0435\u0432\u043e\u0439 \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u2014 <strong>loan_status<\/strong> (\u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439). 1 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0447\u0442\u043e \u043a\u0440\u0435\u0434\u0438\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u0435\u0440\u043d\u0443\u043b\u0438.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0432\u0430\u043c \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041e\u0431\u0443\u0447\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0430\u0439\u0442\u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438.<\/li>\n<li>\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f (\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438) \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0432 \u0444\u0430\u0439\u043b <strong>results.csv<\/strong><\/li>\n<li>\u041f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0432 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0432\u0438\u0434\u0435 (ROC-curve)<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0422\u0449\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u044b\u0431\u043e\u0440 \u0444\u0438\u0447 \u0438 \u043f\u043e\u0434\u0431\u043e\u0440 \u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-283760","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/283760","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=283760"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/283760\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=283760"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=283760"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=283760"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}