Skip to content

Instantly share code, notes, and snippets.

View apetrov's full-sized avatar

Alexander Petrov apetrov

View GitHub Profile
feature_columns = []
for feature_name in CATEGORICAL_COLUMNS:
vocabulary = df[feature_name].unique()
column = tf.feature_column.categorical_column_with_vocabulary_list(feature_name, vocabulary)
embedding_column = tf.feature_column.embedding_column(column, dimension=len(vocabulary))
feature_columns.append(embedding_column)
for feature_name in NUMERIC_COLUMNS:
feature_columns.append(tf.feature_column.numeric_column(feature_name, dtype=tf.float32))
@apetrov
apetrov / Rakefile
Created January 9, 2019 10:36
Extending rake trace
# Adding source locations to rake trace
class Rake::Task
def execute_with_actions_logs(args=nil)
@actions.each do |t|
if application.options.trace
puts "#{name} #{t.inspect}"
end
end
execute_without_actions_logs(args)
end
select [user_id, sum(payout),sum(fee).as(fee)], from: :transactions do
join :users do
users :id
transactions :user_id
end
groupby :user_id
where { user_id [1,2,3] }
where { fee > 40 }
order "sum(payout)", :desc
end
# Let's say user wants to charge a scooter.
class Charge
belongs_to :user
belongs_to :scooter
end
# we want to ensure that scooter is discharged
class Charge
belongs_to :user
belongs_to :scooter
2017-07-27T12:03:27.452Z 12559 TID-orl6iw5e8 ElasticRunner JID-b787bc0bcf984d41eebb12b5 INFO: fail: 13.223 sec 2017-07-27T12:03:27.452Z 12559 TID-orl6iw5e8 WARN: {"class"=>"ElasticRunner", "args"=>["c35e07c2-8b27-4e9a-9204-807c75a222e0", "inventory-forecast-es01.virool", "traffic/impressions", {"elastic"=>"forecasting_traffic/1501038000-c35e07c2-8b27-4e9a-9204-807c75a222e0.json.gz", "from"=>"2017-07-26T03:00:00.000Z", "to"=>"2017-07-26T04:00:00.000Z"}], "retry"=>20, "queue"=>"load_common", "jid"=>"b787bc0bcf984d41eebb12b5", "created_at"=>1501156944.0693657, "enqueued_at"=>1501156994.228116, "error_message"=>"Failure \e[0;37m2017-07-27 12:03:27.223\e[0m [\e[32minfo\e[0m] Connection reset by peer\n/opt/rubies/2.1.3/lib/ruby/2.1.0/net/protocol.rb:153:in `read_nonblock'\n/opt/rubies/2.1.3/lib/ruby/2.1.0/net/protocol.rb:153:in `rbuf_fill'\n/opt/rubies/2.1.3/lib/ruby/2.1.0/net/protocol.rb:134:in `readuntil'\n/opt/rubies/2.1.3/lib/ruby/2.1.0/net/protocol.rb:144:in `readl
10news.com
abbreviations.com
abc.es
abc15.com
abc2news.com
adn.com
ambitiouskitchen.com
andhrajyothy.com
anoregoncottage.com
apieceofrainbow.com
import numpy
import pandas
from keras.models import Sequential
from keras.layers import Dense
from keras.wrappers.scikit_learn import KerasClassifier
from keras.utils import np_utils
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import KFold
from sklearn.preprocessing import LabelEncoder
from sklearn.pipeline import Pipeline
@apetrov
apetrov / app.rb
Last active April 22, 2016 09:17
We couldn’t find that file to show.
@apetrov
apetrov / -
Created January 30, 2015 11:00
sap.ui.controller("controller.BehaviorAllPages", {
onInit: function() {
this.loadReportData();
},
onBeforeRendering: function() {
},
onAfterRendering: function() {
@apetrov
apetrov / -
Created January 30, 2015 09:25
sap.ui.controller("controller.BehaviorAllPages", {
onInit: function() {
this.loadReportData();
},
onBeforeRendering: function() {
},
onAfterRendering: function() {