Skip to content

Instantly share code, notes, and snippets.

@microprediction
Last active September 28, 2020 22:43
Show Gist options
  • Save microprediction/4aebd66c1e6b4d0db885d2e770fa24f4 to your computer and use it in GitHub Desktop.
Save microprediction/4aebd66c1e6b4d0db885d2e770fa24f4 to your computer and use it in GitHub Desktop.
Julia code for rudimentary emoji prediction
using Microprediction
using Distributions
write_config = Microprediction.Config("66a78936 YOUR KEY HERE 6482eb36249a")
test_stream_name = "emojitracker-twitter-grinning_face_with_smiling_eyes.json"
function make_sample()
values = Microprediction.get_lagged_values(write_config, test_stream_name)
good_values = values[1:50]
distribution = fit(Poisson, convert(Array{Int64}, good_values))
samples = rand(distribution, write_config.numPredictions)
Microprediction.submit(write_config, test_stream_name,
convert(Array{Float64}, samples))
println("Sending samples")
println(samples)
end
while true
make_sample()
sleep(60)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment