id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
29,000
Waikato/moa
moa/src/main/java/moa/clusterers/outliers/AnyOut/util/DataSet.java
DataSet.getVariances
public double[] getVariances() { double N = this.size(); double[] LS = new double[this.getNrOfDimensions()]; double[] SS = new double[this.getNrOfDimensions()]; double[] tmpFeatures; double[] variances = new double[this.getNrOfDimensions()]; for (DataObject dataObject : dataList) { tmpFeatures = d...
java
public double[] getVariances() { double N = this.size(); double[] LS = new double[this.getNrOfDimensions()]; double[] SS = new double[this.getNrOfDimensions()]; double[] tmpFeatures; double[] variances = new double[this.getNrOfDimensions()]; for (DataObject dataObject : dataList) { tmpFeatures = d...
[ "public", "double", "[", "]", "getVariances", "(", ")", "{", "double", "N", "=", "this", ".", "size", "(", ")", ";", "double", "[", "]", "LS", "=", "new", "double", "[", "this", ".", "getNrOfDimensions", "(", ")", "]", ";", "double", "[", "]", "S...
Calculates the variance of this data set for each dimension @return double array containing the variance per dimension
[ "Calculates", "the", "variance", "of", "this", "data", "set", "for", "each", "dimension" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/outliers/AnyOut/util/DataSet.java#L202-L223
29,001
Waikato/moa
moa/src/main/java/com/yahoo/labs/samoa/instances/SparseInstanceData.java
SparseInstanceData.toDoubleArray
@Override public double[] toDoubleArray() { double[] array = new double[numAttributes()]; for (int i = 0; i < numValues(); i++) { array[index(i)] = valueSparse(i); } return array; }
java
@Override public double[] toDoubleArray() { double[] array = new double[numAttributes()]; for (int i = 0; i < numValues(); i++) { array[index(i)] = valueSparse(i); } return array; }
[ "@", "Override", "public", "double", "[", "]", "toDoubleArray", "(", ")", "{", "double", "[", "]", "array", "=", "new", "double", "[", "numAttributes", "(", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numValues", "(", ")", ";...
To double array. @return the double[]
[ "To", "double", "array", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/com/yahoo/labs/samoa/instances/SparseInstanceData.java#L203-L210
29,002
Waikato/moa
moa/src/main/java/moa/clusterers/outliers/AnyOut/AnyOutCore.java
AnyOutCore.calcC1
private double calcC1(int objectId) { int nrOfPreviousResults = previousOScoreResultList.get(objectId).size(); if (nrOfPreviousResults == 0) { return 0.0; } int count=1; double difSum_k = Math.abs(lastOScoreResult.get(objectId)-previousOScoreResultList.get(objectId).get(nrOfPreviousResults-1)); ...
java
private double calcC1(int objectId) { int nrOfPreviousResults = previousOScoreResultList.get(objectId).size(); if (nrOfPreviousResults == 0) { return 0.0; } int count=1; double difSum_k = Math.abs(lastOScoreResult.get(objectId)-previousOScoreResultList.get(objectId).get(nrOfPreviousResults-1)); ...
[ "private", "double", "calcC1", "(", "int", "objectId", ")", "{", "int", "nrOfPreviousResults", "=", "previousOScoreResultList", ".", "get", "(", "objectId", ")", ".", "size", "(", ")", ";", "if", "(", "nrOfPreviousResults", "==", "0", ")", "{", "return", "...
Calculates the Confidence on the basis of the standard deviation of previous OScore results @return confidence
[ "Calculates", "the", "Confidence", "on", "the", "basis", "of", "the", "standard", "deviation", "of", "previous", "OScore", "results" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/outliers/AnyOut/AnyOutCore.java#L234-L252
29,003
Waikato/moa
moa/src/main/java/moa/gui/experimentertab/Summary.java
Summary.invertedSumariesPerMeasure
public void invertedSumariesPerMeasure( String path) { int cont = 0; int algorithmSize = this.streams.get(0).algorithm.size(); int streamSize = this.streams.size(); int measureSize = this.streams.get(0).algorithm.get(0).measures.size(); while (cont != measureSize) { ...
java
public void invertedSumariesPerMeasure( String path) { int cont = 0; int algorithmSize = this.streams.get(0).algorithm.size(); int streamSize = this.streams.size(); int measureSize = this.streams.get(0).algorithm.get(0).measures.size(); while (cont != measureSize) { ...
[ "public", "void", "invertedSumariesPerMeasure", "(", "String", "path", ")", "{", "int", "cont", "=", "0", ";", "int", "algorithmSize", "=", "this", ".", "streams", ".", "get", "(", "0", ")", ".", "algorithm", ".", "size", "(", ")", ";", "int", "streamS...
Generates a latex summary, in which the rows are the datasets and the columns the algorithms.
[ "Generates", "a", "latex", "summary", "in", "which", "the", "rows", "are", "the", "datasets", "and", "the", "columns", "the", "algorithms", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/experimentertab/Summary.java#L155-L214
29,004
Waikato/moa
moa/src/main/java/moa/gui/experimentertab/Summary.java
Summary.generateCSV
public void generateCSV() { int cont = 0; int algorithmSize = this.streams.get(0).algorithm.size(); int streamSize = this.streams.size(); int measureSize = this.streams.get(0).algorithm.get(0).measures.size(); while (cont != measureSize) { String out...
java
public void generateCSV() { int cont = 0; int algorithmSize = this.streams.get(0).algorithm.size(); int streamSize = this.streams.size(); int measureSize = this.streams.get(0).algorithm.get(0).measures.size(); while (cont != measureSize) { String out...
[ "public", "void", "generateCSV", "(", ")", "{", "int", "cont", "=", "0", ";", "int", "algorithmSize", "=", "this", ".", "streams", ".", "get", "(", "0", ")", ".", "algorithm", ".", "size", "(", ")", ";", "int", "streamSize", "=", "this", ".", "stre...
Generate a csv file for the statistical analysis.
[ "Generate", "a", "csv", "file", "for", "the", "statistical", "analysis", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/experimentertab/Summary.java#L508-L558
29,005
Waikato/moa
moa/src/main/java/moa/clusterers/dstream/DensityGrid.java
DensityGrid.getNeighbours
public ArrayList<DensityGrid> getNeighbours() { ArrayList<DensityGrid> neighbours = new ArrayList<DensityGrid>(); DensityGrid h; int[] hCoord = this.getCoordinates(); for (int i = 0 ; i < this.dimensions ; i++) { hCoord[i] = hCoord[i]-1; h = new DensityGrid(hCoord); neighbours.add(h); hCoo...
java
public ArrayList<DensityGrid> getNeighbours() { ArrayList<DensityGrid> neighbours = new ArrayList<DensityGrid>(); DensityGrid h; int[] hCoord = this.getCoordinates(); for (int i = 0 ; i < this.dimensions ; i++) { hCoord[i] = hCoord[i]-1; h = new DensityGrid(hCoord); neighbours.add(h); hCoo...
[ "public", "ArrayList", "<", "DensityGrid", ">", "getNeighbours", "(", ")", "{", "ArrayList", "<", "DensityGrid", ">", "neighbours", "=", "new", "ArrayList", "<", "DensityGrid", ">", "(", ")", ";", "DensityGrid", "h", ";", "int", "[", "]", "hCoord", "=", ...
Generates an Array List of neighbours for this density grid by varying each coordinate by one in either direction. Does not test whether the generated neighbours are valid as DensityGrid is not aware of the number of partitions in each dimension. @return an Array List of neighbours for this density grid
[ "Generates", "an", "Array", "List", "of", "neighbours", "for", "this", "density", "grid", "by", "varying", "each", "coordinate", "by", "one", "in", "either", "direction", ".", "Does", "not", "test", "whether", "the", "generated", "neighbours", "are", "valid", ...
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/dstream/DensityGrid.java#L170-L190
29,006
Waikato/moa
moa/src/main/java/moa/clusterers/dstream/DensityGrid.java
DensityGrid.getInclusionProbability
@Override public double getInclusionProbability(Instance instance) { for (int i = 0 ; i < this.dimensions ; i++) { if ((int) instance.value(i) != this.coordinates[i]) return 0.0; } return 1.0; }
java
@Override public double getInclusionProbability(Instance instance) { for (int i = 0 ; i < this.dimensions ; i++) { if ((int) instance.value(i) != this.coordinates[i]) return 0.0; } return 1.0; }
[ "@", "Override", "public", "double", "getInclusionProbability", "(", "Instance", "instance", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "dimensions", ";", "i", "++", ")", "{", "if", "(", "(", "int", ")", "instance", ".", ...
Provides the probability of the argument instance belonging to the density grid in question. @return 1.0 if the instance equals the density grid's coordinates; 0.0 otherwise.
[ "Provides", "the", "probability", "of", "the", "argument", "instance", "belonging", "to", "the", "density", "grid", "in", "question", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/dstream/DensityGrid.java#L239-L248
29,007
Waikato/moa
moa/src/main/java/moa/gui/experimentertab/Stream.java
Stream.readBuffer
public void readBuffer(List<String> algPath, List<String> algNames, List<Measure> measures) { BufferedReader buffer = null; for (int i = 0; i < algPath.size(); i++) { try { buffer = new BufferedReader(new FileReader(algPath.get(i))); } catch (FileNotFoundException...
java
public void readBuffer(List<String> algPath, List<String> algNames, List<Measure> measures) { BufferedReader buffer = null; for (int i = 0; i < algPath.size(); i++) { try { buffer = new BufferedReader(new FileReader(algPath.get(i))); } catch (FileNotFoundException...
[ "public", "void", "readBuffer", "(", "List", "<", "String", ">", "algPath", ",", "List", "<", "String", ">", "algNames", ",", "List", "<", "Measure", ">", "measures", ")", "{", "BufferedReader", "buffer", "=", "null", ";", "for", "(", "int", "i", "=", ...
Read each algorithm file. @param algPath @param algNames @param measures
[ "Read", "each", "algorithm", "file", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/experimentertab/Stream.java#L65-L77
29,008
Waikato/moa
moa/src/main/java/moa/streams/clustering/RandomRBFGeneratorEvents.java
RandomRBFGeneratorEvents.fireClusterChange
protected void fireClusterChange(long timestamp, String type, String message) { // if we have no listeners, do nothing... if (listeners != null && !listeners.isEmpty()) { // create the event object to send ClusterEvent event = new ClusterEvent(this, timestamp, type , message); // make...
java
protected void fireClusterChange(long timestamp, String type, String message) { // if we have no listeners, do nothing... if (listeners != null && !listeners.isEmpty()) { // create the event object to send ClusterEvent event = new ClusterEvent(this, timestamp, type , message); // make...
[ "protected", "void", "fireClusterChange", "(", "long", "timestamp", ",", "String", "type", ",", "String", "message", ")", "{", "// if we have no listeners, do nothing...", "if", "(", "listeners", "!=", "null", "&&", "!", "listeners", ".", "isEmpty", "(", ")", ")...
Fire a ClusterChangeEvent to all registered listeners
[ "Fire", "a", "ClusterChangeEvent", "to", "all", "registered", "listeners" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/streams/clustering/RandomRBFGeneratorEvents.java#L940-L963
29,009
Waikato/moa
moa/src/main/java/com/github/javacliparser/gui/ClassOptionEditComponent.java
ClassOptionEditComponent.notifyChangeListeners
protected void notifyChangeListeners() { ChangeEvent e = new ChangeEvent(this); for (ChangeListener l : changeListeners) { l.stateChanged(e); } }
java
protected void notifyChangeListeners() { ChangeEvent e = new ChangeEvent(this); for (ChangeListener l : changeListeners) { l.stateChanged(e); } }
[ "protected", "void", "notifyChangeListeners", "(", ")", "{", "ChangeEvent", "e", "=", "new", "ChangeEvent", "(", "this", ")", ";", "for", "(", "ChangeListener", "l", ":", "changeListeners", ")", "{", "l", ".", "stateChanged", "(", "e", ")", ";", "}", "}"...
Notifies all registered change listeners that the options have changed.
[ "Notifies", "all", "registered", "change", "listeners", "that", "the", "options", "have", "changed", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/com/github/javacliparser/gui/ClassOptionEditComponent.java#L137-L142
29,010
Waikato/moa
moa/src/main/java/moa/gui/visualization/GraphScatter.java
GraphScatter.setGraph
public void setGraph(MeasureCollection[] measures, MeasureCollection[] stds, double[] variedParamValues, Color[] colors) { this.variedParamValues = variedParamValues; super.setGraph(measures, stds, colors); }
java
public void setGraph(MeasureCollection[] measures, MeasureCollection[] stds, double[] variedParamValues, Color[] colors) { this.variedParamValues = variedParamValues; super.setGraph(measures, stds, colors); }
[ "public", "void", "setGraph", "(", "MeasureCollection", "[", "]", "measures", ",", "MeasureCollection", "[", "]", "stds", ",", "double", "[", "]", "variedParamValues", ",", "Color", "[", "]", "colors", ")", "{", "this", ".", "variedParamValues", "=", "varied...
Draws a scatter graph based on the varied parameter and the measures. @param measures list of measure collections, one for each task @param stds standard deviation values @param variedParamValues values of the varied parameter @param colors color encodings for the different tasks
[ "Draws", "a", "scatter", "graph", "based", "on", "the", "varied", "parameter", "and", "the", "measures", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/visualization/GraphScatter.java#L50-L54
29,011
Waikato/moa
moa/src/main/java/moa/gui/visualization/GraphScatter.java
GraphScatter.scatter
private void scatter(Graphics g, int i) { int height = getHeight(); int width = getWidth(); int x = (int)(((this.variedParamValues[i] - this.lower_x_value) / (this.upper_x_value - this.lower_x_value)) * width); double value = this.measures[i].getLastValue(this.measureSelected); if(Doub...
java
private void scatter(Graphics g, int i) { int height = getHeight(); int width = getWidth(); int x = (int)(((this.variedParamValues[i] - this.lower_x_value) / (this.upper_x_value - this.lower_x_value)) * width); double value = this.measures[i].getLastValue(this.measureSelected); if(Doub...
[ "private", "void", "scatter", "(", "Graphics", "g", ",", "int", "i", ")", "{", "int", "height", "=", "getHeight", "(", ")", ";", "int", "width", "=", "getWidth", "(", ")", ";", "int", "x", "=", "(", "int", ")", "(", "(", "(", "this", ".", "vari...
Paint a dot onto the panel. @param g graphics object @param i index of the varied parameter
[ "Paint", "a", "dot", "onto", "the", "panel", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/visualization/GraphScatter.java#L76-L100
29,012
Waikato/moa
moa/src/main/java/moa/AbstractMOAObject.java
AbstractMOAObject.copy
public static MOAObject copy(MOAObject obj) { try { return (MOAObject) SerializeUtils.copyObject(obj); } catch (Exception e) { throw new RuntimeException("Object copy failed.", e); } }
java
public static MOAObject copy(MOAObject obj) { try { return (MOAObject) SerializeUtils.copyObject(obj); } catch (Exception e) { throw new RuntimeException("Object copy failed.", e); } }
[ "public", "static", "MOAObject", "copy", "(", "MOAObject", "obj", ")", "{", "try", "{", "return", "(", "MOAObject", ")", "SerializeUtils", ".", "copyObject", "(", "obj", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeExc...
This method produces a copy of an object. @param obj object to copy @return a copy of the object
[ "This", "method", "produces", "a", "copy", "of", "an", "object", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/AbstractMOAObject.java#L62-L68
29,013
Waikato/moa
moa/src/main/java/moa/gui/GUIDefaults.java
GUIDefaults.get
public static String get(String property, String defaultValue) { return PROPERTIES.getProperty(property, defaultValue); }
java
public static String get(String property, String defaultValue) { return PROPERTIES.getProperty(property, defaultValue); }
[ "public", "static", "String", "get", "(", "String", "property", ",", "String", "defaultValue", ")", "{", "return", "PROPERTIES", ".", "getProperty", "(", "property", ",", "defaultValue", ")", ";", "}" ]
returns the value for the specified property, if non-existent then the default value. @param property the property to retrieve the value for @param defaultValue the default value for the property @return the value of the specified property
[ "returns", "the", "value", "for", "the", "specified", "property", "if", "non", "-", "existent", "then", "the", "default", "value", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/GUIDefaults.java#L69-L71
29,014
Waikato/moa
moa/src/main/java/moa/gui/GUIDefaults.java
GUIDefaults.getTabs
public static String[] getTabs() { String[] result; String tabs; // read and split on comma tabs = get("Tabs", "moa.gui.ClassificationTabPanel,moa.gui.RegressionTabPanel,moa.gui.MultiLabelTabPanel,moa.gui.MultiTargetTabPanel,moa.gui.clustertab.ClusteringTabPanel,moa.gui.outliertab.Outli...
java
public static String[] getTabs() { String[] result; String tabs; // read and split on comma tabs = get("Tabs", "moa.gui.ClassificationTabPanel,moa.gui.RegressionTabPanel,moa.gui.MultiLabelTabPanel,moa.gui.MultiTargetTabPanel,moa.gui.clustertab.ClusteringTabPanel,moa.gui.outliertab.Outli...
[ "public", "static", "String", "[", "]", "getTabs", "(", ")", "{", "String", "[", "]", "result", ";", "String", "tabs", ";", "// read and split on comma", "tabs", "=", "get", "(", "\"Tabs\"", ",", "\"moa.gui.ClassificationTabPanel,moa.gui.RegressionTabPanel,moa.gui.Mul...
returns an array with the classnames of all the additional panels to display as tabs in the GUI. @return the classnames
[ "returns", "an", "array", "with", "the", "classnames", "of", "all", "the", "additional", "panels", "to", "display", "as", "tabs", "in", "the", "GUI", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/GUIDefaults.java#L134-L143
29,015
Waikato/moa
moa/src/main/java/moa/gui/GUIDefaults.java
GUIDefaults.getFrameWidth
public static int getFrameWidth() { int result; String str; str = get("FrameWidth", "1200"); try { result = Integer.parseInt(str); } catch (Exception e) { result = 1200; } return result; }
java
public static int getFrameWidth() { int result; String str; str = get("FrameWidth", "1200"); try { result = Integer.parseInt(str); } catch (Exception e) { result = 1200; } return result; }
[ "public", "static", "int", "getFrameWidth", "(", ")", "{", "int", "result", ";", "String", "str", ";", "str", "=", "get", "(", "\"FrameWidth\"", ",", "\"1200\"", ")", ";", "try", "{", "result", "=", "Integer", ".", "parseInt", "(", "str", ")", ";", "...
Returns the width for the frame. @return the width in pixel
[ "Returns", "the", "width", "for", "the", "frame", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/GUIDefaults.java#L176-L187
29,016
Waikato/moa
moa/src/main/java/moa/gui/GUIDefaults.java
GUIDefaults.main
public static void main(String[] args) { Enumeration names; String name; Vector sorted; System.out.println("\nMOA defaults:"); names = PROPERTIES.propertyNames(); // sort names sorted = new Vector(); while (names.hasMoreElements()) { sorted.a...
java
public static void main(String[] args) { Enumeration names; String name; Vector sorted; System.out.println("\nMOA defaults:"); names = PROPERTIES.propertyNames(); // sort names sorted = new Vector(); while (names.hasMoreElements()) { sorted.a...
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "Enumeration", "names", ";", "String", "name", ";", "Vector", "sorted", ";", "System", ".", "out", ".", "println", "(", "\"\\nMOA defaults:\"", ")", ";", "names", "=", "PROPER...
only for testing - prints the content of the props file. @param args commandline parameters - ignored
[ "only", "for", "testing", "-", "prints", "the", "content", "of", "the", "props", "file", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/GUIDefaults.java#L248-L270
29,017
Waikato/moa
moa/src/main/java/moa/clusterers/clustream/ClustreamKernel.java
ClustreamKernel.inverseError
public static double inverseError(double x) { double z = Math.sqrt(Math.PI) * x; double res = (z) / 2; double z2 = z * z; double zProd = z * z2; // z^3 res += (1.0 / 24) * zProd; zProd *= z2; // z^5 res += (7.0 / 960) * zProd; zProd *= z2; // z^7 ...
java
public static double inverseError(double x) { double z = Math.sqrt(Math.PI) * x; double res = (z) / 2; double z2 = z * z; double zProd = z * z2; // z^3 res += (1.0 / 24) * zProd; zProd *= z2; // z^5 res += (7.0 / 960) * zProd; zProd *= z2; // z^7 ...
[ "public", "static", "double", "inverseError", "(", "double", "x", ")", "{", "double", "z", "=", "Math", ".", "sqrt", "(", "Math", ".", "PI", ")", "*", "x", ";", "double", "res", "=", "(", "z", ")", "/", "2", ";", "double", "z2", "=", "z", "*", ...
Approximates the inverse error function. Clustream needs this. @param z
[ "Approximates", "the", "inverse", "error", "function", ".", "Clustream", "needs", "this", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/clustream/ClustreamKernel.java#L231-L255
29,018
Waikato/moa
moa/src/main/java/moa/clusterers/kmeanspm/BICO.java
BICO.bicoUpdate
protected void bicoUpdate(double[] x) { assert (!this.bufferPhase && this.numDimensions == x.length); // Starts with the global root node as the current root node ClusteringTreeNode r = this.root; int i = 1; while (true) { ClusteringTreeNode y = r.nearestChild(x); // Checks if the point can not be added...
java
protected void bicoUpdate(double[] x) { assert (!this.bufferPhase && this.numDimensions == x.length); // Starts with the global root node as the current root node ClusteringTreeNode r = this.root; int i = 1; while (true) { ClusteringTreeNode y = r.nearestChild(x); // Checks if the point can not be added...
[ "protected", "void", "bicoUpdate", "(", "double", "[", "]", "x", ")", "{", "assert", "(", "!", "this", ".", "bufferPhase", "&&", "this", ".", "numDimensions", "==", "x", ".", "length", ")", ";", "// Starts with the global root node as the current root node", "Cl...
Inserts a new point into the ClusteringFeature tree. @param x the point
[ "Inserts", "a", "new", "point", "into", "the", "ClusteringFeature", "tree", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/kmeanspm/BICO.java#L294-L328
29,019
Waikato/moa
moa/src/main/java/moa/clusterers/kmeanspm/BICO.java
BICO.rebuild
protected void rebuild() { // Checks if the number of nodes in the tree exceeds the maximum number while (this.rootCount > this.maxNumClusterFeatures) { // Doubles the global threshold this.T *= 2.0; this.root.setThreshold(calcRSquared(1)); // Adds all nodes to the ClusteringFeature tree again Queue<...
java
protected void rebuild() { // Checks if the number of nodes in the tree exceeds the maximum number while (this.rootCount > this.maxNumClusterFeatures) { // Doubles the global threshold this.T *= 2.0; this.root.setThreshold(calcRSquared(1)); // Adds all nodes to the ClusteringFeature tree again Queue<...
[ "protected", "void", "rebuild", "(", ")", "{", "// Checks if the number of nodes in the tree exceeds the maximum number", "while", "(", "this", ".", "rootCount", ">", "this", ".", "maxNumClusterFeatures", ")", "{", "// Doubles the global threshold", "this", ".", "T", "*="...
If the number of ClusteringTreeNodes exceeds the maximum bound, the global threshold T will be doubled and the tree will be rebuild with the new threshold.
[ "If", "the", "number", "of", "ClusteringTreeNodes", "exceeds", "the", "maximum", "bound", "the", "global", "threshold", "T", "will", "be", "doubled", "and", "the", "tree", "will", "be", "rebuild", "with", "the", "new", "threshold", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/kmeanspm/BICO.java#L336-L355
29,020
Waikato/moa
moa/src/main/java/moa/clusterers/kmeanspm/BICO.java
BICO.bicoCFUpdate
protected void bicoCFUpdate(ClusteringTreeNode x) { // Starts with the global root node as the current root node ClusteringTreeNode r = this.root; int i = 1; while (true) { ClusteringTreeNode y = r.nearestChild(x.getCenter()); // Checks if the node can not be merged to the current level if (r.hasNoChil...
java
protected void bicoCFUpdate(ClusteringTreeNode x) { // Starts with the global root node as the current root node ClusteringTreeNode r = this.root; int i = 1; while (true) { ClusteringTreeNode y = r.nearestChild(x.getCenter()); // Checks if the node can not be merged to the current level if (r.hasNoChil...
[ "protected", "void", "bicoCFUpdate", "(", "ClusteringTreeNode", "x", ")", "{", "// Starts with the global root node as the current root node", "ClusteringTreeNode", "r", "=", "this", ".", "root", ";", "int", "i", "=", "1", ";", "while", "(", "true", ")", "{", "Clu...
Inserts a ClusteringTreeNode into the ClusteringFeature tree. @param x the ClusteringTreeNode
[ "Inserts", "a", "ClusteringTreeNode", "into", "the", "ClusteringFeature", "tree", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/kmeanspm/BICO.java#L363-L394
29,021
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/neighboursearch/NearestNeighbourSearch.java
NearestNeighbourSearch.combSort11
public static void combSort11(double arrayToSort[], int linkedArray[]) { int switches, j, top, gap; double hold1; int hold2; gap = arrayToSort.length; do { gap=(int)(gap/1.3); switch(gap) { case 0: gap = 1; break; case 9: case 10: gap=11;...
java
public static void combSort11(double arrayToSort[], int linkedArray[]) { int switches, j, top, gap; double hold1; int hold2; gap = arrayToSort.length; do { gap=(int)(gap/1.3); switch(gap) { case 0: gap = 1; break; case 9: case 10: gap=11;...
[ "public", "static", "void", "combSort11", "(", "double", "arrayToSort", "[", "]", ",", "int", "linkedArray", "[", "]", ")", "{", "int", "switches", ",", "j", ",", "top", ",", "gap", ";", "double", "hold1", ";", "int", "hold2", ";", "gap", "=", "array...
sorts the two given arrays. @param arrayToSort The array sorting should be based on. @param linkedArray The array that should have the same ordering as arrayToSort.
[ "sorts", "the", "two", "given", "arrays", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/neighboursearch/NearestNeighbourSearch.java#L653-L685
29,022
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/neighboursearch/NearestNeighbourSearch.java
NearestNeighbourSearch.quickSort
public static void quickSort(double[] arrayToSort, double[] linkedArray, int left, int right) { if (left < right) { int middle = partition(arrayToSort, linkedArray, left, right); quickSort(arrayToSort, linkedArray, left, middle); quickSort(arrayToSort, linkedArray, middle + 1, right); } }
java
public static void quickSort(double[] arrayToSort, double[] linkedArray, int left, int right) { if (left < right) { int middle = partition(arrayToSort, linkedArray, left, right); quickSort(arrayToSort, linkedArray, left, middle); quickSort(arrayToSort, linkedArray, middle + 1, right); } }
[ "public", "static", "void", "quickSort", "(", "double", "[", "]", "arrayToSort", ",", "double", "[", "]", "linkedArray", ",", "int", "left", ",", "int", "right", ")", "{", "if", "(", "left", "<", "right", ")", "{", "int", "middle", "=", "partition", ...
performs quicksort. @param arrayToSort the array to sort @param linkedArray the linked array @param left the first index of the subset @param right the last index of the subset
[ "performs", "quicksort", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/neighboursearch/NearestNeighbourSearch.java#L734-L740
29,023
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java
KDTree.kNearestNeighbours
public Instances kNearestNeighbours(Instance target, int k) throws Exception { checkMissing(target); MyHeap heap = new MyHeap(k); findNearestNeighbours(target, m_Root, k, heap, 0.0); Instances neighbours = new Instances(m_Instances, (heap.size() + heap .noOfKthNearest())); m_DistanceLi...
java
public Instances kNearestNeighbours(Instance target, int k) throws Exception { checkMissing(target); MyHeap heap = new MyHeap(k); findNearestNeighbours(target, m_Root, k, heap, 0.0); Instances neighbours = new Instances(m_Instances, (heap.size() + heap .noOfKthNearest())); m_DistanceLi...
[ "public", "Instances", "kNearestNeighbours", "(", "Instance", "target", ",", "int", "k", ")", "throws", "Exception", "{", "checkMissing", "(", "target", ")", ";", "MyHeap", "heap", "=", "new", "MyHeap", "(", "k", ")", ";", "findNearestNeighbours", "(", "targ...
Returns the k nearest neighbours of the supplied instance. &gt;k neighbours are returned if there are more than one neighbours at the kth boundary. @param target The instance to find the nearest neighbours for. @param k The number of neighbours to find. @return The k nearest neighbours (or &gt;k if more there are th...
[ "Returns", "the", "k", "nearest", "neighbours", "of", "the", "supplied", "instance", ".", "&gt", ";", "k", "neighbours", "are", "returned", "if", "there", "are", "more", "than", "one", "neighbours", "at", "the", "kth", "boundary", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java#L328-L359
29,024
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java
KDTree.update
public void update(Instance instance) throws Exception { // better to change // to addInstance if (m_Instances == null) throw new Exception("No instances supplied yet. Have to call " + "setInstances(instances) with a set of Instances " + "f...
java
public void update(Instance instance) throws Exception { // better to change // to addInstance if (m_Instances == null) throw new Exception("No instances supplied yet. Have to call " + "setInstances(instances) with a set of Instances " + "f...
[ "public", "void", "update", "(", "Instance", "instance", ")", "throws", "Exception", "{", "// better to change", "// to addInstance", "if", "(", "m_Instances", "==", "null", ")", "throw", "new", "Exception", "(", "\"No instances supplied yet. Have to call \"", "+", "\...
Adds one instance to the KDTree. This updates the KDTree structure to take into account the newly added training instance. @param instance the instance to be added. Usually the newly added instance in the training set. @throws Exception If the instance cannot be added.
[ "Adds", "one", "instance", "to", "the", "KDTree", ".", "This", "updates", "the", "KDTree", "structure", "to", "take", "into", "account", "the", "newly", "added", "training", "instance", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java#L416-L424
29,025
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java
KDTree.checkMissing
protected void checkMissing(Instances instances) throws Exception { for (int i = 0; i < instances.numInstances(); i++) { Instance ins = instances.instance(i); for (int j = 0; j < ins.numValues(); j++) { if (ins.index(j) != ins.classIndex()) if (ins.isMissingSparse(j)) { thr...
java
protected void checkMissing(Instances instances) throws Exception { for (int i = 0; i < instances.numInstances(); i++) { Instance ins = instances.instance(i); for (int j = 0; j < ins.numValues(); j++) { if (ins.index(j) != ins.classIndex()) if (ins.isMissingSparse(j)) { thr...
[ "protected", "void", "checkMissing", "(", "Instances", "instances", ")", "throws", "Exception", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "instances", ".", "numInstances", "(", ")", ";", "i", "++", ")", "{", "Instance", "ins", "=", "instanc...
Checks if there is any instance with missing values. Throws an exception if there is, as KDTree does not handle missing values. @param instances the instances to check @throws Exception if missing values are encountered
[ "Checks", "if", "there", "is", "any", "instance", "with", "missing", "values", ".", "Throws", "an", "exception", "if", "there", "is", "as", "KDTree", "does", "not", "handle", "missing", "values", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java#L530-L542
29,026
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java
KDTree.checkMissing
protected void checkMissing(Instance ins) throws Exception { for (int j = 0; j < ins.numValues(); j++) { if (ins.index(j) != ins.classIndex()) if (ins.isMissingSparse(j)) { throw new Exception("ERROR: KDTree can not deal with missing " + "values. Please run ReplaceMissingValues...
java
protected void checkMissing(Instance ins) throws Exception { for (int j = 0; j < ins.numValues(); j++) { if (ins.index(j) != ins.classIndex()) if (ins.isMissingSparse(j)) { throw new Exception("ERROR: KDTree can not deal with missing " + "values. Please run ReplaceMissingValues...
[ "protected", "void", "checkMissing", "(", "Instance", "ins", ")", "throws", "Exception", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "ins", ".", "numValues", "(", ")", ";", "j", "++", ")", "{", "if", "(", "ins", ".", "index", "(", "j", ...
Checks if there is any missing value in the given instance. @param ins The instance to check missing values in. @throws Exception If there is a missing value in the instance.
[ "Checks", "if", "there", "is", "any", "missing", "value", "in", "the", "given", "instance", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java#L551-L560
29,027
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java
KDTree.enumerateMeasures
public Enumeration enumerateMeasures() { Vector<String> newVector = new Vector<String>(); newVector.addElement("measureTreeSize"); newVector.addElement("measureNumLeaves"); newVector.addElement("measureMaxDepth"); return newVector.elements(); }
java
public Enumeration enumerateMeasures() { Vector<String> newVector = new Vector<String>(); newVector.addElement("measureTreeSize"); newVector.addElement("measureNumLeaves"); newVector.addElement("measureMaxDepth"); return newVector.elements(); }
[ "public", "Enumeration", "enumerateMeasures", "(", ")", "{", "Vector", "<", "String", ">", "newVector", "=", "new", "Vector", "<", "String", ">", "(", ")", ";", "newVector", ".", "addElement", "(", "\"measureTreeSize\"", ")", ";", "newVector", ".", "addEleme...
Returns an enumeration of the additional measure names. @return an enumeration of the measure names
[ "Returns", "an", "enumeration", "of", "the", "additional", "measure", "names", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java#L653-L659
29,028
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java
KDTree.getMeasure
public double getMeasure(String additionalMeasureName) { if (additionalMeasureName.compareToIgnoreCase("measureMaxDepth") == 0) { return measureMaxDepth(); } else if (additionalMeasureName.compareToIgnoreCase("measureTreeSize") == 0) { return measureTreeSize(); } else if (additionalMeasureName.c...
java
public double getMeasure(String additionalMeasureName) { if (additionalMeasureName.compareToIgnoreCase("measureMaxDepth") == 0) { return measureMaxDepth(); } else if (additionalMeasureName.compareToIgnoreCase("measureTreeSize") == 0) { return measureTreeSize(); } else if (additionalMeasureName.c...
[ "public", "double", "getMeasure", "(", "String", "additionalMeasureName", ")", "{", "if", "(", "additionalMeasureName", ".", "compareToIgnoreCase", "(", "\"measureMaxDepth\"", ")", "==", "0", ")", "{", "return", "measureMaxDepth", "(", ")", ";", "}", "else", "if...
Returns the value of the named measure. @param additionalMeasureName the name of the measure to query for its value. @return The value of the named measure @throws IllegalArgumentException If the named measure is not supported.
[ "Returns", "the", "value", "of", "the", "named", "measure", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java#L670-L681
29,029
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java
KDTree.centerInstances
public void centerInstances(Instances centers, int[] assignments, double pc) throws Exception { int[] centList = new int[centers.numInstances()]; for (int i = 0; i < centers.numInstances(); i++) centList[i] = i; determineAssignments(m_Root, centers, centList, assignments, pc); }
java
public void centerInstances(Instances centers, int[] assignments, double pc) throws Exception { int[] centList = new int[centers.numInstances()]; for (int i = 0; i < centers.numInstances(); i++) centList[i] = i; determineAssignments(m_Root, centers, centList, assignments, pc); }
[ "public", "void", "centerInstances", "(", "Instances", "centers", ",", "int", "[", "]", "assignments", ",", "double", "pc", ")", "throws", "Exception", "{", "int", "[", "]", "centList", "=", "new", "int", "[", "centers", ".", "numInstances", "(", ")", "]...
Assigns instances to centers using KDTree. @param centers the current centers @param assignments the centerindex for each instance @param pc the threshold value for pruning. @throws Exception If there is some problem assigning instances to centers.
[ "Assigns", "instances", "to", "centers", "using", "KDTree", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java#L701-L709
29,030
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java
KDTree.determineAssignments
protected void determineAssignments(KDTreeNode node, Instances centers, int[] candidates, int[] assignments, double pc) throws Exception { // reduce number of owners for current hyper rectangle int[] owners = refineOwners(node, centers, candidates); // only one owner if (owners.length == 1) { ...
java
protected void determineAssignments(KDTreeNode node, Instances centers, int[] candidates, int[] assignments, double pc) throws Exception { // reduce number of owners for current hyper rectangle int[] owners = refineOwners(node, centers, candidates); // only one owner if (owners.length == 1) { ...
[ "protected", "void", "determineAssignments", "(", "KDTreeNode", "node", ",", "Instances", "centers", ",", "int", "[", "]", "candidates", ",", "int", "[", "]", "assignments", ",", "double", "pc", ")", "throws", "Exception", "{", "// reduce number of owners for curr...
Assigns instances to the current centers called candidates. @param node The node to start assigning the instances from. @param centers all the current centers. @param candidates the current centers the method works on. @param assignments the center index for each instance. @param pc the threshold value for pruning. @t...
[ "Assigns", "instances", "to", "the", "current", "centers", "called", "candidates", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java#L722-L744
29,031
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java
KDTree.refineOwners
protected int[] refineOwners(KDTreeNode node, Instances centers, int[] candidates) throws Exception { int[] owners = new int[candidates.length]; double minDistance = Double.POSITIVE_INFINITY; int ownerIndex = -1; Instance owner; int numCand = candidates.length; double[] distance = new dou...
java
protected int[] refineOwners(KDTreeNode node, Instances centers, int[] candidates) throws Exception { int[] owners = new int[candidates.length]; double minDistance = Double.POSITIVE_INFINITY; int ownerIndex = -1; Instance owner; int numCand = candidates.length; double[] distance = new dou...
[ "protected", "int", "[", "]", "refineOwners", "(", "KDTreeNode", "node", ",", "Instances", "centers", ",", "int", "[", "]", "candidates", ")", "throws", "Exception", "{", "int", "[", "]", "owners", "=", "new", "int", "[", "candidates", ".", "length", "]"...
Refines the ownerlist. @param node The current tree node. @param centers all centers @param candidates the indexes of those centers that are candidates. @return list of owners @throws Exception If some problem occurs in refining.
[ "Refines", "the", "ownerlist", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java#L755-L807
29,032
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java
KDTree.distanceToHrect
protected double distanceToHrect(KDTreeNode node, Instance x) throws Exception { double distance = 0.0; Instance closestPoint = (Instance)x.copy(); boolean inside; inside = clipToInsideHrect(node, closestPoint); if (!inside) distance = m_EuclideanDistance.distance(closestPoint, x); return...
java
protected double distanceToHrect(KDTreeNode node, Instance x) throws Exception { double distance = 0.0; Instance closestPoint = (Instance)x.copy(); boolean inside; inside = clipToInsideHrect(node, closestPoint); if (!inside) distance = m_EuclideanDistance.distance(closestPoint, x); return...
[ "protected", "double", "distanceToHrect", "(", "KDTreeNode", "node", ",", "Instance", "x", ")", "throws", "Exception", "{", "double", "distance", "=", "0.0", ";", "Instance", "closestPoint", "=", "(", "Instance", ")", "x", ".", "copy", "(", ")", ";", "bool...
Returns the distance between a point and an hyperrectangle. @param node The current node from whose hyperrectangle the distance is to be measured. @param x the point @return the distance @throws Exception If some problem occurs in determining the distance to the hyperrectangle.
[ "Returns", "the", "distance", "between", "a", "point", "and", "an", "hyperrectangle", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java#L819-L828
29,033
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java
KDTree.clipToInsideHrect
protected boolean clipToInsideHrect(KDTreeNode node, Instance x) { boolean inside = true; for (int i = 0; i < m_Instances.numAttributes(); i++) { // TODO treat nominals differently!?? if (x.value(i) < node.m_NodeRanges[i][MIN]) { x.setValue(i, node.m_NodeRanges[i][MIN]); inside = fa...
java
protected boolean clipToInsideHrect(KDTreeNode node, Instance x) { boolean inside = true; for (int i = 0; i < m_Instances.numAttributes(); i++) { // TODO treat nominals differently!?? if (x.value(i) < node.m_NodeRanges[i][MIN]) { x.setValue(i, node.m_NodeRanges[i][MIN]); inside = fa...
[ "protected", "boolean", "clipToInsideHrect", "(", "KDTreeNode", "node", ",", "Instance", "x", ")", "{", "boolean", "inside", "=", "true", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "m_Instances", ".", "numAttributes", "(", ")", ";", "i", "++...
Finds the closest point in the hyper rectangle to a given point. Change the given point to this closest point by clipping of at all the dimensions to be clipped of. If the point is inside the rectangle it stays unchanged. The return value is true if the point was not changed, so the the return value is true if the poin...
[ "Finds", "the", "closest", "point", "in", "the", "hyper", "rectangle", "to", "a", "given", "point", ".", "Change", "the", "given", "point", "to", "this", "closest", "point", "by", "clipping", "of", "at", "all", "the", "dimensions", "to", "be", "clipped", ...
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java#L842-L856
29,034
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java
KDTree.assignSubToCenters
public void assignSubToCenters(KDTreeNode node, Instances centers, int[] centList, int[] assignments) throws Exception { // todo: undecided situations int numCent = centList.length; // WARNING: assignments is "input/output-parameter" // should not be null and the following should not happen i...
java
public void assignSubToCenters(KDTreeNode node, Instances centers, int[] centList, int[] assignments) throws Exception { // todo: undecided situations int numCent = centList.length; // WARNING: assignments is "input/output-parameter" // should not be null and the following should not happen i...
[ "public", "void", "assignSubToCenters", "(", "KDTreeNode", "node", ",", "Instances", "centers", ",", "int", "[", "]", "centList", ",", "int", "[", "]", "assignments", ")", "throws", "Exception", "{", "// todo: undecided situations", "int", "numCent", "=", "centL...
Assigns instances of this node to center. Center to be assign to is decided by the distance function. @param node The KDTreeNode whose instances are to be assigned. @param centers all the input centers @param centList the list of centers to work with @param assignments index list of last assignments @throws Exception ...
[ "Assigns", "instances", "of", "this", "node", "to", "center", ".", "Center", "to", "be", "assign", "to", "is", "decided", "by", "the", "distance", "function", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java#L910-L933
29,035
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java
KDTree.setDistanceFunction
public void setDistanceFunction(DistanceFunction df) throws Exception { if (!(df instanceof EuclideanDistance)) throw new Exception("KDTree currently only works with " + "EuclideanDistanceFunction."); m_DistanceFunction = m_EuclideanDistance = (EuclideanDistance) df; }
java
public void setDistanceFunction(DistanceFunction df) throws Exception { if (!(df instanceof EuclideanDistance)) throw new Exception("KDTree currently only works with " + "EuclideanDistanceFunction."); m_DistanceFunction = m_EuclideanDistance = (EuclideanDistance) df; }
[ "public", "void", "setDistanceFunction", "(", "DistanceFunction", "df", ")", "throws", "Exception", "{", "if", "(", "!", "(", "df", "instanceof", "EuclideanDistance", ")", ")", "throw", "new", "Exception", "(", "\"KDTree currently only works with \"", "+", "\"Euclid...
sets the distance function to use for nearest neighbour search. @param df the distance function to use @throws Exception if not EuclideanDistance
[ "sets", "the", "distance", "function", "to", "use", "for", "nearest", "neighbour", "search", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java#L1066-L1071
29,036
Waikato/moa
moa/src/main/java/moa/clusterers/kmeanspm/ClusteringTreeNode.java
ClusteringTreeNode.count
@Deprecated public int count() { int count = (clusteringFeature != null) ? 1 : 0; for (ClusteringTreeNode child : children) { count += child.count(); } return count; }
java
@Deprecated public int count() { int count = (clusteringFeature != null) ? 1 : 0; for (ClusteringTreeNode child : children) { count += child.count(); } return count; }
[ "@", "Deprecated", "public", "int", "count", "(", ")", "{", "int", "count", "=", "(", "clusteringFeature", "!=", "null", ")", "?", "1", ":", "0", ";", "for", "(", "ClusteringTreeNode", "child", ":", "children", ")", "{", "count", "+=", "child", ".", ...
Counts the elements in tree with this node as the root. @deprecated @return the number of elements
[ "Counts", "the", "elements", "in", "tree", "with", "this", "node", "as", "the", "root", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/kmeanspm/ClusteringTreeNode.java#L70-L77
29,037
Waikato/moa
moa/src/main/java/moa/clusterers/kmeanspm/ClusteringTreeNode.java
ClusteringTreeNode.addToClustering
public Clustering addToClustering(Clustering clustering) { if (center != null && getClusteringFeature() != null) { clustering.add(getClusteringFeature().toCluster()); } for (ClusteringTreeNode child : children) { child.addToClustering(clustering); } return clustering; }
java
public Clustering addToClustering(Clustering clustering) { if (center != null && getClusteringFeature() != null) { clustering.add(getClusteringFeature().toCluster()); } for (ClusteringTreeNode child : children) { child.addToClustering(clustering); } return clustering; }
[ "public", "Clustering", "addToClustering", "(", "Clustering", "clustering", ")", "{", "if", "(", "center", "!=", "null", "&&", "getClusteringFeature", "(", ")", "!=", "null", ")", "{", "clustering", ".", "add", "(", "getClusteringFeature", "(", ")", ".", "to...
Adds all ClusterFeatures of the tree with this node as the root to a Clustering. @param clustering the Clustering to add the ClusterFeatures too. @return the input Clustering
[ "Adds", "all", "ClusterFeatures", "of", "the", "tree", "with", "this", "node", "as", "the", "root", "to", "a", "Clustering", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/kmeanspm/ClusteringTreeNode.java#L87-L95
29,038
Waikato/moa
moa/src/main/java/moa/clusterers/kmeanspm/ClusteringTreeNode.java
ClusteringTreeNode.addToClusteringCenters
public List<double[]> addToClusteringCenters(List<double[]> clustering) { if (center != null && getClusteringFeature() != null) { clustering.add(getClusteringFeature().toClusterCenter()); } for (ClusteringTreeNode child : children) { child.addToClusteringCenters(clustering); } return clustering; }
java
public List<double[]> addToClusteringCenters(List<double[]> clustering) { if (center != null && getClusteringFeature() != null) { clustering.add(getClusteringFeature().toClusterCenter()); } for (ClusteringTreeNode child : children) { child.addToClusteringCenters(clustering); } return clustering; }
[ "public", "List", "<", "double", "[", "]", ">", "addToClusteringCenters", "(", "List", "<", "double", "[", "]", ">", "clustering", ")", "{", "if", "(", "center", "!=", "null", "&&", "getClusteringFeature", "(", ")", "!=", "null", ")", "{", "clustering", ...
Adds all clustering centers of the ClusterFeatures of the tree with this node as the root to a List of points. @param clustering the List to add the clustering centers too. @return the input List
[ "Adds", "all", "clustering", "centers", "of", "the", "ClusterFeatures", "of", "the", "tree", "with", "this", "node", "as", "the", "root", "to", "a", "List", "of", "points", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/kmeanspm/ClusteringTreeNode.java#L105-L113
29,039
Waikato/moa
moa/src/main/java/moa/clusterers/kmeanspm/ClusteringTreeNode.java
ClusteringTreeNode.printClusteringCenters
public void printClusteringCenters(Writer stream) throws IOException { if (center != null && getClusteringFeature() != null) { getClusteringFeature().printClusterCenter(stream); } for (ClusteringTreeNode child : children) { child.printClusteringCenters(stream); } }
java
public void printClusteringCenters(Writer stream) throws IOException { if (center != null && getClusteringFeature() != null) { getClusteringFeature().printClusterCenter(stream); } for (ClusteringTreeNode child : children) { child.printClusteringCenters(stream); } }
[ "public", "void", "printClusteringCenters", "(", "Writer", "stream", ")", "throws", "IOException", "{", "if", "(", "center", "!=", "null", "&&", "getClusteringFeature", "(", ")", "!=", "null", ")", "{", "getClusteringFeature", "(", ")", ".", "printClusterCenter"...
Writes all clustering centers of the ClusterFeatures of the tree with this node as the root to a given stream. @param stream the stream @throws IOException If an I/O error occurs
[ "Writes", "all", "clustering", "centers", "of", "the", "ClusterFeatures", "of", "the", "tree", "with", "this", "node", "as", "the", "root", "to", "a", "given", "stream", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/kmeanspm/ClusteringTreeNode.java#L124-L131
29,040
Waikato/moa
moa/src/main/java/moa/clusterers/kmeanspm/ClusteringTreeNode.java
ClusteringTreeNode.nearestChild
public ClusteringTreeNode nearestChild(double[] pointA) { assert (this.center.length == pointA.length); double minDistance = Double.POSITIVE_INFINITY; ClusteringTreeNode min = null; for (ClusteringTreeNode node : this.getChildren()) { double d = Metric.distance(pointA, node.getCenter()); if (d < minDistan...
java
public ClusteringTreeNode nearestChild(double[] pointA) { assert (this.center.length == pointA.length); double minDistance = Double.POSITIVE_INFINITY; ClusteringTreeNode min = null; for (ClusteringTreeNode node : this.getChildren()) { double d = Metric.distance(pointA, node.getCenter()); if (d < minDistan...
[ "public", "ClusteringTreeNode", "nearestChild", "(", "double", "[", "]", "pointA", ")", "{", "assert", "(", "this", ".", "center", ".", "length", "==", "pointA", ".", "length", ")", ";", "double", "minDistance", "=", "Double", ".", "POSITIVE_INFINITY", ";", ...
Searches for the nearest child node by comparing each representation. @param pointA to find the nearest child for @return the child node which is the nearest
[ "Searches", "for", "the", "nearest", "child", "node", "by", "comparing", "each", "representation", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/kmeanspm/ClusteringTreeNode.java#L188-L200
29,041
Waikato/moa
moa/src/main/java/moa/clusterers/kmeanspm/ClusteringTreeNode.java
ClusteringTreeNode.addChild
public boolean addChild(ClusteringTreeNode e) { assert (this.center.length == e.center.length); return this.children.add(e); }
java
public boolean addChild(ClusteringTreeNode e) { assert (this.center.length == e.center.length); return this.children.add(e); }
[ "public", "boolean", "addChild", "(", "ClusteringTreeNode", "e", ")", "{", "assert", "(", "this", ".", "center", ".", "length", "==", "e", ".", "center", ".", "length", ")", ";", "return", "this", ".", "children", ".", "add", "(", "e", ")", ";", "}" ...
Adds a child node. @param e the child node to add @return <code>true</code> @see java.util.List#add(java.lang.Object)
[ "Adds", "a", "child", "node", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/kmeanspm/ClusteringTreeNode.java#L210-L213
29,042
Waikato/moa
moa/src/main/java/moa/classifiers/meta/RCD.java
RCD.getPreviousClassifier
private ClassifierKS getPreviousClassifier(Classifier classifier, List<Instance> instances) { ExecutorService threadPool = Executors.newFixedThreadPool(this.threadSizeOption.getValue()); int SIZE = this.classifiers.size(); Map<Integer, Future<Double>> futures = new HashMap<>(); ...
java
private ClassifierKS getPreviousClassifier(Classifier classifier, List<Instance> instances) { ExecutorService threadPool = Executors.newFixedThreadPool(this.threadSizeOption.getValue()); int SIZE = this.classifiers.size(); Map<Integer, Future<Double>> futures = new HashMap<>(); ...
[ "private", "ClassifierKS", "getPreviousClassifier", "(", "Classifier", "classifier", ",", "List", "<", "Instance", ">", "instances", ")", "{", "ExecutorService", "threadPool", "=", "Executors", ".", "newFixedThreadPool", "(", "this", ".", "threadSizeOption", ".", "g...
Searches for the classifier best suited for actual data. All statistical tests are performed in parallel. @param classifier Classifier to be added @param instances Instances used to build the classifier @return
[ "Searches", "for", "the", "classifier", "best", "suited", "for", "actual", "data", ".", "All", "statistical", "tests", "are", "performed", "in", "parallel", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/meta/RCD.java#L244-L284
29,043
Waikato/moa
moa/src/main/java/moa/clusterers/clustree/ClusKernel.java
ClusKernel.makeOlder
protected void makeOlder(long timeDifference, double negLambda) { if (timeDifference == 0) { return; } //double weightFactor = AuxiliaryFunctions.weight(negLambda, timeDifference); assert (negLambda < 0); assert (timeDifference > 0); double weightFactor = Mat...
java
protected void makeOlder(long timeDifference, double negLambda) { if (timeDifference == 0) { return; } //double weightFactor = AuxiliaryFunctions.weight(negLambda, timeDifference); assert (negLambda < 0); assert (timeDifference > 0); double weightFactor = Mat...
[ "protected", "void", "makeOlder", "(", "long", "timeDifference", ",", "double", "negLambda", ")", "{", "if", "(", "timeDifference", "==", "0", ")", "{", "return", ";", "}", "//double weightFactor = AuxiliaryFunctions.weight(negLambda, timeDifference);", "assert", "(", ...
Make this cluster older. This means multiplying weighted N, LS and SS with a weight factor given by the time difference and the parameter negLambda. @param timeDifference The time elapsed between this current update and the last one. @param negLambda
[ "Make", "this", "cluster", "older", ".", "This", "means", "multiplying", "weighted", "N", "LS", "and", "SS", "with", "a", "weight", "factor", "given", "by", "the", "time", "difference", "and", "the", "parameter", "negLambda", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/clustree/ClusKernel.java#L114-L129
29,044
Waikato/moa
moa/src/main/java/moa/clusterers/clustree/ClusKernel.java
ClusKernel.overwriteOldCluster
protected void overwriteOldCluster(ClusKernel other) { this.totalN = other.totalN; this.N = other.N; //AuxiliaryFunctions.overwriteDoubleArray(this.LS, other.LS); //AuxiliaryFunctions.overwriteDoubleArray(this.SS, other.SS); assert (LS.length == other.LS.length); System.a...
java
protected void overwriteOldCluster(ClusKernel other) { this.totalN = other.totalN; this.N = other.N; //AuxiliaryFunctions.overwriteDoubleArray(this.LS, other.LS); //AuxiliaryFunctions.overwriteDoubleArray(this.SS, other.SS); assert (LS.length == other.LS.length); System.a...
[ "protected", "void", "overwriteOldCluster", "(", "ClusKernel", "other", ")", "{", "this", ".", "totalN", "=", "other", ".", "totalN", ";", "this", ".", "N", "=", "other", ".", "N", ";", "//AuxiliaryFunctions.overwriteDoubleArray(this.LS, other.LS);", "//AuxiliaryFun...
Overwrites the LS, SS and weightedN in this cluster to the values of the given cluster but adds N and classCount of the given cluster to this one. This function is useful when the weight of an entry becomes to small, and we want to forget the information of the old points. @param other The cluster that should overwrite...
[ "Overwrites", "the", "LS", "SS", "and", "weightedN", "in", "this", "cluster", "to", "the", "values", "of", "the", "given", "cluster", "but", "adds", "N", "and", "classCount", "of", "the", "given", "cluster", "to", "this", "one", ".", "This", "function", ...
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/clustree/ClusKernel.java#L190-L199
29,045
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/SAMkNN.java
SAMkNN.getVotesForInstance
@Override public double[] getVotesForInstance(Instance inst) { double vSTM[]; double vLTM[]; double vCM[]; double v[]; double distancesSTM[]; double distancesLTM[]; int predClassSTM = 0; int predClassLTM = 0; int predClassCM = 0; try { if (this.stm.numInstances()>0) { d...
java
@Override public double[] getVotesForInstance(Instance inst) { double vSTM[]; double vLTM[]; double vCM[]; double v[]; double distancesSTM[]; double distancesLTM[]; int predClassSTM = 0; int predClassLTM = 0; int predClassCM = 0; try { if (this.stm.numInstances()>0) { d...
[ "@", "Override", "public", "double", "[", "]", "getVotesForInstance", "(", "Instance", "inst", ")", "{", "double", "vSTM", "[", "]", ";", "double", "vLTM", "[", "]", ";", "double", "vCM", "[", "]", ";", "double", "v", "[", "]", ";", "double", "distan...
Predicts the label of a given sample by using the STM, LTM and the CM.
[ "Predicts", "the", "label", "of", "a", "given", "sample", "by", "using", "the", "STM", "LTM", "and", "the", "CM", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/SAMkNN.java#L178-L226
29,046
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/SAMkNN.java
SAMkNN.clusterDown
private void clusterDown(){ int classIndex = this.ltm.classIndex(); for (int c = 0; c <= this.maxClassValue; c++){ List<double[]> classSamples = new ArrayList<>(); for (int i = this.ltm.numInstances()-1; i >-1 ; i--) { if (this.ltm.get(i).classValue() == c) { classSamples.add(this.ltm.get(i).toDouble...
java
private void clusterDown(){ int classIndex = this.ltm.classIndex(); for (int c = 0; c <= this.maxClassValue; c++){ List<double[]> classSamples = new ArrayList<>(); for (int i = this.ltm.numInstances()-1; i >-1 ; i--) { if (this.ltm.get(i).classValue() == c) { classSamples.add(this.ltm.get(i).toDouble...
[ "private", "void", "clusterDown", "(", ")", "{", "int", "classIndex", "=", "this", ".", "ltm", ".", "classIndex", "(", ")", ";", "for", "(", "int", "c", "=", "0", ";", "c", "<=", "this", ".", "maxClassValue", ";", "c", "++", ")", "{", "List", "<"...
Performs classwise kMeans++ clustering for given samples with corresponding labels. The number of samples is halved per class.
[ "Performs", "classwise", "kMeans", "++", "clustering", "for", "given", "samples", "with", "corresponding", "labels", ".", "The", "number", "of", "samples", "is", "halved", "per", "class", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/SAMkNN.java#L260-L299
29,047
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/SAMkNN.java
SAMkNN.memorySizeCheck
private void memorySizeCheck(){ if (this.stm.numInstances() + this.ltm.numInstances() > this.maxSTMSize + this.maxLTMSize){ if (this.ltm.numInstances() > this.maxLTMSize){ this.clusterDown(); }else{ //shift values from STM directly to LTM since STM is full int numShifts = this.maxLTMSize - this.ltm.numI...
java
private void memorySizeCheck(){ if (this.stm.numInstances() + this.ltm.numInstances() > this.maxSTMSize + this.maxLTMSize){ if (this.ltm.numInstances() > this.maxLTMSize){ this.clusterDown(); }else{ //shift values from STM directly to LTM since STM is full int numShifts = this.maxLTMSize - this.ltm.numI...
[ "private", "void", "memorySizeCheck", "(", ")", "{", "if", "(", "this", ".", "stm", ".", "numInstances", "(", ")", "+", "this", ".", "ltm", ".", "numInstances", "(", ")", ">", "this", ".", "maxSTMSize", "+", "this", ".", "maxLTMSize", ")", "{", "if",...
Makes sure that the STM and LTM combined doe not surpass the maximum size.
[ "Makes", "sure", "that", "the", "STM", "and", "LTM", "combined", "doe", "not", "surpass", "the", "maximum", "size", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/SAMkNN.java#L304-L326
29,048
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/SAMkNN.java
SAMkNN.clean
private void clean(Instances cleanAgainst, Instances toClean, boolean onlyLast) { if (cleanAgainst.numInstances() > this.kOption.getValue() && toClean.numInstances() > 0){ if (onlyLast){ cleanSingle(cleanAgainst, (cleanAgainst.numInstances()-1), toClean); }else{ for (int i=0; i < cleanAgainst.numInstanc...
java
private void clean(Instances cleanAgainst, Instances toClean, boolean onlyLast) { if (cleanAgainst.numInstances() > this.kOption.getValue() && toClean.numInstances() > 0){ if (onlyLast){ cleanSingle(cleanAgainst, (cleanAgainst.numInstances()-1), toClean); }else{ for (int i=0; i < cleanAgainst.numInstanc...
[ "private", "void", "clean", "(", "Instances", "cleanAgainst", ",", "Instances", "toClean", ",", "boolean", "onlyLast", ")", "{", "if", "(", "cleanAgainst", ".", "numInstances", "(", ")", ">", "this", ".", "kOption", ".", "getValue", "(", ")", "&&", "toClea...
Removes distance-based all instances from the input samples that contradict those in the STM.
[ "Removes", "distance", "-", "based", "all", "instances", "from", "the", "input", "samples", "that", "contradict", "those", "in", "the", "STM", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/SAMkNN.java#L359-L369
29,049
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/SAMkNN.java
SAMkNN.getDistanceWeightedVotes
private double [] getDistanceWeightedVotes(double distances[], int[] nnIndices, Instances instances){ double v[] = new double[this.maxClassValue +1]; for (int nnIdx : nnIndices) { v[(int)instances.instance(nnIdx).classValue()] += 1./Math.max(distances[nnIdx], 0.000000001); } return v; ...
java
private double [] getDistanceWeightedVotes(double distances[], int[] nnIndices, Instances instances){ double v[] = new double[this.maxClassValue +1]; for (int nnIdx : nnIndices) { v[(int)instances.instance(nnIdx).classValue()] += 1./Math.max(distances[nnIdx], 0.000000001); } return v; ...
[ "private", "double", "[", "]", "getDistanceWeightedVotes", "(", "double", "distances", "[", "]", ",", "int", "[", "]", "nnIndices", ",", "Instances", "instances", ")", "{", "double", "v", "[", "]", "=", "new", "double", "[", "this", ".", "maxClassValue", ...
Returns the distance weighted votes.
[ "Returns", "the", "distance", "weighted", "votes", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/SAMkNN.java#L373-L380
29,050
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/SAMkNN.java
SAMkNN.getClassFromVotes
private int getClassFromVotes(double votes[]){ double maxVote = -1; int maxVoteClass = -1; for (int i = 0; i < votes.length; i++){ if (votes[i] > maxVote){ maxVote = votes[i]; maxVoteClass = i; } } return maxVoteClass; }
java
private int getClassFromVotes(double votes[]){ double maxVote = -1; int maxVoteClass = -1; for (int i = 0; i < votes.length; i++){ if (votes[i] > maxVote){ maxVote = votes[i]; maxVoteClass = i; } } return maxVoteClass; }
[ "private", "int", "getClassFromVotes", "(", "double", "votes", "[", "]", ")", "{", "double", "maxVote", "=", "-", "1", ";", "int", "maxVoteClass", "=", "-", "1", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "votes", ".", "length", ";", "...
Returns the class with maximum vote.
[ "Returns", "the", "class", "with", "maximum", "vote", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/SAMkNN.java#L408-L418
29,051
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/SAMkNN.java
SAMkNN.getDistance
private double getDistance(Instance sample, Instance sample2) { double sum=0; for (int i=0; i<sample.numInputAttributes(); i++) { double diff = sample.valueInputAttribute(i)-sample2.valueInputAttribute(i); sum += diff*diff; } return Math.sqrt(sum); ...
java
private double getDistance(Instance sample, Instance sample2) { double sum=0; for (int i=0; i<sample.numInputAttributes(); i++) { double diff = sample.valueInputAttribute(i)-sample2.valueInputAttribute(i); sum += diff*diff; } return Math.sqrt(sum); ...
[ "private", "double", "getDistance", "(", "Instance", "sample", ",", "Instance", "sample2", ")", "{", "double", "sum", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "sample", ".", "numInputAttributes", "(", ")", ";", "i", "++", ")", ...
Returns the Euclidean distance.
[ "Returns", "the", "Euclidean", "distance", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/SAMkNN.java#L429-L438
29,052
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/SAMkNN.java
SAMkNN.get1ToNDistances
private double[] get1ToNDistances(Instance sample, Instances samples){ double distances[] = new double[samples.numInstances()]; for (int i=0; i<samples.numInstances(); i++){ distances[i] = this.getDistance(sample, samples.get(i)); } return distances; }
java
private double[] get1ToNDistances(Instance sample, Instances samples){ double distances[] = new double[samples.numInstances()]; for (int i=0; i<samples.numInstances(); i++){ distances[i] = this.getDistance(sample, samples.get(i)); } return distances; }
[ "private", "double", "[", "]", "get1ToNDistances", "(", "Instance", "sample", ",", "Instances", "samples", ")", "{", "double", "distances", "[", "]", "=", "new", "double", "[", "samples", ".", "numInstances", "(", ")", "]", ";", "for", "(", "int", "i", ...
Returns the Euclidean distance between one sample and a collection of samples in an 1D-array.
[ "Returns", "the", "Euclidean", "distance", "between", "one", "sample", "and", "a", "collection", "of", "samples", "in", "an", "1D", "-", "array", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/SAMkNN.java#L443-L449
29,053
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/SAMkNN.java
SAMkNN.adaptHistories
private void adaptHistories(int numberOfDeletions){ for (int i = 0; i < numberOfDeletions; i++){ SortedSet<Integer> keys = new TreeSet<>(this.predictionHistories.keySet()); this.predictionHistories.remove(keys.first()); keys = new TreeSet<>(this.predictionHistories.keySet()); for (Integer key : keys){ ...
java
private void adaptHistories(int numberOfDeletions){ for (int i = 0; i < numberOfDeletions; i++){ SortedSet<Integer> keys = new TreeSet<>(this.predictionHistories.keySet()); this.predictionHistories.remove(keys.first()); keys = new TreeSet<>(this.predictionHistories.keySet()); for (Integer key : keys){ ...
[ "private", "void", "adaptHistories", "(", "int", "numberOfDeletions", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numberOfDeletions", ";", "i", "++", ")", "{", "SortedSet", "<", "Integer", ">", "keys", "=", "new", "TreeSet", "<>", "(", ...
Removes predictions of the largest window size and shifts the remaining ones accordingly.
[ "Removes", "predictions", "of", "the", "largest", "window", "size", "and", "shifts", "the", "remaining", "ones", "accordingly", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/SAMkNN.java#L483-L493
29,054
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/SAMkNN.java
SAMkNN.getHistoryErrorRate
private double getHistoryErrorRate(List<Integer> predHistory){ double sumCorrect = 0; for (Integer e : predHistory) { sumCorrect += e; } return 1. - (sumCorrect / predHistory.size()); }
java
private double getHistoryErrorRate(List<Integer> predHistory){ double sumCorrect = 0; for (Integer e : predHistory) { sumCorrect += e; } return 1. - (sumCorrect / predHistory.size()); }
[ "private", "double", "getHistoryErrorRate", "(", "List", "<", "Integer", ">", "predHistory", ")", "{", "double", "sumCorrect", "=", "0", ";", "for", "(", "Integer", "e", ":", "predHistory", ")", "{", "sumCorrect", "+=", "e", ";", "}", "return", "1.", "-"...
Calculates the achieved error rate of a history.
[ "Calculates", "the", "achieved", "error", "rate", "of", "a", "history", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/SAMkNN.java#L558-L564
29,055
Waikato/moa
moa/src/main/java/moa/clusterers/kmeanspm/Metric.java
Metric.distanceSquared
public static double distanceSquared(double[] pointA) { double distance = 0.0; for (int i = 0; i < pointA.length; i++) { distance += pointA[i] * pointA[i]; } return distance; }
java
public static double distanceSquared(double[] pointA) { double distance = 0.0; for (int i = 0; i < pointA.length; i++) { distance += pointA[i] * pointA[i]; } return distance; }
[ "public", "static", "double", "distanceSquared", "(", "double", "[", "]", "pointA", ")", "{", "double", "distance", "=", "0.0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "pointA", ".", "length", ";", "i", "++", ")", "{", "distance", "+=...
Calculates the squared Euclidean length of a point. @param pointA point @return the squared Euclidean length
[ "Calculates", "the", "squared", "Euclidean", "length", "of", "a", "point", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/kmeanspm/Metric.java#L35-L41
29,056
Waikato/moa
moa/src/main/java/moa/clusterers/kmeanspm/Metric.java
Metric.distanceSquared
public static double distanceSquared(double[] pointA, double[] pointB, int offsetB) { assert (pointA.length == pointB.length + offsetB); double distance = 0.0; for (int i = 0; i < pointA.length; i++) { double d = pointA[i] - pointB[i + offsetB]; distance += d * d; } return distance; }
java
public static double distanceSquared(double[] pointA, double[] pointB, int offsetB) { assert (pointA.length == pointB.length + offsetB); double distance = 0.0; for (int i = 0; i < pointA.length; i++) { double d = pointA[i] - pointB[i + offsetB]; distance += d * d; } return distance; }
[ "public", "static", "double", "distanceSquared", "(", "double", "[", "]", "pointA", ",", "double", "[", "]", "pointB", ",", "int", "offsetB", ")", "{", "assert", "(", "pointA", ".", "length", "==", "pointB", ".", "length", "+", "offsetB", ")", ";", "do...
Calculates the squared Euclidean distance of two points. Starts at dimension offset + 1 of pointB. @param pointA first point @param pointB second point @param offsetB start dimension - 1 of pointB @return the squared Euclidean distance
[ "Calculates", "the", "squared", "Euclidean", "distance", "of", "two", "points", ".", "Starts", "at", "dimension", "offset", "+", "1", "of", "pointB", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/kmeanspm/Metric.java#L66-L75
29,057
Waikato/moa
moa/src/main/java/moa/clusterers/kmeanspm/Metric.java
Metric.distance
public static double distance(double[] pointA, double[] pointB, int offsetB) { return Math.sqrt(distanceSquared(pointA, pointB, offsetB)); }
java
public static double distance(double[] pointA, double[] pointB, int offsetB) { return Math.sqrt(distanceSquared(pointA, pointB, offsetB)); }
[ "public", "static", "double", "distance", "(", "double", "[", "]", "pointA", ",", "double", "[", "]", "pointB", ",", "int", "offsetB", ")", "{", "return", "Math", ".", "sqrt", "(", "distanceSquared", "(", "pointA", ",", "pointB", ",", "offsetB", ")", "...
Calculates the Euclidean distance of two points. Starts at dimension offset + 1 of pointB. @param pointA first point @param pointB second point @param offsetB start dimension - 1 of pointB @return the Euclidean distance
[ "Calculates", "the", "Euclidean", "distance", "of", "two", "points", ".", "Starts", "at", "dimension", "offset", "+", "1", "of", "pointB", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/kmeanspm/Metric.java#L89-L91
29,058
Waikato/moa
moa/src/main/java/moa/clusterers/kmeanspm/Metric.java
Metric.distanceWithDivisionSquared
public static double distanceWithDivisionSquared(double[] pointA, double dA) { double distance = 0.0; for (int i = 0; i < pointA.length; i++) { double d = pointA[i] / dA; distance += d * d; } return distance; }
java
public static double distanceWithDivisionSquared(double[] pointA, double dA) { double distance = 0.0; for (int i = 0; i < pointA.length; i++) { double d = pointA[i] / dA; distance += d * d; } return distance; }
[ "public", "static", "double", "distanceWithDivisionSquared", "(", "double", "[", "]", "pointA", ",", "double", "dA", ")", "{", "double", "distance", "=", "0.0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "pointA", ".", "length", ";", "i", ...
Calculates the squared Euclidean length of a point divided by a scalar. @param pointA point @param dA scalar @return the squared Euclidean length
[ "Calculates", "the", "squared", "Euclidean", "length", "of", "a", "point", "divided", "by", "a", "scalar", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/kmeanspm/Metric.java#L134-L141
29,059
Waikato/moa
moa/src/main/java/moa/clusterers/kmeanspm/Metric.java
Metric.distanceWithDivision
public static double distanceWithDivision(double[] pointA, double dA, double[] pointB) { return Math.sqrt(distanceWithDivisionSquared(pointA, dA, pointB)); }
java
public static double distanceWithDivision(double[] pointA, double dA, double[] pointB) { return Math.sqrt(distanceWithDivisionSquared(pointA, dA, pointB)); }
[ "public", "static", "double", "distanceWithDivision", "(", "double", "[", "]", "pointA", ",", "double", "dA", ",", "double", "[", "]", "pointB", ")", "{", "return", "Math", ".", "sqrt", "(", "distanceWithDivisionSquared", "(", "pointA", ",", "dA", ",", "po...
Calculates the Euclidean distance of the first point divided by a scalar and another second point. @param pointA first point @param dA scalar @param pointB second point @return the Euclidean distance
[ "Calculates", "the", "Euclidean", "distance", "of", "the", "first", "point", "divided", "by", "a", "scalar", "and", "another", "second", "point", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/kmeanspm/Metric.java#L191-L194
29,060
Waikato/moa
moa/src/main/java/moa/clusterers/kmeanspm/Metric.java
Metric.dotProduct
public static double dotProduct(double[] pointA) { double product = 0.0; for (int i = 0; i < pointA.length; i++) { product += pointA[i] * pointA[i]; } return product; }
java
public static double dotProduct(double[] pointA) { double product = 0.0; for (int i = 0; i < pointA.length; i++) { product += pointA[i] * pointA[i]; } return product; }
[ "public", "static", "double", "dotProduct", "(", "double", "[", "]", "pointA", ")", "{", "double", "product", "=", "0.0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "pointA", ".", "length", ";", "i", "++", ")", "{", "product", "+=", "p...
Calculates the dot product of the point with itself. @param pointA point @return the dot product
[ "Calculates", "the", "dot", "product", "of", "the", "point", "with", "itself", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/kmeanspm/Metric.java#L247-L253
29,061
Waikato/moa
moa/src/main/java/moa/clusterers/kmeanspm/Metric.java
Metric.dotProductWithAddition
public static double dotProductWithAddition(double[] pointA1, double[] pointA2, double[] pointB) { assert (pointA1.length == pointA2.length && pointA1.length == pointB.length); double product = 0.0; for (int i = 0; i < pointA1.length; i++) { product += (pointA1[i] + pointA2[i]) * pointB[i]; } return pro...
java
public static double dotProductWithAddition(double[] pointA1, double[] pointA2, double[] pointB) { assert (pointA1.length == pointA2.length && pointA1.length == pointB.length); double product = 0.0; for (int i = 0; i < pointA1.length; i++) { product += (pointA1[i] + pointA2[i]) * pointB[i]; } return pro...
[ "public", "static", "double", "dotProductWithAddition", "(", "double", "[", "]", "pointA1", ",", "double", "[", "]", "pointA2", ",", "double", "[", "]", "pointB", ")", "{", "assert", "(", "pointA1", ".", "length", "==", "pointA2", ".", "length", "&&", "p...
Calculates the dot product of the addition of the first and the second point with the third point. @param pointA1 first point @param pointA2 second point @param pointB third point @return the dot product
[ "Calculates", "the", "dot", "product", "of", "the", "addition", "of", "the", "first", "and", "the", "second", "point", "with", "the", "third", "point", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/kmeanspm/Metric.java#L285-L293
29,062
Waikato/moa
moa/src/main/java/moa/clusterers/kmeanspm/Metric.java
Metric.dotProductWithAddition
public static double dotProductWithAddition(double[] pointA1, double[] pointA2, double[] pointB1, double[] pointB2) { assert (pointA1.length == pointA2.length && pointB1.length == pointB2.length && pointA1.length == pointB1.length); double product = 0.0; for (int i = 0; i < pointA1.length; i++) { produc...
java
public static double dotProductWithAddition(double[] pointA1, double[] pointA2, double[] pointB1, double[] pointB2) { assert (pointA1.length == pointA2.length && pointB1.length == pointB2.length && pointA1.length == pointB1.length); double product = 0.0; for (int i = 0; i < pointA1.length; i++) { produc...
[ "public", "static", "double", "dotProductWithAddition", "(", "double", "[", "]", "pointA1", ",", "double", "[", "]", "pointA2", ",", "double", "[", "]", "pointB1", ",", "double", "[", "]", "pointB2", ")", "{", "assert", "(", "pointA1", ".", "length", "==...
Calculates the dot product of the addition of the first and the second point with the addition of the third and the fourth point. @param pointA1 first point @param pointA2 second point @param pointB1 third point @param pointB2 fourth point @return the dot product
[ "Calculates", "the", "dot", "product", "of", "the", "addition", "of", "the", "first", "and", "the", "second", "point", "with", "the", "addition", "of", "the", "third", "and", "the", "fourth", "point", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/kmeanspm/Metric.java#L309-L318
29,063
Waikato/moa
moa/src/main/java/com/yahoo/labs/samoa/instances/WekaToSamoaInstanceConverter.java
WekaToSamoaInstanceConverter.samoaInstance
public Instance samoaInstance(weka.core.Instance inst) { Instance samoaInstance; if (inst instanceof weka.core.SparseInstance) { double[] attributeValues = new double[inst.numValues()]; int[] indexValues = new int[inst.numValues()]; for (int i = 0; i < inst.numValues(...
java
public Instance samoaInstance(weka.core.Instance inst) { Instance samoaInstance; if (inst instanceof weka.core.SparseInstance) { double[] attributeValues = new double[inst.numValues()]; int[] indexValues = new int[inst.numValues()]; for (int i = 0; i < inst.numValues(...
[ "public", "Instance", "samoaInstance", "(", "weka", ".", "core", ".", "Instance", "inst", ")", "{", "Instance", "samoaInstance", ";", "if", "(", "inst", "instanceof", "weka", ".", "core", ".", "SparseInstance", ")", "{", "double", "[", "]", "attributeValues"...
Samoa instance from weka instance. @param inst the inst @return the instance
[ "Samoa", "instance", "from", "weka", "instance", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/com/yahoo/labs/samoa/instances/WekaToSamoaInstanceConverter.java#L37-L64
29,064
Waikato/moa
moa/src/main/java/com/yahoo/labs/samoa/instances/WekaToSamoaInstanceConverter.java
WekaToSamoaInstanceConverter.samoaInstances
public Instances samoaInstances(weka.core.Instances instances) { Instances samoaInstances = samoaInstancesInformation(instances); //We assume that we have only one samoaInstanceInformation for WekaToSamoaInstanceConverter this.samoaInstanceInformation = samoaInstances; for (int i = 0; i ...
java
public Instances samoaInstances(weka.core.Instances instances) { Instances samoaInstances = samoaInstancesInformation(instances); //We assume that we have only one samoaInstanceInformation for WekaToSamoaInstanceConverter this.samoaInstanceInformation = samoaInstances; for (int i = 0; i ...
[ "public", "Instances", "samoaInstances", "(", "weka", ".", "core", ".", "Instances", "instances", ")", "{", "Instances", "samoaInstances", "=", "samoaInstancesInformation", "(", "instances", ")", ";", "//We assume that we have only one samoaInstanceInformation for WekaToSamoa...
Samoa instances from weka instances. @param instances the instances @return the instances
[ "Samoa", "instances", "from", "weka", "instances", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/com/yahoo/labs/samoa/instances/WekaToSamoaInstanceConverter.java#L72-L80
29,065
Waikato/moa
moa/src/main/java/com/yahoo/labs/samoa/instances/WekaToSamoaInstanceConverter.java
WekaToSamoaInstanceConverter.samoaInstancesInformation
public Instances samoaInstancesInformation(weka.core.Instances instances) { Instances samoaInstances; List<Attribute> attInfo = new ArrayList<Attribute>(); for (int i = 0; i < instances.numAttributes(); i++) { attInfo.add(samoaAttribute(i, instances.attribute(i))); } ...
java
public Instances samoaInstancesInformation(weka.core.Instances instances) { Instances samoaInstances; List<Attribute> attInfo = new ArrayList<Attribute>(); for (int i = 0; i < instances.numAttributes(); i++) { attInfo.add(samoaAttribute(i, instances.attribute(i))); } ...
[ "public", "Instances", "samoaInstancesInformation", "(", "weka", ".", "core", ".", "Instances", "instances", ")", "{", "Instances", "samoaInstances", ";", "List", "<", "Attribute", ">", "attInfo", "=", "new", "ArrayList", "<", "Attribute", ">", "(", ")", ";", ...
Samoa instances information. @param instances the instances @return the instances
[ "Samoa", "instances", "information", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/com/yahoo/labs/samoa/instances/WekaToSamoaInstanceConverter.java#L88-L101
29,066
Waikato/moa
moa/src/main/java/com/yahoo/labs/samoa/instances/WekaToSamoaInstanceConverter.java
WekaToSamoaInstanceConverter.samoaAttribute
protected Attribute samoaAttribute(int index, weka.core.Attribute attribute) { Attribute samoaAttribute; if (attribute.isNominal()) { Enumeration enu = attribute.enumerateValues(); List<String> attributeValues = new ArrayList<String>(); while (enu.hasMoreElements()) {...
java
protected Attribute samoaAttribute(int index, weka.core.Attribute attribute) { Attribute samoaAttribute; if (attribute.isNominal()) { Enumeration enu = attribute.enumerateValues(); List<String> attributeValues = new ArrayList<String>(); while (enu.hasMoreElements()) {...
[ "protected", "Attribute", "samoaAttribute", "(", "int", "index", ",", "weka", ".", "core", ".", "Attribute", "attribute", ")", "{", "Attribute", "samoaAttribute", ";", "if", "(", "attribute", ".", "isNominal", "(", ")", ")", "{", "Enumeration", "enu", "=", ...
Get Samoa attribute from a weka attribute. @param index the index @param attribute the attribute @return the attribute
[ "Get", "Samoa", "attribute", "from", "a", "weka", "attribute", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/com/yahoo/labs/samoa/instances/WekaToSamoaInstanceConverter.java#L111-L124
29,067
Waikato/moa
moa/src/main/java/moa/gui/experimentertab/ImagePanel.java
ImagePanel.doSaveAs
@Override public void doSaveAs() throws IOException { JFileChooser fileChooser = new JFileChooser(); ExtensionFileFilter filterPNG = new ExtensionFileFilter("PNG Image Files", ".png"); fileChooser.addChoosableFileFilter(filterPNG); ExtensionFileFilter filterJPG = new ExtensionFileF...
java
@Override public void doSaveAs() throws IOException { JFileChooser fileChooser = new JFileChooser(); ExtensionFileFilter filterPNG = new ExtensionFileFilter("PNG Image Files", ".png"); fileChooser.addChoosableFileFilter(filterPNG); ExtensionFileFilter filterJPG = new ExtensionFileF...
[ "@", "Override", "public", "void", "doSaveAs", "(", ")", "throws", "IOException", "{", "JFileChooser", "fileChooser", "=", "new", "JFileChooser", "(", ")", ";", "ExtensionFileFilter", "filterPNG", "=", "new", "ExtensionFileFilter", "(", "\"PNG Image Files\"", ",", ...
Method for save the images. @throws IOException
[ "Method", "for", "save", "the", "images", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/experimentertab/ImagePanel.java#L57-L91
29,068
Waikato/moa
moa/src/main/java/moa/classifiers/rules/RuleClassifier.java
RuleClassifier.round
protected BigDecimal round(double val){ BigDecimal value = new BigDecimal(val); if(val!=0.0){ value = value.setScale(3, BigDecimal.ROUND_DOWN); } return value; }
java
protected BigDecimal round(double val){ BigDecimal value = new BigDecimal(val); if(val!=0.0){ value = value.setScale(3, BigDecimal.ROUND_DOWN); } return value; }
[ "protected", "BigDecimal", "round", "(", "double", "val", ")", "{", "BigDecimal", "value", "=", "new", "BigDecimal", "(", "val", ")", ";", "if", "(", "val", "!=", "0.0", ")", "{", "value", "=", "value", ".", "setScale", "(", "3", ",", "BigDecimal", "...
Round an number
[ "Round", "an", "number" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/rules/RuleClassifier.java#L551-L557
29,069
Waikato/moa
moa/src/main/java/moa/classifiers/rules/RuleClassifier.java
RuleClassifier.initializeRuleStatistics
public void initializeRuleStatistics(RuleClassification rl, Predicates pred, Instance inst) { rl.predicateSet.add(pred); rl.obserClassDistrib=new DoubleVector(); rl.observers=new AutoExpandVector<AttributeClassObserver>(); rl.observersGauss=new AutoExpandVector<AttributeClassObserver>(); rl.instancesSeen = 0;...
java
public void initializeRuleStatistics(RuleClassification rl, Predicates pred, Instance inst) { rl.predicateSet.add(pred); rl.obserClassDistrib=new DoubleVector(); rl.observers=new AutoExpandVector<AttributeClassObserver>(); rl.observersGauss=new AutoExpandVector<AttributeClassObserver>(); rl.instancesSeen = 0;...
[ "public", "void", "initializeRuleStatistics", "(", "RuleClassification", "rl", ",", "Predicates", "pred", ",", "Instance", "inst", ")", "{", "rl", ".", "predicateSet", ".", "add", "(", "pred", ")", ";", "rl", ".", "obserClassDistrib", "=", "new", "DoubleVector...
This function initializes the statistics of a rule
[ "This", "function", "initializes", "the", "statistics", "of", "a", "rule" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/rules/RuleClassifier.java#L561-L572
29,070
Waikato/moa
moa/src/main/java/moa/classifiers/rules/RuleClassifier.java
RuleClassifier.updateRuleAttribStatistics
public void updateRuleAttribStatistics(Instance inst, RuleClassification rl, int ruleIndex){ rl.instancesSeen++; if(rl.squaredAttributeStatisticsSupervised.size() == 0 && rl.attributeStatisticsSupervised.size() == 0){ for (int s = 0; s < inst.numAttributes() -1; s++) { ArrayList<Double> temp1 = new ArrayLis...
java
public void updateRuleAttribStatistics(Instance inst, RuleClassification rl, int ruleIndex){ rl.instancesSeen++; if(rl.squaredAttributeStatisticsSupervised.size() == 0 && rl.attributeStatisticsSupervised.size() == 0){ for (int s = 0; s < inst.numAttributes() -1; s++) { ArrayList<Double> temp1 = new ArrayLis...
[ "public", "void", "updateRuleAttribStatistics", "(", "Instance", "inst", ",", "RuleClassification", "rl", ",", "int", "ruleIndex", ")", "{", "rl", ".", "instancesSeen", "++", ";", "if", "(", "rl", ".", "squaredAttributeStatisticsSupervised", ".", "size", "(", ")...
Update rule statistics
[ "Update", "rule", "statistics" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/rules/RuleClassifier.java#L575-L607
29,071
Waikato/moa
moa/src/main/java/moa/classifiers/rules/RuleClassifier.java
RuleClassifier.createRule
public void createRule(Instance inst) { int remainder = (int)Double.MAX_VALUE; int numInstanciaObservers = (int)this.observedClassDistribution.sumOfValues(); if (numInstanciaObservers != 0 && this.gracePeriodOption.getValue() != 0) { remainder = (numInstanciaObservers) % (this.gracePeriodOption.getValue()); ...
java
public void createRule(Instance inst) { int remainder = (int)Double.MAX_VALUE; int numInstanciaObservers = (int)this.observedClassDistribution.sumOfValues(); if (numInstanciaObservers != 0 && this.gracePeriodOption.getValue() != 0) { remainder = (numInstanciaObservers) % (this.gracePeriodOption.getValue()); ...
[ "public", "void", "createRule", "(", "Instance", "inst", ")", "{", "int", "remainder", "=", "(", "int", ")", "Double", ".", "MAX_VALUE", ";", "int", "numInstanciaObservers", "=", "(", "int", ")", "this", ".", "observedClassDistribution", ".", "sumOfValues", ...
This function creates a rule
[ "This", "function", "creates", "a", "rule" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/rules/RuleClassifier.java#L775-L809
29,072
Waikato/moa
moa/src/main/java/moa/classifiers/rules/RuleClassifier.java
RuleClassifier.theBestAttributes
public void theBestAttributes(Instance instance, AutoExpandVector<AttributeClassObserver> observersParameter) { for(int z = 0; z < instance.numAttributes() - 1; z++){ if(!instance.isMissing(z)){ int instAttIndex = modelAttIndexToInstanceAttIndex(z, instance); ArrayList<Double> attribBest = new ArrayList<...
java
public void theBestAttributes(Instance instance, AutoExpandVector<AttributeClassObserver> observersParameter) { for(int z = 0; z < instance.numAttributes() - 1; z++){ if(!instance.isMissing(z)){ int instAttIndex = modelAttIndexToInstanceAttIndex(z, instance); ArrayList<Double> attribBest = new ArrayList<...
[ "public", "void", "theBestAttributes", "(", "Instance", "instance", ",", "AutoExpandVector", "<", "AttributeClassObserver", ">", "observersParameter", ")", "{", "for", "(", "int", "z", "=", "0", ";", "z", "<", "instance", ".", "numAttributes", "(", ")", "-", ...
This function gives the best value of entropy for each attribute
[ "This", "function", "gives", "the", "best", "value", "of", "entropy", "for", "each", "attribute" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/rules/RuleClassifier.java#L914-L944
29,073
Waikato/moa
moa/src/main/java/moa/classifiers/rules/RuleClassifier.java
RuleClassifier.mainFindBestValEntropy
public void mainFindBestValEntropy(Node root) { if (root != null) { DoubleVector parentClassCL = new DoubleVector(); DoubleVector classCountL = root.classCountsLeft; //class count left DoubleVector classCountR = root.classCountsRight; //class count left double numInst = root.classCountsLeft.sumOfValues() ...
java
public void mainFindBestValEntropy(Node root) { if (root != null) { DoubleVector parentClassCL = new DoubleVector(); DoubleVector classCountL = root.classCountsLeft; //class count left DoubleVector classCountR = root.classCountsRight; //class count left double numInst = root.classCountsLeft.sumOfValues() ...
[ "public", "void", "mainFindBestValEntropy", "(", "Node", "root", ")", "{", "if", "(", "root", "!=", "null", ")", "{", "DoubleVector", "parentClassCL", "=", "new", "DoubleVector", "(", ")", ";", "DoubleVector", "classCountL", "=", "root", ".", "classCountsLeft"...
Best value of entropy
[ "Best", "value", "of", "entropy" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/rules/RuleClassifier.java#L1056-L1073
29,074
Waikato/moa
moa/src/main/java/moa/classifiers/rules/RuleClassifier.java
RuleClassifier.findBestValEntropyNominalAtt
public void findBestValEntropyNominalAtt(AutoExpandVector<DoubleVector> attrib, int attNumValues) { ArrayList<ArrayList<Double>> distClassValue = new ArrayList<ArrayList<Double>>(); // System.out.print("attrib"+attrib+"\n"); for (int z = 0; z < attrib.size(); z++) { distClassValue.add(new ArrayList<Double>());...
java
public void findBestValEntropyNominalAtt(AutoExpandVector<DoubleVector> attrib, int attNumValues) { ArrayList<ArrayList<Double>> distClassValue = new ArrayList<ArrayList<Double>>(); // System.out.print("attrib"+attrib+"\n"); for (int z = 0; z < attrib.size(); z++) { distClassValue.add(new ArrayList<Double>());...
[ "public", "void", "findBestValEntropyNominalAtt", "(", "AutoExpandVector", "<", "DoubleVector", ">", "attrib", ",", "int", "attNumValues", ")", "{", "ArrayList", "<", "ArrayList", "<", "Double", ">>", "distClassValue", "=", "new", "ArrayList", "<", "ArrayList", "<...
Find best value of entropy for nominal attributes
[ "Find", "best", "value", "of", "entropy", "for", "nominal", "attributes" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/rules/RuleClassifier.java#L1076-L1106
29,075
Waikato/moa
moa/src/main/java/moa/classifiers/rules/RuleClassifier.java
RuleClassifier.checkBestAttrib
public boolean checkBestAttrib(double n, AutoExpandVector<AttributeClassObserver> observerss, DoubleVector observedClassDistribution){ double h0 = entropy(observedClassDistribution); boolean isTheBest = false; double[] entropyValues = getBestSecondBestEntropy(this.saveBestGlobalEntropy); double bestEntropy ...
java
public boolean checkBestAttrib(double n, AutoExpandVector<AttributeClassObserver> observerss, DoubleVector observedClassDistribution){ double h0 = entropy(observedClassDistribution); boolean isTheBest = false; double[] entropyValues = getBestSecondBestEntropy(this.saveBestGlobalEntropy); double bestEntropy ...
[ "public", "boolean", "checkBestAttrib", "(", "double", "n", ",", "AutoExpandVector", "<", "AttributeClassObserver", ">", "observerss", ",", "DoubleVector", "observedClassDistribution", ")", "{", "double", "h0", "=", "entropy", "(", "observedClassDistribution", ")", ";...
Check if the best attribute is really the best
[ "Check", "if", "the", "best", "attribute", "is", "really", "the", "best" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/rules/RuleClassifier.java#L1117-L1145
29,076
Waikato/moa
moa/src/main/java/moa/classifiers/rules/RuleClassifier.java
RuleClassifier.getBestSecondBestEntropy
protected double [] getBestSecondBestEntropy(DoubleVector entropy){ double[] entropyValues = new double[2]; double best = Double.MAX_VALUE; double secondBest = Double.MAX_VALUE; for (int i = 0; i < entropy.numValues(); i++) { if (entropy.getValue(i) < best) { secondBest = best; best = entropy.getValu...
java
protected double [] getBestSecondBestEntropy(DoubleVector entropy){ double[] entropyValues = new double[2]; double best = Double.MAX_VALUE; double secondBest = Double.MAX_VALUE; for (int i = 0; i < entropy.numValues(); i++) { if (entropy.getValue(i) < best) { secondBest = best; best = entropy.getValu...
[ "protected", "double", "[", "]", "getBestSecondBestEntropy", "(", "DoubleVector", "entropy", ")", "{", "double", "[", "]", "entropyValues", "=", "new", "double", "[", "2", "]", ";", "double", "best", "=", "Double", ".", "MAX_VALUE", ";", "double", "secondBes...
Get best and second best attributes
[ "Get", "best", "and", "second", "best", "attributes" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/rules/RuleClassifier.java#L1148-L1166
29,077
Waikato/moa
moa/src/main/java/moa/classifiers/rules/RuleClassifier.java
RuleClassifier.getRuleMajorityClassIndex
protected double getRuleMajorityClassIndex(RuleClassification r) { double maxvalue = 0.0; int posMaxValue = 0; for (int i = 0; i < r.obserClassDistrib.numValues(); i++) { if (r.obserClassDistrib.getValue(i) > maxvalue) { maxvalue = r.obserClassDistrib.getValue(i); posMaxValue = i; } } return (do...
java
protected double getRuleMajorityClassIndex(RuleClassification r) { double maxvalue = 0.0; int posMaxValue = 0; for (int i = 0; i < r.obserClassDistrib.numValues(); i++) { if (r.obserClassDistrib.getValue(i) > maxvalue) { maxvalue = r.obserClassDistrib.getValue(i); posMaxValue = i; } } return (do...
[ "protected", "double", "getRuleMajorityClassIndex", "(", "RuleClassification", "r", ")", "{", "double", "maxvalue", "=", "0.0", ";", "int", "posMaxValue", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "r", ".", "obserClassDistrib", ".", ...
Get rule majority class index
[ "Get", "rule", "majority", "class", "index" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/rules/RuleClassifier.java#L1169-L1179
29,078
Waikato/moa
moa/src/main/java/moa/classifiers/rules/RuleClassifier.java
RuleClassifier.oberversDistribProb
protected double[] oberversDistribProb(Instance inst, DoubleVector classDistrib) { double[] votes = new double[this.numClass]; double sum = classDistrib.sumOfValues(); for (int z = 0; z < this.numClass; z++) { votes[z] = classDistrib.getValue(z) / sum; } return votes; }
java
protected double[] oberversDistribProb(Instance inst, DoubleVector classDistrib) { double[] votes = new double[this.numClass]; double sum = classDistrib.sumOfValues(); for (int z = 0; z < this.numClass; z++) { votes[z] = classDistrib.getValue(z) / sum; } return votes; }
[ "protected", "double", "[", "]", "oberversDistribProb", "(", "Instance", "inst", ",", "DoubleVector", "classDistrib", ")", "{", "double", "[", "]", "votes", "=", "new", "double", "[", "this", ".", "numClass", "]", ";", "double", "sum", "=", "classDistrib", ...
Get observers class distribution probability
[ "Get", "observers", "class", "distribution", "probability" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/rules/RuleClassifier.java#L1182-L1190
29,079
Waikato/moa
moa/src/main/java/moa/classifiers/rules/RuleClassifier.java
RuleClassifier.weightedMax
protected double[] weightedMax(Instance inst) { int countFired = 0; boolean fired = false; double highest = 0.0; double[] votes = new double[this.numClass]; ArrayList<Double> ruleSetVotes = new ArrayList<Double>(); ArrayList<ArrayList<Double>> majorityProb = new ArrayList<ArrayList<Double>>(); for (int j ...
java
protected double[] weightedMax(Instance inst) { int countFired = 0; boolean fired = false; double highest = 0.0; double[] votes = new double[this.numClass]; ArrayList<Double> ruleSetVotes = new ArrayList<Double>(); ArrayList<ArrayList<Double>> majorityProb = new ArrayList<ArrayList<Double>>(); for (int j ...
[ "protected", "double", "[", "]", "weightedMax", "(", "Instance", "inst", ")", "{", "int", "countFired", "=", "0", ";", "boolean", "fired", "=", "false", ";", "double", "highest", "=", "0.0", ";", "double", "[", "]", "votes", "=", "new", "double", "[", ...
Get the votes using weighted Max
[ "Get", "the", "votes", "using", "weighted", "Max" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/rules/RuleClassifier.java#L1219-L1258
29,080
Waikato/moa
moa/src/main/java/moa/classifiers/rules/RuleClassifier.java
RuleClassifier.weightedSum
protected double[] weightedSum(Instance inst) { boolean fired = false; int countFired = 0; double[] votes = new double[this.numClass]; ArrayList<Double> weightSum = new ArrayList<Double>(); ArrayList<ArrayList<Double>> majorityProb = new ArrayList<ArrayList<Double>>(); for (int j = 0; j < this.ruleSet.size(...
java
protected double[] weightedSum(Instance inst) { boolean fired = false; int countFired = 0; double[] votes = new double[this.numClass]; ArrayList<Double> weightSum = new ArrayList<Double>(); ArrayList<ArrayList<Double>> majorityProb = new ArrayList<ArrayList<Double>>(); for (int j = 0; j < this.ruleSet.size(...
[ "protected", "double", "[", "]", "weightedSum", "(", "Instance", "inst", ")", "{", "boolean", "fired", "=", "false", ";", "int", "countFired", "=", "0", ";", "double", "[", "]", "votes", "=", "new", "double", "[", "this", ".", "numClass", "]", ";", "...
Get the votes using weighted Sum
[ "Get", "the", "votes", "using", "weighted", "Sum" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/rules/RuleClassifier.java#L1261-L1296
29,081
Waikato/moa
moa/src/main/java/weka/gui/MOAClassOptionEditor.java
MOAClassOptionEditor.closeDialog
protected void closeDialog() { if (m_CustomEditor instanceof Container) { Dialog dlg = PropertyDialog.getParentDialog((Container) m_CustomEditor); if (dlg != null) dlg.setVisible(false); } }
java
protected void closeDialog() { if (m_CustomEditor instanceof Container) { Dialog dlg = PropertyDialog.getParentDialog((Container) m_CustomEditor); if (dlg != null) dlg.setVisible(false); } }
[ "protected", "void", "closeDialog", "(", ")", "{", "if", "(", "m_CustomEditor", "instanceof", "Container", ")", "{", "Dialog", "dlg", "=", "PropertyDialog", ".", "getParentDialog", "(", "(", "Container", ")", "m_CustomEditor", ")", ";", "if", "(", "dlg", "!=...
Closes the dialog.
[ "Closes", "the", "dialog", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/weka/gui/MOAClassOptionEditor.java#L65-L71
29,082
Waikato/moa
moa/src/main/java/weka/gui/MOAClassOptionEditor.java
MOAClassOptionEditor.createCustomEditor
protected Component createCustomEditor() { JPanel panel; panel = new JPanel(new BorderLayout()); panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); m_EditComponent = (ClassOptionEditComponent) getEditComponent((ClassOption) getValue()); m_EditComponent.addChangeListener(new ChangeListener() { ...
java
protected Component createCustomEditor() { JPanel panel; panel = new JPanel(new BorderLayout()); panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); m_EditComponent = (ClassOptionEditComponent) getEditComponent((ClassOption) getValue()); m_EditComponent.addChangeListener(new ChangeListener() { ...
[ "protected", "Component", "createCustomEditor", "(", ")", "{", "JPanel", "panel", ";", "panel", "=", "new", "JPanel", "(", "new", "BorderLayout", "(", ")", ")", ";", "panel", ".", "setBorder", "(", "BorderFactory", ".", "createEmptyBorder", "(", "5", ",", ...
Creates the custom editor. @return the editor
[ "Creates", "the", "custom", "editor", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/weka/gui/MOAClassOptionEditor.java#L78-L93
29,083
Waikato/moa
moa/src/main/java/weka/gui/MOAClassOptionEditor.java
MOAClassOptionEditor.paintValue
public void paintValue(Graphics gfx, Rectangle box) { FontMetrics fm; int vpad; String val; fm = gfx.getFontMetrics(); vpad = (box.height - fm.getHeight()) / 2 ; val = ((ClassOption) getValue()).getValueAsCLIString(); gfx.drawString(val, 2, fm.getHeight() + vpad); }
java
public void paintValue(Graphics gfx, Rectangle box) { FontMetrics fm; int vpad; String val; fm = gfx.getFontMetrics(); vpad = (box.height - fm.getHeight()) / 2 ; val = ((ClassOption) getValue()).getValueAsCLIString(); gfx.drawString(val, 2, fm.getHeight() + vpad); }
[ "public", "void", "paintValue", "(", "Graphics", "gfx", ",", "Rectangle", "box", ")", "{", "FontMetrics", "fm", ";", "int", "vpad", ";", "String", "val", ";", "fm", "=", "gfx", ".", "getFontMetrics", "(", ")", ";", "vpad", "=", "(", "box", ".", "heig...
Paints a representation of the current Object. @param gfx the graphics context to use @param box the area we are allowed to paint into
[ "Paints", "a", "representation", "of", "the", "current", "Object", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/weka/gui/MOAClassOptionEditor.java#L117-L126
29,084
Waikato/moa
moa/src/main/java/moa/classifiers/rules/functions/Perceptron.java
Perceptron.prediction
private double prediction(Instance inst) { if(this.initialisePerceptron){ return 0; }else{ double[] normalizedInstance = normalizedInstance(inst); double normalizedPrediction = prediction(normalizedInstance); return denormalizedPrediction(normalizedPrediction); } }
java
private double prediction(Instance inst) { if(this.initialisePerceptron){ return 0; }else{ double[] normalizedInstance = normalizedInstance(inst); double normalizedPrediction = prediction(normalizedInstance); return denormalizedPrediction(normalizedPrediction); } }
[ "private", "double", "prediction", "(", "Instance", "inst", ")", "{", "if", "(", "this", ".", "initialisePerceptron", ")", "{", "return", "0", ";", "}", "else", "{", "double", "[", "]", "normalizedInstance", "=", "normalizedInstance", "(", "inst", ")", ";"...
Output the prediction made by this perceptron on the given instance
[ "Output", "the", "prediction", "made", "by", "this", "perceptron", "on", "the", "given", "instance" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/rules/functions/Perceptron.java#L231-L240
29,085
Waikato/moa
moa/src/main/java/moa/clusterers/streamkm/BucketManager.java
BucketManager.insertPoint
void insertPoint(Point p){ //check if there is enough space in the first bucket int cursize = this.buckets[0].cursize; if(cursize >= this.maxBucketsize) { //printf("Bucket 0 full \n"); //start spillover process int curbucket = 0; int nextbucket = 1; //check if the next bucket is empty if(t...
java
void insertPoint(Point p){ //check if there is enough space in the first bucket int cursize = this.buckets[0].cursize; if(cursize >= this.maxBucketsize) { //printf("Bucket 0 full \n"); //start spillover process int curbucket = 0; int nextbucket = 1; //check if the next bucket is empty if(t...
[ "void", "insertPoint", "(", "Point", "p", ")", "{", "//check if there is enough space in the first bucket", "int", "cursize", "=", "this", ".", "buckets", "[", "0", "]", ".", "cursize", ";", "if", "(", "cursize", ">=", "this", ".", "maxBucketsize", ")", "{", ...
inserts a single point into the bucketmanager
[ "inserts", "a", "single", "point", "into", "the", "bucketmanager" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/streamkm/BucketManager.java#L55-L116
29,086
Waikato/moa
moa/src/main/java/moa/classifiers/meta/AccuracyUpdatedEnsemble.java
AccuracyUpdatedEnsemble.processChunk
protected void processChunk() { Classifier addedClassifier = null; double mse_r = this.computeMseR(); // Compute weights double candidateClassifierWeight = 1.0 / (mse_r + Double.MIN_VALUE); for (int i = 0; i < this.learners.length; i++) { this.weights[i][0] = 1.0 / (mse_r + this.computeMse(this.l...
java
protected void processChunk() { Classifier addedClassifier = null; double mse_r = this.computeMseR(); // Compute weights double candidateClassifierWeight = 1.0 / (mse_r + Double.MIN_VALUE); for (int i = 0; i < this.learners.length; i++) { this.weights[i][0] = 1.0 / (mse_r + this.computeMse(this.l...
[ "protected", "void", "processChunk", "(", ")", "{", "Classifier", "addedClassifier", "=", "null", ";", "double", "mse_r", "=", "this", ".", "computeMseR", "(", ")", ";", "// Compute weights\r", "double", "candidateClassifierWeight", "=", "1.0", "/", "(", "mse_r"...
Processes a chunk of instances. This method is called after collecting a chunk of examples.
[ "Processes", "a", "chunk", "of", "instances", ".", "This", "method", "is", "called", "after", "collecting", "a", "chunk", "of", "examples", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/meta/AccuracyUpdatedEnsemble.java#L177-L213
29,087
Waikato/moa
moa/src/main/java/moa/classifiers/meta/AccuracyUpdatedEnsemble.java
AccuracyUpdatedEnsemble.computeMse
protected double computeMse(Classifier learner, Instances chunk) { double mse_i = 0; double f_ci; double voteSum; for (int i = 0; i < chunk.numInstances(); i++) { try { voteSum = 0; for (double element : learner.getVotesForInstance(chunk.instance(i))) { voteSum += element; } ...
java
protected double computeMse(Classifier learner, Instances chunk) { double mse_i = 0; double f_ci; double voteSum; for (int i = 0; i < chunk.numInstances(); i++) { try { voteSum = 0; for (double element : learner.getVotesForInstance(chunk.instance(i))) { voteSum += element; } ...
[ "protected", "double", "computeMse", "(", "Classifier", "learner", ",", "Instances", "chunk", ")", "{", "double", "mse_i", "=", "0", ";", "double", "f_ci", ";", "double", "voteSum", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "chunk", ".", ...
Computes the MSE of a learner for a given chunk of examples. @param learner classifier to compute error @param chunk chunk of examples @return the computed error.
[ "Computes", "the", "MSE", "of", "a", "learner", "for", "a", "given", "chunk", "of", "examples", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/meta/AccuracyUpdatedEnsemble.java#L251-L279
29,088
Waikato/moa
moa/src/main/java/moa/classifiers/meta/AccuracyUpdatedEnsemble.java
AccuracyUpdatedEnsemble.trainOnChunk
private void trainOnChunk(Classifier classifierToTrain) { for (int num = 0; num < this.chunkSizeOption.getValue(); num++) { classifierToTrain.trainOnInstance(this.currentChunk.instance(num)); } }
java
private void trainOnChunk(Classifier classifierToTrain) { for (int num = 0; num < this.chunkSizeOption.getValue(); num++) { classifierToTrain.trainOnInstance(this.currentChunk.instance(num)); } }
[ "private", "void", "trainOnChunk", "(", "Classifier", "classifierToTrain", ")", "{", "for", "(", "int", "num", "=", "0", ";", "num", "<", "this", ".", "chunkSizeOption", ".", "getValue", "(", ")", ";", "num", "++", ")", "{", "classifierToTrain", ".", "tr...
Trains a component classifier on the most recent chunk of data. @param classifierToTrain Classifier being trained.
[ "Trains", "a", "component", "classifier", "on", "the", "most", "recent", "chunk", "of", "data", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/meta/AccuracyUpdatedEnsemble.java#L370-L374
29,089
Waikato/moa
moa/src/main/java/moa/cluster/Clustering.java
Clustering.get
public Cluster get(int index){ if(index < clusters.size()){ return clusters.get(index); } return null; }
java
public Cluster get(int index){ if(index < clusters.size()){ return clusters.get(index); } return null; }
[ "public", "Cluster", "get", "(", "int", "index", ")", "{", "if", "(", "index", "<", "clusters", ".", "size", "(", ")", ")", "{", "return", "clusters", ".", "get", "(", "index", ")", ";", "}", "return", "null", ";", "}" ]
get a cluster from the clustering
[ "get", "a", "cluster", "from", "the", "clustering" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/cluster/Clustering.java#L224-L229
29,090
Waikato/moa
moa/src/main/java/moa/classifiers/trees/HoeffdingAdaptiveTree.java
HoeffdingAdaptiveTree.filterInstanceToLeaves
public FoundNode[] filterInstanceToLeaves(Instance inst, SplitNode parent, int parentBranch, boolean updateSplitterCounts) { List<FoundNode> nodes = new LinkedList<FoundNode>(); ((NewNode) this.treeRoot).filterInstanceToLeaves(inst, parent, parentBranch, nodes, updateSplitter...
java
public FoundNode[] filterInstanceToLeaves(Instance inst, SplitNode parent, int parentBranch, boolean updateSplitterCounts) { List<FoundNode> nodes = new LinkedList<FoundNode>(); ((NewNode) this.treeRoot).filterInstanceToLeaves(inst, parent, parentBranch, nodes, updateSplitter...
[ "public", "FoundNode", "[", "]", "filterInstanceToLeaves", "(", "Instance", "inst", ",", "SplitNode", "parent", ",", "int", "parentBranch", ",", "boolean", "updateSplitterCounts", ")", "{", "List", "<", "FoundNode", ">", "nodes", "=", "new", "LinkedList", "<", ...
New for options vote
[ "New", "for", "options", "vote" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/trees/HoeffdingAdaptiveTree.java#L473-L479
29,091
Waikato/moa
moa/src/main/java/com/yahoo/labs/samoa/instances/Range.java
Range.setRange
public void setRange(String range) { String single = range.trim(); int hyphenIndex = range.indexOf('-'); if (hyphenIndex > 0) { this.start = rangeSingle(range.substring(0, hyphenIndex)); this.end = rangeSingle(range.substring(hyphenIndex + 1)); } else { ...
java
public void setRange(String range) { String single = range.trim(); int hyphenIndex = range.indexOf('-'); if (hyphenIndex > 0) { this.start = rangeSingle(range.substring(0, hyphenIndex)); this.end = rangeSingle(range.substring(hyphenIndex + 1)); } else { ...
[ "public", "void", "setRange", "(", "String", "range", ")", "{", "String", "single", "=", "range", ".", "trim", "(", ")", ";", "int", "hyphenIndex", "=", "range", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "hyphenIndex", ">", "0", ")", "{",...
Sets the range from a string representation. @param range the start and end string
[ "Sets", "the", "range", "from", "a", "string", "representation", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/com/yahoo/labs/samoa/instances/Range.java#L39-L56
29,092
Waikato/moa
moa/src/main/java/com/yahoo/labs/samoa/instances/Range.java
Range.rangeSingle
protected /*@pure@*/ int rangeSingle(/*@non_null@*/String singleSelection) { String single = singleSelection.trim(); if (single.toLowerCase().equals("first")) { return 0; } if (single.toLowerCase().equals("last") || single.toLowerCase().equals("-1")) { return -1;...
java
protected /*@pure@*/ int rangeSingle(/*@non_null@*/String singleSelection) { String single = singleSelection.trim(); if (single.toLowerCase().equals("first")) { return 0; } if (single.toLowerCase().equals("last") || single.toLowerCase().equals("-1")) { return -1;...
[ "protected", "/*@pure@*/", "int", "rangeSingle", "(", "/*@non_null@*/", "String", "singleSelection", ")", "{", "String", "single", "=", "singleSelection", ".", "trim", "(", ")", ";", "if", "(", "single", ".", "toLowerCase", "(", ")", ".", "equals", "(", "\"f...
Translates a single string selection into it's internal 0-based equivalent. @param single the string representing the selection (eg: 1 first last) @return the number corresponding to the selected value
[ "Translates", "a", "single", "string", "selection", "into", "it", "s", "internal", "0", "-", "based", "equivalent", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/com/yahoo/labs/samoa/instances/Range.java#L65-L79
29,093
Waikato/moa
moa/src/main/java/moa/clusterers/outliers/utils/mtree/utils/Utils.java
Utils.minMax
public static <T extends Comparable<T>> Pair<T> minMax(Iterable<T> items) { Iterator<T> iterator = items.iterator(); if(!iterator.hasNext()) { return null; } T min = iterator.next(); T max = min; while(iterator.hasNext()) { T item = iterator.next(); if(item.compareTo(min) < 0) { min = ite...
java
public static <T extends Comparable<T>> Pair<T> minMax(Iterable<T> items) { Iterator<T> iterator = items.iterator(); if(!iterator.hasNext()) { return null; } T min = iterator.next(); T max = min; while(iterator.hasNext()) { T item = iterator.next(); if(item.compareTo(min) < 0) { min = ite...
[ "public", "static", "<", "T", "extends", "Comparable", "<", "T", ">", ">", "Pair", "<", "T", ">", "minMax", "(", "Iterable", "<", "T", ">", "items", ")", "{", "Iterator", "<", "T", ">", "iterator", "=", "items", ".", "iterator", "(", ")", ";", "i...
Identifies the minimum and maximum elements from an iterable, according to the natural ordering of the elements. @param items An {@link Iterable} object with the elements @param <T> The type of the elements. @return A pair with the minimum and maximum elements.
[ "Identifies", "the", "minimum", "and", "maximum", "elements", "from", "an", "iterable", "according", "to", "the", "natural", "ordering", "of", "the", "elements", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/outliers/utils/mtree/utils/Utils.java#L43-L63
29,094
Waikato/moa
moa/src/main/java/moa/clusterers/outliers/utils/mtree/utils/Utils.java
Utils.randomSample
public static <T> List<T> randomSample(Collection<T> collection, int n) { List<T> list = new ArrayList<T>(collection); List<T> sample = new ArrayList<T>(n); Random random = new Random(); while(n > 0 && !list.isEmpty()) { int index = random.nextInt(list.size()); sample.add(list.get(index)); int indexL...
java
public static <T> List<T> randomSample(Collection<T> collection, int n) { List<T> list = new ArrayList<T>(collection); List<T> sample = new ArrayList<T>(n); Random random = new Random(); while(n > 0 && !list.isEmpty()) { int index = random.nextInt(list.size()); sample.add(list.get(index)); int indexL...
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "randomSample", "(", "Collection", "<", "T", ">", "collection", ",", "int", "n", ")", "{", "List", "<", "T", ">", "list", "=", "new", "ArrayList", "<", "T", ">", "(", "collection", ")", ";...
Randomly chooses elements from the collection. @param collection The collection. @param n The number of elements to choose. @param <T> The type of the elements. @return A list with the chosen elements.
[ "Randomly", "chooses", "elements", "from", "the", "collection", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/outliers/utils/mtree/utils/Utils.java#L73-L88
29,095
Waikato/moa
moa/src/main/java/moa/gui/visualization/GraphCanvas.java
GraphCanvas.updateMinMaxValues
private boolean updateMinMaxValues() { double min_y_value_new = min_y_value; double max_y_value_new = max_y_value; double max_x_value_new = max_x_value; if (measure0 != null && measure1 != null) { min_y_value_new = Math.min(measure0.getMinValue(measureSelected), measure1.get...
java
private boolean updateMinMaxValues() { double min_y_value_new = min_y_value; double max_y_value_new = max_y_value; double max_x_value_new = max_x_value; if (measure0 != null && measure1 != null) { min_y_value_new = Math.min(measure0.getMinValue(measureSelected), measure1.get...
[ "private", "boolean", "updateMinMaxValues", "(", ")", "{", "double", "min_y_value_new", "=", "min_y_value", ";", "double", "max_y_value_new", "=", "max_y_value", ";", "double", "max_x_value_new", "=", "max_x_value", ";", "if", "(", "measure0", "!=", "null", "&&", ...
returns true when values have changed
[ "returns", "true", "when", "values", "have", "changed" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/visualization/GraphCanvas.java#L148-L173
29,096
Waikato/moa
moa/src/main/java/moa/gui/visualization/GraphCanvas.java
GraphCanvas.addEvents
private void addEvents() { if (clusterEvents != null && clusterEvents.size() > eventCounter) { ClusterEvent ev = clusterEvents.get(eventCounter); eventCounter++; JLabel eventMarker = new JLabel(ev.getType().substring(0, 1)); eventMarker.setPreferredSize(new Dimen...
java
private void addEvents() { if (clusterEvents != null && clusterEvents.size() > eventCounter) { ClusterEvent ev = clusterEvents.get(eventCounter); eventCounter++; JLabel eventMarker = new JLabel(ev.getType().substring(0, 1)); eventMarker.setPreferredSize(new Dimen...
[ "private", "void", "addEvents", "(", ")", "{", "if", "(", "clusterEvents", "!=", "null", "&&", "clusterEvents", ".", "size", "(", ")", ">", "eventCounter", ")", "{", "ClusterEvent", "ev", "=", "clusterEvents", ".", "get", "(", "eventCounter", ")", ";", "...
check if there are any new events in the event list and add them to the plot
[ "check", "if", "there", "are", "any", "new", "events", "in", "the", "event", "list", "and", "add", "them", "to", "the", "plot" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/visualization/GraphCanvas.java#L203-L220
29,097
Waikato/moa
moa/src/main/java/moa/evaluation/BasicMultiTargetPerformanceRelativeMeasuresEvaluator.java
BasicMultiTargetPerformanceRelativeMeasuresEvaluator.addResult
@Override public void addResult(Example<Instance> example, double[] classVotes) { Prediction p=new MultiLabelPrediction(1); p.setVotes(classVotes); addResult(example, p); }
java
@Override public void addResult(Example<Instance> example, double[] classVotes) { Prediction p=new MultiLabelPrediction(1); p.setVotes(classVotes); addResult(example, p); }
[ "@", "Override", "public", "void", "addResult", "(", "Example", "<", "Instance", ">", "example", ",", "double", "[", "]", "classVotes", ")", "{", "Prediction", "p", "=", "new", "MultiLabelPrediction", "(", "1", ")", ";", "p", ".", "setVotes", "(", "class...
only for one output
[ "only", "for", "one", "output" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/evaluation/BasicMultiTargetPerformanceRelativeMeasuresEvaluator.java#L152-L157
29,098
Waikato/moa
moa/src/main/java/moa/gui/visualization/ParamGraphCanvas.java
ParamGraphCanvas.setGraph
public void setGraph(MeasureCollection[] measures, MeasureCollection[] measureStds, double[] variedParamValues, Color[] colors) { this.measures = measures; this.variedParamValues = variedParamValues; ((GraphScatter) this.plotPanel).setGraph(measures, measureStds, vari...
java
public void setGraph(MeasureCollection[] measures, MeasureCollection[] measureStds, double[] variedParamValues, Color[] colors) { this.measures = measures; this.variedParamValues = variedParamValues; ((GraphScatter) this.plotPanel).setGraph(measures, measureStds, vari...
[ "public", "void", "setGraph", "(", "MeasureCollection", "[", "]", "measures", ",", "MeasureCollection", "[", "]", "measureStds", ",", "double", "[", "]", "variedParamValues", ",", "Color", "[", "]", "colors", ")", "{", "this", ".", "measures", "=", "measures...
Sets the scatter graph. @param measures information about the curves @param measureStds standard deviation for the measures @param variedParamValues values of the varied parameter @param colors color encoding for the param array
[ "Sets", "the", "scatter", "graph", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/visualization/ParamGraphCanvas.java#L62-L69
29,099
Waikato/moa
moa/src/main/java/moa/clusterers/CobWeb.java
CobWeb.getVotesForInstance
public double[] getVotesForInstance(Instance instance) { //public int clusterInstance(Instance instance) {//throws Exception { CNode host = m_cobwebTree; CNode temp = null; determineNumberOfClusters(); if (this.m_numberOfClusters < 1) { return (new double[0]); ...
java
public double[] getVotesForInstance(Instance instance) { //public int clusterInstance(Instance instance) {//throws Exception { CNode host = m_cobwebTree; CNode temp = null; determineNumberOfClusters(); if (this.m_numberOfClusters < 1) { return (new double[0]); ...
[ "public", "double", "[", "]", "getVotesForInstance", "(", "Instance", "instance", ")", "{", "//public int clusterInstance(Instance instance) {//throws Exception {", "CNode", "host", "=", "m_cobwebTree", ";", "CNode", "temp", "=", "null", ";", "determineNumberOfClusters", ...
Classifies a given instance. @param instance the instance to be assigned to a cluster @return the number of the assigned cluster as an interger if the class is enumerated, otherwise the predicted value @throws Exception if instance could not be classified successfully
[ "Classifies", "a", "given", "instance", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/CobWeb.java#L815-L844