{"id":283062,"date":"2016-12-26T16:45:03","date_gmt":"2016-12-26T13:45:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=283062"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=283062","title":{"rendered":"\u0411\u044b\u0441\u0442\u0440\u044b\u0439 Data Mining \u0438\u043b\u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 C# vs Python (pandas-numpy-skilearn)"},"content":{"rendered":"<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442!<\/p>\n<p>  \u0420\u0430\u0437\u0431\u0438\u0440\u0430\u044f\u0441\u044c \u0441\u043e Spark Apache, \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0443\u0441\u043b\u043e\u0436\u043d\u0435\u043d\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0440\u0430\u0441\u0447\u0435\u0442\u044b \u0441\u0442\u0430\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043a\u0440\u0430\u0439\u043d\u0435 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u043d\u0430 C# \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u043f\u043e \u043a\u043b\u0430\u0441\u0441\u0443 \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u043d\u0430 \u0441\u0442\u0435\u043a\u0435 python (pandas-numpy-skilearn). \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435. \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 C# \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u043b\u0430\u0441\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 (linq), \u0440\u0430\u0441\u0447\u0435\u0442 \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 <a href=\"http:\/\/www.extremeoptimization.com\/\">extremeoptimization<\/a>.<\/p>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0437\u0430\u0434\u0430\u0447\u0430 \u00abB. \u041f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u0442\u0440\u0430\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432\u00bb \u0441 \u043d\u043e\u044f\u0431\u0440\u044c\u0441\u043a\u043e\u0433\u043e \u0441\u043e\u0440\u0435\u0432\u043d\u043e\u0432\u0430\u043d\u0438\u044f <a href=\"https:\/\/sdsj.ru\/contest.html\">Sberbank Data Science Journey<\/a>.<\/p>\n<p>  \u0421\u0440\u0430\u0437\u0443 \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u0434\u0447\u0435\u0440\u043a\u043d\u0443\u0442\u044c, \u0447\u0442\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043e\u043f\u0438\u0441\u0430\u043d \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0430\u0441\u043f\u0435\u043a\u0442 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c, \u0430 \u043d\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0439. \u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0431\u044b\u043b\u043e \u0432\u0437\u044f\u0442\u043e \u0438 \u0441\u043b\u0435\u0433\u043a\u0430 \u0434\u043e\u043f\u0438\u043b\u0435\u043d\u043e <a href=\"http:\/\/nbviewer.jupyter.org\/urls\/dl.dropbox.com\/s\/j1595xoqa9oheyo\/baseline_c_new.ipynb\">\u0431\u0430\u0437\u043e\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/a>. <\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 C# (\u043a\u0443\u0441\u043a\u0438 \u043a\u043e\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u043d\u0438\u0436\u0435):<\/p>\n<p>  1. \u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 csv. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <a href=\"https:\/\/www.codeproject.com\/Articles\/9258\/A-Fast-CSV-Reader\">Fast Csv Reader<\/a>.<br \/>  2. \u041e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0443 \u043f\u043e \u043c\u0435\u0441\u044f\u0446\u0430\u043c.<br \/>  3. \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0442\u0435 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0443 \u043d\u0435\u0433\u043e \u043d\u0435 \u0431\u044b\u043b\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0431\u043e\u0440 \u0446\u0438\u043a\u043b-\u0432-\u0446\u0438\u043a\u043b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A4%D0%B8%D0%BB%D1%8C%D1%82%D1%80_%D0%91%D0%BB%D1%83%D0%BC%D0%B0\">\u0444\u0438\u043b\u044c\u0442\u0440 \u0411\u043b\u0443\u043c\u0430<\/a>. \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043d\u0430 C# \u043d\u0430\u0448\u0435\u043b <a href=\"https:\/\/gist.github.com\/richardkundl\/8300092\">\u0442\u0443\u0442<\/a>.<br \/>  4. \u0424\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Feature_hashing\">Hashing trick<\/a>. \u0422\u0430\u043a \u043a\u0430\u043a \u0433\u043e\u0442\u043e\u0432\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u0434 C# \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u043c\u0443. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043a\u0430\u0447\u0430\u043b \u0438 \u0441\u043b\u0435\u0433\u043a\u0430 \u0434\u043e\u043f\u0438\u043b\u0438\u043b <a href=\"https:\/\/gist.github.com\/automatonic\/3725443\">\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e<\/a> \u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f murmurhash3<br \/>  5. \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0440\u0430\u0441\u0447\u0435\u0442 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438. <br \/>  <a name=\"habracut\"><\/a><br \/>  \u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 Jupyter Notebook (\u0434\u0430\u043b\u0435\u0435 JN) \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a (\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u043e\u043f\u0443\u0441\u043a\u0430\u044e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u0432\u0445\u043e\u0434\u0438\u043b\u043e \u0432 \u0437\u0430\u043c\u0435\u0440\u044f\u0435\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f):<\/p>\n<pre><code class=\"python\">%%time  #\u0427\u0438\u0442\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u0441 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u043e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f\u043c transactions = pd.read_csv('.\/\/JN\/\/SBSJ\/\/transactions.csv') all_cuses = transactions.customer_id.unique()  #\u0427\u0438\u0442\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u0441 \u0442\u0438\u043f\u0430\u043c\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 mcc = pd.read_csv('.\/\/JN\/\/SBSJ\/\/tr_mcc_codes.csv', sep=';') all_mcc = mcc.mcc_code.unique()  #\u0424\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u0440\u0430\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439 transactions = transactions[transactions.amount &lt; 0].copy() transactions['day'] = transactions.tr_day.apply(lambda dt: dt.split()[0]).astype(int) transactions.day += 29 - transactions['day'].max()%30  #\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043d\u0435\u0439 \u0432 \u043c\u0435\u0441\u044f\u0446\u044b transactions['month_num'] = (transactions.day) \/\/ 30 train_transactions = transactions[transactions.month_num &lt; 15]  #\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u043c\u0435\u0441\u044f\u0446\u0435\u0432 (\u043d\u0430 \u043f\u043e\u043b\u043d\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u043b\u043e \u043f\u0430\u043c\u044f\u0442\u0438) grid = list(product(*[all_cuses, all_mcc, range(11, 15)])) train_grid = pd.DataFrame(grid, columns = ['customer_id', 'mcc_code', 'month_num'])  train = pd.merge(train_grid,          train_transactions.groupby(['month_num', 'customer_id', 'mcc_code'])[['amount']].sum().reset_index(),          how='left').fillna(0)  #\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0440\u0430\u0441\u0445\u043e\u0434\u0430\u0445 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u043c\u0435\u0441\u044f\u0446\u0430\u0445 for month_shift in range(1, 3):     train_shift = train.copy()     train_shift['month_num'] = train_shift['month_num'] + month_shift     train_shift = train_shift.rename(columns={&quot;amount&quot; : 'amount_{0}'.format(month_shift)})       train_shift = train_shift[['month_num', 'customer_id', 'mcc_code', 'amount_{0}'.format(month_shift)]]  train = pd.merge(train, train_shift, on=['month_num', 'customer_id', 'mcc_code'], how='left').fillna(0)        train['year_num'] = (train.month_num) \/\/ 12  #\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 hashier trick hasher = FeatureHasher(n_features=6, input_type='string')  train_sparse = \\     hasher.fit_transform(train[['year_num', 'month_num', 'customer_id', 'mcc_code']].astype(str).as_matrix())            train_sparse2 = sparse.hstack([train_sparse, np.log(np.abs(train[['amount_1', 'amount_2']]) + 1).as_matrix(),])      #\u0411\u0435\u0437 \u044d\u0442\u043e\u0433\u043e \u0445\u0438\u043d\u0442\u0430 \u0440\u0430\u0441\u0447\u0435\u0442 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u043d\u0435 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0435\u043d d = list(train_sparse2.toarray())  #\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0440\u0430\u0441\u0447\u0435\u0442 clf = LinearRegression() clf.fit(d, np.log(np.abs(train['amount']) + 1))  #\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b print('Coefficients: \\n', clf.coef_) print('Intercept: \\n', clf.intercept_) print(&quot;\\nRMSLE: &quot;)  np.sqrt(mse(np.log(np.abs(train['amount']) + 1),clf.predict(d)))<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 C#. \u041e\u043f\u044b\u0442\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0438, \u0447\u0442\u043e \u043a\u043b\u0430\u0441\u0441\u044b \u0442\u0438\u043f\u0430 DataTable \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u043e\u0447\u0435\u043d\u044c \u0440\u0430\u0441\u0442\u043e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a \u043f\u0430\u043c\u044f\u0442\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u0430 Client:<\/p>\n<pre><code class=\"cs\">    [Serializable]     public class Client     {         private Int32 name;         private Int16 period;         private Int16 year;         private Int16 mcc;         private double amount;         private double amount1;         private double amount2;          \/\/ \u041c\u0435\u0442\u043e\u0434\u044b get\/set         ... <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435, \u0447\u0442\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0430:<\/p>\n<pre><code class=\"cs\">        \/\/ \u0413\u0440\u0443\u043f\u043f\u0438\u0440\u0443\u0435\u043c \u0440\u0430\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438         List&lt;Client&gt; lTransGrouped = lClientsTrans.AsParallel()                 .Where(row =&gt; row.getAmount() &lt; 0)                 .GroupBy(row =&gt; new                 {                         month = (row.getPeriod() + 29 - Convert.ToInt16(maxNumDay) % 30) \/ 30,    \/\/ \u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u0434\u043d\u0438 \u0432 \u043c\u0435\u0441\u044f\u0446\u044b                         mcc = row.getMcc(),                         cid = row.getName()                 })                 .Select(grp =&gt; new Client(                         grp.Key.cid,                         Convert.ToInt16(grp.Key.month),                         grp.Key.mcc,                         Math.Log(Math.Abs(grp.Sum(r =&gt; r.getAmount())) + 1))).ToList();                  lClientsTrans = null;<\/code><\/pre>\n<p>  \u0417\u0430\u0442\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0444\u0438\u043b\u044c\u0442\u0440 \u0411\u043b\u0443\u043c\u0430. \u041c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0438 \u0431\u0435\u0437 \u043d\u0435\u0433\u043e, \u043d\u043e \u0442\u043e\u0433\u0434\u0430 \u0431\u044b \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043b\u043e\u0441\u044c \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (\u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0431\u043e\u0440 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0438\u043f\u0430) \u0438\u043b\u0438 \u043e\u0431\u044a\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 (\u0435\u0441\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u0441\u0435 \u0442\u0438\u043f\u044b \u043f\u043e\u0434\u0440\u044f\u0434, \u0430 \u043f\u043e\u0442\u043e\u043c \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c).<\/p>\n<pre><code class=\"cs\">public static List&lt;Client&gt; addPeriodMcc(List&lt;Client&gt; lTransGrouped, Int16 maxNumMon) {        List&lt;Client&gt; lMcc = new List&lt;Client&gt;();         string fnameMcc = @&quot;j:\\hadoop\\Contest\\Contest\\tr_mcc_codes.csv&quot;;         \/\/ \u0427\u0438\u0442\u0430\u0435\u043c mcc_code        CsvReader csvMccReader = new CsvReader(new StreamReader(fnameMcc), true, ';');        \/\/ \u0427\u0438\u0442\u0430\u0435\u043c \u0442\u0438\u043f\u044b \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439        while (csvMccReader.ReadNextRecord())        {               Int16 mcc = Convert.ToInt16(csvMccReader[0]);               lMcc.Add(new Client(0, 0, mcc, 0));        }         \/\/ \u0413\u043e\u0442\u043e\u0432\u0438\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0434\u043b\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u0430 mcc \u043f\u043e\u0434 \u0432\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438         List&lt;Client&gt; lNewMcc = new List&lt;Client&gt;();         \/\/ \u0414\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c ID \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432        var lTransCID = lTransGrouped.AsParallel().Select(a =&gt; a.getName()).Distinct();        Console.WriteLine(&quot;Unique CID: &quot; + lTransCID.Count());         \/\/ \u0417\u0430\u0434\u0430\u0435\u043c \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440\u0430        int capacity = lTransGrouped.Count() * 6;   \/\/ \u0427\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044c, \u0442\u0435\u043c \u043c\u0435\u043d\u044c\u0448\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u043c\u0430\u0445\u043d\u0443\u0442\u044c\u0441\u044f        var filter = new Filter&lt;string&gt;(capacity); \/\/\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u0430\u043c \u0444\u0438\u043b\u044c\u0442\u0440         \/\/ \u0417\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u0430        foreach (var i in lTransGrouped)               filter.Add(i.getName().ToString() + i.getPeriod() + i.getMcc());         \/\/ \u0415\u0441\u043b\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043d\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 \u0444\u0438\u043b\u044c\u0442\u0440\u0435, \u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c        foreach (var cid in lTransCID)               for (Int16 m = 0; m &lt;= maxNumMon; m++)                      foreach (var mcc in lMcc)                             if (filter.Contains(cid.ToString() + m.ToString() + mcc.getMcc().ToString()) != true)                             lNewMcc.Add(new Client(cid, m, mcc.getMcc(), 0));         lTransCID = lMcc = null;         Console.WriteLine(&quot;Count lNewMcc: &quot; + lNewMcc.Count);        Console.WriteLine(&quot;Count lTransGrouped: &quot; + lTransGrouped.Count);         \/\/ \u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435        List&lt;Client&gt; lTransFull = lNewMcc.Union(lTransGrouped).ToList();        Console.WriteLine(&quot;Count lTransFull: &quot; + lTransFull.Count);         lTransGrouped = lNewMcc = null;         return lTransFull; }<\/code><\/pre>\n<p>  \u042d\u0442\u0430\u043f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0437\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u043c\u0435\u0441\u044f\u0446\u044b:<\/p>\n<pre><code class=\"cs\">public static List&lt;Client&gt; addAmounts(List&lt;Client&gt; lTransFull) {         List&lt;Client&gt; lTransFullA2;          \/\/ \u0414\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u043c\u0435\u0441\u044f\u0446\u0435\u0432 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c         lTransFullA2 = lTransFull.OrderBy(a =&gt; a.getName())                                     .ThenBy(a =&gt; a.getMcc())                                     .ThenBy(a =&gt; a.getYear())                                     .ThenBy(a =&gt; a.getPeriod()).ToList();          int name = 0;         int month = 0;         int year = 0;         int mcc = 0;         int i = 0;         foreach (var l in lTransFullA2)         {                 name = l.getName();                 mcc = l.getMcc();                 year = l.getYear();                 month = l.getPeriod();                  \/\/ \u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u043c\u0435\u0441\u044f\u0446                 if (i &gt; 0 && name == lTransFullA2[i - 1].getName() &&                                     mcc == lTransFullA2[i - 1].getMcc() &&                                     year == lTransFullA2[i - 1].getYear() &&                                     month == lTransFullA2[i - 1].getPeriod() + 1)                 {                     l.setAmount1(lTransFullA2[i - 1].getAmount());                 }                  \/\/ \u041f\u043e\u0437\u0430\u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u043c\u0435\u0441\u044f\u0446                 if (i &gt; 1 && name == lTransFullA2[i - 2].getName() &&                                     mcc == lTransFullA2[i - 2].getMcc() &&                                     year == lTransFullA2[i - 2].getYear() &&                                     month == lTransFullA2[i - 2].getPeriod() + 2)                 {                     l.setAmount2(lTransFullA2[i - 2].getAmount());                 }                  i++;         }          return lTransFullA2; }<\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 hashing trick \u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u043c \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0440\u0430\u0441\u0447\u0435\u0442  <\/p>\n<pre><code class=\"cs\">            int n_features = 6;              \/\/ \u0412\u0435\u043a\u0442\u043e\u0440 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445             Extreme.Mathematics.LinearAlgebra.SparseVector&lt;double&gt; v = Vector.CreateSparse&lt;double&gt;(lTransFullA2.Count);              \/\/ \u041c\u0430\u0441\u0441\u0438\u0432 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 (hash + \u0440\u0430\u0441\u0445\u043e\u0434\u044b \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u043c\u0435\u0441\u044f\u0446\u0435\u0432)             md = Matrix.Create&lt;double&gt;(lTransFullA2.Count, n_features + 2);              \/\/ \u0424\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 Hashing trick             Parallel.For(0, lTransFullA2.Count(), i =&gt; hashing_vectorizer(lTransFullA2[i], i, n_features));              for (int i = 0; i &lt; lTransFullA2.Count; i++)             {                 md[i, n_features] = lTransFullA2[i].getAmount1();                 md[i, n_features + 1] = lTransFullA2[i].getAmount2();                 v.AddAt(i, lTransFullA2[i].getAmount());             }              lTransFullA2 = null;             GC.Collect(2, GCCollectionMode.Forced);  \/\/ \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0438 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f, \u043d\u0430\u0434\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c              var model = new LinearRegressionModel(v, md); \/\/ \u0424\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438              model.MaxDegreeOfParallelism = 8;             model.Compute(); \/\/ \u0420\u0430\u0441\u0447\u0435\u0442             Console.WriteLine(model.Summarize());   \/\/ \u0412\u044b\u0432\u043e\u0434 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439             GC.Collect(2, GCCollectionMode.Forced);  \/\/ \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0438 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f, \u043d\u0430\u0434\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c <\/code><\/pre>\n<p>  \u041d\u0443 \u0438 \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f Hashing trick:  <\/p>\n<pre><code class=\"cs\">       public static void hashing_vectorizer(Client f,  int i, int n)         {              int[] x = new int[n];              string s = f.getYear().ToString(); \/\/             int idx = getIndx(s, n);             x[idx] += calcBit(s);             md[i,idx] = x[idx];              s = f.getPeriod().ToString();             idx = getIndx(s, n);             x[idx] += calcBit(s);             md[i, idx] = x[idx];              s = f.getName().ToString();             idx = getIndx(s, n);             x[idx] += calcBit(s);             md[i, idx] = x[idx];              s = f.getMcc().ToString();             x[idx] += calcBit(s);             md[i, idx] = x[idx];         }          \/\/ \u0425\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u0432\u044b\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u043a\u0430         public static int calcBit(string s) \/\/ \u041f\u0435\u0440\u0432\u0430\u044f \u043f\u043e\u043f\u0430\u0432\u0448\u0430\u044f\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f, \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u043c\u043e\u0436\u043d\u043e \u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438 \u043f\u0440\u043e\u0449\u0435, \u0431\u0435\u0437 \u0443\u0449\u0435\u0440\u0431\u0430 \u0434\u043b\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430         {             byte b = 0;              b = Convert.ToByte(s[0]);             for (int i = 1; i &lt; s.Count(); i++)                 b ^= Convert.ToByte(s[0]);              bool result = true;             while (b &gt;= 1)             {                 result ^= (b & 0x01) != 0;                 b = Convert.ToByte(b &gt;&gt; 1);             }              if (result)                 return -1;             else                 return 1;         }          public static int getIndx(string str, int n)         {             Encoding encoding = new UTF8Encoding();             byte[] input = encoding.GetBytes(str);             uint h = MurMurHash3.Hash(input); \/\/              \/\/h = (uint)str.GetHashCode();  \/\/ \u041f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0442\u043e\u043c, \u043c\u043e\u0436\u0435\u0442 \u041c\u0443\u0440\u041c\u0443\u04403 \u0438 \u043d\u0435 \u043d\u0443\u0436\u0435\u043d             return Convert.ToInt32(h % n);         }<\/code><\/pre>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b (RMSLE \u043e\u043a\u043e\u043b\u043e 1.6). \u0412\u043e\u0442 \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/af9\/dfb\/ea2\/af9dfbea26724ee3ac9428fd7156746e.png\"\/><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0441\u0430\u043c\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u043c\u0443 \u2014 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0412\u0441\u0435 \u0442\u0435\u0441\u0442\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0438\u0441\u044c \u043d\u0430 i7-2600 (8 \u044f\u0434\u0435\u0440, \u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e 1-2). \u041e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 12 \u0413\u0431, \u041e\u0421 Win7.<\/p>\n<p>  \u0414\u043b\u044f \u0432\u044b\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043e\u0442 \u043e\u0431\u044a\u0435\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0440\u0430\u0441\u0447\u0435\u0442\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0438\u0441\u044c \u043d\u0430 1.7, 3.4, 5,1 \u0438 6.8 \u043c\u043b\u043d. \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (\u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 transactions.csv). \u041d\u043e \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u0445\u043e\u0434\u0435 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u043b\u0430 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u0437\u0430 11-14 \u043c\u0435\u0441\u044f\u0446\u044b, \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u0430\u043d\u043d\u044b\u0445 \u0443\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/bc9\/983\/147\/bc9983147fff40a9a7682bba0400a729.png\"\/><\/p>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u0432\u0435\u0440\u0441\u0438\u044f \u043d\u0430 C# \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432 2 \u0440\u0430\u0437\u0430 \u0431\u044b\u0441\u0442\u0440\u0435\u0435. \u041f\u043e\u0445\u043e\u0436\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u0438 \u0441 \u0440\u0430\u0441\u0445\u043e\u0434\u043e\u043c \u043f\u0430\u043c\u044f\u0442\u0438. \u0422\u0443\u0442 \u043d\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0430\u043c\u044f\u0442\u044c \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u043c\u0430\u044f Visual Studio (C# \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0441\u044f \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u043e\u0442\u043b\u0430\u0434\u043a\u0438) \u0438 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043e\u043c (localhost:8888). \u0414\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u0431\u0440\u0430\u043b\u043e\u0441\u044c \u043f\u0438\u043a\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/3f3\/95a\/906\/3f395a906c2d4b1aa704b6f9f0b5ae88.png\"\/><\/p>\n<p>  \u041f\u0440\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0438 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 JN \u043d\u0430\u0447\u0438\u043d\u0430\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u043f\u043e\u0434\u043a\u0430\u0447\u043a\u0438, \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0447\u0435\u0433\u043e \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0441\u044f \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c.<\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 C# \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u0439 \u043e\u0431\u044a\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0445, \u0447\u0435\u043c JN, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0442\u0443\u0442 \u0436\u0435\u0441\u0442\u043a\u0438\u043c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u0435\u043b\u0435\u043c.<\/p>\n<p>  \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 matplotlib \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0447\u0442\u0438 \u00ab\u043d\u0430 \u043b\u0435\u0442\u0443\u00bb, \u0434\u0430 \u0438 \u043a\u043e\u0434\u0430 C# \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0432\u044b\u0445\u043e\u0434\u043e\u043c \u0434\u043b\u044f \u043f\u0440\u043e\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f (\u0435\u0441\u043b\u0438 \u043e\u0431\u044a\u0435\u043c\u044b \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0438 \u043d\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f) \u0432\u0438\u0434\u0438\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0435\u043a\u0430 JN \u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u0438 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0443\u0436\u0435 \u043d\u0430 C#.<br \/> \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\/318484\/\"> https:\/\/habrahabr.ru\/post\/318484\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442!<\/p>\n<p>  \u0420\u0430\u0437\u0431\u0438\u0440\u0430\u044f\u0441\u044c \u0441\u043e Spark Apache, \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0443\u0441\u043b\u043e\u0436\u043d\u0435\u043d\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0440\u0430\u0441\u0447\u0435\u0442\u044b \u0441\u0442\u0430\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043a\u0440\u0430\u0439\u043d\u0435 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u043d\u0430 C# \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u043f\u043e \u043a\u043b\u0430\u0441\u0441\u0443 \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u043d\u0430 \u0441\u0442\u0435\u043a\u0435 python (pandas-numpy-skilearn). \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435. \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 C# \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u043b\u0430\u0441\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 (linq), \u0440\u0430\u0441\u0447\u0435\u0442 \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 <a href=\"http:\/\/www.extremeoptimization.com\/\">extremeoptimization<\/a>.<\/p>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0437\u0430\u0434\u0430\u0447\u0430 \u00abB. \u041f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u0442\u0440\u0430\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432\u00bb \u0441 \u043d\u043e\u044f\u0431\u0440\u044c\u0441\u043a\u043e\u0433\u043e \u0441\u043e\u0440\u0435\u0432\u043d\u043e\u0432\u0430\u043d\u0438\u044f <a href=\"https:\/\/sdsj.ru\/contest.html\">Sberbank Data Science Journey<\/a>.<\/p>\n<p>  \u0421\u0440\u0430\u0437\u0443 \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u0434\u0447\u0435\u0440\u043a\u043d\u0443\u0442\u044c, \u0447\u0442\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043e\u043f\u0438\u0441\u0430\u043d \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0430\u0441\u043f\u0435\u043a\u0442 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c, \u0430 \u043d\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0439. \u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0431\u044b\u043b\u043e \u0432\u0437\u044f\u0442\u043e \u0438 \u0441\u043b\u0435\u0433\u043a\u0430 \u0434\u043e\u043f\u0438\u043b\u0435\u043d\u043e <a href=\"http:\/\/nbviewer.jupyter.org\/urls\/dl.dropbox.com\/s\/j1595xoqa9oheyo\/baseline_c_new.ipynb\">\u0431\u0430\u0437\u043e\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/a>. <\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 C# (\u043a\u0443\u0441\u043a\u0438 \u043a\u043e\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u043d\u0438\u0436\u0435):<\/p>\n<p>  1. \u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 csv. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <a href=\"https:\/\/www.codeproject.com\/Articles\/9258\/A-Fast-CSV-Reader\">Fast Csv Reader<\/a>.<br \/>  2. \u041e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0443 \u043f\u043e \u043c\u0435\u0441\u044f\u0446\u0430\u043c.<br \/>  3. \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0442\u0435 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0443 \u043d\u0435\u0433\u043e \u043d\u0435 \u0431\u044b\u043b\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0431\u043e\u0440 \u0446\u0438\u043a\u043b-\u0432-\u0446\u0438\u043a\u043b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A4%D0%B8%D0%BB%D1%8C%D1%82%D1%80_%D0%91%D0%BB%D1%83%D0%BC%D0%B0\">\u0444\u0438\u043b\u044c\u0442\u0440 \u0411\u043b\u0443\u043c\u0430<\/a>. \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043d\u0430 C# \u043d\u0430\u0448\u0435\u043b <a href=\"https:\/\/gist.github.com\/richardkundl\/8300092\">\u0442\u0443\u0442<\/a>.<br \/>  4. \u0424\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Feature_hashing\">Hashing trick<\/a>. \u0422\u0430\u043a \u043a\u0430\u043a \u0433\u043e\u0442\u043e\u0432\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u0434 C# \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u043c\u0443. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043a\u0430\u0447\u0430\u043b \u0438 \u0441\u043b\u0435\u0433\u043a\u0430 \u0434\u043e\u043f\u0438\u043b\u0438\u043b <a href=\"https:\/\/gist.github.com\/automatonic\/3725443\">\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e<\/a> \u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f murmurhash3<br \/>  5. \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0440\u0430\u0441\u0447\u0435\u0442 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438.   <\/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-283062","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/283062","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=283062"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/283062\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=283062"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=283062"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=283062"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}