Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc select drilldown: add description about key_vector_expansion in Japanese #1476

Merged
merged 17 commits into from
Jan 6, 2023

Conversation

HashidaTKS
Copy link
Contributor

@HashidaTKS HashidaTKS commented Dec 27, 2022

Add description about key_vector_expansion in Japanese

@HashidaTKS
Copy link
Contributor Author

HashidaTKS commented Jan 5, 2023

@kou @komainu8

日本語の時点で内容をレビューして頂けないでしょうか?
括弧で英語が追加されているものは、 @yoshimotoyuk さん向けに使って欲しい用語を補足しているものです。

@yoshimotoyuk

上記のレビュー終了後、本内容を翻訳して頂けないでしょうか?
翻訳していただきたいのは、 doc/source/reference/commands/select.rst の差分部分(色付き部分)のみです。

@HashidaTKS HashidaTKS marked this pull request as ready for review January 5, 2023 05:49
.. --drilldowns[tags].columns[power_set].flags COLUMN_VECTOR \
.. --drilldowns[tags].sort_keys 'power_set' \
.. --drilldowns[tags].output_columns 'power_set, _nsubrecs' \
.. --limit 0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

このサンプルコマンド実行結果は以下の通り。

table_create PowersetDrilldownMemos TABLE_HASH_KEY ShortText
# [[0, 1337566253.89858, 0.000355720520019531], true]
column_create PowersetDrilldownMemos tags COLUMN_VECTOR ShortText
# [[0, 1337566253.89858, 0.000355720520019531], true]
load --table PowersetDrilldownMemos
[
{"_key": "Groonga is fast!", "tags": ["Groonga"]},
{"_key": "Mroonga uses Groonga!", "tags": ["Groonga", "Mroonga"]},
{"_key": "PGroonga uses Groonga!", "tags": ["Groonga", "PGroonga"]},
{"_key": "Mroonga and PGroonga are Groonga family", "tags": ["Groonga", "Mroonga", "PGroonga"]}
]
# [[0, 1337566253.89858, 0.000355720520019531], 4]
select PowersetDrilldownMemos \
  --drilldowns[tags].keys tags \
  --drilldowns[tags].key_vector_expansion power_set \
  --drilldowns[tags].columns[power_set].stage initial \
  --drilldowns[tags].columns[power_set].value _key \
  --drilldowns[tags].columns[power_set].flags COLUMN_VECTOR \
  --drilldowns[tags].sort_keys 'power_set' \
  --drilldowns[tags].output_columns 'power_set, _nsubrecs' \
  --limit 0
# [
#   [
#     0,
#     1337566253.89858,
#     0.000355720520019531
#   ],
#   [
#     [
#       [
#         4
#       ],
#       [
#         [
#           "_id",
#           "UInt32"
#         ],
#         [
#           "_key",
#           "ShortText"
#         ],
#         [
#           "tags",
#           "ShortText"
#         ]
#       ]
#     ],
#     {
#       "tags": [
#         [
#           7
#         ],
#         [
#           [
#             "power_set",
#             "Text"
#           ],
#           [
#             "_nsubrecs",
#             "Int32"
#           ]
#         ],
#         [
#           [
#             "Groonga"
#           ],
#           4
#         ],
#         [
#           [
#             "Mroonga"
#           ],
#           2
#         ],
#         [
#           [
#             "PGroonga"
#           ],
#           2
#         ],
#         [
#           [
#             "Groonga",
#             "Mroonga"
#           ],
#           2
#         ],
#         [
#           [
#             "Groonga",
#             "PGroonga"
#           ],
#           2
#         ],
#         [
#           [
#             "Mroonga",
#             "PGroonga"
#           ],
#           1
#         ],
#         [
#           [
#             "Groonga",
#             "Mroonga",
#             "PGroonga"
#           ],
#           1
#         ]
#       ]
#     }
#   ]
# ]

Copy link
Member

@komainu8 komainu8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

"``{A, B, C}``", "1"
"``{B, C, D}``", "1"

この集計方法は、例えばタグの出現回数と、タグの組み合わせの出現回数を一度に集計したい場合に便利です。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

