Skip to content

Instantly share code, notes, and snippets.

https://www.yomiuri.co.jp/culture/book/column/20230411-OYT8T50001/ に書かれた、太刀川氏による文章をもとにChatGPTと会話した記録

次の文章に誤りもしくは不自然な点があれば指摘してください:  まず気候変動の緩和とは、二酸化炭素などの温室効果ガスを削減して気候変動を和らげる戦略だ。これは具体的でわかりやすい。一方で気候変動への適応は、起こった気候の変化に社会を合わせる戦略だ。うむ…わかる気もするが、一体どうすれば適応できるのか。生活の全てが適応の手段なので、指標も測りづらい。適応策はこの複雑さ故に、緩和策ほどには進んでいない。

ChatGPT

文章に誤りや不自然な点は見受けられませんが、一部表現をより明確にする提案があります。

現在の文章:

@kagaya
kagaya / read_raw_pkl.R
Last active December 10, 2022 10:42
read raw.pkl file from soft_skeleton_solver (https://github.com/katsuma-inoue/soft_skeleton_solver)
library(tidyverse)
library(reticulate)
read_raw_pkl <- function(file_path="/path/to/raw.pkl"){
# https://gist.github.com/kagaya/32706c38404c99431669ba34b8bccbac
j <- import("joblib") # python package joblib is loaded via {reticulate}
arm_xy <- j$load(file_path)
tibble(t=1:length(arm_xy$path), path=arm_xy$path) %>%
group_by(t) %>%
@kagaya
kagaya / random_variable_with_Tidyeval.ipynb
Last active September 26, 2019 16:51
Tidyevalで関数としての確率変数を表現してみる
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
functions {
vector my_student_t_rng(int N, real nu, real mu, real sigma){
vector[N] Y;
for (n in 1:N){
Y[n] = student_t_rng(nu, mu, sigma);
}
return(Y);
}
vector my_ZIP_rng(int N, real q, real lambda){
@kagaya
kagaya / model_selection_by_WAIC.rmd
Last active March 5, 2019 01:15
an example of model selection of hierarchical Bayesian model by WAIC / draft
---
title: "an example of model comparison by WAIC (draft)"
author: "Katsushi Kagaya"
date: "`r Sys.time()`"
output:
html_document: default
---
# motivation and aims
@kagaya
kagaya / across_facet_plot.R
Last active August 14, 2018 10:13
plot a segment connecting points across facets in ggplot
library(tidyverse)
library(grid)
library(gtable)
plot_segment_across_facets <- function(p, from=1, to=2,
from_point_id=1,
to_point_id=1,
plotout = F,
gp=gpar(lty=1, alpha=0.5)){
waic <- function(log_likelihood) {
# from https://gist.github.com/MatsuuraKentaro/3f6ae5863e700f5039c19e36a9bdf646
training_error <- - mean(log(colMeans(exp(log_likelihood))))
functional_variance_div_N <- mean(colMeans(log_likelihood^2) - colMeans(log_likelihood)^2)
waic <- training_error + functional_variance_div_N
return(waic)
}
@kagaya
kagaya / plot_choice.R
Last active June 3, 2018 13:49
part of plot function, choice
library(tidyverse)
library(ggrepel)
library(rstan)
expose_stan_functions("my_stan_functions.stan") # https://gist.github.com/kagaya/c726f16d82b80026bb1924b408a72b5c
source("utility.R") # https://gist.github.com/kagaya/60c4190ac306840daee54115b3c315c3
plot_choice_random_intercept <- function(d, fit){
# mu[n,2] = bias_l[ID[n]] + cwl*C_width[n] + ll*Leg_lack[n];
# mu[n,3] = bias_no0 + cwno*C_width[n] + lno*Leg_lack[n];
ms <- rstan::extract(fit)
@kagaya
kagaya / kick_model_1_1_choice.R
Last active June 4, 2018 02:39
copy of kick_model_1_1_choice.R
library(rstan)
library(tidyverse)
rstan_options(auto_write = TRUE)
options(mc.cores = parallel::detectCores())
## preprocessing
d <- read_csv(file='Dromiidae.csv') # https://gist.github.com/kagaya/0d309397300b7e8294fe53c44b6fc525
d <- d %>%
select(c('shell_width', 'choice',
@kagaya
kagaya / model_1_1_choice.stan
Last active June 4, 2018 02:36
copy of model_1_1_choice.stan
functions {
real f(real mu, real s, real x){
// separately performing numerical integration to make this computing fast
return(normal_lpdf(x | mu, s));
}
real log_lik_Simpson(real mu, real s, real a, real b, int M) {
// numerical integration using the Simpson's rule
vector[M+1] lp;
real h;