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
// define inside file timetest.m | |
function blank = timetest(x, y, MAX_ITR) | |
m = length(y); | |
x = [ones(m, 1) x]; | |
theta = zeros(size(x(1,:)))'; % initialize fitting parameters | |
alpha = 0.07; | |
for num_iterations = 1:MAX_ITR | |
grad = (1/m).* x' * ((x * theta) - y); | |
theta = theta - alpha .* grad; |
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
// TEST DATA | |
curl -XPUT http://localhost:9200/twitter/user/kimchy -d '{ | |
"name" : "Shay Banon" | |
}' | |
curl -XPUT http://localhost:9200/twitter/tweet/1 -d '{ | |
"user": "kimchy", | |
"post_date": "2009-11-15T13:12:00", | |
"message": "Trying out elasticsearch, so far so good?" |
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
{ | |
"query": { | |
"match_all": {} | |
}, | |
"filter": { | |
"term": { | |
"model": "vw" | |
} | |
}, | |
"facets": { |
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
curl -XPOST localhost:9200/boosts -d ' | |
{ | |
"settings": { | |
"number_of_shards": 1, | |
"number_of_replicas": 0 | |
}, | |
"mappings": { | |
"doc": { | |
"properties": { | |
"text": { |
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
package org.elasticsearch.index.similarity; | |
import org.apache.lucene.search.similarities.DefaultSimilarity; | |
import org.elasticsearch.common.logging.ESLogger; | |
import org.elasticsearch.common.logging.Loggers; | |
public class NormRemovalSimilarity extends DefaultSimilarity { | |
private ESLogger logger; |
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
appender: | |
socketA: | |
type: org.apache.log4j.net.SocketAppender | |
port: 9500 | |
remoteHost: logstash-server | |
socketB: | |
type: org.apache.log4j.net.SocketAppender | |
port: 9501 | |
remoteHost: logstash-server |
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
sed -e 's/{"took":[0-9]*,"timed_out":false,"_shards":{"total":[0-9]*,"successful":[0-9]*,"failed":0},"hits":{"total":[0-9]*,"max_score":[0-9\.]*,"hits":\[\(.*\)\]}}$/\1/' -e 's/}},/}}\n/g' -e 's/{"_index"/{ "index":{"_index"/' -e 's/,"_score":[0-9\.]*, "_source" : /}}\n/g' |
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
curl -XPUT localhost:9200/test -d '{ | |
"settings": { | |
"index": { | |
"number_of_shards": 1, | |
"number_of_replicas": 0 | |
} | |
}, | |
"mappings": { | |
"test" : { | |
"properties" : { |
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
rails_env = ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development' | |
Split.redis = YAML.load_file(Rails.root.join('config/split.yml')).fetch(rails_env) | |
Split.configure do |config| | |
adapter = Split::Persistence::RedisAdapter.with_config( | |
lookup_by: :params_user_id, | |
namespace: 'abtesting_participant_id', | |
expire_seconds: 2_592_000, # 30 days | |
) |