📄 kmeansoperatorresult.java
字号:
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* Created on 2005-1-17
*
* $Author$
* $Date$
* $Revision$
*
*/
package edu.xmu.operation.result;
import com.prudsys.pdm.Core.MiningAttribute;
import com.prudsys.pdm.Core.MiningDataSpecification;
import com.prudsys.pdm.Core.MiningException;
import com.prudsys.pdm.Input.MiningStoredData;
import com.prudsys.pdm.Models.Clustering.ClusteringMiningModel;
import eti.bi.alphaminer.core.handler.ICaseHandler;
import eti.bi.alphaminer.operation.operator.INodeInfo;
import eti.bi.alphaminer.operation.result.OperatorResult;
import eti.bi.alphaminer.operation.result.view.PmmlView;
import eti.bi.alphaminer.patch.standard.operation.operator.KMeansOperator;
import eti.bi.alphaminer.patch.standard.operation.result.view.ClusteringDataView;
import eti.bi.alphaminer.patch.standard.operation.result.view.ClusteringGraphView;
import eti.bi.alphaminer.patch.standard.operation.result.view.ClusteringTreeView;
import eti.bi.alphaminer.vo.IBIData;
import eti.bi.alphaminer.vo.IBIModel;
import eti.bi.alphaminer.vo.IBIObject;
import eti.bi.common.Locale.Resource;
import eti.bi.exception.SysException;
/**
* Create the result JPanle for the Clustering Operator.
* It contains the Tree View, Graph View, PMML View and
* Data View.
*
* @author TWang Jan 17, 2005.
*
*/
public class KMeansOperatorResult extends OperatorResult {
/**
*
*/
private static final long serialVersionUID = -4411974409113744166L;
private KMeansOperator m_ClusteringOperator;
private ClusteringMiningModel m_ClusteringModel;
private MiningDataSpecification m_MetaData;
@SuppressWarnings("unused")
private MiningStoredData m_MiningStoredData;
private String m_ModelPMMLPath;
private MiningAttribute[] m_Attributes;
public KMeansOperatorResult(String a_CaseID, String a_NodeID,
String a_Name, INodeInfo a_NodeInfo, ICaseHandler a_CaseHandler) throws Exception {
super(a_Name + Resource.srcStr("Result"), a_CaseID, a_NodeID,a_NodeInfo, a_CaseHandler);
}
protected void getContent() throws SysException {
m_ClusteringOperator = (KMeansOperator) m_Operator;
IBIObject aBIObject = m_ClusteringOperator.getOutputBIObject();
if (aBIObject == null || aBIObject.getBIModel() == null
|| aBIObject.getBIData() == null) {
throw new SysException("The input BIObject is NULL");
}
IBIModel aBIModel = aBIObject.getBIModel();
IBIData aBIData = aBIObject.getBIData();
m_ClusteringModel = (ClusteringMiningModel) aBIModel.getMiningModel();
m_MetaData = aBIData.getMetaData();
m_MiningStoredData = aBIData.getMiningStoredData();
m_Attributes = m_MetaData.getAttributesArray();
try {
//to create pmml view
m_Operator.writeTempModelFile();
m_ModelPMMLPath = aBIModel.getTempBIModelPath();
} catch (SysException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* Create Views.
* @throws MiningException
* @throws SysException
* @throws InterruptedException
*
*/
protected void createResult() throws SysException, MiningException, InterruptedException{
ClusteringTreeView treeView = new ClusteringTreeView(m_ClusteringModel, m_Attributes);
ClusteringGraphView graphView = new ClusteringGraphView(m_ClusteringModel, m_Attributes);
addView(treeView);
addView(graphView);
PmmlView pmmlView = new PmmlView(m_ModelPMMLPath, this);
try
{
pmmlView.preparePmml();
pmmlView.showPmml();
addView(pmmlView);
} catch (SysException e)
{
e.printStackTrace();
m_SystemMessageHandler.appendMessage( e.getMessage());
}
ClusteringDataView dataView = new ClusteringDataView(m_ClusteringOperator);
addView(dataView);
this.setClosable(true);
this.setMaximizable(true);
this.setResizable(true);
this.setSize(700, 500);
}
@Override
protected void init() throws Exception {
// TODO Auto-generated method stub
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -