Skip to content

カスタムモデルのメタデータを定義する

For structured inference models, model-metadata.yaml needs to declare an inferenceModel section: binary models need positive/negative class labels; multiclass models need targetName and classLabels in the same order as the model’s probability outputs. See Inference model metadata for more information.

メタデータを定義するには、model-metadata.yamlファイルを作成して、タスクまたはモデルのディレクトリのトップレベルに置きます。 この手順はほとんどのケースで省略できますが、カスタムタスクが非数値データを出力する場合のカスタム変換タスクには必要です。 model-metadata.yamlは、custom.pyと同じフォルダーにあります。

以下のセクションでは、カスタムモデルとカスタムタスクのメタデータを定義する方法について説明します。 詳細については、DRUMリポジトリのカスタムモデルタスクの完全な例を参照してください。

一般的なメタデータのパラメーター

次の表で、タスクや推論モデルで利用可能なオプションについて説明します。 drum pushを使用して、作成するモデル/タスク/バージョンに関する情報を提供するには、そのパラメーターが必要です。 一部のパラメーターは、互換性の理由から、drum push以外でも必要です。

備考

そのmodelIDパラメーターは、指定されたIDを持つ既存のカスタムモデルやカスタムタスクに新しいバージョンを追加します。 このため、新しいベースレベルのカスタムモデルやカスタムタスクを構成するすべてのオプションは、このパラメーターと一緒に渡された場合、無視されます。 ただし、現時点ではまだこれらのパラメーターを含める必要があります。

オプション 必要な場合 タスクまたは推論モデル 説明
name 常時 両方 drum pushがカスタムモデルのタイトルとして使用する文字列で、検索を容易にするため、ユニークなものにすることが望ましいです。
type 常時 両方 training(カスタムタスク用)またはinference(カスタム推論モデル用)のいずれかの文字列です。
environmentID 常時 両方 カスタムモデルやカスタムタスクの実行中に使用する実行環境のハッシュです。 利用可能な実行環境の一覧は、モデルレジストリ > カスタムモデルワークショップ > 環境で確認できます。 環境を展開して、環境情報タブをクリックすると、ファイルIDが表示され、コピーできます。 drum pushの場合のみに必要です。
targetType 常時 両方 ターゲットのタイプを示す文字列です。 次のいずれかである必要があります。
  • binary
  • regression
  • anomaly
  • unstructured(推論モデルのみ)
  • multiclass
  • textgeneration(推論モデルのみ)
  • agenticworkflow(推論モデルのみ)
  • transform(変換タスクのみ)
modelID オプション 両方 モデルやタスクの作成後に、バージョン管理を使って反復しながらコードを追加することがベストプラクティスです。 新しいモデルやタスクの代わりに新しいバージョンを作成する場合は、このフィールドを使用して作成したカスタムのモデルやタスクをリンクします。 このID(ハッシュ)は、カスタムのモデルやタスクのURLを介して、UIから取得できます。 drum pushでのみ使用します。
description オプション 両方 検索可能なフィールドです。 modelIDが設定されている場合、モデルやタスクの説明の変更にはUIを使います。 drum pushでのみ使用します。
majorVersion オプション 両方 このパラメーターで、作成するモデルのバージョンをメジャー(True、デフォルト)または、マイナー(False)のどちらの更新バージョンにするか指定します。 たとえば、更新前のモデルのバージョンが2.3の場合、メジャーなら3.0、マイナーなら2.4の更新バージョンが作成されます。drum pushにのみ使用します。
targetName For binary and multiclass (in inferenceModel) モデル In inferenceModel, the name of the column the model predicts. For multiclass, use the same name as Target name in the Workshop and the same order of classes as Target classes for classLabels.
positiveClassLabel / negativeClassLabel 二値分類モデル用 モデル inferenceModelでは、モデルが確率を予測する場合、positiveClassLabelは予測がどのクラスに対応するかを示します。
classLabels For multiclass classification models モデル In inferenceModel, a list of class names (strings). The list order must match the order of predicted class probabilities your model returns (for example, the column order of probability outputs). Use the same labels as the Target classes you configure for the custom model in the Workshop.
predictionThreshold オプション(二値分類モデルでのみ使用) モデル inferenceModelでは、予測ラベルとして選択されるラベルを示す、0と1の間のカットオフポイント。
trainOnProject オプション タスク モデルやバージョンのトレーニングを行う、プロジェクトID(PID)のハッシュ。 drum pushを使用してカスタム推定タスクのテストとアップロードを行う場合、DataRobotへの推定タスクのアップロードに成功した直後に、シングルタスクのブループリントをトレーニングするオプションを選択できます。 trainOnProjectオプションは、そのブループリントをトレーニングするプロジェクトを指定します。

Inference model metadata (inferenceModel)

For structured inference models, target and class-label settings belong under the top-level key inferenceModel in model-metadata.yaml. If you omit fields that DataRobot or DRUM require for your targetType, builds, tests, or deployments can fail.

targetType Required under inferenceModel 備考
binary targetName, positiveClassLabel, negativeClassLabel Optional: predictionThreshold.
multiclass targetName, classLabels classLabels is a YAML list of class names in the same order as your model’s probability outputs.
regression (often none) Many regression templates work without an inferenceModel block; follow your environment and DRUM requirements.
anomaly, unstructured, textgeneration, … Follow template / DRUM See examples for your target type.

Workshop-generated file: On the Registry Workshop Assemble tab, Create model-metadata.yaml produces a starter file for your model’s target type. For multiclass, that file includes inferenceModel with targetName and classLabels (aligned with your Target classes), matching what you need for a successful deployment.

model-metadata.yamlファイルでは、ランタイムパラメーターを定義して、カスタムモデルのコードを再利用しやすくすることもできます。