↑は登場回数という表現でした。表現を揃えませんか?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

例えばタグの出現回数と、タグの組み合わせの出現回数を一度に集計したい場合

この例って、↑を集計しています?要素数が1のグループはタグの出現回数で、要素数が3のグループはタグの組み合わせの出現回数だと思いますけど、要素数が2のグループは無意味じゃないですか?

Copy link
Contributor Author

@HashidaTKS HashidaTKS Jan 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

要素数が2のグループは、別の要素が含まれていても構わないので、とにかくその2つの要素が同時に使われた回数として意味があるのではないかと思います。
PGroongaなどの別のタグが同時に使われているものも含めて、)GroongaMroonga が同時に使用された回数だけを見たい場合などです。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

うーん、であればなんかもう少しピンとくる説明を考えられないですかねぇ。一度に集計してどう活用するの?みたいな話もあると違うんですかねぇ。

たとえば、この機能のユースケースの1つが https://github.com/jnothman/UpSetPlot の入力に使うことですけど、この図は(対象のベクターを全部まぜた集合の)べき集合中の各部分集合の数を可視化しています。この図を見ることでどのカテゴリーの組み合わせがよく使われているか・使われていないかをパッと見で把握できます。

あれ、この機能で作ったデータを使うと{B, C}は必ず{A, B, C}以上になりますね。それでいいのか。。。?そういうデータはどういうときに嬉しいんだろう。。。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

たとえば、この機能のユースケースの1つが https://github.com/jnothman/UpSetPlot の入力に使うことですけど、この図は(対象のベクターを全部まぜた集合の)べき集合中の各部分集合の数を可視化しています。この図を見ることでどのカテゴリーの組み合わせがよく使われているか・使われていないかをパッと見で把握できます。

まさにこのようなどのカテゴリーの組み合わせがよく使われているか・使われていないかをパッと見で把握するために使う想定でいました。
うーん、「この結果をUpSetPlotなどのプロットツールを使って図示することで、どのタグの組み合わせがよく使われているか、使われていないか図を使って簡単に把握できるようになる。」とかですか。。。

あれ、この機能で作ったデータを使うと{B, C}は必ず{A, B, C}以上になりますね。それでいいのか。。。?そういうデータはどういうときに嬉しいんだろう。。。

{B, C} の中で更に {A, B, C} であるもの というように細かい条件を見ていくのに使うものかと思っていました。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fig. 4.がUpSetとベン図で同じデータを表現したときの違いなのかな。

Copy link
Contributor Author

@HashidaTKS HashidaTKS Jan 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

もとの論文の Fig. 6 を見ると、中点なしの場合は他の集合との重複部分なしの要素数、中点ありの場合他の集合との重複部分も含んだ要素数が表現されているようです。
https://github.com/jnothman/UpSetPlot は中点なしでの結果表示なので、 {cat0, cat1, cat2} の数が {cat0, cat1}{cat0, cat2} といった包含される部分集合の数より多くても正しい気がしてきました。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/jnothman/UpSetPlot のサンプルデータを見ると、ベン図で考えた時に重なった部分は排除した各部分集合自体の数を入れていそうなので、べき集合のデータをそのまま入れても嬉しくない結果になりそうな雰囲気はある。。。(重複ありという前提でデータを指定することができるのだろうか?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

すみません、急ぎでこちらの翻訳&マージをしてしまいたいため、図示するのに使いやすいという文言の話は一旦なしにして、その他の指摘事項分対応した状態で翻訳&マージしてしまいたいのですが、問題ないでしょうか?
図示する方法などの記載はドキュメント改善としてリリース後に別のPRでやりたいです。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

そうしましょう。

@HashidaTKS
Copy link
Contributor Author

@yoshimotoyuk

一旦、現状から大きな変更が入ることはなさそうですので、 select.rst の差分部分(色付き部分)の翻訳をお願いできるでしょうか。
内容的には #1475 で翻訳して頂いた、「ドリルダウンでベクターのべき集合(power set)を集計できるようになりました。」 https://github.com/groonga/groonga/pull/1475/files#diff-d58d4051345fb9c5aadf9d757018a550ae117def32852beb1d6ba5ef6ebf1553R17 と同じ話です。

