📄 kernelinterface.java
字号:
public native void setSeed(int seed);
public native int getNoOfInputUnits();
public native int getNoOfOutputUnits();
public native int getNoOfSpecialInputUnits();
public native int getNoOfSpecialOutputUnits();
public native void resetNet();
// Memory management functions
public native void allocateUnits(int n);
//public native void getMemoryManagerInfo(int *unit_bytes, int *site_bytes,
// int link_bytes, int NTable_bytes,
// int STable_bytes, int FTable_bytes);
public native void deleteNet();
// ART interface functions
//public native void getClassifiedStatus(art_cl_status *status);
public native int getClassNo();
public native int getN();
public native int getM();
public native int getNa();
public native int getMa();
public native int getNb();
public native int getMb();
// Undocumented but useful functions
/**
* Returns training error of the network / unit. Used by analyzer.
*
* @param currPatt current pattern
* @param unitNo unit (neuron) number
* @param errorType type of error to compute: network absolute (1), network squared (2) or unit absolute (3)
* @param average <code>true</code> if error should be divided by the number of output units
* @return network or unit training error
*/
public native double analyzer_error(int currPatt, int unitNo, int errorType, boolean average);
// variables:
public String siteName, siteFunction; // set by getFirstSiteTableEntry and getNextSiteTableEntry
public String functionName = ""; // set by getFuncInfo
public int functionType; // set by getFuncInfo
public int function_inputs; // set by getFuncParamInfo
public int function_outputs; // set by getFuncParamInfo
public int sites; // set by getNetInfo
public int links; // set by getNetInfo
public int symbols; // set by getNetInfo
public int functions; // set by getNetInfo
public double defaultActivation; // set by getUnitDefaults
public double defaultBias; // set by getUnitDefaults
public int defaultIOType; // set by getUnitDefaults
public int defaultSubnet; // set by getUnitDefaults
public int defaultLayer; // set by getUnitDefaults
public String defaultActFunction; // set by getUnitDefaults
public String defaultOutFunction; // set by getUnitDefaults
// from Batchman, without implementation in kernel interface:
public native void setSubPattern(String list_of_params);
public native void setParallelMode(boolean mode);
public native void setCascadeParams(double max_outp_uni_error,
String learn_func,
boolean print_covar,
boolean prune_new_hidden,
String mini_func,
double min_covar_change,
int cand_patience,
int max_no_covar,
int max_no_cand_units,
String actfunc,
double error_change,
int output_patience,
int max_no_epochs,
String modification,
double[] modParams,
boolean cacheUnitAct);
public native void testNet(); // instead of testAllPatterns
/**
* Prunes the network.
*/
public native void pruneNet();
/**
* Performs the initial step for network pruning.
* Used instead of <code>pruneNet</code> to allow for display update
* during pruning.
*
* @return maximum accepted error
*/
public native double pruneNet_FirstStep();
/**
* Performs a single step for network pruning.
* Used instead of <code>pruneNet</code> to allow for display update
* during pruning.
*
* @return current network error
*/
public native double pruneNet_Step();
/**
* Performs the last step for network pruning.
* Used instead of <code>pruneNet</code> to allow for display update
* during pruning.
*/
public native void pruneNet_LastStep();
public native void pruneTrainNet();
public native void pruneNetNow();
public native void delCandUnits();
//public native void setActFunc(arglist_type *arglist);
// extra methods for JavaGUI
public native int getCurrPatternSetNo();
public native int getNoOfPatternSets();
public native String getPatternSet(int setNo);
public native String getCurrPatternSet();
public native void renamePatternSet(int setNo, String newName);
public native void renamePatternSet(String name, String newName);
public native void renameCurrPatternSet(String newName);
public native void resetSNNS();
/////////////////////////////////////////////////////////////////////////////////////////////
// GUI related variables:
public int posX, posY, posZ; // used and set by getUnitPosition and getUnitNoAtPosition
public int cycles;
public int subpatterns;
public int output_units;
public double link_weight; // set by getFirstPredUnit and getNextPredUnit
public double activation, init_activation, output, bias, sse, mse, ssepu;
public double[] sseArr;
public int steps_done;
/////////////////////////////////////////////////////////////////////////////////////////////
// method for loading of native library
public void loadLibrary(String path) throws UnsatisfiedLinkError {
if(Snns.applet != null) path = System.getProperty("user.dir", "");
if( path == null ) System.loadLibrary(Snns.LIBRARY_NAME);
else System.load(
path + File.separatorChar + System.mapLibraryName(Snns.LIBRARY_NAME)
);
}
/**
* Exception thrown by kernel native methods.
*/
static public class KernelException extends Exception {
public KernelException(String msg) {
super(msg);
}
}
/**
* Java counterpart for pattern_set_info and pattern_descriptor
* of the kernel.
*/
static public class KernelPatternInfo {
// Take care that the following constants have the same value as in the
// native part (defined in glob_typ.h):
public static final int MAX_NO_OF_VAR_I_DIM = 2;
public static final int MAX_NO_OF_VAR_O_DIM = 2;
public static final int NO_OF_REMAP_PARAMS = 5;
///////////////////////////////////////////////////////////////////////////
// pattern_set_info:
int number_of_pattern; // the number of patterns (pairs) in this set
int virtual_no_of_pattern; // the number of patterns (pairs) if class_distrib_active == TRUE
boolean output_present; // TRUE if output pattern present
boolean fixed_fixsizes; // TRUE if the fixsizes of all pattern are equal
int in_fixsize; // if fixed_fixsizes TRUE, fixsize of the input pattern, else -1
int out_fixsize; // if fixed_fixsizes TRUE, fixsize of the output pattern, else -1
int in_number_of_dims; // number of variable input dimensions
int out_number_of_dims; // number of variable output dimensions
int[] in_max_dim_sizes // maximum size for each variable input dimension
= new int[MAX_NO_OF_VAR_I_DIM];
int[] out_max_dim_sizes // maximum size for each variable output dimension
= new int[MAX_NO_OF_VAR_O_DIM];
int[] in_min_dim_sizes // minimum size for each variable input dimensions
= new int[MAX_NO_OF_VAR_I_DIM];
int[] out_min_dim_sizes // minimum size for each variable output dimensions
= new int[MAX_NO_OF_VAR_O_DIM];
int classes; // number of pattern classes if > 0
String[] class_names // array of <classes> class names, ordered
= new String[2]; // (kernel expects the array to exist, so create one)
boolean class_distrib_active; // class amount redistribution is active
int[] class_redistribution // amounts for redistrib. <classes> entries
= new int[2]; // (kernel expects the array to exist, so create one)
String remap_function; // name of remap function or NULL
double[] remap_params // remap function parameters
= new double [NO_OF_REMAP_PARAMS];
int no_of_remap_params; // number of remap function parameters
///////////////////////////////////////////////////////////////////////////
// pattern_descriptor:
int input_dim; // number of variable input dimensions
int[] input_dim_sizes
= new int[MAX_NO_OF_VAR_I_DIM]; // actual size of each variable input dimensions
int input_fixsize; // size of the fixed part of the in pattern (0 if no input pattern present)
int output_dim; // number of variable output dimensions
int[] output_dim_sizes // actual size of each variable output dimensions
= new int[MAX_NO_OF_VAR_O_DIM];
int output_fixsize; // size of the fixed part of the out pattern (0 if no output pattern present)
int my_class; // class index of this pattern if classes available, -1 otherwise
}
/**
* Object returned from getShapeOfSubPattern.
*/
static public class KernelSubPatShape {
int[] insize = new int[KernelPatternInfo.MAX_NO_OF_VAR_I_DIM];
int[] outsize = new int[KernelPatternInfo.MAX_NO_OF_VAR_O_DIM];
int[] inpos = new int[KernelPatternInfo.MAX_NO_OF_VAR_I_DIM];
int[] outpos = new int[KernelPatternInfo.MAX_NO_OF_VAR_O_DIM];
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -