2023,江端さんの忘備録

Pythonは、統計計算ライブラリが充実しています。

Python has an extensive statistical computing library.

『いきなり何の話 ?』と思われるかもしれませんが、この話の続きになります。

You may be thinking, "What is Ebata starting to talk about?

『ChatGPTは、もの凄く真摯な言葉で、嘘をつく』

『ChatGPTは嘘をつく』どころか、Pythonの統計ライブラリのコードに関して言えば『ChatGPTはもの凄い』。

ChatGPT is awesome" regarding Python statistical library code, not just "ChatGPT lies.

-----

(Q1) np.random.randint(0, 5, GENOMS) の意味は?

(Q1) What does np.random.randint(0, 5, GENOMS) mean?

(Q2) pythonで1次元の行列を多次元にするには?

(Q2) How to make a one-dimensional matrix multidimensional in Python?

(Q3) pythonで1次元の行列を多次元する場合、行数だけ分かっている場合には?

(Q3) What if I want to make a one-dimensional matrix multidimensional in Python, and I only know the number of rows?

(Q4) 行列の要素を標準偏差値に変換するには?

(Q4) How do I convert matrix elements to standard deviation values?

(Q5) 算出した標準偏差値行列から固有値を計算するには?

(Q5) How do I calculate eigenvalues from the estimated standard deviation matrix?

(Q6) Pythonを使って算出した標準偏差値から因子分析を行うには?

(Q6) How can I perform a factor analysis from standard deviation values calculated using Python?

で、ChatGPTが提示したコードの『全て』が、動きました ―― いいですか。『全て』ですよ、『全て』。

So, "all" of the codes presented by ChatGPT worked -- OK? It is "All".

―― 今の私なら"ChatGPT教"に入信する

"I would join the ChatGPT cult now."

と、確信できるレベルです。

I am confident about it.

-----

では、このChatGPTを"神"のレベルに押し上げたのは誰か?

So, who has raised ChatGPT to the level of "God"?

もちろん、ChatGPTを制作されたOpenAIの皆さんであることは言うまでもありません。

It is the OpenAI people who produced ChatGPT.

しかし、その神を支えているのは、実は、私(たち)エンジニアなんです。

But It is engineers who support that God.

数多くのプログラムコードを、(著作権がどうのこうのと言うことなく)惜しげもなくネットに公開してきた、多くのエンジニアです。

Many engineers have generously released their program code online (without copyright concerns).

私が書いてきた『不快なコード』も ―― その貢献は、ほんとにささいなものかもしれませんが、役に立っているはずなのです。

The "uncomfortable" that I wrote -- its contribution may be trivial, but it must have been useful.

「作成プロセス途中の、小さくて、汚い、のソースコードを残して下さい」

そう考えると、痛快です。

That makes me happy.

-----

私の作った、汚い書き込みだらけのードは、今、第319世代の計算を終えて、私の当初目標の2倍近くの精度のデータ出力に成功しています。

My messy, write-filled Python code has now completed the 319th generation of calculations and is successfully outputting data with nearly twice the accuracy of my original goal.

あ、今、2倍を超えた。

Oh, now it's over twice as much.

"Generation: 328: Best fitness: 20.229819753125508. Worst fitness: 2.800005438880445"

高速化やら、スケールアップやら、課題は山積だけど、それは、これから考えればいいです。

Many issues must be addressed, such as increasing speed, scaling up, etc., but I will figure out that in the future.

先ずは、嬉しかったことを、ちゃんと喜ぼう。

First of all, let's feel happy about what makes me happy.

今からダイニングで、ノンアルビールで、一人で乾杯してきます。

I'm now off to the dining room to toast myself with a non-alcoholic beer.

2023,江端さんの忘備録

私が開示しているコードが「不快」と思われるのは、仕方がないです。

I can't help but if you think the code I am disclosing is "offensive."

―― 人のプログラムを読むことは、他人の人体を切り開いて、脳味噌や内蔵を覗きこむような不快感がある

