Skip to content

Instantly share code, notes, and snippets.

@kmundnic
kmundnic / startup.jl
Created December 14, 2020 19:48
Julia startup file
ENV["JULIA_ERROR_COLOR"] = :magenta
ENV["JULIA_WARN_COLOR"] = :yellow
ENV["JULIA_INFO_COLOR"] = :cyan
ENV["JULIA_STACKFRAME_LINEINFO_COLOR"] = :cyan
ENV["JULIA_STACKFRAME_FUNCTION_COLOR"] = :yellow
ENV["JULIA_EDITOR"] = "subl"
ENV["COLUMNS"] = 1000
#!/bin/bash
# Extract frames from the videos of the RECOLA data set. The images are then cropped to squares and resized to 50%.
# The script requires ffmpef and imagemagick installed.
for file in train_*.mp4
do
echo $file
DIR="frames_${file%.*}"
mkdir $DIR
@kmundnic
kmundnic / test.csv
Last active September 21, 2018 23:31
CSV test file
timeStamp participantId receiverId rssi
2018-03-27T17:00:47.04 6723 001bc50940820034 140
2018-03-27T17:01:51.96 3829 001bc5094082003b 144
2018-03-27T17:01:51.96 3829 001bc5094082003f 153
2018-03-27T17:01:57.806 3829 001bc5094082003b 143
2018-03-27T17:01:57.806 3829 001bc5094082003f 153
2018-03-27T17:02:44.478 6723 001bc50940820034 130
2018-03-27T17:02:52.621 3829 001bc5094082003b 155
2018-03-27T17:02:52.621 3829 001bc5094082003c 143
2018-03-27T17:03:49.827 3829 001bc5094082003b 152
clear; close all; clc;
c = get(gca,'colororder');
close;
for i = 1:size(c,1)
string = ['\definecolor{mycolor', num2str(i), '}{rgb}{',...
num2str(c(i,1),'%.4f'), ',', num2str(c(i,2),'%.4f'), ',', num2str(c(i,2),'%.4f'), '}'];
disp(string)
end
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kmundnic
kmundnic / mturk_example.csv
Last active July 29, 2018 02:56
Mechanical Turk output CSV file example
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 2.
"HITId","HITTypeId","Title","Description","Keywords","Reward","CreationTime","MaxAssignments","RequesterAnnotation","AssignmentDurationInSeconds","AutoApprovalDelayInSeconds","Expiration","NumberOfSimilarHITs","LifetimeInSeconds","AssignmentId","WorkerId","AssignmentStatus","AcceptTime","SubmitTime","AutoApprovalTime","ApprovalTime","RejectionTime","RequesterFeedback","WorkTimeInSeconds","LifetimeApprovalRate","Last30DaysApprovalRate","Last7DaysApprovalRate","Input.ref_video_url","Input.a_video_url","Input.b_video_url","Input.ref_start","Input.ref_end","Input.a_start","Input.a_end","Input.b_start","Input.b_end","Answer.choice","Approve","Reject"
"37M4O367VIHEVXMPBF7RWV9Z67V5MD","36NY760EF6AYOI4600Z6OYSCAIPB36","Choose the image most similar in color intensity to the reference image","Choose the image most similar in color intensity to the reference image","color, comparison, triplet","$0.01","Fri Jul 27 15:36:29 PDT 2018","1","BatchId:201861;OriginalHitTemplateId:920937242;","300","259200","Fri Aug 03 15:36:2
@kmundnic
kmundnic / krippendorff_alpha.m
Last active May 9, 2019 15:24
Krippendorff's alpha in MATLAB
function alpha=kriAlpha(data,scale)
% alpha=kriAlpha(data,scale)
% calculates Krippendorff's Alpha as a measure of inter-rater agreement
% data: rate matrix, each row is a rater or coder, each column is a case
% scale: level of measurement, supported are 'nominal', 'ordinal', 'interval'
% missing values have to be coded as NaN or inf
% For details about Krippendorff's Alpha see:
% http://en.wikipedia.org/wiki/Krippendorff%27s_Alpha
% Hayes, Andrew F. & Krippendorff, Klaus (2007). Answering the call for a
function ∇tSTE(X::Array{Float64,2},
no_objects::Int64,
no_dims::Int64,
no_triplets::Int64,
triplets::Array{Int64,2},
λ::Float64,
α::Float64)
P::Float64 = 0.0
C::Float64 = 0.0 + λ * sum(X.^2) # Initialize cost including l2 regularization cost
Variables:
X::Array{Float64,2}
no_objects::Int64
no_dims::Int64
no_triplets::Int64
triplets::Array{Int64,2}
λ::Float64
α::Float64
threadsfor_fun::getfield(Main.Embeddings, Symbol("##57#threadsfor_fun#7")){Array{Float64,2},Int64,Array{Int64,2},Array{Float64,1},Array{Float64,1},Array{Float64,2},Array{Float64,2},Array{Float64,2},Array{Float64,1},Array{Float64,1},Float64,Array{Int64,1},Array{Int64,1},Array{Int64,1},UnitRange{Int64}}
P::Array{Float64,1}
function ∇tSTE(X::Array{Float64,2},
no_objects::Int64,
no_dims::Int64,
no_triplets::Int64,
triplets::Array{Int64,2},
λ::Float64,
α::Float64;
use_log = true::Bool)::Tuple{Float64,Array{Float64,2}}
P = 0.0::Float64