Skip to content

Instantly share code, notes, and snippets.

View nzw0301's full-sized avatar

Kento Nozawa nzw0301

  • Preferred Networks, Inc. / Preferred Elements, Inc.
  • Japan
  • 12:37 (UTC +09:00)
View GitHub Profile
#!/usr/bin/env python3
# Author: Alexandre Défossez, 2020
# This is free and unencumbered software released into the public domain.
# For more information, please refer to <http://unlicense.org/>
"""
Merge multiple bibfiles, remove duplicates and unused references, matching bibtex entries
based on the 'title' field. Rewrite all the .tex files in the current directory
to reflect the elimination of duplicates.
Finally, this will rewrite all the arXiv references to use the @unpublished category.
@leifvan
leifvan / matern_for_int_and_categorical.py
Last active November 24, 2022 05:14
A wrapper for the `sklearn.gaussian_process.kernels.Matern` kernel that implements the kernel-level transformation of parameters as described by Garrido-Merchán and Hernández-Lobato in "Dealing with Categorical and Integer-valued Variables in Bayesian Optimization with Gaussian Processes"
import numpy as np
from sklearn.gaussian_process.kernels import Matern
from collections import defaultdict
class WrappedMatern(Matern):
def __init__(self, param_types, length_scale=1.0, length_scale_bounds=(1e-5, 1e5), nu=1.5):
self.param_types = param_types
super(WrappedMatern, self).__init__(length_scale, length_scale_bounds, nu)
def _transform(self, X):
@kaityo256
kaityo256 / kakenhi.md
Last active March 21, 2024 05:39
科研費の話

科研費の話

はじめに

最近、少し科研費が話題になっています。どうせ話題になっている理由などは一か月もしないうちに忘れ去られるでしょうが、研究者でない人には科研費は馴染みが薄いかもしれません。せっかくなので、科研費がどういうものか簡単に説明してみたいと思います。

大学の経理状況

まず、大学の経理状況をちょっと見てみましょう。例えば東大の令和元年度財務情報を見てみることにします。令和元年度の支出は2376億円、収入が2368億円となっています。収入のうち36%が国費、つまり税金ですが、そのメインは運営交付金という大学に毎年支給される補助金で763億円です。授業料は165億円と収入に占める割合は7%程度です。支出では、人件費が1009億円で42%ほどを占めます。つまり、毎年入ってくる運営交付金と授業料では人件費に届かないくらいです(附属病院による収益はかなり大きいですが、ここでは除いています)。多くの大学において運営交付金が収入に占める割合はもっと大きいと思います。気になる人は「大学名 財務諸表」で検索してみてください。

@neubig
neubig / get_citations.py
Created October 21, 2021 22:39
Comparing citations between EMNLP 2020 and EMNLP 2020 findings
import requests
import sys
import time
sleep_time = 20
def query_api(url, session):
global sleep_time
time.sleep(sleep_time / 1000.0)
r = session.get(url)
while r.status_code == 429:
@c-bata
c-bata / main.py
Last active October 28, 2023 01:04
W&B 東京Meetup #3 - Optunaを使ったHuman-in-the-loop最適化の紹介
# Requirements:
# $ pip install optuna optuna-dashboard[preferential] diffusers transformers accelerate scipy safetensors xformers
#
# Process A: Launch a process that suggest new params and generate images.
# $ python main.py
#
# Process B: Launch an Optuna Dashboard process.
# $ optuna-dashboard sqlite:///db.sqlite3 --artifact-dir ./artifact
import time
@heysanil
heysanil / unhide-files.sh
Created March 13, 2024 02:00
Bash script to recursively hide all files in a directory and its subdirectories
#!/bin/bash
# Function to recursively process files and folders
process_directory() {
local directory="$1"
# Loop through each item in the directory
for item in "$directory"/*; do
# Check if the item is a file
if [[ -f "$item" ]]; then