私は「コードは動きさえすればいい」と思っていますし、コードの後片付けは敢えてしません。

I believe "code is good as long as it works," and I dare not clean up after code.

もっとも大切なことは、『後で私が思い出せること』だからです。

The most important thing is 'what I can remember later.'

「作成プロセス途中の、小さくて、汚い、のソースコードを残して下さい」

『過去の私と現在の私の間で行われる、共同開発』

-----

それでも、本当に稀ですが、私のコードを理解して動かそうとして、何週間もがんばってくれている人もいます。

Still, it is rare, but some people have been trying for weeks to understand my code and get it to work.

私も、そのような方の質問には、できるだけ答えするようにしています。

I try to answer questions from such people as much as possible.

私のコードを、ご自分の環境で無事動かした方には、『おめでとう & ありがとうメール』や、直接電話をして、祝辞を贈っています。

I congratulate those who have successfully run my code in their environment with a "Congratulations & Thank You Email" or by calling them directly.

ここ2年くらいで2人くらいしかいませんが(ちなみに、ソフト外注の皆さんは、仕事なので、この人数に含んでいません)。

However, there have only been about two of us in the last two years or so (by the way, this number does not include everyone at the software outsourcing company).

-----

比して ――

Compared to the above,

私が開示したコードに『不快』と言ってきた奴

You who said "offended" to me about the code I disclosed

私は、奴を絶対に許さない ―― 絶対に

I will never forgive you -- absolutely.

2023,江端さんの忘備録

https://aravisproject.github.io/aravis/building.html
と、
cam@cam-desktop:~/download/aravis-0.8.10$README.md

の内容を参照にして、ざっくり以下の内容を実施しました。

(Step.1)
https://download.gnome.org/sources/aravis/ から、https://download.gnome.org/sources/aravis/0.8/ の LATEST-IS-0.8.10(最新であれば良い)から、aravis-0.8.10.tar.xz をダウンロードして、解凍。(私は、:~/download/にダウンロード)

(Step.2) cam@cam-desktop:~/download/aravis-0.8.10$ で、

$ meson setup build
$ cd build
$ ninja
$ ninja install
$ sudo ldconfig

$ sudo apt install libxml2-dev libglib2.0-dev cmake libusb-1.0-0-dev gobject-introspection \
libgtk-3-dev gtk-doc-tools xsltproc libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev \
libgirepository1.0-dev gettext
 として、

cam@cam-desktop:~/download/aravis-0.8.10/build$ ninja test

実行すると
[0/1] Running all tests.
1/6 aravis:main / evaluator OK 0.07s
2/6 aravis:main / buffer OK 0.06s
3/6 aravis:main / misc OK 0.08s
4/6 aravis:main / genicam OK 0.20s
5/6 aravis:main / fake FAIL 1.60s killed by signal 6 SIGABRT
>>> MALLOC_PERTURB_=127 /home/cam/download/aravis-0.8.10/build/tests/fake
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― ✀ ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
stdout:
# random seed: R02S5b8ac58722df24f3d23b19ba049cf5e1
1..8
# Start of fake tests
ok 1 /fake/trigger-registers
ok 2 /fake/registers
ok 3 /fake/fake-device
ok 4 /fake/fake-device-error
ok 5 /fake/fake-stream
ok 6 /fake/camera-api
ok 7 /fake/camera-device
Bail out! ERROR:../tests/fake.c:592:set_features_from_string_test: assertion failed: (success)
stderr:
**
ERROR:../tests/fake.c:592:set_features_from_string_test: assertion failed: (success)
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

6/6 aravis:network / fakegv OK 8.68s

Summary of Failures:

5/6 aravis:main / fake FAIL 1.60s killed by signal 6 SIGABRT

Ok: 5
Expected Fail: 0
Fail: 1
Unexpected Pass: 0
Skipped: 0
Timeout: 0

Full log written to /home/cam/download/aravis-0.8.10/build/meson-logs/testlog.txt
FAILED: meson-test
/usr/bin/meson test --no-rebuild --print-errorlogs
ninja: build stopped: subcommand failed.

てな感じで、失敗しますが、そのまま続けます。

cam@cam-desktop:~/download/aravis-0.8.10/build/gst$ に移動して、

一度、カメラのUSBを抜いて、再度差してから、

cam@cam-desktop:~/download/aravis-0.8.10/build/gst$ ./gst-aravis-launch aravissrc  ! "video/x-raw, format=GRAY8,width=640,height=480,framerate=4/1" ! videoconvert ! ximagesink

で、映像が出てきます。

image.png

ピント等がブレブレですが、遅延はほとんどないようです。

とりあえず、ホッとしています。

SRT通信もできるようです。

cam@cam-desktop:~/download/aravis-0.8.10/build/gst$ ./gst-aravis-launch aravissrc ! "video/x-raw, format=GRAY8,width=640,height=480,framerate=4/1" ! videoconvert ! x264enc tune=zerolatency key-int-max=30 ! mpegtsmux ! srtserversink uri="srt://:12345" latency=500

カラー表示も出てきました。

cam@cam-desktop:~/download/aravis-0.8.10/build/gst$ ./gst-aravis-launch aravissrc ! "video/x-raw, format=RGB ,width=640,height=480,framerate=30/1" ! videoconvert ! x264enc tune=zerolatency key-int-max=30 ! mpegtsmux ! srtserversink uri="srt://:12345" latency=500

2023,江端さんの忘備録

どこかで犯罪が発生すると、ニュースで、その近所の人に対して、被疑者に関するインタビューが放送されます。

Whenever a crime occurs, the news broadcasts an interview about the suspect to the neighbors.

私は、この手のインタビューには絶対に応じませんし、家族にも応じないように言っています。

I would never respond to this interview and have told my family not to do it.

その映像が、『その後、どのように使われるか』分かったものではないからです。

We don't know how the images will be used afterward.

もし、被疑者にネガティブなコメントをした挙句、その事件が『20年後に再審で冤罪が確定判決』になろうものなら ―― そのインタビューに応じた人は『冤罪を誘発した人物』として、視聴者に記憶されることになります。

If a negative comment is made about a suspect and the case is "retried 20 years later, and the defendant is falsely convicted," - viewers will remember the interviewee as "the person who provoked the false conviction.

-----

最近、近所で『良い人』とされている人間による重大犯罪が報道されることが多いように思えますが ―― これ、恣意的な報道(偏向報道)の一例です。

Lately, there seem to be many reports of serious crimes committed by people considered 'good people' in the neighborhood -- this is an example of arbitrary reporting (biased reporting).

なぜか?

Why 'biased reporting'?

―― ご近所で、礼儀正しくて、大人しくて、目立たない人物による凶悪犯罪の方が、圧倒的に面白いから

"Because it is by far more interesting to make it a violent crime committed by a polite, quiet, inconspicuous person in your neighborhood."

です。

面白い方が、視聴率が稼げます。

The more interesting it is, the more ratings it will earn.

それ故『偏向報道』なのです。

Hence, it is 'biased reporting.

-----

私:「私が殺人事件を起こしたら、近所の人はインタビューに何と答えるかな?」

Me: "What would my neighbors say in an interview if I committed a murder?"

嫁さん:「『やっぱり・・・』、『いつかやると思っていたんですよ』、『挨拶もしないし、目付きも悪い人でした』、『町内会では、いつもトラブルメーカーでした』・・・」

Wife: "'I knew it...', 'I knew he was going to do it someday,' 'He never greeted me and had a bad eye,' 'He was always a troublemaker in the neighborhood association'..."

私:「もういい」

Me: "Enough."

―― 「遠山の金さん "冤罪"捕物帳」

2023,江端さんの忘備録

10年、100億円の費用をかけて、8割方開発が進んだ国家プロジェクトあったとします。

Suppose a national project took ten years and cost 10 billion yen, and 80% of the development had been completed.

