KaggleでSQL-PFへの道①(The Road to SQL Portfolios with Kaggle(1))

①と書いたけど続いてほしくない。セッティングで萎えてきたので奮起のためにメモります。途中で振り返ったときに役に立つかもしれない。

月に一度は書こうと思いつつ、もう月末なのでダッシュボードを開きました。ここで生存確認してくれてるひともいるし。ありがとうございます。生きてます。


KaggleとRstudio

ポートフォリオをどこにつくるかについて。kaggleはコンペが有名ですね。プロフにバッジ表示あったりデータの提供も多くて、食料豊富なバトルフロンティア。

PythonじゃなくRを使いたいのでRstudioかなと思ってたけど、kaggleはGoogleBigqueryとつなぎやすそう。所詮私はR初心者なので外部連携まで知識が至ってない。どうやらkaggle-Rstudio間もAWSやGitHubパッケージで道はある。


PythonとR

kaggleのノートブックはコード記述がPythonかRを選べます。マークダウンは###がH1-H3だったりHTMLぽくて違和感なし。UIもわかりやすい。

ここで躓き。SQLとつなぐのがPythonばっかりで、Rの例が見つけられない。そもそもkaggleってPython主流、SQLはおまけ的、そのまま使えないし…。ノートブック上でコード動かして分析して世界中で検証しあえる素敵なプラットフォーム、私の使い方はマイナーなのだ。毎度データソース保存は手間だなーリアタイがいいなー。取り込みやheadくらいはPython覚えなん。


KaggleとGoogleBigquery

彼らをつなぐ「bq_helper」という便利なやつがいるらしい、いざ自分でつなごうとしたらエラー。

bq_helperは廃止予定です。再現可能なノートブックには、google.cloud import bigqueryの利用をご検討ください。詳しくはBigQueryのドキュメントをご覧ください。

うう…これだからクラウドサービスは…。先人たちの知恵をカンペにしたかったのに…。BigQuery API の Cloud クライアント ライブラリの使用方法では、

  • C#
  • Go
  • Java
  • Node.js
  • PHP
  • Python
  • Ruby

がサポートされていました。はい。読んでなんとかします。


AIとのお仕事

最近はAIと脳トレの日々で、風船に限界まで空気入れるかのごとく「まだいける?うーん微妙。いや反対から抜けてるみたい。カフェインブーストいこう」と自分を叱咤激励しつつこなしてます。量を増やして頭と体の限界値を探ってるところです。

ガチなマルチタスクは3個までかなあ…脳キャパ&処理能力増やしたい。


********


I wrote (1), but I don't want to go on too long. I'm stuck in the setting, I'm writing this down for inspiration. It might come in handy when I look back on it down the road.

I was thinking about writing a journal once a month, but it's the end of the month already, so I opened my dashboard. Some people I know are checking here to see if I'm still alive. Thank you very much. I am alive.


Kaggle and Rstudio

About where to create my portfolio. kaggle is famous for its competitions. User profiles show the badges they have and there is a lot of public data available. My image is a battle frontier with lots of food.

I was thinking of Rstudio since I want to use R instead of Python, but kaggle seems to be easy to connect to Google Bigquery. I'm just a newbie to R, so my knowledge of external integration is not up to snuff. Apparently, connecting kaggle-Rstudio can be done with AWS or GitHub packages.


Python and R

In the kaggle notebook, you can choose to write code in Python or R. The markup is HTML-like and the interface is easy to understand.

Here's a stumbling block: most of the examples for connecting to SQL are in Python, and I couldn't find any in R. To begin with, kaggle is mostly Python, SQL is just an add-on, unfortunately...

Kaggle is a nice platform where you can run code on a notebook, analyze it, and validate it with the rest of the world. My usage pattern is minority. However, it's a pain to save the data source every time... I need to be able to use Python at least to import and display summaries.


kaggle and GoogleBigquery

I heard that there is a useful command called "bq_helper" that connects them, but when I tried to connect them myself, I got an error.

bq_helper is planned to be deprecated. Please consider using from google.cloud import bigquery for reproducible notebooks. Please see BigQuery Documentation for details

Ugh...this is cloud services.... I wanted to refer to the wisdom of our predecessors...In how to use the cloud client library of the BigQuery API,

  • C#
  • Go
  • Java
  • Node.js
  • PHP
  • Python
  • Ruby

These have been supported. Yes, I try to read and try to manage.


Working by using AI

Lately I've been training my brain by using AI. "Can I still do it? No, I'm slowing down a bit. Inject some caffeine!" I cheer myself up. I'm trying to find the limits of my brain and body by increasing the amount of work I do.

I suppose I can multitask up to 3 tasks...I want to increase my brain capacity and processing power.