ラベル

AI Forecast 8306MUFG (349) Social (79) life (75) Financial (70) IT (62) Proposal (57) AI (52) Fund Management (52) idea (51) economics (44) Trading (43) Covid-19 (40) Hedge Fund (37) Risk (36) Culture (31) BOJ (29) Science (29) hobby (27) accounting (17) Apps (16) Travel (14) career (11) job (7) Hiking (5) emotion (5) music (3) Statarb (2) piano (2)

2019年11月28日木曜日

AIで温度管理の実験をしよう AI Temperature Control Play Ground

AIで温度管理してみよう

AI Temperature Control Play Ground


エアコンの温度管理をAIでやってみよう。熱伝導方程式による解析的なアプローチよりはるかに簡単に、ニューラルネットは「動物的カン」で答えをだすのである。Let's control air conditioner by AI. Far easier than analytical solution by solving heat conduction equation, neutral network gives out answer like animal hunch.

温度を一定に保つ初期の装置はバイメタルによるOn/Offだった。でも、今は、ニューラルネットがよりスマートにやってくれる。Early day's temperature stabilization was done by bi-metal to perform on/off. But now neutral network does it more smoothly.

下のプログラムでは、外気温、エアコンダイアル設定(+は暖房/-は冷房)、室内温度について9つのデータを取った結果でニューラルネットを教育している。In the program below, AI takes 9 data sample for outside temperature, air conditioner setting(+for heating/-for cooling), and inside temperature.

いろいろパラメータを変えて走らせてみよう。You can change parameter and play around in the test environment. Pls try.

活性化関数は全部で11ある。There are all 11 activation functions you can try (elu, hardsigmoid, linear, relu, relu6, selu, sigmoid, softmax, softplus, softsign, tanh).

プログラムはこちら。Codes are here. 



Air Conditioning AI Controller
Decide control level to achieve target room tempetature

#OfNeurons/layerニューロン数/層
#ofEpoc教育繰り返し回数
InputLyrActivFunc入力層活性化関数
HidnLyrActivFunc中間層活性化関数
#ofHiddenLayer中間層の数

データー番号 data number   
               
x. 外気温temperature   outside
               
z. 冷暖力Air conditioning power (+warm/-cool)
               
y. 最終室温Final room temperature
               


2019年11月20日水曜日

超簡単ブルースアドリブ(Super Easy Blues improvisation)

超簡単ブルースアドリブ

Super Easy Blues improvisation




ダイアトニックスケール(1/1/0.5/1/1/1/0.5)でキーがCの時、コード進行の上に、ブルーススケール(2.5/1/0.5/0.5/2.5/0.5)構成音(C/Eb/F/Gb/G/Bb)をランダムにリズムに乗せるだけでブルースアドリブが完成。途中にクロマチックスケール(0.5/0.5/0.5/0.5/...)など他のスケールも入れるともっとカッコ良くなる。やってみよう!びっくりするほど役に立つよ!

キーボード:Roland FP-5
コード進行:セッションパートナーr.1ポップス
音色:161アルトサックス When you are in key C diatonic scale(1/1/0.5/1/1/1/0.5) chord progression, you can just randomly put C blues scale (2.5/1/0.5/0.5/2.5/0.5) notes C/Eb/F/Gb/G/Bb to have quick and easy improvisation. Inserting other scale such as chromatic scale (0.5/0.5/0.5/0.5/...) will make it sounds nicer. Try it and you will find it totally surprisingly useful.

Keyboard:Roland FP-5
Chord progression: Session Partner r.1 Pops
Instrument : 161 Alt Sax

円コイン(中央銀行デジタル通貨)の構造 The Architecture of Yen Coin(CBDC)

円コイン(中央銀行デジタル通貨)の構造 The Architecture of Yen Coin(CBDC)



LIBRAからの挑戦もあって、中央銀行によるデジタル通貨(CBDC)の議論が始まった。日銀のスライド(2019/7/5 [参考1])には、プリペイドカード形式での導入案が紹介されている。LIBRAの最大の利点は国境を透過するPTP(個人間)決済である。PTP決済ができて初めてCDBCは「お札」と同等の利便性をもつ。LIBRAは各国通貨にリンクするステーブルコインであるが、マネロン対策、通貨主権の観点からグローバルな公式展開は許容されなかった。Facing challenges from LIBRA, discussion on CBDC(Central Bank Digital Currency) has started. BOJ made prepaid card style proposal as in Reference 1. Meanwhile LIBRA's biggest advantage is PTP settlement across boundaries. CBDC becomes cash equivalent only when PTP settlement is possible. LIBRA was rejected by countries due to lack of money laundering measure as well as risk of invasion on sovereignty, although it is a stable coin linked to currency of each countries.

ここではPTP(個人間)決済の利便性・マネロン対策・国家の通貨主権・金融政策のすべてを満足するCBDCの形態を段階別に2つ提案したい。Here, I wish to propose two-stage approach for development of CBDC that satisfies all problems that LIBRA has.

第一段階 日銀券(お札・硬貨)だけを円コイン化 
Stage 1. Convert Central Bank Note to CBDC 
  • 日銀の口座型CBDCのプラン[参考1]をPTP(個人間)化する。発行済み日銀券(現在100兆円)を保有しているすべての経済主体(個人・法人・含非居住者)は日銀のバランスシート上にアカウントを持ち、互いにCBDCを日銀口座間振替で決済できる体制に移行する。Convert BOJ's proposal in Reference-1 to PTP. All economic body own account on BOJ balance sheet and can settle CBDC mutually. 
  • 円の全利用者のトランザクションをリアルタイムで行うインフラの整備が必須なため、追加投資を最小にするため、当面、銀行に当座預金、普通預金の他に政府預金を追加してもらい、口座振替は政府預金間のみ許可する対応も一案。To save cost of implementation, it may be an idea to mandate existing commercial banks to include government account access in their existing services while approving settlement only in between government accounts by way of CBDC. 
  • PTP決済が可能で現在の現金と利便性は同等以上、アカウントは国民識別IDなどと対応させることでマネロン対策になり、その他現状の、国家の通貨主権、金融政策などはそのまま維持される。This makes CBDC as convenient as current cash while having anti money laundering feature through national ID linkage. Currency sovereignty as well as monetary policy will be maintained. 
第二段階 すべての円のコイン化
Stage 2. Convert all Yen to CBDC 


  • 特徴 Feature
    1. 送金・振替は日銀口座間のみ合法とする。銀行口座間振替は順次停止する。Make only settlements in between CBDC as legal. Money transfers between existing bank accounts will be stopped. 
    2. 日銀の口座に存在する円のみを有効な円と告知する。具体的な会計仕訳は[参考2]を参照。Declare that only Yen in BOJ accounts is valid Yen. Accounting sample entries are shown in Reference-2. 
    3. 円の利用者は日銀の自分の口座で資金を保存する選択ができ、銀行の信用リスク(取付騒ぎ)を回避する選択肢を持つ。Yen users now have right to keep fund at BOJ account, thus can avoid bank's credit risk(bank run). 
    4. マネロン対策、国家の通貨主権、金融政策は引き続き維持される。 Anti money laundering, Currency sovereignty as well as monetary policy will be maintained. 
  • 管理Management
    1. すべての円はコイン化され、円コインの決済はすべて、日銀のバランスシート上で行われるため、準備率という概念は消滅し、通貨供給量は日銀のバランスシートの大きさとなる。There is no central bank reserve concept anymore while money supply is directly monitored by the size of BOJ balance sheet. 
    2. すべての円の動きがリアルタイムに日銀バランスシート上で管理できる。All Yen movement is monitored on BOJ balance sheet on real time. 
  • 法制Legal framework
    1. 円コインの決済にかかわらない会計処理は基本現状通りとなる。Accounting process irrelevant to Yen coin settlement will be kept as current manner.
    2. 現状の金融契約はそのまま大きな変更なく継続利用できる。Existing financial contracts will be kept as they are without any major changes. 
[参考1] Reference 1

2019年11月17日日曜日

強化学習も関数補間 Reinforcement Learning is also Function Interpolation

強化学習も関数補間

 Reinforcement Learning is also Function Interpolation




AIの「教師あり学習」と「強化学習」とは異なる方法と感じる人も多いだろう。強化学習の代表選手であるQ学習は、関数の補間機能である「教師あり学習」と比べ、どこが違うのだろうか。Many may feel that supervised learning and reinforcement learning are different. What is the difference between Q learning representing reinforcement learning and supervised learning that interpolate functions?

実は、Q学習も「教師あり学習」も、全空間を記述する関数、即ち補間関数を作り上げようとしている点で、本質的な違いはない。In reality, there is no fundamental difference between the Q learning and supervised learning since both try to establish interpolating function describing whole problem universe.

Q学習においては、環境に対し、エージェントが行動Aをとり、報酬rを得た場合、状態Sと行動Aの組合せにおける価値Qを、Qテーブルという表に保存する。テーブルというデータ構造上、全空間は離散化されているが、DQN(Deep Q Neural Network)を使えば離散化は不要となる。なお、Q関数は一般的にはN次元だが、上の図は見易くするため、2次元で書いてある。In Q learning, value Q at state S and action A is stored in table called Q table when agent took action A against environment. Whole problem universe is discritized due to table in nature while such discritization will be unnecessary if DQN(Deep Q neural Network) is used. Q is N dimensional in general however for ease of presentation, it is shown as 2 dimensional.

次のサイクルの行動Aは、現在の状態Sの場合のQを最大にするAとする。探索の幅を広げるために、Aの選択は時々ランダムを入れる。次の行動Aを環境に入れ、次のサイクルが始まる。The action A for next cycle is set by picking the A that makes Q maximum when state is S. For diversity expansion, take A randomly once in a while. The next cycle will start by applying action A to environment.

\begin{align} Q(S_{t},A_{t})  &\gets Q(S_{t},A_{t}) + \alpha(r_{t} + \gamma Max_{A}[Q(S_{t+1},A)] - Q(S_{t},A_{t}) )  \\
&\gets (1-\alpha)Q(S_{t},A_{t}) +\alpha(r_{t} + \gamma Max_{A}[Q(S_{t+1},A)] ) \\  \\

S_{t}  &:  時刻tにおける状態 \ State \ at \ time \ t \\
A_{t} &:  時刻tにおける行動 \ Action \ taken \ at \ time \ t \\
Q(S_{t},A_{t})   &:  S_{t}、A_{t}の場合の価値 \ Value \ at \  S_{t},  \ A_{t} \\
\alpha &:  学習率 \ learning \ rate\\
r_{t}   &:  報酬 \ reward\\
\gamma   &: 割引率 \ discount \ factor\\
Max_{A}[Q(S_{t+1},A)] )   &: A変化時のQの最大値 \ Max \ Q \ by \ varying \ A  \\
\end{align}

「教師あり学習」では最初から大量の教育データがあったが、強化学習では、最初の状態からいろいろ試行を重ねるたびに教育データを集積していくところが異なる。しかし、解の全空間を対象にした補間関数を求めているという点では全く一致している。Supervised training has big data for education but reinforcement learning accumulates data as making try & error.  However, both are identical from the point of seeking for interpolation function covering whole problem universe in scope.

 このため、過去のデータなどから教育データを生成できる場合は、強化学習より「教師あり学習」が効率が良い。一方、二足歩行、ゲームなど、最初の状態が明確で、そこから分岐していくデータのみに意味がある場合など、範囲を絞り込むなんからの境界条件がある場合は強化学習が適している。Hence, if historical data is well prepared, it is more efficient to use supervised learning. Meanwhile, if initial condition is clear followed by consequential status where bounds are rather limited with boundary condition, reinforcement learning may fit.

 この学習の過程を考えていると、人間の学習とダブって見える。最初の教え方がまずいと、紆余曲折、遠回りをして目的を達成することになるが、その過程で、普通なら体験しない様々な場面に遭遇し人生を豊にする。This reinforcement learning process overlaps the process of learning done by human being. If initial instruction is not correctly provided, we end up going around, making detour to achieve objective however, during such elongated process, we may face many interesting situations that other will not encounter, then life will be more fascinating.

 人生の選択は組合せの爆発で、全てのケースを「教師あり学習」することは不可能だ。自然、強化学習となり、そこでは少ないサンプルの試行錯誤の経験値を元に最適化を図っていくことになる。しかし過学習の果て、状態が少しでもずれると利用できなくなったり、逆にデータの少なさにより学習が収束しなかったりなど、少ないサンプルでの収束には問題も多い。これは人間にも言えることで、修練を重ねることで強くなっていく。The choice in life is an explosion of combination, hence it is impossible to have supervised learning for the whole problem universe. Naturally learning will be reinforcement learning where optimization is based on try and error. However over learning destroy robustness while data scarcity makes non convergence.  This applies to human life also however it is mitigated by multiple training.

 この強化学習の考え方は生命の学習と近いものがある。環境が与えたある範囲の最適関数をいち早く正しく習得した個体が生き残る。This reinforcement learning idea is similar to learning by living creatures. Only those that learn the optimized function given by environment correctly and quickly should survive.

2019年11月15日金曜日

格安スマホ革命.. 中国製スマホはEbayをチェック Smart Phone Revolution .. Check Ebay for Chinese Smart Phone

格安スマホ革命.. 中国製スマホはEbayをチェック 
Smart Phone Revolution .. Check Ebay for Chinese Smart Phone



格安スマホの本流を行く1機種を紹介したい。Let me introduce one main streamer of cheap smart phone.

それはDoogee X5 Max Proだ。4,000mAhのバッテリーで中国製格安スマホにありがちな連続使用時間を解消し、信頼性ともに十分に実用的である。It is Doogee X5 Max Pro. Equipped with 4,000mAh battery, it solves battery shortage problem unlike other Chinese cheap smart phones. Reliable and performance is high enough. 

今日現在、本体価格1万円程度、交換バッテリーは千円程度だ。It costs only JPY10K and battery costs JPY1K as of today.

Amazonでは取り扱いが不定期だが、Ebay(US)では本体・バッテリー共、通年在庫がみつかる。Amazon does not have consistent inventory but Ebay(US) does  including battery throughout a year.

現在新たに楽天がキャリアとして参入するが、SIMベースの格安スマホでほぼ同様のサービスが数分の1の価格で実現できる現在、大手キャリアはその存在意義を問われている。Rakuten is now jumping into smart phone business as new career however, such careers are now questioned for their existence facing super cost effective cheap smart phones based on SIM.

また、統一ブランド名の下で、格安スマホ利用を端末購入から設定まで一貫して有償サポートするビジネスも成り立つ。宣伝をうまくやれば革命がおこるかもしれない。As a new business chance, paid service to support cheap smart phone implementation from purchase to setting up is possible. If done well for advertisement, can create revolution to the smart phone business.










2019年11月13日水曜日

プログラミングと数学(小さな発見) Programming and Mathematics(One Tiny Finding)

プログラミングと数学(小さな発見) Programming and Mathematics(One Tiny Finding)



CartPoleという棒立ての問題をQテーブルを用いて離散的に強化学習するPythonのステップを読んだ。4要素の連続値ベクタを5ステップに離散化したのち、スカラーに次元圧縮するロジックを見つけて感動した。I read Python code for reinforced learning using Q table for CartPole problem to let pole keep standing on the cart.  Very impressed to find out one logic to perform dimension reduction from 4 dimension to scalar on 4 element continuous number vector with 5 step discretization.

最初、下記の赤の部分が何をしているのか不明だった。いろいろ見ていくうちに、離散化ステップをNとしたN進法で次元圧縮しているのだということが分かり、「アッタマいい!」と納得した。プログラムは単なるコーディングでなく、いろいろな知恵の集合体であることを再認識した。Initially no idea what below red part is doing.  While reading further, I realized that it is a N base dimension reduction taking number of discritization steps as N. Very smart way to do all at once.  At the same time I realized again that programming is not just a coding but including lots of wisdom.

def digitize_state(observation):
    cart_pos, cart_v, pole_angle, pole_v = observation
    digitized = [
        np.digitize(cart_pos, bins=bins(-2.4, 2.4, num_dizitized)),
        np.digitize(cart_v, bins=bins(-3.0, 3.0, num_dizitized)),
        np.digitize(pole_angle, bins=bins(-0.5, 0.5, num_dizitized)),
        np.digitize(pole_v, bins=bins(-2.0, 2.0, num_dizitized))
    ]
    return sum([x * (num_dizitized**i) for i, x in enumerate(digitized)])

リアルフォン計画.シンプルなIP電話 Project Real Phone. Most Simple Phone

リアルフォン計画.シンプルなIP電話
English follows




すべては実際、IP接続が出来た時点で終わっていた。 音声、画像、データは、IP接続の下ではすべて同じデータだ。

しかし、今まで実際の運用は種類別に行われた。 音声電話は従来型の課金システムに縛られ、 IP電話が急激に広まることはなかった。

現在、IP電話は、LINE、Skype、WeChat、などに分かれ統一感はまったくない。

ここで提案がある。

シンプルな、PtP IP接続を実現しよう。複雑なシステムはいらない。

その名前は「フォン」一言。 だれでも番号を持ち、お互いにIP電話で通話できる。 中央にリポジトリを持ち、PtPのIP接続のみをサポートする。

フォンにアカウントを持つには、パスポート、運転免許証などの認証を求める。またフォンは音声、映像、データ、など、すべてのサービスをPtPで実現する。これにより、アカウントを持つだけで、ユーザーはビデオ電話、会議、データ交換などが自由に行えるようになるのだ。

Project Real PHONE. Simple IP Phone



In reality, all setup has been done long time ago when IP connection has been established. Under IP connection, voice, video, data are all under same category, that is data.

However, up until now, the actual operation has been done by type of data. Voice connection was bound by existing charging system, hence IP phone did not expand rapidly.

At this point, IP phones are split into LINE, Skype, WeChat and there is no consistency.

Here is one proposal.

Let's establish simple IP connection environment. No need for complex system.

The name is PHONE, one word. All has own code and call each other by IP phone. Central repository supports PtP IP connection only.

PHONE requires the due diligence process by passport/driver's license submission. The PHONE realize voice, video, data service on PtP basis. Just by having account, users can enjoy video, conference, data exchange freely.




中学校の合唱 Junior High Chorus

中学校の合唱

Junior High Chorus



中学校の合唱で子供がピアノ伴奏の役をもらった。クラスメートをまとめて一つの合唱を仕上げていく過程は子供から聞いていても感動的だ。クラスは最初ばらばらで、非協力的な人(特に男子)も多くいる。中学校のコーラスは小学校よりパート分割などより本格的になり、上手に歌えるとかなり聞きごたえがある。最初まったく参加していなかった生徒が最後は大きな力となって最後の発表会で歌っているのを聴くと、チームをまとめてプロジェクトを完遂させることを学ぶ非常に良い教育機会だと思う。

My kid was assigned to piano accompaniment for junior high chorus. The process of development of class chorus is impressive as I hear from Kids. Initially team is disoriented and members are not really cooperative(especially boys). Junior high chorus has multiple layers of chorus part splits, and sounds much better than elementary school chorus if done well. Seeing the eventual serious involvement to the team by all including those who initially not were not cooperative but now creating really good sounds, I felt this is a very good educational opportunity to learn how to complete project combining team to achieve goal.


2019年10月29日火曜日

見えたものを声で教えるAI AI tells you what AI sees

見たものを声で教えるAI
AI tells you what AI sees



カメラに映ったものをAIが声でおしえてくれるよ。やってみよう!現在Win10のPCのみで動作。動作しない場合、ブラウザのハードウエアアクセラレーションをOFFにしてみてください。プログラムはこちら。  AI tells you what AI sees. Let's try! Now works on Win10 PC only. If does not work, pls try turning off browser hardware acceleration. GitHub is here.

2019年10月26日土曜日

関数補間マシンとしてのAI実験  AI Experiment as a Function Interpolation Machine

関数補間マシンとしてのAI実験 

AI Experiment as a Function Interpolation Machine




ニューラルネットは補間関数だと前に述べたが、下の自作ツールで試してみよう!Ealier I mentioned that neural net is an interpolation function so let's try it out now in below tool I made!

10個のデータポイントを色々変えると、関数が難しくなるにつれて、ニューロン数、繰り返し回数、中間層の数を増やさないと追従できなくなることが確認できる。If you change 10 data points, as the function becomes complex, you can see that interpolation becomes more difficult unless you increase number of neurons, epochs, layers.

活性化関数は全部で11ある。There are all 11 activation functions you can try (elu, hardsigmoid, linear, relu, relu6, selu, sigmoid, softmax, softplus, softsign, tanh).

枠内の数字を変えてボタンを押すと計算終了後に与えた関数および推定関数を表示する。計算速度は利用中のパソコンの性能によりかなり時間がかかる場合がある。If you change numbers in the boxes then click button, your input function set as well as its approximation are shown at the button graph. Calculation takes longer depending on the spec of your computer.

なお、本プログラムはJavascript版のTensorflowで書かれており、計算はあなたのマシンでローカルに実行している。プログラムはココ。For information, this program is written in Javascript version of Tensorflow and calculation is done on your machine locally. Program is here.


Neuralnet Capability Check on Javascript based Tensorflow
NumOfNeurons/layerニューロン数/層
NumOfEpoch教育繰り返し回数
InputLyrActivFunc入力層活性化関数
HidnLyrActivFunc中間層活性化関数
NumOfHiddenLayer中間層の数

Value of Y when X = 1, X=1の場合のYの値
Value of Y when X = 2, X=2の場合のYの値
Value of Y when X = 3, X=3の場合のYの値
Value of Y when X = 4, X=4の場合のYの値
Value of Y when X = 5, X=5の場合のYの値
Value of Y when X = 6, X=6の場合のYの値
Value of Y when X = 7, X=7の場合のYの値
Value of Y when X = 8, X=8の場合のYの値
Value of Y when X = 9, X=9の場合のYの値
Value of Y when X = 10, X=10の場合のYの値

2019年10月18日金曜日

日本の超安スマホ電話代は月額1,400円だ! Super Low Cost Smart Phone Bill in Japan is $13/Month !

日本の超安スマホ電話代は月額1,400円だ!

Super Low Cost Smart Phone Bill in Japan is $13/Month !



2019年10月現在の、日本の携帯電話超安セットは概略こうだ。月に3ギガまでインターネットが使え、電話も自由にできる。携帯電話代を節約したい人には、是非お薦めだ。Super Low Cost Cell Phone Bill profile in Japan as of Oct 2019.  Condition is 3GigaByte/M with internet and conversation. Highly recommended for those who wish to reduce phone bill in Japan.

②データ接続SIM(3ギガ/月)を契約する。1,000円/月。初期費用3千円。Subscribe SIM for Data connection (3GigaByte/M). JPY1,000/Month with initial cost of JPY3,000.
③SkypeIn番号を取得する。400円/月。 Purchase Skype In Number. JPY400/Month.

これで、初期投資1万3千円、月払い1,400円のインターネット+携帯電話環境が完成!This makes internet+phone setup with only initial investment of JPY13K(USD110), monthly payment JPY1.4K(USD12).
  • 利点 Advantage
    • コストが低い Cheap
    • SIMはNTTのため、接続エリアはDOCOMO並み Connection area equivalent to NTT
    • 他のIP電話(LINE上の音声会話など)も自在 Can use voice on other IP based framework such as LINE
    • 電話の発信もSkypeOutで容易にできる Can make call by the use of SkypeOut
  • 欠点 Downside
    • ある程度、問題処理ができることが必要。Need to cope with problems to some extent.
    • 中華アンドロイドは当たり外れがあるので、Amazonのレビュー欄などを注意深くチェック。冒険したくない人はヤフオクで中古のiPhoneを購入 Chinese Android's quality is not stable so need to check review and comments. If you prefer trouble free, better to purchase used iPhone at Yahoo Auction.
    • Skypeの利用のため、送受信時にワンクッションある Skye is not really responsible compared to regular voice phone
    • 安い中華スマートフォンは電池容量が少ない Cheap Chinese Smart Phone does not have big battery capacity.

2019年10月14日月曜日

歴史の振り子..米国で社会主義!?  History's Pendulum .. Socialism in USA!?

歴史の振り子。米国で社会主義!? 
History's Pendulum. Socialism in USA!? 


 米国で社会主義が勢力を増大しているという。Socialism looks in increasing trend in USA.

 先鋭化し過ぎた資本主義が、共産主義、社会主義を生み、腐敗の後に資本主義を取り入れ成功したと思っていたら、本家本元の資本主義もまた、修正を余儀なくされているようだ。トランプ現象、BREXITも資本主義に取り残された人々から生まれた民主的な革命だ。  Capitalism gone too extreme created communism and capitalism, that was later corrupted, then incorporated capitalism to be successful however, now, even the original capitalism looks requiring for further amendment to survive.

右に、左に、大きく振れた社会体制の振り子は、1周期の起点にまた戻りつつある。 しかしここで、米国が社会主義国家になってしまっては、人間は全く歴史から学んでいないことになる。 Pendulum of social frameworks swung big toward right and left, now looks swinging back to the starting point.  But if USA converts to socialism, then it means that human being did not learn anything from history.

資本主義の本尊である米国には是非大局的な視点から資本主義の建設的な修正をリードしてもらいたものだ。 所得の再配分を徹底化することが一つの答えだろう。具体的には、累進課税の強化とベーシックインカム、資産課税だろう。As a guru of capitalism, I wish USA will lead the constructive and holistic amendment of capitalism. Thorough enforcement of redistribution of income can be one answer.  In more concrete manner, it will be the enforcement of the progressive tax, basic income and tax on asset.


2019年10月13日日曜日

Javasctipt Canvasアプリをアプリをブログに挿入する二つの方法。Two ways to migrate JavaScript Canvas application to Blog


Javasctipt Canvasアプリをブログに入れる二つの方法。

Two ways to migrate JavaScript Canvas application to Blog



Javascriptは完成品のWebベースの展開が容易であることから、簡易なAIの開発については今後Tensorflow.jsが主流になるだろう。ここでは、ML5もしくはTensorflow.jsアプリをブログに掲載する場合の変更点を書いた。Tensorflow.js will be mainstream for light AI development going forward due to its product scalability through Web. Here I wrapped the points of changes when migrating the ML5 or Tensorflow.js application to blog.

Method1-ML5)
制御がML5にあり、CallBack スタイルなため、Parent関数を使って、Canvasが属しているdivを指定する Control is under ML5 due to call-back style, specify the div where Canvas belongs using Parent function.
Sample https://randomwalkjapan.blogspot.com/2019/10/mobilenetusing-mobilenet-inside-blogspot.html

div id="myContainer379"
MyCanvas=createCanvas(320, 240);
MyCanvas.parent('myContainer379');
video = createCapture(VIDEO);
video.parent('myContainer379')

Method2-Tensorflow.js)
制御が自分にあるため、appendChild関数を使って、Canvasをdivに帰属させる User has control, hence let Canvas belong to div using appendChild function.
Sample .. Pls implement below to any apps, then it will be part of your blog.

div id="mainContent1432"
var canvas = document.createElement("canvas");
var mydiv = document.getElementById("mainContent1432");
mydiv.appendChild(canvas);



2019年10月11日金曜日

YOLO(物体認識AI)で遊んでみよう Let's play on YOLO(AI Object Detector)

