2024,江端さんの忘備録

「チ。-地球の運動について」は創作物です。

“Chi: About the Movement of the Earth” is a work of fiction.

そのため、すべてが歴史的事実でないことは当然ですが、この本に衝撃を受けた人はかなり多いのではないでしょうか。

As a result, it is only natural that not all the facts are historical, but I think the books impact quite a few people.

現在、アニメ化されてNHKで放映されていますが、素晴しい完成度だと思います。

It has been made into an anime and is currently being broadcast on NHK, and I think it is of a very high standard

次女は、大絶賛していますし、私はすでに絶賛のレベルを越えて、「チ」は、私の中で、一つの哲学と完成しています。

My second daughter is raving about this work, and I have already gone beyond the level of raving, and “Chi” has become a philosophy and a complete work for me.

-----

私は、以前、「旧統一教会の理解の仕方」として、この地動説のパラダイムを用いたコラムを書きました。

I have written a column in the past using this geocentric paradigm to understand the former Unification Church.

これ

This diary is, and

『地動説を理解できないお前たちは、みんな、サタンだ!』

と、

これ

This column is. 

イラスト

(↑クリックするとコラムに飛びます)

(Click to go to the column)

です。

-----

私は、カルト教団としても旧統一教会も、毒ガステロを実施した旧オウム真理教も、過去も今許していませんし、未来も許すことはないでしょう。

I have never forgiven the Aum Shinrikyo cult, the former Unification Church, or the former Aum Shinrikyo, which carried out the sarin gas attack in the past, and I will never forgive them in the future.

それは、やつらが「霊感商法」をやり「毒ガス散布」を行ったからです。

This is because they engaged in “spiritual sales fraud” and “distributed poison gas.”

しかし、私は、これまで一度もその「教義」そのものを攻撃したことはありません。

However, I have never attacked the “doctrine” itself.

教義の中身については、かなりバカにしてきましたとは思いますし、ロジックでコテンパにしてきたという実績もありますが ―― 『信仰はロジックではない』ということくらいは弁(わきま)えているつもりです。

I think I've made fun of the content of religious doctrine quite a bit, and I've also had a track record of defeating people with logic, but I think I understand that 'faith is not logic.'

とはいえ、「聖書は絶対」という主張に対し、歴史的には「聖書は少年ジャンプの編集作業と同程度の産物」とも言える事実を知っています(皆さんも世界史で学んだと思います)。

That being said, in response to the claim that the Bible is absolute, we know that historically, it can be said that the Bible is a product on a par with the editorial work of Shonen Jump (I think you all learned this in world history).

新約聖書の編集会議は、少年ジャンプの新連載マンガを決定する、または連載打ち切りを決定する会議と、基本的に同じだったのです。

閑話休題

Leaving that aside,

-----

日本においては、地動説は争いのない定説として受け入れられています。

In Japan, the heliocentric theory is accepted as an undisputed established theory.

運動方程式、ケプラーの楕円方程式、万有引力係数(さらに正確にはアインシュタインの一般相対性理論 (1915年))を知らなくても、地動説が、同一の物理式で説明可能であり、(原則として)無矛盾であることを、私たち日本人は受け入れているからです。