@HashidaTKS HashidaTKS changed the title [WIP] doc select drilldown: add description about key_vector_expansion doc select drilldown: add description about key_vector_expansion in Japanese Jan 6, 2023
@HashidaTKS HashidaTKS merged commit c5ddac1 into master Jan 6, 2023
@HashidaTKS HashidaTKS deleted the doc-key-vector-expansion branch January 6, 2023 09:55
ドリルダウン対象のキーがベクター(vector)のときの、キーの展開方法を指定します。現状は ``NONE`` または ``POWER_SET`` が指定可能です。

ドリルダウン対象のキーが1つの場合にのみ使用可能です。キーが2つ以上の場合は無視されます。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This specifies how to expand key when keys for drilldown are vector. Currently, NONE or POWER_SET are able to be specified.

This work only time when one key is target for drilldown. This doesn't work time when more than 2 keys are target for drilldown.

キーを展開しません。ベクター内の各要素がそれぞれキーとなります。

以下は ``Groonga`` 、 ``Mroonga`` 、 ``PGroonga`` という3つのタグに対して、これらのタグの登場回数を集計する例です。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works as same as key_vector_expansion is not specified.

Keys would not be expanded. Each elements within vector works as each key.

Following is sample to aggregate total number of individual and combination occurrence for 3 tags, Groonga , Mroonga , and PGroonga.

.. --drilldowns[tags].output_columns 'none_expantion, _nsubrecs' \
.. --limit 0

実行結果から以下のことがわかります。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following are facts from the results.

ベクターをべき集合(power set)に展開して集計(aggregate)します。
このとき、対象のベクターを多重集合(multiset)とみなします。
多重集合とみなすので、同じ値の要素が複数ある場合、それぞれ別の要素とみなします。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This aggregates total with expanding vector to power set.
In this case, target vector are considered as multi set.
Thus, each elements are considered as an individual element when there are multiple elements with same value.

べき集合は、集合のすべての部分集合(subset)の集合なので、まず、 ``{A, B, C}`` のすべての部分集合を以下に示します。
ただし、Groongaは要素数(number of elements)が0の集合(空集合(empty set))は使いません。ドリルダウン結果に使うには有益ではないからです。
空集合も使ったほうがよいユースケースがある場合は `issue <https://github.com/groonga/groonga/issues>`_ で報告してください。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, there are vector [A, B, C]. In this case, a target set is {A, B, C}.
Power set is aggrigation for all of subsets within a set. Following shows all of subset within a set {A, B, C}.
However, Groonga does not use empty set, that number of elements is 0. It is because empty set is not useful for results of drilldown.
Please report at issue <https://github.com/groonga/groonga/issues>_ , if you find a case to use a empty set.

"``{A, B, C}``", "1"
"``{B, C, D}``", "1"

この集計方法は、例えばタグの登場回数と、タグの組み合わせの登場回数を一度に集計したい場合に便利です。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This aggregating methods is useful when it is requirement to sum total number of occurrence for individual tag and combination tag at once.


以下は ``Groonga`` 、 ``Mroonga`` 、 ``PGroonga`` という3つのタグに対して、これらのタグの登場回数と、
これらの組み合わせの登場回数を集計する例です。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following is an example to aggregate total occurrence for individual and combination of 3 tags, Groonga , Mroonga, and PGroonga.

.. --limit 0

この集計結果から、以下のことがわかります。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this aggregation result, following information would be known.


.. csv-table::

"タグ","登場回数"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"tag", "number of occurrence"

"``Groonga`` かつ ``Mroonga`` かつ ``PGroonga``", "1"

この結果から、どのタグの組み合わせがよく使われているか・使われていないかといった相関関係を分析できます。
例えば、 ``Groonga`` と ``Mroonga`` が同時に使われている回数は2回で、そのうち更に ``PGroonga`` が同時に使われている回数が1回、というような分析ができます。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This result allows to analyze correlation between each tag and combination such as whether often used. For example with this sample, it can be analyzed that Groonga and Mroonga are used twice at same time and within those twice, PGroonga is also used at same time for once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants