本文整理汇总了Java中weka.core.SerializedObject类的典型用法代码示例。如果您正苦于以下问题:Java SerializedObject类的具体用法?Java SerializedObject怎么用?Java SerializedObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SerializedObject类属于weka.core包,在下文中一共展示了SerializedObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DelValueAction
import weka.core.SerializedObject; //导入依赖的package包/类
DelValueAction(int nTargetNode, String sValue) {
try {
m_nTargetNode = nTargetNode;
m_sValue = sValue;
m_att = m_Instances.attribute(nTargetNode);
SerializedObject so = new SerializedObject(m_Distributions[nTargetNode]);
m_CPT = (Estimator[]) so.getObject();
;
m_children = new ArrayList<Integer>();
for (int iNode = 0; iNode < getNrOfNodes(); iNode++) {
if (m_ParentSets[iNode].contains(nTargetNode)) {
m_children.add(iNode);
}
}
m_childAtts = new Estimator[m_children.size()][];
for (int iChild = 0; iChild < m_children.size(); iChild++) {
int nChild = m_children.get(iChild);
m_childAtts[iChild] = m_Distributions[nChild];
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例2: makeCopies
import weka.core.SerializedObject; //导入依赖的package包/类
/**
* Creates a given number of deep or shallow (if the kernel implements
* Copyable) copies of the given kernel using serialization.
*
* @param model the kernel to copy
* @param num the number of kernel copies to create.
* @return an array of kernels.
* @throws Exception if an error occurs
*/
public static Kernel[] makeCopies(Kernel model, int num) throws Exception {
if (model == null) {
throw new Exception("No model kernel set");
}
Kernel[] kernels = new Kernel[num];
if (model instanceof Copyable) {
for (int i = 0; i < kernels.length; i++) {
kernels[i] = (Kernel) ((Copyable) model).copy();
}
} else {
SerializedObject so = new SerializedObject(model);
for (int i = 0; i < kernels.length; i++) {
kernels[i] = (Kernel) so.getObject();
}
}
return kernels;
}
示例3: getFlow
import weka.core.SerializedObject; //导入依赖的package包/类
/**
* Gets the current flow being edited. The flow is returned as a single Vector
* containing two other Vectors: the beans and the connections. These two
* vectors are deep-copied via serialization before being returned.
*
* @return the current flow being edited
* @throws Exception if a problem occurs
*/
public Vector<Vector<?>> getFlow() throws Exception {
Vector<Vector<?>> v = new Vector<Vector<?>>();
Vector<Object> beans = BeanInstance.getBeanInstances(m_mainKFPerspective
.getCurrentTabIndex());
Vector<BeanConnection> connections = BeanConnection
.getConnections(m_mainKFPerspective.getCurrentTabIndex());
detachFromLayout(beans);
v.add(beans);
v.add(connections);
SerializedObject so = new SerializedObject(v);
@SuppressWarnings("unchecked")
Vector<Vector<?>> copy = (Vector<Vector<?>>) so.getObject();
// tempWrite(beans, connections);
integrateFlow(beans, connections, true, false);
return copy;
}
示例4: getFunction
import weka.core.SerializedObject; //导入依赖的package包/类
/**
* Get a named DefineFunction. Returns a deep copy of the function.
*
* @param functionName the name of the function to get
* @return the named function or null if it cannot be found
* @throws Exception if there is a problem deep copying the function
*/
protected DefineFunction getFunction(String functionName) throws Exception {
DefineFunction copy = null;
DefineFunction match = null;
for (DefineFunction f : m_defineFunctions) {
if (f.getName().equals(functionName)) {
match = f;
// System.err.println("Found a match!!!");
break;
}
}
if (match != null) {
SerializedObject so = new SerializedObject(match, false);
copy = (DefineFunction) so.getObject();
// System.err.println(copy);
}
return copy;
}
示例5: DelValueAction
import weka.core.SerializedObject; //导入依赖的package包/类
DelValueAction(int nTargetNode, String sValue) {
try {
m_nTargetNode = nTargetNode;
m_sValue = sValue;
m_att = m_Instances.attribute(nTargetNode);
SerializedObject so = new SerializedObject(m_Distributions[nTargetNode]);
m_CPT = (Estimator[]) so.getObject();
;
m_children = new FastVector();
for (int iNode = 0; iNode < getNrOfNodes(); iNode++) {
if (m_ParentSets[iNode].contains(nTargetNode)) {
m_children.addElement(iNode);
}
}
m_childAtts = new Estimator[m_children.size()][];
for (int iChild = 0; iChild < m_children.size(); iChild++) {
int nChild = (Integer) m_children.elementAt(iChild);
m_childAtts[iChild] = m_Distributions[nChild];
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例6: getFlow
import weka.core.SerializedObject; //导入依赖的package包/类
/**
* Gets the current flow being edited. The flow is returned as a single
* Vector containing two other Vectors: the beans and the connections.
* These two vectors are deep-copied via serialization before being
* returned.
*
* @return the current flow being edited
*/
public Vector getFlow() throws Exception {
Vector v = new Vector();
Vector beans =
BeanInstance.getBeanInstances(m_mainKFPerspective.getCurrentTabIndex());
Vector connections =
BeanConnection.getConnections(m_mainKFPerspective.getCurrentTabIndex());
detachFromLayout(beans);
v.add(beans);
v.add(connections);
SerializedObject so = new SerializedObject(v);
Vector copy = (Vector)so.getObject();
// tempWrite(beans, connections);
integrateFlow(beans, connections, true, false);
return copy;
}
示例7: getFunction
import weka.core.SerializedObject; //导入依赖的package包/类
/**
* Get a named DefineFunction. Returns a deep copy of the
* function.
*
* @param functionName the name of the function to get
* @return the named function or null if it cannot be found
* @throws Exception if there is a problem deep copying the function
*/
protected DefineFunction getFunction(String functionName) throws Exception {
DefineFunction copy = null;
DefineFunction match = null;
for (DefineFunction f : m_defineFunctions) {
if (f.getName().equals(functionName)) {
match = f;
//System.err.println("Found a match!!!");
break;
}
}
if (match != null) {
SerializedObject so = new SerializedObject(match, false);
copy = (DefineFunction)so.getObject();
//System.err.println(copy);
}
return copy;
}
示例8: makeCopies
import weka.core.SerializedObject; //导入依赖的package包/类
/**
* Creates a given number of deep or shallow (if the kernel implements Copyable)
* copies of the given kernel using serialization.
*
* @param model the kernel to copy
* @param num the number of kernel copies to create.
* @return an array of kernels.
* @throws Exception if an error occurs
*/
public static Kernel[] makeCopies(Kernel model, int num) throws Exception {
if (model == null)
throw new Exception("No model kernel set");
Kernel[] kernels = new Kernel[num];
if (model instanceof Copyable) {
for (int i = 0; i < kernels.length; i++) {
kernels[i] = (Kernel) ((Copyable) model).copy();
}
} else {
SerializedObject so = new SerializedObject(model);
for (int i = 0; i < kernels.length; i++)
kernels[i] = (Kernel) so.getObject();
}
return kernels;
}
示例9: instantiateToolBarMetaBean
import weka.core.SerializedObject; //导入依赖的package包/类
/**
* Instantiates (by making a serialized copy) the supplied template meta bean
* for display in the user tool bar
*
* @param bean the prototype MetaBean to display in the toolbar
*/
private JPanel instantiateToolBarMetaBean(MetaBean bean) {
// copy the bean via serialization
((Visible) bean).getVisual().removePropertyChangeListener(this);
bean.removePropertyChangeListenersSubFlow(this);
Object copy = null;
try {
SerializedObject so = new SerializedObject(bean);
copy = so.getObject();
} catch (Exception ex) {
ex.printStackTrace();
return null;
}
((Visible) bean).getVisual().addPropertyChangeListener(this);
bean.addPropertyChangeListenersSubFlow(this);
String displayName = "";
//
if (copy instanceof Visible) {
((Visible) copy).getVisual().scale(3);
displayName = ((Visible) copy).getVisual().getText();
}
return makeHolderPanelForToolBarBean(displayName, copy, false, null, true);
}
示例10: getFlow
import weka.core.SerializedObject; //导入依赖的package包/类
/**
* Gets the current flow being edited. The flow is returned as a single Vector
* containing two other Vectors: the beans and the connections. These two
* vectors are deep-copied via serialization before being returned.
*
* @return the current flow being edited
*/
public Vector getFlow() throws Exception {
Vector v = new Vector();
Vector beans = BeanInstance.getBeanInstances();
Vector connections = BeanConnection.getConnections();
detachFromLayout(beans);
v.add(beans);
v.add(connections);
SerializedObject so = new SerializedObject(v);
Vector copy = (Vector) so.getObject();
// tempWrite(beans, connections);
integrateFlow(beans, connections);
return copy;
}
示例11: makeCopies
import weka.core.SerializedObject; //导入依赖的package包/类
/**
* Creates copies of the current clusterer. Note that this method now uses
* Serialization to perform a deep copy, so the Clusterer object must be fully
* Serializable. Any currently built model will now be copied as well.
*
* @param model an example clusterer to copy
* @param num the number of clusterer copies to create.
* @return an array of clusterers.
* @exception Exception if an error occurs
*/
public static Clusterer[] makeCopies(Clusterer model, int num)
throws Exception {
if (model == null) {
throw new Exception("No model clusterer set");
}
Clusterer[] clusterers = new Clusterer[num];
SerializedObject so = new SerializedObject(model);
for (int i = 0; i < clusterers.length; i++) {
clusterers[i] = (Clusterer) so.getObject();
}
return clusterers;
}
示例12: makeCopies
import weka.core.SerializedObject; //导入依赖的package包/类
/**
* Creates copies of the current clusterer. Note that this method
* now uses Serialization to perform a deep copy, so the Clusterer
* object must be fully Serializable. Any currently built model will
* now be copied as well.
*
* @param model an example clusterer to copy
* @param num the number of clusterer copies to create.
* @return an array of clusterers.
* @exception Exception if an error occurs
*/
public static DensityBasedClusterer [] makeCopies(DensityBasedClusterer model,
int num) throws Exception {
if (model == null) {
throw new Exception("No model clusterer set");
}
DensityBasedClusterer [] clusterers = new DensityBasedClusterer [num];
SerializedObject so = new SerializedObject(model);
for(int i = 0; i < clusterers.length; i++) {
clusterers[i] = (DensityBasedClusterer) so.getObject();
}
return clusterers;
}
示例13: makeCopies
import weka.core.SerializedObject; //导入依赖的package包/类
/**
* Creates copies of the current evaluator. Note that this method now uses
* Serialization to perform a deep copy, so the evaluator object must be fully
* Serializable. Any currently built model will now be copied as well.
*
* @param model an example evaluator to copy
* @param num the number of evaluator copies to create.
* @return an array of evaluators.
* @exception Exception if an error occurs
*/
public static ASEvaluation[] makeCopies(ASEvaluation model,
int num) throws Exception {
if (model == null) {
throw new Exception("No model evaluator set");
}
ASEvaluation[] evaluators = new ASEvaluation[num];
SerializedObject so = new SerializedObject(model);
for (int i = 0; i < evaluators.length; i++) {
evaluators[i] = (ASEvaluation) so.getObject();
}
return evaluators;
}
示例14: makeCopies
import weka.core.SerializedObject; //导入依赖的package包/类
/**
* Creates copies of the current search scheme. Note that this method
* now uses Serialization to perform a deep copy, so the search
* object must be fully Serializable. Any currently built model will
* now be copied as well.
*
* @param model an example search scheme to copy
* @param num the number of search scheme copies to create.
* @return an array of search schemes.
* @throws Exception if an error occurs
*/
public static ASSearch[] makeCopies(ASSearch model, int num) throws Exception {
if (model == null)
throw new Exception("No model search scheme set");
ASSearch[] result = new ASSearch[num];
SerializedObject so = new SerializedObject(model);
for (int i = 0; i < result.length; i++)
result[i] = (ASSearch) so.getObject();
return result;
}
示例15: makeCopies
import weka.core.SerializedObject; //导入依赖的package包/类
/**
* returns deep copies of the given object
*
* @param obj the object to copy
* @param num the number of copies
* @return the deep copies
* @throws Exception if copying fails
*/
protected Object[] makeCopies(Object obj, int num) throws Exception {
if (obj == null) {
throw new Exception("No object set");
}
Object[] objs = new Object[num];
SerializedObject so = new SerializedObject(obj);
for (int i = 0; i < objs.length; i++) {
objs[i] = so.getObject();
}
return objs;
}