Skip to content

Instantly share code, notes, and snippets.

View lucidfrontier45's full-sized avatar

杜世橋 Du Shiqiao lucidfrontier45

  • GROUND Inc.
  • Tochigi, Japan
View GitHub Profile
@lucidfrontier45
lucidfrontier45 / smart_sort.py
Created February 27, 2020 10:54
smart_sort
from functools import total_ordering
def _apply(v, k):
if callable(k):
return k(v)
else:
return v[k]
@lucidfrontier45
lucidfrontier45 / KRR_GPR_test.ipynb
Last active February 24, 2020 03:37 — forked from Yukishita26/KRR_GPR_test.ipynb
Comparison of GPR and KRR
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lucidfrontier45
lucidfrontier45 / dunnet_test.r
Created January 6, 2020 10:58
Testing Dunnett's test
library(reshape2)
library(multcomp)
n <- 10
ctrl <- rnorm(n, 0, 0.5)
a <- rnorm(n, 0.1, 0.5)
b <- rnorm(n, 2, 0.5)
df <- melt(data.frame(ctrl = ctrl, a = a, b=b))
names(df) <- c("cat", "val")
@lucidfrontier45
lucidfrontier45 / model.stan
Created December 3, 2019 14:23
Stan Coin flipping Test
data {
int<lower=0> N;
}
transformed data {
int<lower=0> n;
n = N / 2;
}
parameters {
@lucidfrontier45
lucidfrontier45 / fp.c
Created October 17, 2019 13:55
Functional programming in C
#include <stdio.h>
double sum(const double *x, double s, size_t n)
{
if (n == 0)
{
return s;
}
return sum(x + 1, s + *x, n - 1);
{
"editor.formatOnSave": false,
"eslint.enable": true,
"eslint.run": "onType",
"eslint.autoFixOnSave": true,
"prettier.eslintIntegration": true,
"editor.detectIndentation": false,
"eslint.validate": [
"javascript",
"javascriptreact",
@lucidfrontier45
lucidfrontier45 / argsort.hpp
Created June 20, 2019 01:47
C++ argsort template
#include <algorithm>
#include <functional>
#include <numeric>
#include <vector>
#include <array>
template <typename T>
using CMPFUNC = std::function<bool(T, T)>;
template <typename T>
@lucidfrontier45
lucidfrontier45 / .clang-format
Created May 24, 2019 05:03
clang-format config
BasedOnStyle: Webkit
AlignOperands: true
AlignAfterOpenBracket: Align
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Empty
ConstructorInitializerAllOnOneLineOrOnePerLine: true
BreakConstructorInitializersBeforeComma: true
@lucidfrontier45
lucidfrontier45 / .vimrc
Last active October 13, 2017 15:47
Terminal Settings
set tabstop=4
set autoindent
set expandtab
set shiftwidth=4
@lucidfrontier45
lucidfrontier45 / padding.py
Created August 12, 2017 16:38
padding with numpy
import numpy as np
def padding(xs, z=0, max_len=None, dtype=np.int32):
if max_len is None:
max_len = max(len(x) for x in xs)
n_samples = len(xs)
results = np.empty((n_samples, max_len), dtype=dtype)
results[:, :] = z
for i, x in enumerate(xs):