要素が単なる公称値または文字列値である場合は、Instanceオブジェクトを使用してその特定のインスタンスを表すことができます。また、インスタンスデータセットの場合、属性を事前に定義することで属性を取得できます。しかし、私は質問があります。コレクションを属性要素の値として使用する場合のアプローチは何ですか?
例:
weka.core.Attribute attribute1 = new weka.core.Attribute("list1");
weka.core.Attribute attribute2 = new weka.core.Attribute("list2");
weka.core.Attribute classAttribute = new weka.core.Attribute("Function");
FastVector fvWekaAttributes = new FastVector(3);
fvWekaAttributes.addElement(attribute1);
fvWekaAttributes.addElement(attribute2);
fvWekaAttributes.addElement(classAttribute);
2つが公称値で、1つがstring(class)の場合、これは属性を作成する方法です。そして、任意のデータセット(例:trainInstances)に要素を追加する方法で、インスタンスオブジェクトを作成し、次のように追加します。
Instance iExample = new Instance(3);
iExample.setValue((weka.core.Attribute)fvWekaAttributes.elementAt(0), 10);
iExample.setValue((weka.core.Attribute)fvWekaAttributes.elementAt(0), 15);
iExample.setValue((weka.core.Attribute)fvWekaAttributes.elementAt(2), "F1");
trainInstances.add(iExample);
これは問題ありませんが、単一の公称値の代わりにリスト/コレクションを保存するために何を使用する必要がありますか。私はこのようにしたい:
int[] list1={10,20,30,40};
int[] list2={90,80,70,60};
iExample.setValue((weka.core.Attribute)fvWekaAttributes.elementAt(0), **list1**);
iExample.setValue((weka.core.Attribute)fvWekaAttributes.elementAt(0), **list2**);
iExample.setValue((weka.core.Attribute)fvWekaAttributes.elementAt(2), "F1");
trainInstances.add(iExample);
具体的には、これらのリストのサイズが変更される場合があります。つまり、この例では、サイズが4の長さの各リストが表示されますが、他のインスタンスオブジェクトで異なるサイズのリストをサポートする必要があります。WEKAまたは任意の学習APIを使用してそれは可能ですか?もしそうなら、私にリソースを提供してください。それは私の修士論文に必須です。