質問

JPMMLでロジスティック回帰モデルを作成してから、PMMLをファイルに書き込みます。私が抱えている問題は、次の例で「概要」や「ロングフォーム」など、カスタムタグを作成する方法が見つからないことです。

<MapValues outputColumn="longForm">
  <FieldColumnPair field="gender" column="shortForm"/>
  <InlineTable>
    <row><shortForm>m</shortForm><longForm>male</longForm>
    </row>
    <row><shortForm>f</shortForm><longForm>female</longForm>
    </row>
  </InlineTable>
</MapValues>

これが私がこれまでに持っているものです:

MapValues mv = new MapValues("output")
  .withFieldColumnPairs(
        new FieldColumnPair( new FieldName("gender"), "shortForm" )
  ).withInlineTable(
        new InlineTable().withRows(
                new Row().with???( new ??? )
)))

要するに、私は例の「概要」要素をインスタンス化し、「行」オブジェクトに添付するために使用できるAPIコールを要求しています。私はすべてAPI、例、およびGoogle/SOを通して行ってきましたが、物を見つけることができません。

ご協力いただきありがとうございます!

役に立ちましたか?

解決

XMLバインディング(JAXB)アプローチに一般的なJavaアーキテクチャを使用できます。

簡単に言えば、電話してください Row#withContent(Object...) のインスタンス付き org.w3c.dom.Element これは、目的のXMLコンテンツを表します。

例えば:

Document document = documentBuilder.newDocument();
Element shortForm = document.createElement("shortForm");
shortForm.setTextContent("m");
Element longForm = document.createElement("longForm");
longForm.setTextContent("male");
row = row.withContent(shortForm, longForm);
ライセンス: CC-BY-SA帰属
所属していません datascience.stackexchange
scroll top