This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from keras.models import Sequential | |
from keras.layers import Dense | |
x, y = ... | |
x_val, y_val = ... | |
# 1-dimensional MSE linear regression in Keras | |
model = Sequential() | |
model.add(Dense(1, input_dim=x.shape[1])) | |
model.compile(optimizer='rmsprop', loss='mse') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size = map(lambda (x,y): (x, len(y)),product_set.items()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size = map(lambda (x,y): (x, len(y)),product_set.items()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author: Andreas Mueller <amueller@ais.uni-bonn.de> | |
# Mod: zhpmatrix@2017-03-16 20:17 | |
# License: BSD 3 clause | |
from numpy import log1p | |
from sklearn.pipeline import Pipeline, FeatureUnion | |
from sklearn.model_selection import GridSearchCV | |
from sklearn.svm import SVC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int CLIRunTask(int argc, char *argv[]) { | |
if (argc < 2) { | |
printf("Usage: <config>\n"); | |
return 0; | |
} | |
rabit::Init(argc, argv); | |
std::vector<std::pair<std::string, std::string> > cfg; | |
cfg.push_back(std::make_pair("seed", "0")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
desc: worker,speed up for tianchi competition using distributed method | |
author: zhpmatrix | |
date: 2017-02-19 | |
contributor: XueFeng Liao | |
''' | |
import time, sys, queue | |
from task import * | |
from multiprocessing.managers import BaseManager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
desc: master,speed up for tianchi competition using distributed method | |
author: zhpmatrix | |
date: 2017-02-19 | |
contributor: XueFeng Liao | |
''' | |
import random, time | |
from multiprocessing.managers import BaseManager | |
from multiprocessing import Queue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import multiprocessing | |
def profile(func): | |
def wrapper(*args, **kwargs): | |
import time | |
start = time.time() | |
func(*args, **kwargs) | |
end = time.time() | |
print 'COST: {}'.format(end - start) | |
return wrapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add header to shop_info.txt | |
echo shop_id,city_name,location_id,per_pay,score,comment_cnt,shop_level,cate_1_name,cate_2_name,cate_3_name > show_info_header.txt | |
cat shop_info.txt >> shop_info_header.txt | |
mv shop_info_header.txt > shop_info.txt | |
# add header to user_view.txt | |
echo user_id,shop_id,time_stamp > user_view_header.txt | |
cat user_view.txt >> user_view_header.txt | |
mv user_view_header.txt > user_view.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add header to shop_info.txt | |
echo shop_id,city_name,location_id,per_pay,score,comment_cnt,shop_level,cate_1_name,cate_2_name,cate_3_name > show_info_header.txt | |
cat shop_info.txt >> shop_info_header.txt | |
mv shop_info_header.txt > shop_info.txt | |
# add header to user_view.txt | |
echo user_id,shop_id,time_stamp > user_view_header.txt | |
cat user_view.txt >> user_view_header.txt | |
mv user_view_header.txt > user_view.txt |