YOLO(物体認識AI)で遊んでみよう
 Let's play on YOLO (AI Object Detector)



YOLOは物体認識AIで、自動運転などでの報道でお馴染みだと思う。このページをパソコンで開けるだけで(カメラは必要だが)動く。コードはこちら。現状ではWin10のChrome上、「ハードウエアアクセラレーション」はONで動作確認しています。

YOLO is an object detection AI that many may be familiar in news on auto-driving.  Just open up this page and you can run it(camera is necessary). Code is here. Note that this is confirmed to work on Win10 Chrome with hardware acceleration ON in browser setting.



2019年10月10日木曜日

子供の水いぼに、ヨクイニンのすすめ Yokuinin Recommendation for Kid's Water Warts

子供の水いぼに、ヨクイニンのすすめ

Yokuinin Recommendation for Kid's Water Warts



2年ほど前、小学生の子供がプールで水いぼにかかった。全身ではないけれど、よく見るとあちこちにある。皮膚科に行くと、液体水素を使ったピンセットでの除去を継続する通院を奨められた。こどもは嫌がった。ネット情報で知ったヨクイニンを代わりに3か月分もらった。結果、2か月で水いぼは完全に消滅。物理的な除去を決断する前に、ためらわず、親から医師に要求することをお勧めする。ちなみにヨクイニンはハトムギのエキスで安価である。

2yrs ago, elementary school kid got inflicted by water warts. Not all over the body but I could see here and there if I looked close. Dermatology doctor recommended physical one by one removal by tweezers and liquid nitrogen. Kid hated it.  Instead, we got Yokuinin for 3 month that I learned as effective sometimes by net search. As a result, all the water warts were gone in 2 month.  I recommend not to hesitate to request doctor for Yokuinin before going for physical removal.  For information, Yokuinin is an essence of Pearl barley that is less expensive.


2019年10月8日火曜日

Webアプリから実行環境情報取得 PC Info retrieval from Web application


Webアプリからの実行環境情報取得

PC Info retrieval from Web application





Web上で走るプログラム(JavaScript)側から、実行環境を調べる必要が出てくる。例えばビデオ入力。カメラの位置(表か裏か)を知るため、実行環境がPCか、スマートフォン/タブレットかを知る必要がある。Sometimes we need to find out local machine information from web application(JavaScript). Video input is one example. Program needs to know if local machine is PC or smart phone/tablet to find out hardware location of Cameras(front/rear).

因みに、次のリスト(Computer Information)は、今このブログが実行されている端末の情報である。For reference, below list(Computer Information) shows local machine information where current blog is running on.

            document.writeln(navigator.platform)
            document.writeln(navigator.appVersion)
            document.writeln(navigator.oscpu)
            document.writeln(navigator.navigator)
            document.writeln(navigator.platform.indexOf("Linux"))
            document.writeln(navigator.platform.indexOf("iPhone"))
            document.writeln(navigator.platform.indexOf("iPad"))



Android、iPad、PCについて上記の情報をチェックした結果、Android端末を検出するにはnavigator.platformに文字Linux、iPhoneは文字iPhone、iPadは文字iPadがあるかないかで判定できるであろうことが推測できた。下は、これらの情報を用いた利用例である。I checked the above information for Android, iPad, iPhone and found out that characters Linux, iPhone, iPad can be used to detect Android, iPhone, iPad respectively retrieving from navigator.platform. Below is one example.

    if(navigator.platform.indexOf("Linux")!=-1 || navigator.platform.indexOf("iPhone")!=-1 || navigator.platform.indexOf("iPad")!=-1) {
      video = createCapture({audio:false, video:{facingMode:{exact:"environment"}}}); }
      else {video = createCapture(VIDEO);}


ここで「できるであろう」と書いたのは、Androidなのに、文字Androidが入っている場合とない場合があるようで、確固とした業界基準がないように見受けられたからだ。I wrote "can be" since I see a case where there is no character 'Android' even though machine is definitely Android, hence it looks there is no clear standard.