This is because we Japanese accept the fact that the Copernican theory can be explained using the same physical equations and is (in principle) consistent, even if we don't know the equations of motion, Kepler's elliptic equations, or the gravitational constant (or, more accurately, Einstein's general theory of relativity (1915)).

で、私、かなり、悪意的なことを考えています。

So, I'm thinking something pretty malicious.

―― アニメ「チ。-地球の運動について」を、アメリカ合衆国で放送したら、何が起こるだろうか

"What would happen if the anime “Chi: About the Movement of the Earth” was broadcast in the United States?"

2014年のアメリカ科学振興協会(AAAS)の報告によれば、アメリカ人の約4人に1人が地球が太陽の周りを公転していることを知らないとされています(*)。

According to a 2014 report by the American Association for the Advancement of Science (AAAS), around one in four Americans are unaware that the Earth orbits the sun(*).

(*)https://ja.wikipedia.org/wiki/%E5%9C%B0%E5%8B%95%E8%AA%AC

進化論に関する調査では、アメリカ人の成人のうち45%が「今から1万年ほど前に神が人類を創造した」と信じており、科学的な進化論を受け入れている人は少数派であることが示されています(*)。

Surveys on the theory of evolution show that 45% of American adults believe that God created humans around 10,000 years ago and that only a minority accept the scientific theory of evolution (*).

(*)https://wedge.ismedia.jp/articles/-/23070?page=2

米国といえば、科学技術の先端国であり、月面着陸やGPS衛星の実用化を成し遂げた国です。ビッグバン説をCosmic Background Explorer(宇宙背景放射探査機)で完璧に証明してみせたNASAもあります。

The United States is a country at the forefront of science and technology, and it is the country that achieved the landing on the moon and the practical application of GPS satellites. There is also NASA, which has perfectly proven the Big Bang theory with the Cosmic Background Explorer.

「カーナビを使いながら地動説を知らない/信じない」という人が一定数いる、不思議な国です。

It is a strange country where some people “do not know or believe in the heliocentric theory” while using a car navigation system.

-----

この国に、アニメ「チ。-地球の運動について」を放り込んだら、何が起こるか?

What would happen if you threw the anime “Chi: About the Movement of the Earth” into this country?

このアニメ一つで、あの日米貿易摩擦(1960-1994)と同程度の紛争に発展したら ―― それはそれで面白い。

If this anime alone were to develop into a dispute on the same scale as the Japan-US trade friction (1960-1994) - that would be interesting.

そういう、底意地の悪い思惑を持っている人間が、ここに一人います。

There is one person here with such a malicious motive.

2024,江端さんの忘備録

『今時、上限6000円のホテルなんて、あるわけがない!』と思っていました。

I thought, “There's no way there's a hotel with a maximum price of 6,000 yen these days!”.

ですので、学会会場からかなり離れていたのですが、会社のネットでそのホテルを見つけた時には、本当に驚きました。

Even though it was pretty far from the conference venue, I was surprised to find that hotel on the company intranet.

取り急ぎ、そのホテルを予約しましたが、昨日、駅から30分歩いてホテルの前に立った時点で、すでに後悔していました。

In a hurry, I booked a room at the hotel, but yesterday, when I stood in front of the hotel after walking for 30 minutes from the station, I was already regretting it.

―― ホテルの前に立った瞬間、ヤニの匂いが漂ってきた。

"The moment I stood in front of the hotel, I could smell the smell of tobacco."

嫌な予感がしたものの、フロントに入ると予感は的中。フロントはヤニの匂いで充満していました。

I had a bad feeling, and when I went to the front desk, my hunch was correct. The front desk was filled with the smell of tobacco.

今回は禁煙室が取れず、仕方なく喫煙室のシングルを予約したのですが、部屋に入った瞬間、ヤニ臭の強烈な圧力で、部屋の外に押し出されそうな気分になりました。

This time, I couldn't get a non-smoking room, so I had no choice but to book a single in a smoking room, but the moment I entered the room, the intense pressure of the tobacco smell made me feel like I was going to be pushed outside the room.

―― ここで2日間眠れるの? いや、そもそも眠れるのか?

"Can I sleep here for two days? Or can I sleep at all?"

そんな不安が頭をよぎりました。

Such worries crossed my mind.

今回は最終セッションで講演の予定があるため、発表練習をしなければなりませんでしたが、部屋にある机は小さく、ノートPCを置いての作業は困難。部屋は狭く、壁はどんよりとした黄色に染まり、一部の壁紙は剥がれていました。さらに、小さなテレビは色補正が狂っており、ギラギラした異様な色を放っています。

I had to practice my presentation this time because I was scheduled to give a talk in the final session. However, the desk in the room was small, so working with my laptop was challenging. The room was also small, and the walls were a dull yellow, with some wallpaper peeling off. Furthermore, the small TV's color correction messed up, giving off a strange, glaring color.

さらに驚いたのは、廊下に設置されていた「アダルトビデオ視聴用カード」の自動販売機でした。

Even more surprising was the vending machine for “adult video viewing cards” set up in the hallway.

そして最大の驚きは、WiFiがないこと(当然イーサネットポートもなし)。まさに「言葉を失う」とはこのことです。

And the biggest surprise was that there was no WiFi (and, of course, no Ethernet port). This is what it means to “lose your words.”

学会開催期間中、私は完全にネットアクセスを失いました(ちなみに、学会会場の大学もWiFiアクセスポイントを公開していませんでした)。結果、学会中の3日間、インターネットから完全に切り離されるという経験をすることになりました。

During the conference, I completely lost my internet access (incidentally, the university where the conference was held did not have a public WiFi access point). As a result, I had the experience of being completely cut off from the internet for the three days of the conference.

これが、私が3日間にわたりブログを更新できなかった理由です。

This is why I could not update my blog for three days.

-----

ホテルでは食堂で夕食サービスがあるとのことだったので、頼んでみたところ、ここ数年で最も心が寂しくなるような具の入っていないカレーが、プラスチックの容器で出てきました。

The hotel said they had dinner service in the dining room, so I ordered some. They brought out a plastic container of curry with no filling, the most heartbreaking curry I've had in years.

学生時代に旅したインド・ニューデリーの格安ドミトリーにタイムスリップしたような気分でした。

It felt like I had slipped back to the cheap dormitory I stayed in as a student traveling in New Delhi, India.

-----

いやいや、私も入社当時は、こんな宿に連泊して工場でデバッグしていたものです。

No, when I first joined the company, I used to stay at a place like this and debug at the factory.

いつの間にか、自分が贅沢になってしまったのだと気づきました。

Before I knew it, I realized that I had become extravagant.

「雨露がしのげればそれで十分」と思っていた当時の自分を思い出し、少し反省しました。

I remembered how I used to think that “as long as I could keep out the rain and dew, that would be enough,” and I felt a little sorry for myself.

----

ただし、その反省は反省として、会社規程金額以上の部分は自腹で負担するので、せめてヤニ臭のしないホテルへの変更を認めてほしい。

However, as a reflection of that, I will pay out of my own pocket for the portion that exceeds the company's regulations, so please at least allow me to change to a hotel that doesn't smell tobacco.

ヤニの匂いで不眠になり(実際、初日はその匂いで喉を痛めました)、仕事や学会で、私がパフォーマンスを発揮できないのは、会社にとっても私にとっても「Lose-Lose」だと思うんですけどね。

The smell of the tar makes me lose sleep (in fact, on the first day, the scent made my throat hurt), and I think that if I can't perform well at work or academic conferences, it's a “lose-lose” situation for both the company and me.

なんか、もう、泣くのも面倒くさい、という感じでした。

2024,江端さんの忘備録

今回の学会では、次女から譲り受けたPCに発表用資料を入れ、持ち込んだのですが、HDMI接続に不具合が発生し、えらい目にあいました。

At this academic conference, I brought the presentation materials on the PC I received from my second daughter. Still, I had a terrible time because of a problem with the HDMI connection.

HDMIインターフェースが完全に壊れているのであれば諦めもつくのですが、10回中2回ほど、プロジェクタへの投影に失敗するのです。

If the HDMI interface were completely broken, I would give up, but it fails to project onto the projector about two out of ten times.

私は前日、会場でこのテストを10回ほど行い、さらに2日目の開始前に3回、昼休憩中に3回動作確認をしたにもかかわらず、発表直前に映像が映らなくなりました。

I had run through the test about ten times at the venue the day before, and even though I had also checked it three times before the start of the second day and three more times during the lunch break, the video stopped working just before the presentation.

―― このノートPCは悪魔なのか?

"Is this laptop a demon?"

と思わざるを得ませんでした。直前まで問題なく動作しておきながら、本番で確実に失敗する。これを悪魔の所業と言わずして何と言うのでしょう。

I couldn't help but think that. It worked fine until the last minute, but it definitely failed in the actual performance. What else can you call this but the work of the devil?

次女のノートPCに大量に貼ってあるステッカーが、ちょっとアバンギャルドで、このPCを学会会場に持ち込む勇気が出ませんでした。

今回は、座長を務めていた中央大学の先生からPCをお借りし、どうにか事なきを得ました。まさに九死に一生を得た思いです。

This time, I managed to get through it by borrowing a PC from the professor at Chuo University who was chairing the meeting. It was indeed a case of escaping death by a hair's breadth.

ただ、この問題は大学のプロジェクタ以外では発生しないのです。自宅のディスプレイでは全く問題なく映ります。これもまた腹立たしい話です。

However, this problem only occurs with the projector at the university. It shows perfectly fine on my home display. This is another annoying thing.

-----

ともあれ、私がこれから中央大学の教職員や学生の皆さんが困難に直面した際には、可能な限り力を尽くしてお助けしたいと思っています。

Anyway, I will do my best to help the faculty and students of Chuo University when they face difficulties.

「ひいき」というのは、このような個人的な経験や感謝から生まれていくものなのだなぁ、と実感しました。

I realized that “favoritism” is born from personal experiences and gratitude like this.

-----

それはさておき、当面の間、私の学会活動は続くと思われるため、まずはノートPCの問題を解決しなければなりません。

My academic activities will likely continue for now, so I must first solve the problem with my laptop.

しかし、正直なところ、もうPCにこれ以上お金をかけたくありません。これまでの人生で何台のPCを購入しては処分してきたか――考えたくもありません。

But honestly, I don't want to spend any more money on a PC. I don't want to think about how many PCs I've bought and disposed of.

私にとってPCは「常温で保管したバナナ」と同じくらい、あっという間に劣化するものです。そんなものに自腹を切るのは、非常に腹立たしいです。

To me, a PC deteriorates as quickly as a banana stored at room temperature. Paying for something like that out of my pocket makes me very angry.

とはいえ、購入するのであれば、せめてVSCodeでコーディングできる程度のスペックは欲しい、という欲が出てしまうのも事実です。

That said, if I buy one, I'll want it to have at least the specs to code with VSCode, which is also true.

とりあえず、USB(C-Type)のHDMI変換アダプタを試してみます。HDMIの不具合ごときで、気軽にノートPCを買い替えられるほど、私は裕福ではありませんから(ちなみに、試しました。失敗しました)。

I'll use a USB (C-Type) to HDMI conversion adapter for now. I'm not wealthy enough to replace my laptop casually because of an HDMI problem (by the way, I tried it, but it didn't work).

ともかく、HDMIの問題に頭を悩ませ続けた私は(それだけが原因ではないにせよ)結果的に疲弊しきっていました。

Anyway, I was exhausted due to having been troubled by the HDMI problem (even if that wasn't the only reason).

ホテル、HDMI、不完全燃焼のプレゼンテーション――これらが重なり、私の自尊心もすっかりボロボロです。

The hotel, the HDMI, and the incomplete combustion presentation combined to eradicate my self-esteem.

2024,江端さんの忘備録

いつ頃からから、出張などで慣れない土地に行くのが「面倒」と感じるようになりました。

From when did I start to feel that going to unfamiliar places for business trips and the like was “troublesome”?

というか、知らない土地で、予想できないことが起こるかもしれない、と、心配するのが、煩わしいです。

Or rather, I find it annoying to worry about the possibility of unexpected things happening in a place I don't know.

人間は、住み慣れた所に帰ってくると言いますが、つまるところ、『新しい土地で新しい生活を始めるのが、面倒くさい』のだろう、と思っています。

They say that people return to the places they are used to, but I think that, in the end, it's probably because 'starting a new life in a new place is troublesome.'

-----

一方、都市部への人口流入が止まりません。

Meanwhile, the population influx into urban areas shows no sign of stopping.

コロナ禍の最中に、地方移転現象が発生して、『あ、流れが変わったのかも』と思ったのですが、結局、元に戻ってしまったようです。

During the coronavirus pandemic, people moved to the countryside, and I thought, 'Oh, maybe the tide has turned,' but things have returned to normal.

もちろん、感染リスクが小さくなった今となっては、この流れは仕方がないのかもhしれませんが ―― 何も『完全に元に戻すことはないだろう』とも思うのですよね。

Of course, now that the risk of infection has decreased, this trend may be inevitable, but I also think that nothing will 'be completely restored to the way it was.'

ハイブリッド運用すればいいのに、と。

I wish they would use a hybrid operation.

義務教育や高等教育、または大学の講義にしても、折角、苦労して作ったリモート学習の仕組みです。もっと大いに活用して欲しい、と思います。

The remote learning system has been painstakingly created, whether it's compulsory education, higher education, or university lectures. I hope it will be used to its full potential.

-----

でも、私が衝撃を受けたのが「青少年の自殺数の増加」です。

However, what shocked me was the “increase in the number of youth suicides.”

「リモートと自殺率」に因果関係が立証された訳ではありませんが、主観的には関連があるように思えます。

Although a causal relationship between “remote work and suicide rates” has not been proven, it seems to be related subjectively.

SNSもその要因ではあるでしょうが、リモート環境がSNSの負の機能を増大していることは推測できます。

Although social networking services may be a factor, it can be assumed that the remote environment is increasing the opposing functions of social networking services.

つまるところ、(1)大都市人口集中、(2)リモート学習環境の撤収、(3)青少年の自殺率の増加の3点から見ても、私の「"リモート環境"礼賛」は、世間とズレているようです。

In the end, my “praise of the remote learning environment” seems to be out of step with the world when viewed from the three points of (1) the concentration of the population in large cities, (2) the removal of remote learning environments, and (3) the increase in the suicide rate among young people.

-----

で、まあ、なんで、今日、私がこんなことを愚痴っているかというと、新幹線に3時間乗車して、荷物を引き摺りながら歩いている今の状況が、なんとも『面倒くさい』のです。

So, why am I complaining about this today? The situation I'm in now, dragging my luggage along as I walk for three hours on the Shinkansen, is troublesome.'

そう、また、憂鬱な学会発表が始まるのです。

Yes, the depressing conference presentations are about to begin again.

―― リモート発表でいいじゃんか。なんで、何もかもリアルに戻すかなぁ

"Why do they have to make everything real again?"

私は、コロナ禍の機関、国際学会で英語発表2本、稼ぎました。

I made two English presentations at international conferences during the coronavirus pandemic.

海外の渡航が全面禁止された中での、国際学会の発表は ―― まあ、深夜に、自分の家の部屋の中でデタラメな英語を叫んでいて家族に迷惑かけたかもしれませんが ―― 正直、私にとってはパラダイスでした。

With overseas travel completely banned, presenting at an international conference was - well, I may have caused my family trouble by shouting nonsense in English in my room late at night - but honestly, it was paradise for me.

―― こんなに英語がダメダメな奴が、こんなもしょーもない質問しているなら、私も質問してみようかな

学会というは、先端の学問についての議論の場であり、過去の有用な手段を積極的に取り込むことのできる、知的水準の高い人達による会議ですよね。

Academic conferences are forums for discussing cutting-edge academic topics, and they are meetings of people with high intellectual standards who can actively incorporate helpful methods from the past.

『なんで、わざわざ過去に戻るんだ・・・』と、呪詛の言葉を吐きながら、今の私は、荷物を引きずっています。

'Why go back to the past on purpose...' I'm dragging my luggage around while cursing.

2024,江端さんの忘備録

若いころ、私にも友人というものがいました。

When I was young, I also had so-called "friends".

その友人と二人で、深夜の京都の街を泥酔しながら、声を張り上げて歌いながら学寮に帰ったのを覚えています。

I remember in the middle of the night, singing at the top of my voice while drunk with my friend, returning to the dormitory.

で、昨夜で、何十年かぶりで、その夢を見ました ―― かなり鮮明に。

So, last night, for the first time in decades, I had that dream - quite vividly.

ですので、

So,

『あいつ、昨夜、死んだのかもしれんなぁ』

'I wonder if he died last night...'

と思いました。

I thought.

今は、連絡を取りあっていないので、生死は不明です。

We are not in contact with each other now, so I don't know whether he is alive or dead.

そして、彼の生死は今後も不明のまま、いずれ私も死にます。

And his life or death will remain unknown in the future, and I will also die eventually.

-----

ともあれ、私の中では、彼は、死んだことにして、心の中で「葬式」をあげました。

Anyway, in my mind, I pretended he was dead and held a “funeral” in my heart.

『いい奴だったなぁ』と、彼のことを思い返しています。

I reflect on him and think, 'He was a good guy.

もし、彼がまだ生きていたとしたら、彼は怒るかもしれませんが ―― 私たちは、これでいいのです。

He might be angry if he were still alive - but we are OK with this.

時間と空間の行き尽く果てで、私は私を待っている

 

2024,江端さんの技術メモ

博多駅のNodeを選んで、GIS-DBを作りなおしてみたが、博多駅から西に抜けるwayがなかったので、抜けるNodeに接続するレコードを手動で作った。

Postgresql + PostGISのデータベースに、エントリを直接投入して、結線道路を一本作る

gidとosm_idは衝突しない数値を選んで、tag_idは、既存の数値を選ぶ(選ばないと弾かれる)

あとは、sourceとtargetからsource_osm、target_osm とそれぞれの座標を引っ張って、あとは、chatGPTに座標を入れると2点間の距離を教えてくれる。

この距離が、 length_m となる。 lengthは、length_m / 92854.2986 の値になる。 length = cost = reverse_cost となる。 cost_s,  reverse_cost_sは、時間を含めたコストらしいが、cost x 6685.509499 の値を入れておいた(まあ、どうでも言いのだろう)

あとthe_geomの値も、ChatGPTが教えてくれる。このSQL文を教えて貰った。

SELECT ST_AsEWKB(ST_MakeLine(
ST_SetSRID(ST_MakePoint(130.4210743, 33.5897456), 4326),
ST_SetSRID(ST_MakePoint(130.4206351, 33.5899416), 4326)
)) AS the_geom_hex;

で、最終的に、こうなった。

INSERT INTO ways (gid, osm_id, tag_id, length, length_m, name, source, target, source_osm, target_osm, cost, reverse_cost, cost_s, reverse_cost_s, rule, one_way, oneway, x1, y1, x2, y2, maxspeed_forward, maxspeed_backward, priority, the_geom)
VALUES (200001, 2000000001, 501, 0.000497554, 46.2, 'ebata', 44351 , 89839, 1882462094, 7992560451, 0.000497554, 0.000497554, 3.3264, 3.3264, NULL, 0, 'UNKNOWN', 130.4210743 , 33.5897456 , 130.4206351 , 33.5899416 , 10 , 10 , 0 , '0102000020E610000002000000f475CF70794D6040DE7AA8C87CCB404097c1BDD7754D60406446D33483CB4040');

で、上手く動いているようです。

SELECT seq, edge, b.the_geom AS "the_geom" FROM pgr_dijkstra('SELECT gid as id, source, target, cost, reverse_cost FROM ways', 51913,23498) a INNER JOIN ways b ON (a.edge = b.gid) ORDER BY seq;

として、

2013,江端さんの忘備録

私のパスワードは、長い間、「100年後の私を誰が知ろうか」を英語にして、その頭文字を取ったものでした。

「100年後の私を誰が知ろうか」の意味は、「だから、誰にどんな批評をされようとも、100年後には、私を含めて、その人達は一人残らず消えてなくなる」

―― だから、自分の行動基準に「人の目」を入れるのは止めよう。人の目を気にする生き方は止めよう。

という話を友人にしたことがあります。

しかし、彼は、「アホか」という目で、私を一瞥した後で

「その『100年間の評判』が大問題なんだろうが」と言いました。

私は、「あ、そういえば確かにそうか」と妙に納得したことを覚えています。

-----

昨日記載した、中島みゆきの「永久欠番」ですが、早速聞いてみました。

文部科学省さん。「慟哭」はいかがですか?

私は、上記のように「100年後」の概念には辿りついていたのですが、「100年前」という観念には届きませんでした。

さすがは、我が国が誇る歌姫です。

まあ、それはさておき。

-----

これまで、何度も書きましたが、私の信念は

「いつかどこかで、誰かが、私を、待っていない」

です。

「誰かがあなたを見ている」とか「誰かがあなたを愛している」とかいう歌が、嫌いなのです。

なぜか。

嘘だからです。

そんな「誰か」は、世界のどこにもいません。

-----

「永久欠番」は、「いつかどこかで、誰かが、私を、待っていない」を強く肯定しつつ、しかし、それでも、歌の最後のフレーズで、唯一の例外を提示しています。

多くの人は、この歌の最後のフレーズを、宗教的な救済と解しているようですが、私の解釈はちょっと違います。

-----

私は、「宇宙で、ただ一人、私だけは私を待っている」―― と、解釈したい。

分子のレベルで、自分の身体が土壌の中で分解し、

原子のレベルで、自分の精神が宇宙の熱量死の中で消え去ろうとも、

―― 時間と空間の行き尽く最後で、私は私を待っている

のである、と。

-----

時間と空間の、果ての、果ての、果てにおいても、

「自分に抱きしめて貰えるように」

そういう風に、私は私を生きたい、と思うのです。

2024,江端さんの忘備録

出生前検診について、私たち夫婦も随分考えたことがありました。

My wife and I also thought a lot about prenatal checkups.

結局、私たちは、出生前検診をしませんでした―― ただ、そう決めた、というだけです。

Ultimately, we didn't have prenatal check-ups - we just decided not to.

少なくとも、私は、他の人の出生前検診について、肯定も否定も評価も批判もしません。

At the very least, I neither approve of nor disapprove of, evaluate, or criticize other people's prenatal checkups.

-----

ただ、私の判断に、ちょっとだけ背中を押したことがあったとすれば、『子どもと嫁さんと一緒に生きていく日々を、公開していこうと思った』 ―― それくらいですね。

If anything pushed me a little towards making my decision, I thought, 'I want to share the days I spent living with my child.

私が毎日書いている、この日記(ブログ)は、結構、私の人生の「根っこ」だったりします。

This diary (blog) I write daily is quite the “root” of my life.

『他の人の』ではなく『私の』です。

It's 'my,' not 'someone else's.'

『包丁一本 晒(さらし)に巻いて』という感じで、『"index.html"一本、テキストのみで生きていく』で、私はいいんです。

2013,江端さんの忘備録

「中島みゆきの歌詞が、教科書に掲載されるらしいよ」と嫁さんから聞いたので、今、ちょっと調べたら、すでに著名な話のようでした。

私が嫁さんから聞いたのは「二隻の舟」だったと思うのですが、私が調べた範囲では、「永久欠番」が出てきました。

-----

嫁さん:「私だったら『時代』かな」

私:「何を言うか。彼女の歌だったら『シュガー』に決まっとろう」

嫁さん:「・・・『シュガー』。あの歌詞を、学校教科書に掲載するのは、ちょっと無理じゃない?」

私:「いや、今の若者に対して必要なメッセージは、『「唯一無二の夢」という硬直した考えから脱却せよ』だと思うぞ、私は」

-----

実際、「夢」というのは、複数に分散して、ポートフォリオを組んでおくべきなのです。

あたかも「一つの夢に固執して目指すということが最上の価値だ」などという「でたらめな価値観」を賞賛するから、若い人が苦しむことになる、と。

まあ、それはさておき。

-----

文部科学省の皆さんには、是非、次の曲の掲載の採用もご検討頂きたく。

「慟哭」 ―― 若者のストーカ化を防止する観点から

国語教師への教育指導要領には、

「振られたら、スッパリ諦めろ」

と教えるように記載して下さい。

2024,江端さんの技術メモ

第三章を20回ほど読み直して、方式よりメソッドの理解に努めました。

資料5 『非集計ロジットのRプログラム例』のMNLモデルのサンプルコードを拡張したものを使っていたのですが、上手く動かなかったので、GO言語で作ってみました。

/*
このプログラムは、Go言語を用いて多項ロジットモデル(Multinomial Logit Model, MNL)の推定を行い、以下の要素を計算・表示するものです。

### プログラムの主要な機能

1. **データ読み込み**
   - `loadData` 関数で、`transport_data.csv` ファイルからデータを読み込み、各選択肢の所要時間、費用、利用可能性、および実際に選択された結果を `Data` 構造体に格納します。

2. **対数尤度関数の定義**
   - `logLikelihood` 関数で、ロジットモデルの対数尤度関数を定義します。
   - 各選択肢について、効用を計算し、その効用に基づいた選択確率を計算します。実際の選択結果に基づいて対数尤度を計算し、最適化のために負の対数尤度を返します。

3. **初期尤度の計算**
   - `initialLogLikelihood` 関数で、選択肢が全て等確率(均等選択)で選ばれると仮定した場合の初期尤度を計算します。
   - 初期尤度は、モデルの改善度を測るための基準として使用します。

4. **ヘッセ行列の計算(数値微分による近似)**
   - `hessianMatrix` 関数で、数値微分を用いて対数尤度関数の二階微分からヘッセ行列を計算します。
   - `epsilon` は微小量として設定され、4つの関数値の組み合わせを使って二階微分を近似的に計算します。
   
5. **最適化の実行**
   - `optimize.Problem` 構造体を用いて、対数尤度関数を最小化(尤度最大化)する問題を定義します。
   - `optimize.Minimize` 関数で最適化を実行し、最適なパラメータを推定します。

6. **結果の表示**
   - 最適化が終了すると、次の項目が表示されます:
     - 最適化されたパラメータ
     - 最終対数尤度
     - ヘッセ行列
     - t値
     - 尤度比と補正済み尤度比

### t値の計算

- `t値` は、推定されたパラメータの統計的有意性を示す指標であり、各パラメータの推定値をヘッセ行列の対角要素の平方根で割ることで求められます。
- ヘッセ行列の対角要素が非常に小さい場合や不安定な値の場合、計算が `NaN` になるのを防ぐため、`diag > 1e-5` の条件で計算しています。

### 尤度比と補正済み尤度比

- **尤度比**:初期尤度と最終尤度の差を初期尤度で割ったもので、モデルがどれだけデータに適合しているかの指標です。
- **補正済み尤度比**:尤度比に、パラメータ数の補正を加えたものです。

### 実行結果の例

実行時には、次のような情報が出力されます:

1. **初期尤度**(均等選択の仮定による尤度)
2. **最適化されたパラメータ**
3. **最終尤度**(モデルの最大尤度)
4. **ヘッセ行列**(二階微分を基に計算された行列)
5. **t値**(推定パラメータの統計的有意性の指標)
6. **尤度比**および**補正済み尤度比**(モデルの改善度の指標)

### 全体の流れ

1. `transport_data.csv` からデータを読み込む。
2. 初期尤度と、最適化前の準備を行う。
3. `optimize.Minimize` 関数を使って対数尤度を最大化し、パラメータを推定する。
4. 最適化後の結果(パラメータ、最終尤度、ヘッセ行列、t値、尤度比)を表示する。

### 注意点

- このプログラムは `gonum` パッケージを使用しているため、事前に `gonum` をインストールしておく必要があります。
- ヘッセ行列の数値微分による計算には誤差が生じやすく、`epsilon` の設定を適切に行う必要があります。

*/

package main

import (
	"encoding/csv"
	"fmt"
	"log"
	"math"
	"os"
	"strconv"

	"gonum.org/v1/gonum/mat"
	"gonum.org/v1/gonum/optimize"
)

// データ構造体の定義
type Data struct {
	所要時間  [6]float64
	費用    [6]float64
	利用可能性 [6]int
	選択結果  int
}

// データの読み込み
func loadData(filename string) ([]Data, error) {
	file, err := os.Open(filename)
	if err != nil {
		return nil, err
	}
	defer file.Close()

	reader := csv.NewReader(file)
	records, err := reader.ReadAll()
	if err != nil {
		return nil, err
	}

	// データの解析
	var data []Data
	for _, record := range records[1:] { // ヘッダをスキップ
		var d Data
		for i := 0; i < 6; i++ {
			d.所要時間[i], _ = strconv.ParseFloat(record[7+i], 64)
			d.費用[i], _ = strconv.ParseFloat(record[13+i], 64)
			d.利用可能性[i], _ = strconv.Atoi(record[1+i])
		}
		d.選択結果, _ = strconv.Atoi(record[0])
		data = append(data, d)
	}

	return data, nil
}

// 対数尤度関数の定義
func logLikelihood(x []float64, data []Data) float64 {
	// パラメータの取得
	b := x[:6] // 定数項
	d1 := x[6]
	f1 := x[7]
	epsilon := 1e-10
	LL := 0.0

	for _, d := range data {
		// 効用の計算
		var v [6]float64
		for i := 0; i < 6; i++ {
			v[i] = b[i] + d1*(d.所要時間[i]/10) + f1*(d.費用[i]/10)
		}

		// 各選択肢の効用
		var vehicle [6]float64
		var deno float64
		for i := 0; i < 6; i++ {
			if d.利用可能性[i] == 1 {
				vehicle[i] = math.Exp(v[i])
				deno += vehicle[i]
			}
		}
		deno += epsilon

		// 選択確率の計算と対数尤度の加算
		selected := d.選択結果 - 1
		if selected >= 0 && selected < 6 {
			P := vehicle[selected] / deno
			LL += math.Log(P + epsilon)
		}
	}

	return -LL // 最小化のため、対数尤度を負にする
}

// 初期尤度の計算
func initialLogLikelihood(data []Data) float64 {
	numChoices := 6
	initialProb := 1.0 / float64(numChoices)
	L0 := float64(len(data)) * math.Log(initialProb)
	return L0
}

// ヘッセ行列の計算(数値微分)
func hessianMatrix(f func([]float64) float64, x []float64) *mat.Dense {
	n := len(x)
	hessian := mat.NewDense(n, n, nil)
	epsilon := 1e-7 // 微小量を小さめに調整

	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			x1 := make([]float64, n)
			x2 := make([]float64, n)
			x3 := make([]float64, n)
			x4 := make([]float64, n)
			copy(x1, x)
			copy(x2, x)
			copy(x3, x)
			copy(x4, x)

			x1[i] += epsilon
			x1[j] += epsilon
			x2[i] += epsilon
			x2[j] -= epsilon
			x3[i] -= epsilon
			x3[j] += epsilon
			x4[i] -= epsilon
			x4[j] -= epsilon

			f1 := f(x1)
			f2 := f(x2)
			f3 := f(x3)
			f4 := f(x4)

			hessian.Set(i, j, (f1-f2-f3+f4)/(4*epsilon*epsilon))
		}
	}

	return hessian
}

func main() {
	// データの読み込み
	data, err := loadData("transport_data.csv")
	if err != nil {
		log.Fatalf("データの読み込みに失敗しました: %v", err)
	}

	// 初期尤度の計算
	L0 := initialLogLikelihood(data)
	fmt.Printf("初期尤度: %.4f\n", L0)

	// 初期パラメータの設定
	b0 := []float64{0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.01, 0.01}

	// 最適化問題の設定
	problem := optimize.Problem{
		Func: func(x []float64) float64 {
			return logLikelihood(x, data)
		},
	}

	// 最適化の実行
	result, err := optimize.Minimize(problem, b0, nil, nil)
	if err != nil {
		log.Fatalf("最適化に失敗しました: %v", err)
	}

	// 結果の表示
	fmt.Println("パラメータ:", result.X)
	fmt.Println("最終尤度:", -result.F) // 対数尤度は負にしているため、正に戻す

	// ヘッセ行列の計算
	hessian := hessianMatrix(problem.Func, result.X)
	fmt.Println("ヘッセ行列:")
	fmt.Printf("%v\n", mat.Formatted(hessian, mat.Prefix(" ")))

	// t値の計算(対角要素が小さい場合は NaN の出力を回避)
	tValues := make([]float64, len(result.X))
	for i := 0; i < len(result.X); i++ {
		//diag := -hessian.At(i, i)  // 負数だと失敗する t値: [NaN NaN NaN NaN NaN NaN NaN NaN]
		diag := hessian.At(i, i) // この値だと t値: [0.27283268674968236 0.4899627491877213 NaN 0.5670961673406928 0.5233519195569353 0.4461558961138306 2.2512263380604414e-07 0.00010138601282162748]となる
		/*
			ChatGPTのご意見

			ヘッセ行列の対角要素は、対数尤度関数の二階微分を表します。尤度関数の最大化問題において、対数尤度関数の最大点近傍では、通常、二階微分は負になります。
			これにより、ヘッセ行列の対角成分も負になる傾向があります。このため、-hessian.At(i, i) として二階微分の符号を反転し、正の値を使うことで、t値 の計算が可能になるのです。
			diag := +hessian.At(i, i) を用いることで t値 の計算が安定する場合があることから、この方法を適用するのは合理的です。
			この修正により、数値計算上の不安定性が軽減され、t値 の NaN が減少する結果になっています。このまま diag := +hessian.At(i, i) の設定を維持するのが適切でしょう。
		*/

		fmt.Println("diag:", diag)
		if diag > 1e-5 { // 計算が安定する閾値を設定
			tValues[i] = result.X[i] / math.Sqrt(diag)
		} else {
			tValues[i] = math.NaN() // 計算が不安定な場合は NaN を設定
		}
	}
	fmt.Println("t値:", tValues)

	// 尤度比と補正済み尤度比の計算
	LL := -result.F
	likelihoodRatio := (L0 - LL) / L0
	adjustedLikelihoodRatio := (L0 - (LL - float64(len(result.X)))) / L0
	fmt.Printf("尤度比: %.4f\n", likelihoodRatio)
	fmt.Printf("補正済み尤度比: %.4f\n", adjustedLikelihoodRatio)
}

データ(transport_data.csv)はこんな感じでした。

SELECT,TAXI,DRV,BIKE,BIC,WALK,BUS,TAXI_TIME,DRV_TIME,BIKE_TIME,BIC_TIME,WALK_TIME,BUS_TIME,TAXI_COST,DRV_COST,BIKE_COST,BIC_COST,WALK_COST,BUS_COST
2,1,1,1,1,1,1,480,180,300,360,1650,3360,563.22,318.16,6.05,2.42,1.21,210.00
6,1,1,1,1,1,1,180,150,240,300,1380,2760,500.00,317.02,5.67,2.27,1.13,210.00
5,1,1,1,1,1,1,90,60,120,150,720,900,500.00,309.33,3.11,1.24,0.62,210.00
2,1,1,1,1,1,1,450,120,180,210,840,2310,500.00,309.40,3.13,1.25,0.63,210.00
6,1,1,1,1,1,1,300,150,240,330,1470,870,500.00,317.06,5.69,2.27,1.14,210.00
6,1,1,1,1,1,1,330,180,270,330,1530,2040,500.00,317.06,5.69,2.27,1.14,210.00
6,1,1,1,1,1,1,330,210,330,420,1890,2340,593.18,319.66,6.55,2.62,1.31,210.00
6,1,1,1,1,1,1,300,180,330,420,1890,1410,593.18,319.66,6.55,2.62,1.31,210.00
6,1,1,1,1,1,1,450,120,210,270,1290,31770,500.00,315.31,5.10,2.04,1.02,210.00
6,1,1,1,1,1,1,450,150,240,270,1290,1920,500.00,315.31,5.10,2.04,1.02,210.00
6,1,1,1,1,1,1,90,60,90,90,390,24630,500.00,305.88,1.96,0.78,0.39,210.00

で計算結果は、10秒ほどで出てきました。

G:\home\ebata\tomioka3B\src\others\main102>go run .
初期尤度: -1014.1359
パラメータ: [2.2058979412543716 5.024455710944181 -25.15815870069447 4.874931119599283 7.05844290286456 6.064128738785668 0.0007331345928576025 0.03238097122760465]
最終尤度: -678.9446456155601
ヘッセ行列:
? 65.36993168992923 -11.368683772161605 0 5.684341886080802 -5.684341886080802 17.053025658242408 -1082.867129298393 378.00873542437336?
? -11.368683772161605 105.16032489249484 0 -14.210854715202005 -14.210854715202005 -19.89519660128281 -9362.111086375082 1477.9288903810086?
? 0 0 0 0 0 0 0 0?
? 5.684341886080802 -14.210854715202005 0 73.89644451905043 -5.684341886080802 28.42170943040401 -2611.9550966541287 -335.37617127876734?
? -5.684341886080802 -14.210854715202005 0 -5.684341886080802 181.89894035458568 -93.79164112033324 -2444.267011014745 -3129.2302082874817?
? 17.053025658242408 -19.89519660128281 0 28.42170943040401 -93.79164112033324 184.74111129762608 15529.622032772751 1568.8783605583014?
? -1082.867129298393 -9362.111086375082 0 -2611.9550966541287 -2444.267011014745 15529.622032772751 1.0605450029288478e+07 -26716.40686457977?
? 378.00873542437336 1477.9288903810086 0 -335.37617127876734 -3129.2302082874817 1568.8783605583014 -26716.40686457977 102005.51514572?
diag: 65.36993168992923
diag: 105.16032489249484
diag: 0
diag: 73.89644451905043
diag: 181.89894035458568
diag: 184.74111129762608
diag: 1.0605450029288478e+07
diag: 102005.51514572
t値: [0.27283268674968236 0.4899627491877213 NaN 0.5670961673406928 0.5233519195569353 0.4461558961138306 2.2512263380604414e-07 0.00010138601282162748]
尤度比: 0.3305
補正済み尤度比: 0.3226

ーーーーー

これを説明すると、
2.2058979412543716 → b_taxi
5.024455710944181 → b_drv
-25.15815870069447  →  b_bike
(以下省略)

となっており、
0.0007331345928576025 → d1
0.03238097122760465 → f1

効用関数は、次のようになります。

で、これをどう使うかは、以下の通り(ここからは分かった→シミュレータで使い倒すところ)

で、最後にパラメータの説明ですが、

となるようです。

ーーーーーーー

初期尤度: -1014.1359 と 最終尤度: -678.9446456155601の意味と意義は以下の通り。

======

今回の計算では、初期尤度: -1014.1359 に対して、最終尤度: -678.9446456155601が小さくなっているので、パラメータを使った方が良い、というのは理解できました。その場合、この
尤度比: 0.3305
および
補正済み尤度比: 0.3226
は何を表わしているか、は以下の通り。

======

負数値がついているので分かりにくいけど、
初期尤度: -1014.1359 → 最終尤度: -678.9446456155601 は、値が335も大きくなったということになります

======
尤度をもっとも簡単に説明する方法

つまるところ、偏ったコインを作る = パラメータをつけくわえる、という理解で良いようです。

=====

ところで、今回作成して頂いたモデルでマルチエージェントシミュレーションのエージェントに適用させたい場合、何を入力値として、エージェントの交通選択を選ぶことになるか?

"所要時間"と"費用"を入力値とすれば良い。

t値: [0.27283268674968236 0.4899627491877213 NaN 0.5670961673406928 0.5233519195569353 0.4461558961138306 2.2512263380604414e-07 0.00010138601282162748] のように値が小さいです

t値を大きくするためには、以下の3つの具体的なアプローチが考えられます。それぞれ、具体例を交えて説明します。

1. 標本数を増やす
標本数(サンプル数)を増やすと、t値が増加する可能性が高まります。これは、標本数が増えることで推定の**標準誤差が小さく**なり、結果としてt値が大きくなるためです。

- 例: ある多項ロジットモデルで、交通手段の選択確率を説明するための「時間」と「費用」の変数があるとします。最初のサンプル数が50の場合、時間の係数に対するt値が1.8で有意ではなかったとします。標本数を100に増やすと、標準誤差が小さくなり、同じ係数であってもt値が2.5になり、有意となる可能性が高まります。

2. 変数のスケールを調整する
変数のスケールを調整することで、標準誤差を減らしt値を大きくすることができます。特に、変数の分布が狭い範囲に集中している場合、その変数をスケール調整すると係数の推定がより安定します。

- 例: 収入に関するデータが1000円単位で表されているとします。この場合、係数の標準誤差が大きくなりやすいことがあります。これを1万円単位にスケール変換すると、収入の変動がモデルに対してより明確に影響し、標準誤差が小さくなることでt値が増える可能性があります。

 3. 説明変数の分散を大きくする
説明変数の値が全体として似通っている場合(例えば、分散が小さい場合)、t値が小さくなりやすいです。このため、変数の分散を増やすようにデータを調整することも効果的です。可能であれば、サンプルに多様な値を含むようにデータを収集します。

- 例: 交通手段の選択モデルにおいて「通勤距離」を変数に入れたとします。もしすべてのサンプルがほぼ同じ距離(例えば、全員が2~3 kmの範囲)であれば、分散が少なくt値も小さくなります。データ収集の際に5~10 kmなどの多様な距離を持つサンプルを増やすことで、距離の変化に応じた係数の影響が明確になり、t値が大きくなることが期待できます。

これくさいなぁ。今回の移動距離は、高々1km以内だったからなぁ。終端距離まで入れると変わるかもしれん

---

これらの方法は、すべて統計的にt値を大きくするために役立ちますが、注意が必要です。無理にt値を大きくすることは、分析結果の解釈を歪める可能性もあるため、変数やデータの内容、意味を十分に理解した上で適用することが重要です。