―― その時、突如として、0.5億円(5000万円)程度の予算で、開発1ヶ月間で、現在のプロジェクトの3倍の効果が得られる新技術が登場する

Then, suddenly, a new technology appears that can triple the effectiveness of the current project with a budget of about 0.5 billion yen (50 million yen) and within one month of development

ということが、テクノロジーの世界では、結構な頻度で発生します。

This happens quite often in the world of technology.

『100億円、10年の日時と人材が、一瞬にゴミとなる』 ―― ここに、イノベーションの怖さがあります。

Ten billion yen, ten years, and human resources can be turned into garbage instantly" -- herein lies the fear of innovation.

(これは、あの"イノベーションのジレンマ"とは異なります)。

(This is different from the "innovation dilemma.)

しかも、そのようなイノベーションは、出現予測ができません。

Moreover, such innovations cannot be predicted to emerge.

ええ、もう、全然、予想できません。

Yeah, I can't predict it at all anymore.

例えば、昨年の今頃に『生成AIの出現と社会へのインパクト』を予想した人は、私が知る限り一人もいません。

For example, no one, as far as I know, predicted the 'emergence of generative AI and its impact on society' this time last year.

-----

規模や対象は全く異なるのですが、私にも似たようなことが起きます。

Something similar happens to me, although the scale and subject matter differ.

一週間、昼夜ぶっつづけで、ありとあらゆる方法をやりつくして『もうダメだ』という結論を纏めた報告書を書き終えた直後 ――

Just after I had finished writing a report that concluded that I had exhausted all possible methods, working day and night, and had come to the conclusion that "it was hopeless,"

『気紛れに試した方法で、課題が一瞬で解決してしまった』という目に会っています。

I am confronted with a situation where "a method I tried on a whim solved the problem instantly.

これは、もちろん技術者としては「幸せな話」なのですが、サラリーマンとしては「不幸な話」なのです。

This is, of course, a "happy story" for an engineer but an "unhappy story" for a businessman.

-----

イノベーションに社会が翻弄されるのは、仕方がないでしょう。

It is no wonder that society is at the mercy of innovation.

しかし、それ以上に、イノベーションのフロントに立っているエンジニアは、「仕方がない」などと言っていられないのです。

But more than that, the engineers on the front lines of the invention cannot say, "It cannot be helped."

正直なところ、

Honesty, I want to shout

―― 冗談じゃない!

"No kidding!"

と叫びたくなります。

―― うるさい!『イノベーションの作り方』なんぞどうでもいいから、お前の考えた『イノベーションそのもの』を教えろ!

2023,江端さんの忘備録

私は、気にいったモノは、とことん使い倒すタイプで、腕時計など、同じモノを3つ購入しています。

I am the type of person who uses up things I like to the fullest, and I have purchased three identical watches and other items.

一つは、(亡き)父にプレゼントしましたが、 ―― そうだとしても、3つは数が合いません(2つなら分かるのですが)。

One was a gift to my (late) father, but -- even if so, three doesn't count (although two would make sense).

この時計、電波時計で、文字が大きく、なにより安い(4000円弱)です。

This clock is radio-controlled, has large letters, and, most importantly, is inexpensive (less than 4,000 yen).

しかし、電池交換をすると2000円以上、バンド交換をしても同程度のコストがかかりますので、それを考えると、『使い捨て』が正しい用途なのだと思います。

However, replacing the battery costs more than 2,000 yen, and replacing the band costs about the same, so considering this, I think "disposable" is the correct use.

------

話を戻しまして、上記の「2つ」と「3つ」の違いなのですが、『電池切れになったので購入したものの、自分で電池交換したら動いてしまった』あたりがオチではないか、と思い、過去の日記を調べてみました。

Back to the story, the difference between the "two" and the "three" above, I thought it might be around "I bought another watch because the battery of the first watch ran out, but it worked after I changed the battery of the first by myself," so I checked my past diaries.

当たりでした。

It was a hit.

で、今回 ―― 「自分で電池交換してみようかな」と思いました。

で、私が、自力で電池交換やら、バンド交換している理由も、すでに記載していました。

And I have already mentioned why I am replacing batteries and bands alone.

―― 空腹で、気を失っている

-----

先日、1つが電池切れになって、もう一つがバンド切れになりましたので、それぞれ電池交換とバンド交換をしました。

One recently ran out of battery, and the other ran out of band, so I replaced the battery and band.

ゴムのバンドは、1年くらいで切れてしまうので、今回は、布のバンドに挑戦してみました。

The rubber bands would break after about a year, so I tried fabric bands this time.

送付されてきたものを見た時、『誤発注した』と思ったのですが、カスタマレビューを読みながら、このベルトの仕組みを理解しました。

When I saw what was sent to me, I thought, 'I ordered the wrong belt,' but as I read the customer reviews, I understood how this belt works.

「こういう仕組みのバンドなんだ」と納得して、無事にバンド交換を完了することができました。

I was convinced that "this is how the band works," and I completed the band replacement successfully.

-----

ボロボロで、液晶表示も欠けていて、各所を瞬間接着剤補強されている、私の可愛い大切な腕時計たちです。

They are my precious watches that are battered, missing LCDs and have been reinforced with superglue in various places.

『100万円のブランド時計と交換してくれ』と言われても、『だが、断わる』と言い切れます。

Even If someone says, 'Trade me a million yen for a brand-name watch,' I can say, 'But I refuse.'

-----

私の寿命と、この時計たちの寿命 ―― どっちが長いか? 勝負です。

My lifespan or the lifespan of these watches -- which is longer? It's a game.

私が死ぬ時に、この時計がまだ動いていたら ―― 私の勝ちです。

If this clock is still running when I die -- It is my win.

2018,江端さんの忘備録

(昨日の続きです)

(Continuation from yesterday)

食費が高いからといって、長年お世話になった人をゴミとして廃棄する ―― これは人道的・・ではなくて、IoT的にどうだろうか。

Just because food costs are high, we discard people who have been indebted for many years as garbage. This is not for humanism but for IoT engineer.

で、今回 ―― 「自分で電池交換してみようかな」と思いました。

So, this time - "I thought I'd try to replace battery by myself".

仮に、電池交換に失敗して、時計を壊すことになっても、これが、長いこと、お世話になった時計に対する私なりの「恩返し」です。

Even if I fail to replace the battery and destroy my watch, this is my "gratitude" for my watch that I have taken care of for a long time.

-----

Amazonで電池(143円)を購入して、YouTubeで映像見ながら、電池交換を試みました。

I bought a battery (143 yen) at Amazon.com and attempted to change the battery by watching the video on YouTube.

映像通りには上手く交換できませんでした。

I could not replace it as I expected.

ほとんど無理矢理に金具を引き剥して、電池を引き抜き、新しい電池を差し込みました。

I pulled the metal fitting almost, forcibly pull out the battery, and inserted a new battery.

-----

2台の時計は、今、元気よく動いています。

The two clocks are moving cheerfully now.

毎日電波を受信して時刻合わせもしていますし、バックライトもちゃんと点滅するようになり、アラーム音も確実に鳴るようになりました。

They can receive the radio waves everyday and adjust the correct time. the backlight also flashes properly, and the alarm sound is clear.

両方とも、今回の電池交換ではかなり無茶をしましたので、次は動かないかもしれませんが、

Both of them did considerably unreasonable in this battery exchange, so it may not do well,

こうやって、自分で動かし直した時計というのは、そうでない時計よりも、何倍も「可愛い」のですよ。

In this way, the watch I have fixed by oneself is many times "cute" than a watch that I have not.

2018,江端さんの忘備録

私は、"CASIO 腕時計 WAVE CEPTOR 電波時計 MULTI BAND5 デジタルモデル WV-58J-1AJF メンズ"を愛用しております。

I always use a watch, ""CASIO Watch WAVE CEPTOR Radio Watch MULTI BAND 5 Digital Model WV-58J-1AJF for Mens".

先ほど、Amazonで過去の履歴を調べたら、私は全く同じ時計を3台購入していました。

After examining past history at Amazon, I have already bought three same watches.

1台は父用に、あとの2台も、すでにバンドの結合部が欠落しています。

One for my father, the others for myself, the junction of the band has already been lost.

時計屋に持っていくと、「修理するより購入した方が安い」と言われます ―― 残念ですが、これは事実です。

Taking it to the watch shop, the clerk tells me "it is cheaper to purchase than to repair". Unfortunately, it is true.

ですから、Amazonで、結合部品(10本入り180円)を購入して、接着剤で強制的にバンドを結合しています。

So, I purchased bonded parts (180 yen for 10 pieces) at Amazon, and forcibly join the band with glue.

最近、その2台が、立て続けに電池切れとなりました(なんどか、2005年1月1日にリセットされ、そして全く表示が出てこなくなった)

Recently, the two batteries have run out of batteries in a row.(It was reset on January 1, 2005, and no display came out at all)

電池切れとなったら、買い替えをしようと思っていました。

When the battery runs out, I was planning to replace it.

電池交換のコストも、結構な金額になるからです(特に防水処理を維持すると、はやり「修理するより購入した方が安い」ことになります。

The cost of replacing the batteries is also a reasonable amount(Especially when maintaining the waterproof treatment, it also becomes "it is cheaper to purchase than to repair".

-----

コスト的には、これらの時計を廃棄をして、新品を購入するのが正しい行動ですし、引いては、このような行動は、日本経済の景気にも資することになります。

Costly, it is correct behavior to discard these watches and purchase new items, In other words, such actions will also contribute to the economy of the Japanese economy.

しかし、この時計たちは、

But these watches were

―― 空腹で、気を失っている

fainting on hunger.

という状態とも言えます。

(続く)

(To be continued)

2017,江端さんの忘備録

以前、

Once I wrote a diary,

"Even if I antagonize the world ....? " The world includes the Armed Forces of the United States doesn't it?"

という日記を書きました。

-----

最近、もう一つ思いつきました。

In these day, I came to another phrase

「世界中を敵に回しても」・・・? 世界中って、<北>みたいに?

"Even if I antagonize the world ....? " like ?"

-----

あの国の

The goverment of the has an ideology of

"Any approch to collapse ourselves is all same, even if it is invation, civil war or counter nuclear attack"

と、いうような「腹のくくり方」もできないようなヤツ(歌手とか)が、、

If they, for example "singers", don't prepare themselves for the worst,

軽々しく「世界中を敵に回しても」などと口にすべきではない ―― と思っています。

they should not sing "even if I antagonize the world" lightly, I think.

2015,江端さんの忘備録

瀬戸口みづきさんの描かれている「初恋症候群(はつこいシンドローム)」という漫画イラストの、一つに次のコマがありました。

I happened to see a illustration of Setoguchi Mizuki-san's comic "First love syndrome", and found the next frame.

=====

瑠璃に借りたこの新曲の歌詞 「世界中を敵に回しても」・・・? 世界中って、米軍も?

=====

"This is a lyric sheet of new song I borrowed from Ruri, "even if I antagonize the world ....? " The world includes the Armed Forces of the United States doesn't it?"

ちょっとツボに入ってしまいました。

I happened to burst into laughter.

思わず、瀬戸口みづきさんの著作を、調べてしまいました。

Accidentally, I started to search Setoguchi Mizuki-san's works.

と同時に、

At the same time,

「世界中を敵に回しても」

I tried to search the songs which includes the phrase of "even if I antagonize the world", and I could find forty-two songs in Japan.

というフレーズを採用している歌詞も調べてみたところ、42曲見つけました。

------

日本には、アメリカ合衆国の第7艦隊や、イスラエル対外諜報機関と対決する気概のある、少くとも42人以上の歌手が存在するようです。

In Japan, there are more than forty-two singers who are with plenty of courage, fighting the seventh fleet of the United State, and Israeli intelligence agency.