int countValue = histogram_values[i].size();
Value value = dataFields[i].addNewValue();
for(int j=0; j<countValue; j++)
{
value.setValue(histogram_values[i].get(j).toString());
Extension ext = value.addNewExtension();
ext.setName("count");
ext.setValue(String.valueOf(histogram_frequency[i][j]));
}
}
}
pmmlObject.setDataDictionary(mPMML.getDataDictionary());
pmmlObject.getDataDictionary().setDataFieldArray(dataFields);
//ModelStat
MiningModel miningModel = pmmlObject.addNewMiningModel();
miningModel.setModelName("Statistica");
org.dmg.pmml31.ModelStatsDocument.ModelStats modelStats =
miningModel.addNewModelStats();
for(int i=0; i<columnCount; i++)
{
UnivariateStats statfield = modelStats.addNewUnivariateStats();
statfield.setField(colInfo[i].getName());
// Counts
Counts counts = statfield.addNewCounts();
BigInteger pom = new BigInteger(String.valueOf(totalFreq[i]));
counts.setTotalFreq(pom);
pom = new BigInteger(String.valueOf(missingData[i]));
counts.setMissingFreq(pom);
pom = new BigInteger(String.valueOf(invalidFreq[i]));
counts.setInvalidFreq(pom);
Extension ext = counts.addNewExtension();
ext.setName("distinctValues");
ext.setValue(String.valueOf(distinctValue[i]));
//DiscrStats
OPTYPE.Enum optype = mPMML.getDataDictionary().getDataFieldArray(i).getOptype();
if(optype == OPTYPE.CATEGORICAL)
{
DiscrStats discrStats = statfield.addNewDiscrStats();
int index = histogram_maxfrequency[i];
discrStats.setModalValue(histogram_values[i].get(index).toString());
}
else
{
if (interval[i]!=null)
{
NumericInfo numInfo = statfield.addNewNumericInfo();
numInfo.setMinimum(minimum[i]);
numInfo.setMaximum(maximum[i]);
numInfo.setMean(mean[i]);
numInfo.setStandardDeviation(stddev[i]);
// ContStats
ContStats contsStats = statfield.addNewContStats();
contsStats.setTotalValuesSum(sum[i]);
contsStats.setTotalSquaresSum(sum2[i]);
int intervalCount = interval[i].length;
for(int index=0; index<intervalCount; index++)
{
org.dmg.pmml31.IntervalDocument.Interval interv =
contsStats.addNewInterval();
interv.setLeftMargin(interval[i][index].getLeftMargin());
interv.setRightMargin(interval[i][index].getRightMargin());
interv.setClosure(
Closure.Enum.forString(
interval[i][index].getClosureName()));
Extension extension = interv.addNewExtension();
extension.setName("Frequencies");
extension.setValue(String.valueOf(interval_frequency[i][index]));
extension = interv.addNewExtension();
extension.setName("SumOfValues");
extension.setValue(String.valueOf(interval_sumofvalues[i][index]));
extension = interv.addNewExtension();
extension.setName("SumOfSquaredValues");
extension.setValue(String.valueOf(interval_squaresum[i][index]));
}
}
else
{
statfield.setNumericInfo(