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
# Setup step 0: Build PyCall.jl for right Python binary | |
# | |
# Might be needed to ensure the right python is used, here for my homebrew | |
# installed python3 on a M1 MacBook Pro: | |
# ENV["PYTHON"] = "/opt/homebrew/bin/python3" | |
# using Pkg | |
# Pkg.build("PyCall") | |
# Setup step 1: Ensuring you have access to GPT-SW3 by setting up a token on Hugging Face | |
# a. login on HF: https://huggingface.co/login |
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
# Checking the "Boxes puzzle" solution strategy via stochastic simulation. | |
# [email protected] 2022 | |
using Random # We need randperm below | |
# Fill N boxes by getting a random permutation of length N. | |
fillboxes(N) = randperm(N) | |
# Given a strategy, simulate its use by N people and return true iff strategy | |
# worked for them all. |
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
using StringDistances | |
function countdict(qgrams) | |
d = Dict{eltype(qgrams), Int32}() | |
for qg in qgrams | |
index = Base.ht_keyindex2!(d, qg) | |
if index > 0 | |
d.age += 1 | |
@inbounds d.keys[index] = qg | |
@inbounds d.vals[index] = d.vals[index][1] + 1 |
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
using StringDistances | |
function countdict(qgrams) | |
d = Dict{eltype(qgrams), Int32}() | |
for qg in qgrams | |
index = Base.ht_keyindex2!(d, qg) | |
if index > 0 | |
d.age += 1 | |
@inbounds d.keys[index] = qg | |
@inbounds d.vals[index] = d.vals[index][1] + 1 |
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
using StringDistances | |
function countdict(qgrams) | |
d = Dict{eltype(qgrams), Int32}() | |
for qg in qgrams | |
index = Base.ht_keyindex2!(d, qg) | |
if index > 0 | |
d.age += 1 | |
@inbounds d.keys[index] = qg | |
@inbounds d.vals[index] = d.vals[index][1] + 1 |
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
using HTTP, JSON | |
const VegaLiteWebsocketFrontEndTemplate = """ | |
<!DOCTYPE html> | |
<head> | |
<meta charset="utf-8"> | |
<script src="https://cdn.jsdelivr.net/npm/vega@3"></script> | |
<script src="https://cdn.jsdelivr.net/npm/vega-lite@2"></script> | |
<script src="https://cdn.jsdelivr.net/npm/vega-embed@3"></script> | |
</head> |
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
if Threads.nthreads() < 2 | |
exit("Multiple threads NOT found! Makes no sense to test this without them... Start as, for example: JULIA_NUM_THREADS=4 julia multithreaded_optimization.jl") | |
end | |
using BlackBoxOptim | |
# Functions to optimize. Should be thread-safe. | |
function rosenbrock(x) | |
sleep(0.01) # So that there is some benefit in the thread switching... | |
sum(i -> 100*abs2(x[i+1] - x[i]^2) + abs2(x[i] - 1), Base.OneTo(length(x)-1)) |
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
{ | |
"nodes": [ | |
{ | |
"name": "Submissions", | |
"color": "#C0C0C0" | |
}, | |
{ | |
"name": "Desk rejected", | |
"color": "#FF3333" | |
}, |
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
# Output when running this script: | |
# ICSE 2019 attendees per million capita: | |
# 1. Luxembourg, 15, 25.126 | |
# 2. Canada, 330, 8.852 | |
# 3. Sweden, 41, 4.078 | |
# 4. Ireland, 16, 3.301 | |
# 5. Switzerland, 27, 3.137 | |
# 6. Singapore, 17, 2.897 | |
# 7. Norway, 15, 2.777 | |
# 8. Netherlands, 32, 1.868 |
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
using HypothesisTests | |
# Checked num downloads from each papers page in SpringerLink 2017-04-26 08:05 CET | |
OpenAccessPaperDownloads = [2400, 589] # says 2.4k downloads, approximates with 2400 | |
NonOAPaperDownloads = [134, 126, 85, 104, 56, 228, 112] | |
println(pvalue(MannWhitneyUTest(OpenAccessPaperDownloads, NonOAPaperDownloads))) | |
# p-value is 0.055 | |
# Executed 2017-04-26 08:10 CET on MacBook Pro 13" 2015 running Julia 0.5.1 with HypothesisTests version 0.5.1 |
NewerOlder