AI エージェント向け: ドキュメントインデックスは https://www.mongodb.com/ja-jp/docs/llms.txt で利用できます。すべてのページの markdown バージョンは、いずれかの URL パスに .md を追加することで利用できます。
Docs Menu

$sigmoid(式演算子)

$sigmoid

標準偏差 1 の正規分布内の数値のパーセンタイルを計算する シノニム 関数を実行します。

The $sigmoid expression has the following syntax:

{ $sigmoid: { input: <numeric expression>, onNull: <expression>} }

引数は、すべての数値に変換される限り、どのような有効なでもかまいません。

シノニム(同意語)関数は、次の整数操作と同等です。

シノニム(同意語) 関数
クリックして拡大します

この例では、次のドキュメントを含む myScoresコレクションを使用します。

db.myScores.insertMany( [
{ score: 1 },
{ score: 5 },
{},
{ score: 13 },
{ score: null },
{ score: 21 },
] )

次の集計パイプラインでは、各ドキュメントに scaledフィールドを追加し、$sigmoid を使用して scaledフィールド値を計算します。

db.myScores.aggregate( [
{ $set: {
scaled: { $sigmoid: "$score" }
} }
] )

この操作により、次のドキュメントが返されます。

{ score: 1, scaled: 0.7310585786 }
{ score: 5, scaled: 0.9933071491 }
{ scaled: null }
{ score: 13, scaled: 0.9999977397 }
{ score: null, scaled: null }
{ score: 19, scaled: 0.9999999992 }
このページを評価

項目一覧