---
sourceDocument: オーストラリア API リファレンス
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ja-JP/api-reference

 Release :

    - australia

ft:locale :

    - ja-JP

ft:publication_title :

    - オーストラリア API リファレンス

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# MLSolution - グローバル

# MLSolution - グローバル {#ariaid-title1}

* リリースバージョン: Australia
* 
* 更新日 2026年03月12日
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 所要時間：14分

MLSolution API は、予測インテリジェンス予測を処理し、すべての機能 (類似性、分類、クラスタリング) のソリューションオブジェクトを取得するためのメソッドを提供します。  
この API は、すべてのソリューション機能の中で一般的に使用されるメソッドと、分類およびクラスタリングソリューションに固有のメソッドを提供します。

* すべてのソリューションオブジェクトに使用される一般的なメソッド:
  * getCapability()
  * getVersion()
  * isActive()
  * 予測()
  {#MLSolutionAPI__ul_uyg_bjy_xjb}
* 分類および回帰ソリューションにのみ使用される方法:
  * applyPrediction()
  {#MLSolutionAPI__ul_wls_bjy_xjb}
* ソリューションのクラスタリングにのみ使用される方法:
  * getClusterAssignments()
  * getClusterForRecord()
  * getClusterInfo()
  {#MLSolutionAPI__ul_j35_bjy_xjb}
{#MLSolutionAPI__ul_cd1_1jy_xjb}

MLSolution API には 予測インテリジェンス プラグイン (com.glide.platform_ml) が必要で、 `sn_ml` 名前空間内で提供されます。

このオブジェクトのメソッドは、 [MLSolutionFactory](https://servicenow-prod.fluidtopics.net/UTYWvSqxmydcL0ELU9vAag#MLSolutionFactoryAPI "MLSolutionFactory API は、MLSolution スクリプト可能オブジェクトを取得するためのファクトリ クラスです。") を使用してインスタンス化されます。{#MLSolutionAPI__classInstantMLSF}
**関連概念**   

* [MLSolutionUtil](https://servicenow-prod.fluidtopics.net/MF7dYhvBjANmbEnWTcg~NQ#MLSolutionUtilAPI "MLSolutionUtil スクリプトインクルードは、予測インテリジェンス予測を取得するためのメソッドを提供します。")
* [REST API:複数のソリューションの予測を取得](https://servicenow-prod.fluidtopics.net/TD4eqkRjYT_~rwDZADZAzA#agent-intelligence-api "予測インテリジェンス API は、1 つ以上の入力フィールドとトレーニング済みソリューションに基づいてフィールド値を予測するエンドポイントを提供します。")

## MLSolution - applyPrediction(GlideRecord now_GR) {#ariaid-title2}

分類ソリューションの予測結果を取得し、信頼性値がしきい値よりも高い場合は入力 GlideRecord に適用します。
{#MLSolution-applyPrediction_GR__table_hqw_pbm_yfb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| now_GR | GlideRecord | 予測を実行し、結果を適用する値を含む GlideRecord オブジェクト。 |
[表 : 1. パラメーター]

{#MLSolution-applyPrediction_GR__table_hqw_pbm_yfb} {#MLSolution-applyPrediction_GR__table_iqw_pbm_yfb__entry__2}

| タイプ | 説明 |
|-|-|
| ブーリアン | 予測が適用されたかどうかを示すフラグ: * true:予測が適用されました * false:予測は却下されました {#MLSolution-applyPrediction_GR__ul_pvl_ggm_ckb} |
[表 : 2. 返される内容]

{#MLSolution-applyPrediction_GR__table_iqw_pbm_yfb}  

    var mlSolution = sn_ml.MLSolutionFactory.getSolution("ml_incident_categorization");

    var inputGR = new GlideRecord("incident");
    inputGR.get("0ef47232db801300864adfea5e961912");

    mlSolution.applyPrediction(inputGR);

## MLSolution:getCapability() {#ariaid-title3}

トレーニング済みソリューションの機能情報を取得します。
{#MLSolution-getCapability__table_em3_pfx_ggb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| なし |   |   |
[表 : 3. パラメーター]

{#MLSolution-getCapability__table_em3_pfx_ggb} {#MLSolution-getCapability__table_fm3_pfx_ggb__entry__2}

| タイプ | 説明 |
|-|-|
| 文字列 | トレーニング済みソリューションのタイプ。 可能な値： * 類似性 * 分類 * クラスタリング {#MLSolution-getCapability__ul_sv5_slm_ckb} |
[表 : 4. 返される内容]

{#MLSolution-getCapability__table_fm3_pfx_ggb}  

    var mlSolution = sn_ml.MLSolutionFactory.getSolution("ml_x_global_clustering");

    // configure optional parameters
    var options = {};
    options.group_by = 'network';
    options.cluster_id = 1;
    options.top_n_per_cluster = 3;

    if (mlSolution.getCapability() == 'clustering') {
    	var results = mlSolution.getClusterAssignments(options);
    	// pretty print JSON results
    	gs.print(JSON.stringify(JSON.parse(results), null, 2));
    }

## MLSolution - getClusterAssignments (オブジェクトオプション) {#ariaid-title4}

クラスタリングソリューションのアサインを取得します。
{#MLSolution-getClusterAssignments_O__table_t1q_hxt_rhb__entry__3}{#MLSolution-getClusterAssignments_O__ml-cluster-create-xbl}

| 名前 | タイプ | 説明 |
|-|-|-|
| オプション | オブジェクト | オプション。クラスタリングソリューション内のグループ別およびレベル別に返される結果を絞り込むために使用する値。 デフォルト:すべてのクラスターのクラスターメンバーシップを返します。 |
| options.group_by | 文字列 | オプション。クラスターメンバーシップを取得するセグメンテーションフィールド (assignment_group など) を識別します。 このフィールドは、クラスターリング定義フォームの \[グループを使用 (Use Group By)\] チェックボックスで提供されるオプションと同じグループ化を提供します。提供される情報は、\[ テーブル\] フィールドで選択したテーブルによって異なります。詳細については、「 [クラスタリングソリューションの作成とトレーニング](https://www.servicenow.com/docs/access?context=create-clustering-solution&version=australia&pubname=australia-intelligent-experiences&ft:locale=en-US) 」を参照してください。 |
| options.cluster_id | 文字列 | オプション。クラスターサマリー \[ml_cluster_summary\] テーブル内のトレーニング済みソリューションのクラスター ID。 |
| options.top_n_per_cluster | 番号 | 各クラスターについて受信する上位結果の数。 |
[表 : 5. パラメーター]

{#MLSolution-getClusterAssignments_O__table_t1q_hxt_rhb} {#MLSolution-getClusterAssignments_O__table_u1q_hxt_rhb__entry__2}

| タイプ | 説明 |
|-|-|
| オブジェクト | cluster_id別の昇順のクラスター情報を含む JSON アレイ: * cluster_id:文字列。クラスターのソリューション内の一意のクラスター番号。{#MLSolution-getClusterAssignments_O__mlv-getClusterInfo-returnsID} * rec_display_id:文字列。レコードのタイプと番号。{#MLSolution-getClusterAssignments_O__mlv-GetClustrAssn-rec-dispid} * rec_sys_id:文字列。レコードsys_id。{#MLSolution-getClusterAssignments_O__mlv-GetClustrAssn-rec-sysid} * group_by: グループ化されている場合、このクラスターに関連付けられているセグメンテーションフィールドの名前。{#MLSolution-getClusterAssignments_O__mlv-getClusterInfo-returnsGrp} {#MLSolution-getClusterAssignments_O__ul_oz5_dwm_rhb} |
[表 : 6. 返される内容]

{#MLSolution-getClusterAssignments_O__table_u1q_hxt_rhb}  

    var mlSolution = sn_ml.MLSolutionFactory.getSolution("ml_x_global_clustering");

    // configure optional parameters
    var options = {};
    options.group_by = 'network';
    options.cluster_id = '1';
    // returns top 3 results per cluster
    options.top_n_per_cluster = 3;

    var results = mlSolution.getClusterAssignments(options);

出力:

    [{"cluster_id":"1","rec_display_id":"Incident: INC0014483","rec_sys_id":"04e33e7adb401300864adfea5e961900","group_by":"network"},
     {"cluster_id":"1","rec_display_id":"Incident: INC0011133","rec_sys_id":"5bd23af2db401300864adfea5e96194d","group_by":"network"}]

## MLSolution - getClusterForRecord(GlideRecord now_GR) {#ariaid-title5}

クラスタリングソリューションのクラスター情報を取得します。
{#MLSolution-getClusterForRecord_GR__table_ak2_xcn_rhb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| now_GR | GlideRecord | 入力 GlideRecord の名前。 |
[表 : 7. パラメーター]

{#MLSolution-getClusterForRecord_GR__table_ak2_xcn_rhb} {#MLSolution-getClusterForRecord_GR__table_bk2_xcn_rhb__entry__2}

| タイプ | 説明 |
|-|-|
| 文字列 | レコードがクラスターに属している場合のクラスターサマリー \[ml_cluster_summary\] テーブルからのcluster_id。レコードがクラスターに属していない場合は空の文字列が返されます。 |
[表 : 8. 返される内容]

{#MLSolution-getClusterForRecord_GR__table_bk2_xcn_rhb}  

    var mlSolution = sn_ml.MLSolutionFactory.getSolution("solution_name");
    var now_GR = new GlideRecord('incident');
    if (mlSolution.getCapability() == 'clustering') {
    var clusterId = mlSolution.getClusterForRecord(now_GR);
    }

## MLSolution - getClusterInfo (オブジェクトオプション) {#ariaid-title6}

指定されたクラスタリングソリューションの情報を取得します。
{#MLSolution-getClusterInfo_O__table_ak2_xcn_rhb__entry__3}{#MLSolution-getClusterInfo_O__ml-cluster-create-xbl}

| 名前 | タイプ | 説明 |
|-|-|-|
| オプション | オブジェクト | オプション。クラスタリングソリューション内のグループとレベル別に返される結果を絞り込みます。 デフォルト:すべてのクラスターのクラスターメンバーシップを返します。 |
| options.group_by | 文字列 | オプション。クラスターメンバーシップを取得するセグメンテーションフィールド (assignment_group など) を識別します。 このフィールドは、クラスターリング定義フォームの \[グループを使用 (Use Group By)\] チェックボックスで提供されるオプションと同じグループ化を提供します。提供される情報は、\[ テーブル\] フィールドで選択したテーブルによって異なります。詳細については、「 [クラスタリングソリューションの作成とトレーニング](https://www.servicenow.com/docs/access?context=create-clustering-solution&version=australia&pubname=australia-intelligent-experiences&ft:locale=en-US) 」を参照してください。 |
| options.cluster_id | 文字列 | オプション。クラスターサマリー \[ml_cluster_summary\] テーブル内のトレーニング済みソリューションのクラスター ID。 |
[表 : 9. パラメーター]

{#MLSolution-getClusterInfo_O__table_ak2_xcn_rhb} {#MLSolution-getClusterInfo_O__table_bk2_xcn_rhb__entry__2}

| タイプ | 説明 |
|-|-|
| オブジェクト | cluster_id別の昇順のクラスター情報を含む JSON アレイ: * cluster_id:文字列。クラスターのソリューション内の一意のクラスター番号。{#MLSolution-getClusterInfo_O__mlv-getClusterInfo-returnsID} * cluster_quality:文字列。0 〜 100 の数値。数値が大きいほど、クラスター密度が高いことを示します。{#MLSolution-getClusterInfo_O__mlv-getClusterInfo-returnsCQ} * cluster_size:文字列。クラスター内のレコードの数。{#MLSolution-getClusterInfo_O__mlv-getClusterInfo-returnsSize} * group_by: グループ化されている場合、このクラスターに関連付けられているセグメンテーションフィールドの名前。{#MLSolution-getClusterInfo_O__mlv-getClusterInfo-returnsGrp} * cluster_concept:文字列。クラスターを頻度の降順で説明する単語のセット。{#MLSolution-getClusterInfo_O__mlv-getClusterInfo-returnsConcept} {#MLSolution-getClusterInfo_O__ul_oz5_tv5_rhb} |
[表 : 10. 返される内容]

{#MLSolution-getClusterInfo_O__table_bk2_xcn_rhb}  

    var mlSolution = sn_ml.MLSolutionFactory.getSolution("ml_x_global_clustering");

    // configure optional parameters
    var options = {};
    options.group_by = 'network';
    options.cluster_id = 1;

    var results = mlSolution.getClusterInfo(options);

出力:

    [ {"cluster_id":"1","cluster_quality":"56.6","cluster_size":"46","group_by":"SLA","cluster_concept":"issue occur capacity ..."},
      {"cluster_id":"2","cluster_quality":"55.47","cluster_size":"75","group_by":"SLA","cluster_concept":"clone instance request ..."},
    ... ]

## MLSolution - getVersion() {#ariaid-title7}

アクティブなソリューションのバージョンを取得します。
{#MLSolution-getVersion__table_hrt_ngx_ggb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| なし |   |   |
[表 : 11. パラメーター]

{#MLSolution-getVersion__table_hrt_ngx_ggb} {#MLSolution-getVersion__table_irt_ngx_ggb__entry__2}

| タイプ | 説明 |
|-|-|
| 文字列 | アクティブなソリューションのバージョン。 |
[表 : 12. 返される内容]

{#MLSolution-getVersion__table_irt_ngx_ggb}  

    var mlSolution = sn_ml.MLSolutionFactory.getSolution("solution_name");

    var solutionVersion = mlSolution.getVersion();

## MLSolution - isActive() {#ariaid-title8}

ソリューションがアクティブかどうかを判別します。
{#MLSolution-isActive__table_xzj_lgx_ggb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| なし |   |   |
[表 : 13. パラメーター]

{#MLSolution-isActive__table_xzj_lgx_ggb} {#MLSolution-isActive__table_yzj_lgx_ggb__entry__2}

| タイプ | 説明 |
|-|-|
| ブーリアン | ソリューションがアクティブかどうかを示すフラグ。 * true:ソリューションがアクティブ * false:ソリューションが非アクティブ {#MLSolution-isActive__ul_cnk_ltv_bkb} |
[表 : 14. 返される内容]

{#MLSolution-isActive__table_yzj_lgx_ggb}  

    var mlSolution = sn_ml.MLSolutionFactory.getSolution("solution_name");

    var isActive = mlSolution.isActive();

## MLSolution - predict(オブジェクト入力, オブジェクトオプション) {#ariaid-title9}

GlideRecord またはキーと値のペアのアレイを指定して、予測サーバーから予測結果を取得します。
GlideRecord は反復子であるため、このメソッドを使用して複数の入力レコードで予測を呼び出すことができます。
{#MLSolution-predict_O_O__table_vv5_yfx_ggb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| input | オブジェクト | [GlideRecord](https://servicenow-prod.fluidtopics.net/k3bj5xjwIDZp86NECoEt2A#c_GlideRecordAPI "GlideRecord API はデータベース操作に使用されます。") または、フィールド名と値をキーと値のペアとして含む JSON オブジェクトのアレイ。 |
| オプション | オブジェクト | オプション。次のプロパティを持つ JSON キーと値のペア: * top_n:番号。指定した場合、指定された数の予測まで、上位の結果を返します。{#MLSolution-predict_O_O__solution-prediction-topn} * apply_threshold:ブーリアン。ソリューションのしきい値をチェックし、結果セットに適用します。しきい値は、類似性のソリューションしきい値または分類のクラスレベルしきい値です。デフォルト値は true です。{#MLSolution-predict_O_O__solution-prediction-thresh} * custom_results_filter:文字列。類似性ソリューションのみ。エンコードされたクエリを使用して結果が返される許容セットを指定します。{#MLSolution-predict_O_O__solution-prediction-custom} {#MLSolution-predict_O_O__ul_eqd_tcs_ckb} |
[表 : 15. パラメーター]

{#MLSolution-predict_O_O__table_vv5_yfx_ggb} {#MLSolution-predict_O_O__table_khq_hgx_ggb__entry__2}

| タイプ | 説明 |
|-|-|
| オブジェクト | sys_idまたはrecord_numberでソートされた予測結果を含む JSON オブジェクト。 * predictedValue:文字列。予測結果を表す値。{#MLSolution-predict_O_O__ml-returnsVal} * predictedSysId:文字列。予測値のsys_id。結果は、情報が予測されている任意のテーブルから取得できます。{#MLSolution-predict_O_O__ml-returnsID} * 信頼性:数値。予測に関連付けられた信頼度の値。例:53.84。{#MLSolution-predict_O_O__ml-returnsConf} * しきい値:数値。予測に関連付けられた構成済みのしきい値の値。{#MLSolution-predict_O_O__ml-returnsThrsh} {#MLSolution-predict_O_O__ul_fg2_vcs_ckb} |
[表 : 16. 返される内容]

{#MLSolution-predict_O_O__table_khq_hgx_ggb}  

    var mlSolution = sn_ml.MLSolutionFactory.getSolution("ml_incident_categorization");

    // single GlideRecord input
    var input = new GlideRecord("incident");
    input.get("0ef47232db801300864adfea5e961912");

    // configure optional parameters
    var options = {};
    options.top_n = 3;
    options.apply_threshold = false;

    var results = mlSolution.predict(input, options);
    // pretty print JSON results
    gs.print(JSON.stringify(JSON.parse(results), null, 2));

    var mlSolution = sn_ml.MLSolutionFactory.getSolution("ml_incident_categorization");

    // multiple GlideRecord input
    var input = new GlideRecord("incident");
    input.addQuery("sys_created_onONLast week@javascript:gs.beginningOfLastWeek()@javascript:gs.endOfLastWeek()");
    input.query();

    // configure optional parameters
    var options = {};
    options.top_n = 3;
    options.apply_threshold = false;

    var results = mlSolution.predict(input, options);
    // pretty print JSON results
    gs.print(JSON.stringify(JSON.parse(results), null, 2));

出力:

    {
        input_gr_sys_id1: [
                    {
                        predictedValue : xxx,
                        predictedSysId : xx0,
                        confidence : xxx,
                        threshold : xxx

                    }, 
                    {
                        predictedValue : yyy,
                        predictedSysId : xx1,
                        confidence : xxx,
                        threshold : xxx
                    }
            ],
        input_gr_sys_id2 : [
                    {
                        predictedValue : xxx,
                        predictedSysId : xx0,
                        confidence : xxx,
                        threshold : xxx

                    }, 
                ...
            ]
    }

    var mlSolution = sn_ml.MLSolutionFactory.getSolution("ml_incident_categorization");

    // key-value pairs input
    var input = [{"short_description":"my email is not working"}, 
    			{short_description:"need help with password"}];

    // configure optional parameters
    var options = {};
    options.top_n = 3;
    options.apply_threshold = false;

    var results = mlSolution.predict(input, options);
    // pretty print JSON results
    gs.print(JSON.stringify(JSON.parse(results), null, 2));


