- Release date: September 22nd 2022
- System: 32-bit
- Kernel version: 5.15
- Debian version: 11 (bullseye)
- Size: 338MB
Linux pi 5.15.61-v7+ #1579 SMP Fri Aug 26 11:10:59 BST 2022 armv7l
This file contains hidden or 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
""" | |
Implementation of pairwise ranking using scikit-learn LinearSVC | |
Reference: | |
"Large Margin Rank Boundaries for Ordinal Regression", R. Herbrich, | |
T. Graepel, K. Obermayer 1999 | |
"Learning to rank from medical imaging data." Pedregosa, Fabian, et al., | |
Machine Learning in Medical Imaging 2012. |
This file contains hidden or 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
from math import log | |
log2= lambda x:log(x,2) | |
from scipy import histogram, digitize, stats, mean, std | |
from collections import defaultdict | |
def mutual_information(x,y): | |
return entropy(y) - conditional_entropy(x,y) | |
def conditional_entropy(x, y): | |
""" |
This file contains hidden or 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
#!/bin/bash | |
#<[email protected]> | |
# http://dummyimage.com/600x400/000/fff&text=100000 | |
BASE_URL="http://dummyimage.com/" | |
DEFAULT_SIZE="600X400" | |
DEFAULT_BG_COLOR="000" | |
DEFAULT_COLOR="fff" | |
START=1001 | |
END=4000 |
This file contains hidden or 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
#!/bin/bash | |
# Save docker images | |
ds() { | |
docker images | \ | |
cut -d ' ' -f 1 | \ | |
tail -n +2 | \ | |
xargs -t -n 1 -I {} -P 4 \ | |
sh -c 'docker save {} | bzip2 > $(echo "{}" | sed "s/^.*\///").tar.bz2' | |
} |
This file contains hidden or 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
from math import log | |
import unittest | |
def dcg_at_k(scores): | |
assert scores | |
return scores[0] + sum(sc / log(ind, 2) for sc, ind in zip(scores[1:], range(2, len(scores)+1))) | |
def ndcg_at_k(predicted_scores, user_scores): | |
assert len(predicted_scores) == len(user_scores) |
This file contains hidden or 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
import tensorflow as tf | |
from tensorflow_serving.apis import predict_pb2 | |
import time | |
import base64 | |
import requests | |
import pickle | |
import numpy as np | |
import random | |