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
28,900
Waikato/moa
moa/src/main/java/moa/classifiers/oneclass/HSTrees.java
HSTrees.initialize
@Override public void initialize(Collection<Instance> trainingPoints) { Iterator<Instance> trgPtsIterator = trainingPoints.iterator(); if(trgPtsIterator.hasNext() && this.numInstances == 0) { Instance inst = trgPtsIterator.next(); this.buildForest(inst); this.trainOnInstance(inst); } while(tr...
java
@Override public void initialize(Collection<Instance> trainingPoints) { Iterator<Instance> trgPtsIterator = trainingPoints.iterator(); if(trgPtsIterator.hasNext() && this.numInstances == 0) { Instance inst = trgPtsIterator.next(); this.buildForest(inst); this.trainOnInstance(inst); } while(tr...
[ "@", "Override", "public", "void", "initialize", "(", "Collection", "<", "Instance", ">", "trainingPoints", ")", "{", "Iterator", "<", "Instance", ">", "trgPtsIterator", "=", "trainingPoints", ".", "iterator", "(", ")", ";", "if", "(", "trgPtsIterator", ".", ...
Initializes the Streaming HS-Trees classifier on the argument trainingPoints. @param trainingPoints the Collection of instance with which to initialize the Streaming Hs-Trees classifier.
[ "Initializes", "the", "Streaming", "HS", "-", "Trees", "classifier", "on", "the", "argument", "trainingPoints", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/oneclass/HSTrees.java#L261-L277
28,901
Waikato/moa
moa/src/main/java/moa/classifiers/core/attributeclassobservers/FIMTDDNumericAttributeClassObserver.java
FIMTDDNumericAttributeClassObserver.searchForBestSplitOption
protected AttributeSplitSuggestion searchForBestSplitOption(Node currentNode, AttributeSplitSuggestion currentBestOption, SplitCriterion criterion, int attIndex) { // Return null if the current node is null or we have finished looking through all the possible splits if (currentNode == null || countRight...
java
protected AttributeSplitSuggestion searchForBestSplitOption(Node currentNode, AttributeSplitSuggestion currentBestOption, SplitCriterion criterion, int attIndex) { // Return null if the current node is null or we have finished looking through all the possible splits if (currentNode == null || countRight...
[ "protected", "AttributeSplitSuggestion", "searchForBestSplitOption", "(", "Node", "currentNode", ",", "AttributeSplitSuggestion", "currentBestOption", ",", "SplitCriterion", "criterion", ",", "int", "attIndex", ")", "{", "// Return null if the current node is null or we have finish...
Implementation of the FindBestSplit algorithm from E.Ikonomovska et al.
[ "Implementation", "of", "the", "FindBestSplit", "algorithm", "from", "E", ".", "Ikonomovska", "et", "al", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/core/attributeclassobservers/FIMTDDNumericAttributeClassObserver.java#L148-L187
28,902
Waikato/moa
moa/src/main/java/moa/classifiers/core/attributeclassobservers/FIMTDDNumericAttributeClassObserver.java
FIMTDDNumericAttributeClassObserver.removeBadSplits
public void removeBadSplits(SplitCriterion criterion, double lastCheckRatio, double lastCheckSDR, double lastCheckE) { removeBadSplitNodes(criterion, this.root, lastCheckRatio, lastCheckSDR, lastCheckE); }
java
public void removeBadSplits(SplitCriterion criterion, double lastCheckRatio, double lastCheckSDR, double lastCheckE) { removeBadSplitNodes(criterion, this.root, lastCheckRatio, lastCheckSDR, lastCheckE); }
[ "public", "void", "removeBadSplits", "(", "SplitCriterion", "criterion", ",", "double", "lastCheckRatio", ",", "double", "lastCheckSDR", ",", "double", "lastCheckE", ")", "{", "removeBadSplitNodes", "(", "criterion", ",", "this", ".", "root", ",", "lastCheckRatio", ...
A method to remove all nodes in the E-BST in which it and all it's children represent 'bad' split points
[ "A", "method", "to", "remove", "all", "nodes", "in", "the", "E", "-", "BST", "in", "which", "it", "and", "all", "it", "s", "children", "represent", "bad", "split", "points" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/core/attributeclassobservers/FIMTDDNumericAttributeClassObserver.java#L193-L195
28,903
Waikato/moa
moa/src/main/java/moa/classifiers/core/attributeclassobservers/FIMTDDNumericAttributeClassObserver.java
FIMTDDNumericAttributeClassObserver.removeBadSplitNodes
private boolean removeBadSplitNodes(SplitCriterion criterion, Node currentNode, double lastCheckRatio, double lastCheckSDR, double lastCheckE) { boolean isBad = false; if (currentNode == null) { return true; } if (currentNode.left != null) { isBad = removeBadSpl...
java
private boolean removeBadSplitNodes(SplitCriterion criterion, Node currentNode, double lastCheckRatio, double lastCheckSDR, double lastCheckE) { boolean isBad = false; if (currentNode == null) { return true; } if (currentNode.left != null) { isBad = removeBadSpl...
[ "private", "boolean", "removeBadSplitNodes", "(", "SplitCriterion", "criterion", ",", "Node", "currentNode", ",", "double", "lastCheckRatio", ",", "double", "lastCheckSDR", ",", "double", "lastCheckE", ")", "{", "boolean", "isBad", "=", "false", ";", "if", "(", ...
Recursive method that first checks all of a node's children before deciding if it is 'bad' and may be removed
[ "Recursive", "method", "that", "first", "checks", "all", "of", "a", "node", "s", "children", "before", "deciding", "if", "it", "is", "bad", "and", "may", "be", "removed" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/core/attributeclassobservers/FIMTDDNumericAttributeClassObserver.java#L201-L229
28,904
Waikato/moa
moa/src/main/java/moa/classifiers/oneclass/NearestNeighbourDescription.java
NearestNeighbourDescription.resetLearningImpl
@Override public void resetLearningImpl() { this.nbhdSize = this.neighbourhoodSizeOption.getValue(); //this.k = this.kOption.getValue(); //NOT IMPLEMENTED// //this.m = this.mOption.getValue(); //NOT IMPLEMENTED// this.tau = this.thresholdOption.getValue(); this.neighbourhood = new FixedLengthList<Inst...
java
@Override public void resetLearningImpl() { this.nbhdSize = this.neighbourhoodSizeOption.getValue(); //this.k = this.kOption.getValue(); //NOT IMPLEMENTED// //this.m = this.mOption.getValue(); //NOT IMPLEMENTED// this.tau = this.thresholdOption.getValue(); this.neighbourhood = new FixedLengthList<Inst...
[ "@", "Override", "public", "void", "resetLearningImpl", "(", ")", "{", "this", ".", "nbhdSize", "=", "this", ".", "neighbourhoodSizeOption", ".", "getValue", "(", ")", ";", "//this.k = this.kOption.getValue(); //NOT IMPLEMENTED//", "//this.m = this.mOption.getValue(); //NOT...
Resets the implementation's parameters and data structures.
[ "Resets", "the", "implementation", "s", "parameters", "and", "data", "structures", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/oneclass/NearestNeighbourDescription.java#L93-L103
28,905
Waikato/moa
moa/src/main/java/moa/classifiers/oneclass/NearestNeighbourDescription.java
NearestNeighbourDescription.getVotesForInstance
@Override public double[] getVotesForInstance(Instance inst) { double[] votes = {0.5, 0.5}; if(this.neighbourhood.size() > 2) { votes[1] = Math.pow(2.0, -1.0 * this.getAnomalyScore(inst) / this.tau); votes[0] = 1.0 - votes[1]; } return votes; }
java
@Override public double[] getVotesForInstance(Instance inst) { double[] votes = {0.5, 0.5}; if(this.neighbourhood.size() > 2) { votes[1] = Math.pow(2.0, -1.0 * this.getAnomalyScore(inst) / this.tau); votes[0] = 1.0 - votes[1]; } return votes; }
[ "@", "Override", "public", "double", "[", "]", "getVotesForInstance", "(", "Instance", "inst", ")", "{", "double", "[", "]", "votes", "=", "{", "0.5", ",", "0.5", "}", ";", "if", "(", "this", ".", "neighbourhood", ".", "size", "(", ")", ">", "2", "...
Calculates the distance between the argument instance and its nearest neighbour as well as the distance between that nearest neighbour and its own nearest neighbour. The ratio of these distances is compared to the threshold value, tau, and converted into a vote score. @param inst the instance to get votes for. @retur...
[ "Calculates", "the", "distance", "between", "the", "argument", "instance", "and", "its", "nearest", "neighbour", "as", "well", "as", "the", "distance", "between", "that", "nearest", "neighbour", "and", "its", "own", "nearest", "neighbour", ".", "The", "ratio", ...
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/oneclass/NearestNeighbourDescription.java#L126-L138
28,906
Waikato/moa
moa/src/main/java/moa/classifiers/oneclass/NearestNeighbourDescription.java
NearestNeighbourDescription.getAnomalyScore
public double getAnomalyScore(Instance inst) { if(this.neighbourhood.size() < 2) return 1.0; Instance nearestNeighbour = getNearestNeighbour(inst, this.neighbourhood, false); Instance nnNearestNeighbour = getNearestNeighbour(nearestNeighbour, this.neighbourhood, true); double indicatorArgument = dista...
java
public double getAnomalyScore(Instance inst) { if(this.neighbourhood.size() < 2) return 1.0; Instance nearestNeighbour = getNearestNeighbour(inst, this.neighbourhood, false); Instance nnNearestNeighbour = getNearestNeighbour(nearestNeighbour, this.neighbourhood, true); double indicatorArgument = dista...
[ "public", "double", "getAnomalyScore", "(", "Instance", "inst", ")", "{", "if", "(", "this", ".", "neighbourhood", ".", "size", "(", ")", "<", "2", ")", "return", "1.0", ";", "Instance", "nearestNeighbour", "=", "getNearestNeighbour", "(", "inst", ",", "th...
Returns the anomaly score for an argument instance based on the distance from it to its nearest neighbour compared to the distance from its nearest neighbour to the neighbour's nearest neighbour. @param inst the argument instance @return d(inst, instNN) / d(instNN, instNNNN)
[ "Returns", "the", "anomaly", "score", "for", "an", "argument", "instance", "based", "on", "the", "distance", "from", "it", "to", "its", "nearest", "neighbour", "compared", "to", "the", "distance", "from", "its", "nearest", "neighbour", "to", "the", "neighbour"...
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/oneclass/NearestNeighbourDescription.java#L148-L159
28,907
Waikato/moa
moa/src/main/java/moa/classifiers/oneclass/NearestNeighbourDescription.java
NearestNeighbourDescription.getNearestNeighbour
private Instance getNearestNeighbour(Instance inst, List<Instance> neighbourhood2, boolean inNbhd) { double dist = Double.MAX_VALUE; Instance nearestNeighbour = null; for(Instance candidateNN : neighbourhood2) { // If inst is in neighbourhood2 and an identical instance is found, then it is no longer requ...
java
private Instance getNearestNeighbour(Instance inst, List<Instance> neighbourhood2, boolean inNbhd) { double dist = Double.MAX_VALUE; Instance nearestNeighbour = null; for(Instance candidateNN : neighbourhood2) { // If inst is in neighbourhood2 and an identical instance is found, then it is no longer requ...
[ "private", "Instance", "getNearestNeighbour", "(", "Instance", "inst", ",", "List", "<", "Instance", ">", "neighbourhood2", ",", "boolean", "inNbhd", ")", "{", "double", "dist", "=", "Double", ".", "MAX_VALUE", ";", "Instance", "nearestNeighbour", "=", "null", ...
Searches the neighbourhood in order to find the argument instance's nearest neighbour. @param inst the instance whose nearest neighbour is sought @param neighbourhood2 the neighbourhood to search for the nearest neighbour @param inNbhd if inst is in neighbourhood2: <b>true</b>, else: <b>false</b> @return the instance...
[ "Searches", "the", "neighbourhood", "in", "order", "to", "find", "the", "argument", "instance", "s", "nearest", "neighbour", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/oneclass/NearestNeighbourDescription.java#L170-L194
28,908
Waikato/moa
moa/src/main/java/moa/classifiers/oneclass/NearestNeighbourDescription.java
NearestNeighbourDescription.distance
private double distance(Instance inst1, Instance inst2) { double dist = 0.0; for(int i = 0 ; i < inst1.numAttributes() ; i++) { dist += Math.pow((inst1.value(i) - inst2.value(i)), 2.0); } return Math.sqrt(dist); }
java
private double distance(Instance inst1, Instance inst2) { double dist = 0.0; for(int i = 0 ; i < inst1.numAttributes() ; i++) { dist += Math.pow((inst1.value(i) - inst2.value(i)), 2.0); } return Math.sqrt(dist); }
[ "private", "double", "distance", "(", "Instance", "inst1", ",", "Instance", "inst2", ")", "{", "double", "dist", "=", "0.0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "inst1", ".", "numAttributes", "(", ")", ";", "i", "++", ")", "{", ...
Calculates the Euclidean distance between two instances. @param inst1 the first instance @param inst2 the second instance @return the Euclidean distance between the two instances
[ "Calculates", "the", "Euclidean", "distance", "between", "two", "instances", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/oneclass/NearestNeighbourDescription.java#L204-L214
28,909
Waikato/moa
moa/src/main/java/moa/clusterers/streamkm/Point.java
Point.costOfPointToCenter
public double costOfPointToCenter(Point centre){ if(this.weight == 0.0){ return 0.0; } //stores the distance between p and centre double distance = 0.0; //loop counter for(int l=0; l<this.dimension; l++){ //Centroid coordinate of the point double centroidCoordinatePoint; if(this.weight != 0.0)...
java
public double costOfPointToCenter(Point centre){ if(this.weight == 0.0){ return 0.0; } //stores the distance between p and centre double distance = 0.0; //loop counter for(int l=0; l<this.dimension; l++){ //Centroid coordinate of the point double centroidCoordinatePoint; if(this.weight != 0.0)...
[ "public", "double", "costOfPointToCenter", "(", "Point", "centre", ")", "{", "if", "(", "this", ".", "weight", "==", "0.0", ")", "{", "return", "0.0", ";", "}", "//stores the distance between p and centre", "double", "distance", "=", "0.0", ";", "//loop counter"...
Computes the cost of this point with centre centre
[ "Computes", "the", "cost", "of", "this", "point", "with", "centre", "centre" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/streamkm/Point.java#L161-L190
28,910
Waikato/moa
moa/src/main/java/weka/core/MOAUtils.java
MOAUtils.fromOption
public static MOAObject fromOption(ClassOption option) { return MOAUtils.fromCommandLine(option.getRequiredType(), option.getValueAsCLIString()); }
java
public static MOAObject fromOption(ClassOption option) { return MOAUtils.fromCommandLine(option.getRequiredType(), option.getValueAsCLIString()); }
[ "public", "static", "MOAObject", "fromOption", "(", "ClassOption", "option", ")", "{", "return", "MOAUtils", ".", "fromCommandLine", "(", "option", ".", "getRequiredType", "(", ")", ",", "option", ".", "getValueAsCLIString", "(", ")", ")", ";", "}" ]
Creates a MOA object from the specified class option. @param option the option to build the object from @return the created object
[ "Creates", "a", "MOA", "object", "from", "the", "specified", "class", "option", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/weka/core/MOAUtils.java#L89-L91
28,911
Waikato/moa
moa/src/main/java/weka/core/MOAUtils.java
MOAUtils.toCommandLine
public static String toCommandLine(MOAObject obj) { String result = obj.getClass().getName(); if (obj instanceof AbstractOptionHandler) result += " " + ((AbstractOptionHandler) obj).getOptions().getAsCLIString(); return result.trim(); }
java
public static String toCommandLine(MOAObject obj) { String result = obj.getClass().getName(); if (obj instanceof AbstractOptionHandler) result += " " + ((AbstractOptionHandler) obj).getOptions().getAsCLIString(); return result.trim(); }
[ "public", "static", "String", "toCommandLine", "(", "MOAObject", "obj", ")", "{", "String", "result", "=", "obj", ".", "getClass", "(", ")", ".", "getName", "(", ")", ";", "if", "(", "obj", "instanceof", "AbstractOptionHandler", ")", "result", "+=", "\" \"...
Returs the commandline for the given object. If the object is not derived from AbstractOptionHandler, then only the classname. Otherwise the classname and the options are returned. @param obj the object to generate the commandline for @return the commandline
[ "Returs", "the", "commandline", "for", "the", "given", "object", ".", "If", "the", "object", "is", "not", "derived", "from", "AbstractOptionHandler", "then", "only", "the", "classname", ".", "Otherwise", "the", "classname", "and", "the", "options", "are", "ret...
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/weka/core/MOAUtils.java#L101-L106
28,912
Waikato/moa
moa/src/main/java/com/yahoo/labs/samoa/instances/ArffLoader.java
ArffLoader.readDenseInstanceSparse
private Instance readDenseInstanceSparse() { //Returns a dense instance Instance instance = newDenseInstance(this.instanceInformation.numAttributes()); //System.out.println(this.instanceInformation.numAttributes()); int numAttribute; try { //while (streamTokenizer.tty...
java
private Instance readDenseInstanceSparse() { //Returns a dense instance Instance instance = newDenseInstance(this.instanceInformation.numAttributes()); //System.out.println(this.instanceInformation.numAttributes()); int numAttribute; try { //while (streamTokenizer.tty...
[ "private", "Instance", "readDenseInstanceSparse", "(", ")", "{", "//Returns a dense instance", "Instance", "instance", "=", "newDenseInstance", "(", "this", ".", "instanceInformation", ".", "numAttributes", "(", ")", ")", ";", "//System.out.println(this.instanceInformation....
Reads an instance sparse and returns a dense one. @return the instance
[ "Reads", "an", "instance", "sparse", "and", "returns", "a", "dense", "one", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/com/yahoo/labs/samoa/instances/ArffLoader.java#L298-L344
28,913
Waikato/moa
moa/src/main/java/moa/MakeObject.java
MakeObject.main
public static void main(String[] args) { try { System.err.println(); System.err.println(Globals.getWorkbenchInfoString()); System.err.println(); if (args.length < 2) { System.err.println("usage: java " + MakeObject.class.getName() ...
java
public static void main(String[] args) { try { System.err.println(); System.err.println(Globals.getWorkbenchInfoString()); System.err.println(); if (args.length < 2) { System.err.println("usage: java " + MakeObject.class.getName() ...
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "try", "{", "System", ".", "err", ".", "println", "(", ")", ";", "System", ".", "err", ".", "println", "(", "Globals", ".", "getWorkbenchInfoString", "(", ")", ")", ";", ...
Main method for writing an object to a file from the command line. @param args the options
[ "Main", "method", "for", "writing", "an", "object", "to", "a", "file", "from", "the", "command", "line", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/MakeObject.java#L42-L69
28,914
Waikato/moa
moa/src/main/java/moa/cluster/CFCluster.java
CFCluster.addVectors
public static void addVectors(double[] a1, double[] a2) { assert (a1 != null); assert (a2 != null); assert (a1.length == a2.length) : "Adding two arrays of different " + "length"; for (int i = 0; i < a1.length; i++) { a1[i] += a2[i]; } }
java
public static void addVectors(double[] a1, double[] a2) { assert (a1 != null); assert (a2 != null); assert (a1.length == a2.length) : "Adding two arrays of different " + "length"; for (int i = 0; i < a1.length; i++) { a1[i] += a2[i]; } }
[ "public", "static", "void", "addVectors", "(", "double", "[", "]", "a1", ",", "double", "[", "]", "a2", ")", "{", "assert", "(", "a1", "!=", "null", ")", ";", "assert", "(", "a2", "!=", "null", ")", ";", "assert", "(", "a1", ".", "length", "==", ...
Adds the second array to the first array element by element. The arrays must have the same length. @param a1 Vector to which the second vector is added. @param a2 Vector to be added. This vector does not change.
[ "Adds", "the", "second", "array", "to", "the", "first", "array", "element", "by", "element", ".", "The", "arrays", "must", "have", "the", "same", "length", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/cluster/CFCluster.java#L162-L171
28,915
Waikato/moa
moa/src/main/java/moa/gui/active/ALPreviewPanel.java
ALPreviewPanel.refresh
private void refresh() { if (this.previewedThread != null) { if (this.previewedThread.isComplete()) { setLatestPreview(); disableRefresh(); } else { this.previewedThread.getPreview(ALPreviewPanel.this); } } }
java
private void refresh() { if (this.previewedThread != null) { if (this.previewedThread.isComplete()) { setLatestPreview(); disableRefresh(); } else { this.previewedThread.getPreview(ALPreviewPanel.this); } } }
[ "private", "void", "refresh", "(", ")", "{", "if", "(", "this", ".", "previewedThread", "!=", "null", ")", "{", "if", "(", "this", ".", "previewedThread", ".", "isComplete", "(", ")", ")", "{", "setLatestPreview", "(", ")", ";", "disableRefresh", "(", ...
Refreshes the preview.
[ "Refreshes", "the", "preview", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/active/ALPreviewPanel.java#L116-L125
28,916
Waikato/moa
moa/src/main/java/moa/gui/active/ALPreviewPanel.java
ALPreviewPanel.setTaskThreadToPreview
public void setTaskThreadToPreview(ALTaskThread thread) { this.previewedThread = thread; setLatestPreview(); if (thread == null) { disableRefresh(); } else if (!thread.isComplete()) { enableRefresh(); } }
java
public void setTaskThreadToPreview(ALTaskThread thread) { this.previewedThread = thread; setLatestPreview(); if (thread == null) { disableRefresh(); } else if (!thread.isComplete()) { enableRefresh(); } }
[ "public", "void", "setTaskThreadToPreview", "(", "ALTaskThread", "thread", ")", "{", "this", ".", "previewedThread", "=", "thread", ";", "setLatestPreview", "(", ")", ";", "if", "(", "thread", "==", "null", ")", "{", "disableRefresh", "(", ")", ";", "}", "...
Sets the TaskThread that will be previewed. @param thread TaskThread to be previewed
[ "Sets", "the", "TaskThread", "that", "will", "be", "previewed", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/active/ALPreviewPanel.java#L131-L139
28,917
Waikato/moa
moa/src/main/java/moa/gui/active/ALPreviewPanel.java
ALPreviewPanel.getColorCodings
private Color[] getColorCodings(ALTaskThread thread) { if (thread == null) { return null; } ALMainTask task = (ALMainTask) thread.getTask(); List<ALTaskThread> subtaskThreads = task.getSubtaskThreads(); if (subtaskThreads.size() == 0) { // no hierarchical thread, e...
java
private Color[] getColorCodings(ALTaskThread thread) { if (thread == null) { return null; } ALMainTask task = (ALMainTask) thread.getTask(); List<ALTaskThread> subtaskThreads = task.getSubtaskThreads(); if (subtaskThreads.size() == 0) { // no hierarchical thread, e...
[ "private", "Color", "[", "]", "getColorCodings", "(", "ALTaskThread", "thread", ")", "{", "if", "(", "thread", "==", "null", ")", "{", "return", "null", ";", "}", "ALMainTask", "task", "=", "(", "ALMainTask", ")", "thread", ".", "getTask", "(", ")", ";...
Reads the color codings of the subtasks. @return array of color codings, one for each subtask
[ "Reads", "the", "color", "codings", "of", "the", "subtasks", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/active/ALPreviewPanel.java#L187-L215
28,918
Waikato/moa
moa/src/main/java/moa/gui/active/ALPreviewPanel.java
ALPreviewPanel.disableRefresh
private void disableRefresh() { this.refreshButton.setEnabled(false); this.autoRefreshLabel.setEnabled(false); this.autoRefreshComboBox.setEnabled(false); this.autoRefreshTimer.stop(); }
java
private void disableRefresh() { this.refreshButton.setEnabled(false); this.autoRefreshLabel.setEnabled(false); this.autoRefreshComboBox.setEnabled(false); this.autoRefreshTimer.stop(); }
[ "private", "void", "disableRefresh", "(", ")", "{", "this", ".", "refreshButton", ".", "setEnabled", "(", "false", ")", ";", "this", ".", "autoRefreshLabel", ".", "setEnabled", "(", "false", ")", ";", "this", ".", "autoRefreshComboBox", ".", "setEnabled", "(...
Disables refreshing.
[ "Disables", "refreshing", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/active/ALPreviewPanel.java#L236-L241
28,919
Waikato/moa
moa/src/main/java/moa/gui/active/ALPreviewPanel.java
ALPreviewPanel.enableRefresh
private void enableRefresh() { this.refreshButton.setEnabled(true); this.autoRefreshLabel.setEnabled(true); this.autoRefreshComboBox.setEnabled(true); updateAutoRefreshTimer(); }
java
private void enableRefresh() { this.refreshButton.setEnabled(true); this.autoRefreshLabel.setEnabled(true); this.autoRefreshComboBox.setEnabled(true); updateAutoRefreshTimer(); }
[ "private", "void", "enableRefresh", "(", ")", "{", "this", ".", "refreshButton", ".", "setEnabled", "(", "true", ")", ";", "this", ".", "autoRefreshLabel", ".", "setEnabled", "(", "true", ")", ";", "this", ".", "autoRefreshComboBox", ".", "setEnabled", "(", ...
Enables refreshing.
[ "Enables", "refreshing", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/active/ALPreviewPanel.java#L246-L251
28,920
Waikato/moa
moa/src/main/java/moa/streams/filters/ReLUFilter.java
ReLUFilter.filterInstance
public Instance filterInstance(Instance x) { if(dataset==null){ initialize(x); } double z_[] = new double[H+1]; int d = x.numAttributes() - 1; // suppose one class attribute (at the end) for(int k = 0; k < H; k++) { // for each hidden unit ... double a_k = 0.; // k-th activation (dot p...
java
public Instance filterInstance(Instance x) { if(dataset==null){ initialize(x); } double z_[] = new double[H+1]; int d = x.numAttributes() - 1; // suppose one class attribute (at the end) for(int k = 0; k < H; k++) { // for each hidden unit ... double a_k = 0.; // k-th activation (dot p...
[ "public", "Instance", "filterInstance", "(", "Instance", "x", ")", "{", "if", "(", "dataset", "==", "null", ")", "{", "initialize", "(", "x", ")", ";", "}", "double", "z_", "[", "]", "=", "new", "double", "[", "H", "+", "1", "]", ";", "int", "d",...
Filter an instance. Assume that the instance has a single class label, as the final attribute. Note that this may not always be the case! @param x input instance @return output instance
[ "Filter", "an", "instance", ".", "Assume", "that", "the", "instance", "has", "a", "single", "class", "label", "as", "the", "final", "attribute", ".", "Note", "that", "this", "may", "not", "always", "be", "the", "case!" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/streams/filters/ReLUFilter.java#L49-L74
28,921
Waikato/moa
moa/src/main/java/moa/clusterers/streamkm/TreeCoreset.java
TreeCoreset.treeNodeSplitCost
double treeNodeSplitCost(treeNode node, Point centreA, Point centreB){ //loop counter variable int i; //stores the cost double sum = 0.0; for(i=0; i<node.n; i++){ //loop counter variable int l; //stores the distance between p and centreA double distanceA = 0.0; for(l=0;l<node.points[i]...
java
double treeNodeSplitCost(treeNode node, Point centreA, Point centreB){ //loop counter variable int i; //stores the cost double sum = 0.0; for(i=0; i<node.n; i++){ //loop counter variable int l; //stores the distance between p and centreA double distanceA = 0.0; for(l=0;l<node.points[i]...
[ "double", "treeNodeSplitCost", "(", "treeNode", "node", ",", "Point", "centreA", ",", "Point", "centreB", ")", "{", "//loop counter variable", "int", "i", ";", "//stores the cost", "double", "sum", "=", "0.0", ";", "for", "(", "i", "=", "0", ";", "i", "<",...
computes the hypothetical cost if the node would be split with new centers centreA, centreB
[ "computes", "the", "hypothetical", "cost", "if", "the", "node", "would", "be", "split", "with", "new", "centers", "centreA", "centreB" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/streamkm/TreeCoreset.java#L138-L207
28,922
Waikato/moa
moa/src/main/java/moa/clusterers/streamkm/TreeCoreset.java
TreeCoreset.treeNodeCostOfPoint
double treeNodeCostOfPoint(treeNode node, Point p){ if(p.weight == 0.0){ return 0.0; } //stores the distance between centre and p double distance = 0.0; //loop counter variable int l; for(l=0;l<p.dimension;l++){ //centroid coordinate of the point double centroidCoordinatePoint; if(p.weigh...
java
double treeNodeCostOfPoint(treeNode node, Point p){ if(p.weight == 0.0){ return 0.0; } //stores the distance between centre and p double distance = 0.0; //loop counter variable int l; for(l=0;l<p.dimension;l++){ //centroid coordinate of the point double centroidCoordinatePoint; if(p.weigh...
[ "double", "treeNodeCostOfPoint", "(", "treeNode", "node", ",", "Point", "p", ")", "{", "if", "(", "p", ".", "weight", "==", "0.0", ")", "{", "return", "0.0", ";", "}", "//stores the distance between centre and p", "double", "distance", "=", "0.0", ";", "//lo...
computes the cost of point p with the centre of treenode node
[ "computes", "the", "cost", "of", "point", "p", "with", "the", "centre", "of", "treenode", "node" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/streamkm/TreeCoreset.java#L213-L244
28,923
Waikato/moa
moa/src/main/java/moa/clusterers/streamkm/TreeCoreset.java
TreeCoreset.isLeaf
boolean isLeaf(treeNode node){ if(node.lc == null && node.rc == null){ return true; } else { return false; } }
java
boolean isLeaf(treeNode node){ if(node.lc == null && node.rc == null){ return true; } else { return false; } }
[ "boolean", "isLeaf", "(", "treeNode", "node", ")", "{", "if", "(", "node", ".", "lc", "==", "null", "&&", "node", ".", "rc", "==", "null", ")", "{", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
tests if a node is a leaf
[ "tests", "if", "a", "node", "is", "a", "leaf" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/streamkm/TreeCoreset.java#L249-L257
28,924
Waikato/moa
moa/src/main/java/moa/clusterers/streamkm/TreeCoreset.java
TreeCoreset.determineClosestCentre
Point determineClosestCentre(Point p, Point centreA, Point centreB){ //loop counter variable int l; //stores the distance between p and centreA double distanceA = 0.0; for(l=0;l<p.dimension;l++){ //centroid coordinate of the point double centroidCoordinatePoint; if(p.weight != 0.0){ centroi...
java
Point determineClosestCentre(Point p, Point centreA, Point centreB){ //loop counter variable int l; //stores the distance between p and centreA double distanceA = 0.0; for(l=0;l<p.dimension;l++){ //centroid coordinate of the point double centroidCoordinatePoint; if(p.weight != 0.0){ centroi...
[ "Point", "determineClosestCentre", "(", "Point", "p", ",", "Point", "centreA", ",", "Point", "centreB", ")", "{", "//loop counter variable", "int", "l", ";", "//stores the distance between p and centreA", "double", "distanceA", "=", "0.0", ";", "for", "(", "l", "=...
returns the next centre
[ "returns", "the", "next", "centre" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/streamkm/TreeCoreset.java#L344-L401
28,925
Waikato/moa
moa/src/main/java/moa/clusterers/streamkm/TreeCoreset.java
TreeCoreset.treeFinished
boolean treeFinished(treeNode root){ return (root.parent == null && root.lc == null && root.rc == null); }
java
boolean treeFinished(treeNode root){ return (root.parent == null && root.lc == null && root.rc == null); }
[ "boolean", "treeFinished", "(", "treeNode", "root", ")", "{", "return", "(", "root", ".", "parent", "==", "null", "&&", "root", ".", "lc", "==", "null", "&&", "root", ".", "rc", "==", "null", ")", ";", "}" ]
Checks if the storage is completly freed
[ "Checks", "if", "the", "storage", "is", "completly", "freed" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/streamkm/TreeCoreset.java#L489-L491
28,926
Waikato/moa
moa/src/main/java/moa/clusterers/streamkm/TreeCoreset.java
TreeCoreset.freeTree
void freeTree(treeNode root){ while(!treeFinished(root)){ if(root.lc == null && root.rc == null){ root = root.parent; } else if(root.lc == null && root.rc != null){ //Schau ob rc ein Blatt ist if(isLeaf(root.rc)){ //Gebe rechtes Kind frei root.rc.free(); root.rc = null; } else { ...
java
void freeTree(treeNode root){ while(!treeFinished(root)){ if(root.lc == null && root.rc == null){ root = root.parent; } else if(root.lc == null && root.rc != null){ //Schau ob rc ein Blatt ist if(isLeaf(root.rc)){ //Gebe rechtes Kind frei root.rc.free(); root.rc = null; } else { ...
[ "void", "freeTree", "(", "treeNode", "root", ")", "{", "while", "(", "!", "treeFinished", "(", "root", ")", ")", "{", "if", "(", "root", ".", "lc", "==", "null", "&&", "root", ".", "rc", "==", "null", ")", "{", "root", "=", "root", ".", "parent",...
frees a tree of its storage
[ "frees", "a", "tree", "of", "its", "storage" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/streamkm/TreeCoreset.java#L496-L522
28,927
Waikato/moa
moa/src/main/java/moa/classifiers/oneclass/Autoencoder.java
Autoencoder.initializeNetwork
private void initializeNetwork() { this.hiddenLayerSize = this.hiddenLayerOption.getValue(); this.learningRate = this.learningRateOption.getValue(); this.threshold = this.thresholdOption.getValue(); double[][] randomWeightsOne = new double[this.hiddenLayerSize][this.numAttributes]; double[][] randomWeightsTw...
java
private void initializeNetwork() { this.hiddenLayerSize = this.hiddenLayerOption.getValue(); this.learningRate = this.learningRateOption.getValue(); this.threshold = this.thresholdOption.getValue(); double[][] randomWeightsOne = new double[this.hiddenLayerSize][this.numAttributes]; double[][] randomWeightsTw...
[ "private", "void", "initializeNetwork", "(", ")", "{", "this", ".", "hiddenLayerSize", "=", "this", ".", "hiddenLayerOption", ".", "getValue", "(", ")", ";", "this", ".", "learningRate", "=", "this", ".", "learningRateOption", ".", "getValue", "(", ")", ";",...
Initializes the autoencoder network.
[ "Initializes", "the", "autoencoder", "network", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/oneclass/Autoencoder.java#L126-L149
28,928
Waikato/moa
moa/src/main/java/moa/classifiers/oneclass/Autoencoder.java
Autoencoder.trainOnInstanceImpl
@Override public void trainOnInstanceImpl(Instance inst) { //Initialize if(this.reset) { this.numAttributes = inst.numAttributes()-1; this.initializeNetwork(); } this.backpropagation(inst); }
java
@Override public void trainOnInstanceImpl(Instance inst) { //Initialize if(this.reset) { this.numAttributes = inst.numAttributes()-1; this.initializeNetwork(); } this.backpropagation(inst); }
[ "@", "Override", "public", "void", "trainOnInstanceImpl", "(", "Instance", "inst", ")", "{", "//Initialize", "if", "(", "this", ".", "reset", ")", "{", "this", ".", "numAttributes", "=", "inst", ".", "numAttributes", "(", ")", "-", "1", ";", "this", ".",...
Uses backpropagation to update the weights in the autoencoder.
[ "Uses", "backpropagation", "to", "update", "the", "weights", "in", "the", "autoencoder", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/oneclass/Autoencoder.java#L154-L165
28,929
Waikato/moa
moa/src/main/java/moa/classifiers/oneclass/Autoencoder.java
Autoencoder.firstLayer
private RealMatrix firstLayer(RealMatrix input) { RealMatrix hidden = (this.weightsOne.multiply(input)).scalarAdd(this.biasOne); double[] tempValues = new double[this.hiddenLayerSize]; // Logistic function used for hidden layer activation for(int i = 0 ; i < this.hiddenLayerSize ; i++) { tempValues[i] ...
java
private RealMatrix firstLayer(RealMatrix input) { RealMatrix hidden = (this.weightsOne.multiply(input)).scalarAdd(this.biasOne); double[] tempValues = new double[this.hiddenLayerSize]; // Logistic function used for hidden layer activation for(int i = 0 ; i < this.hiddenLayerSize ; i++) { tempValues[i] ...
[ "private", "RealMatrix", "firstLayer", "(", "RealMatrix", "input", ")", "{", "RealMatrix", "hidden", "=", "(", "this", ".", "weightsOne", ".", "multiply", "(", "input", ")", ")", ".", "scalarAdd", "(", "this", ".", "biasOne", ")", ";", "double", "[", "]"...
Performs the requisite calculations between the input layer and the hidden layer. @param input the input values @return the activations of the hidden units
[ "Performs", "the", "requisite", "calculations", "between", "the", "input", "layer", "and", "the", "hidden", "layer", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/oneclass/Autoencoder.java#L174-L186
28,930
Waikato/moa
moa/src/main/java/moa/classifiers/oneclass/Autoencoder.java
Autoencoder.secondLayer
private RealMatrix secondLayer(RealMatrix hidden) { RealMatrix output = (this.weightsTwo.multiply(hidden)).scalarAdd(this.biasTwo); double[] tempValues = new double[this.numAttributes]; // Logistic function used for output layer activation for(int i = 0 ; i < this.numAttributes ; i++) { tempValues[i] =...
java
private RealMatrix secondLayer(RealMatrix hidden) { RealMatrix output = (this.weightsTwo.multiply(hidden)).scalarAdd(this.biasTwo); double[] tempValues = new double[this.numAttributes]; // Logistic function used for output layer activation for(int i = 0 ; i < this.numAttributes ; i++) { tempValues[i] =...
[ "private", "RealMatrix", "secondLayer", "(", "RealMatrix", "hidden", ")", "{", "RealMatrix", "output", "=", "(", "this", ".", "weightsTwo", ".", "multiply", "(", "hidden", ")", ")", ".", "scalarAdd", "(", "this", ".", "biasTwo", ")", ";", "double", "[", ...
Performs the requisite calculations between the hidden layer and the output layer. @param hidden the activations of the hidden units @return the activations of the output layer
[ "Performs", "the", "requisite", "calculations", "between", "the", "hidden", "layer", "and", "the", "output", "layer", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/oneclass/Autoencoder.java#L195-L208
28,931
Waikato/moa
moa/src/main/java/moa/classifiers/oneclass/Autoencoder.java
Autoencoder.backpropagation
private void backpropagation(Instance inst) { double [] attributeValues = new double[this.numAttributes]; for(int i = 0 ; i < this.numAttributes ; i++) { attributeValues[i] = inst.value(i); } RealMatrix input = new Array2DRowRealMatrix(attributeValues); RealMatrix hidden = firstLayer(input); Rea...
java
private void backpropagation(Instance inst) { double [] attributeValues = new double[this.numAttributes]; for(int i = 0 ; i < this.numAttributes ; i++) { attributeValues[i] = inst.value(i); } RealMatrix input = new Array2DRowRealMatrix(attributeValues); RealMatrix hidden = firstLayer(input); Rea...
[ "private", "void", "backpropagation", "(", "Instance", "inst", ")", "{", "double", "[", "]", "attributeValues", "=", "new", "double", "[", "this", ".", "numAttributes", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "numAttribu...
Performs backpropagation based on a training instance. @param inst the training instance
[ "Performs", "backpropagation", "based", "on", "a", "training", "instance", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/oneclass/Autoencoder.java#L215-L261
28,932
Waikato/moa
moa/src/main/java/moa/classifiers/oneclass/Autoencoder.java
Autoencoder.getVotesForInstance
@Override public double[] getVotesForInstance(Instance inst) { double[] votes = new double[2]; if (this.reset == false) { double error = this.getAnomalyScore(inst); // Exponential function to convert the error [0, +inf) into a vote [1,0]. votes[0] = Math.pow(2.0, -1.0 * (error / this.threshold)); ...
java
@Override public double[] getVotesForInstance(Instance inst) { double[] votes = new double[2]; if (this.reset == false) { double error = this.getAnomalyScore(inst); // Exponential function to convert the error [0, +inf) into a vote [1,0]. votes[0] = Math.pow(2.0, -1.0 * (error / this.threshold)); ...
[ "@", "Override", "public", "double", "[", "]", "getVotesForInstance", "(", "Instance", "inst", ")", "{", "double", "[", "]", "votes", "=", "new", "double", "[", "2", "]", ";", "if", "(", "this", ".", "reset", "==", "false", ")", "{", "double", "error...
Calculates the error between the autoencoder's reconstruction of the input and the argument instances. This error is converted to vote scores. @param inst the instance to get votes for @return the votes for the instance's label [normal, outlier]
[ "Calculates", "the", "error", "between", "the", "autoencoder", "s", "reconstruction", "of", "the", "input", "and", "the", "argument", "instances", ".", "This", "error", "is", "converted", "to", "vote", "scores", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/oneclass/Autoencoder.java#L305-L320
28,933
Waikato/moa
moa/src/main/java/moa/classifiers/oneclass/Autoencoder.java
Autoencoder.getAnomalyScore
public double getAnomalyScore(Instance inst) { double error = 0.0; if(!this.reset) { double [] attributeValues = new double[inst.numAttributes()-1]; for(int i = 0 ; i < attributeValues.length ; i++) { attributeValues[i] = inst.value(i); } RealMatrix input = new Array2DRowRealMatrix(attri...
java
public double getAnomalyScore(Instance inst) { double error = 0.0; if(!this.reset) { double [] attributeValues = new double[inst.numAttributes()-1]; for(int i = 0 ; i < attributeValues.length ; i++) { attributeValues[i] = inst.value(i); } RealMatrix input = new Array2DRowRealMatrix(attri...
[ "public", "double", "getAnomalyScore", "(", "Instance", "inst", ")", "{", "double", "error", "=", "0.0", ";", "if", "(", "!", "this", ".", "reset", ")", "{", "double", "[", "]", "attributeValues", "=", "new", "double", "[", "inst", ".", "numAttributes", ...
Returns the squared error between the input value and the reconstructed value as the anomaly score for the argument instance. @param inst the instance to score @return the argument instance's anomaly score.
[ "Returns", "the", "squared", "error", "between", "the", "input", "value", "and", "the", "reconstructed", "value", "as", "the", "anomaly", "score", "for", "the", "argument", "instance", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/oneclass/Autoencoder.java#L330-L354
28,934
Waikato/moa
moa/src/main/java/moa/classifiers/oneclass/Autoencoder.java
Autoencoder.initialize
@Override public void initialize(Collection<Instance> trainingPoints) { Iterator<Instance> trgPtsIterator = trainingPoints.iterator(); if(trgPtsIterator.hasNext() && this.reset) { Instance inst = (Instance)trgPtsIterator.next(); this.numAttributes = inst.numAttributes()-1; this.initializeNetwork(); ...
java
@Override public void initialize(Collection<Instance> trainingPoints) { Iterator<Instance> trgPtsIterator = trainingPoints.iterator(); if(trgPtsIterator.hasNext() && this.reset) { Instance inst = (Instance)trgPtsIterator.next(); this.numAttributes = inst.numAttributes()-1; this.initializeNetwork(); ...
[ "@", "Override", "public", "void", "initialize", "(", "Collection", "<", "Instance", ">", "trainingPoints", ")", "{", "Iterator", "<", "Instance", ">", "trgPtsIterator", "=", "trainingPoints", ".", "iterator", "(", ")", ";", "if", "(", "trgPtsIterator", ".", ...
Initializes the Autoencoder classifier on the argument trainingPoints. @param trainingPoints the Collection of instances on which to initialize the Autoencoder classifier.
[ "Initializes", "the", "Autoencoder", "classifier", "on", "the", "argument", "trainingPoints", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/oneclass/Autoencoder.java#L382-L398
28,935
Waikato/moa
moa/src/main/java/com/yahoo/labs/samoa/instances/AttributesInformation.java
AttributesInformation.setAttributes
public void setAttributes(Attribute[] v) { this.attributes = v; this.numberAttributes=v.length; this.indexValues = new int[numberAttributes]; for (int i = 0; i < numberAttributes; i++) { this.indexValues[i]=i; } }
java
public void setAttributes(Attribute[] v) { this.attributes = v; this.numberAttributes=v.length; this.indexValues = new int[numberAttributes]; for (int i = 0; i < numberAttributes; i++) { this.indexValues[i]=i; } }
[ "public", "void", "setAttributes", "(", "Attribute", "[", "]", "v", ")", "{", "this", ".", "attributes", "=", "v", ";", "this", ".", "numberAttributes", "=", "v", ".", "length", ";", "this", ".", "indexValues", "=", "new", "int", "[", "numberAttributes",...
Sets the attribute information. @param v the new attribute information
[ "Sets", "the", "attribute", "information", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/com/yahoo/labs/samoa/instances/AttributesInformation.java#L113-L120
28,936
Waikato/moa
moa/src/main/java/com/yahoo/labs/samoa/instances/AttributesInformation.java
AttributesInformation.locateIndex
public int locateIndex(int index) { int min = 0; int max = this.indexValues.length - 1; if (max == -1) { return -1; } // Binary search while ((this.indexValues[min] <= index) && (this.indexValues[max] >= index)) { int current = (max + min) / 2; ...
java
public int locateIndex(int index) { int min = 0; int max = this.indexValues.length - 1; if (max == -1) { return -1; } // Binary search while ((this.indexValues[min] <= index) && (this.indexValues[max] >= index)) { int current = (max + min) / 2; ...
[ "public", "int", "locateIndex", "(", "int", "index", ")", "{", "int", "min", "=", "0", ";", "int", "max", "=", "this", ".", "indexValues", ".", "length", "-", "1", ";", "if", "(", "max", "==", "-", "1", ")", "{", "return", "-", "1", ";", "}", ...
Locates the greatest index that is not greater than the given index. @return the internal index of the attribute index. Returns -1 if no index with this property could be found
[ "Locates", "the", "greatest", "index", "that", "is", "not", "greater", "than", "the", "given", "index", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/com/yahoo/labs/samoa/instances/AttributesInformation.java#L128-L153
28,937
Waikato/moa
moa/src/main/java/moa/tasks/meta/MetaMainTask.java
MetaMainTask.setIsLastSubtaskOnLevel
public void setIsLastSubtaskOnLevel( boolean[] parentIsLastSubtaskList, boolean isLastSubtask) { this.isLastSubtaskOnLevel = new boolean[parentIsLastSubtaskList.length + 1]; for (int i = 0; i < parentIsLastSubtaskList.length; i++) { this.isLastSubtaskOnLevel[i] = parentIsLastSubtaskList[i]; } thi...
java
public void setIsLastSubtaskOnLevel( boolean[] parentIsLastSubtaskList, boolean isLastSubtask) { this.isLastSubtaskOnLevel = new boolean[parentIsLastSubtaskList.length + 1]; for (int i = 0; i < parentIsLastSubtaskList.length; i++) { this.isLastSubtaskOnLevel[i] = parentIsLastSubtaskList[i]; } thi...
[ "public", "void", "setIsLastSubtaskOnLevel", "(", "boolean", "[", "]", "parentIsLastSubtaskList", ",", "boolean", "isLastSubtask", ")", "{", "this", ".", "isLastSubtaskOnLevel", "=", "new", "boolean", "[", "parentIsLastSubtaskList", ".", "length", "+", "1", "]", "...
Set the list of booleans indicating if the current branch in the subtask tree is the last one on its respective level. @param parentIsLastSubtaskList the internal list of the parent @param isLastSubtask if the current subtask is the parents last one
[ "Set", "the", "list", "of", "booleans", "indicating", "if", "the", "current", "branch", "in", "the", "subtask", "tree", "is", "the", "last", "one", "on", "its", "respective", "level", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/tasks/meta/MetaMainTask.java#L107-L118
28,938
Waikato/moa
moa/src/main/java/moa/gui/experimentertab/RankingGraph.java
RankingGraph.fontSelection
public void fontSelection() { FontChooserPanel panel = new FontChooserPanel(textFont); int result = JOptionPane.showConfirmDialog( this, panel, "Font Selection", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE ...
java
public void fontSelection() { FontChooserPanel panel = new FontChooserPanel(textFont); int result = JOptionPane.showConfirmDialog( this, panel, "Font Selection", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE ...
[ "public", "void", "fontSelection", "(", ")", "{", "FontChooserPanel", "panel", "=", "new", "FontChooserPanel", "(", "textFont", ")", ";", "int", "result", "=", "JOptionPane", ".", "showConfirmDialog", "(", "this", ",", "panel", ",", "\"Font Selection\"", ",", ...
Allow to select the text font.
[ "Allow", "to", "select", "the", "text", "font", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/experimentertab/RankingGraph.java#L242-L255
28,939
Waikato/moa
moa/src/main/java/com/github/javacliparser/Options.java
Options.splitParameterFromRemainingOptions
protected static String[] splitParameterFromRemainingOptions( String cliString) { String[] paramSplit = new String[2]; cliString = cliString.trim(); if (cliString.startsWith("\"") || cliString.startsWith("'")) { int endQuoteIndex = cliString.indexOf(cliString.charAt(0), 1...
java
protected static String[] splitParameterFromRemainingOptions( String cliString) { String[] paramSplit = new String[2]; cliString = cliString.trim(); if (cliString.startsWith("\"") || cliString.startsWith("'")) { int endQuoteIndex = cliString.indexOf(cliString.charAt(0), 1...
[ "protected", "static", "String", "[", "]", "splitParameterFromRemainingOptions", "(", "String", "cliString", ")", "{", "String", "[", "]", "paramSplit", "=", "new", "String", "[", "2", "]", ";", "cliString", "=", "cliString", ".", "trim", "(", ")", ";", "i...
Internal method that splits a string into two parts - the parameter for the current option, and the remaining options. @param cliString the command line string, beginning at an option parameter @return an array of two strings - the first is the option paramter, the second is the remaining cli string
[ "Internal", "method", "that", "splits", "a", "string", "into", "two", "parts", "-", "the", "parameter", "for", "the", "current", "option", "and", "the", "remaining", "options", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/com/github/javacliparser/Options.java#L217-L262
28,940
Waikato/moa
moa/src/main/java/moa/clusterers/clustree/ClusTree.java
ClusTree.updateToTop
private void updateToTop(Node toUpdate) { while(toUpdate!=null){ for (Entry e: toUpdate.getEntries()) e.recalculateData(); if (toUpdate.getEntries()[0].getParentEntry()==null) break; toUpdate=toUpdate.getEntries()[0].getParentEntry().getNode(); } }
java
private void updateToTop(Node toUpdate) { while(toUpdate!=null){ for (Entry e: toUpdate.getEntries()) e.recalculateData(); if (toUpdate.getEntries()[0].getParentEntry()==null) break; toUpdate=toUpdate.getEntries()[0].getParentEntry().getNode(); } }
[ "private", "void", "updateToTop", "(", "Node", "toUpdate", ")", "{", "while", "(", "toUpdate", "!=", "null", ")", "{", "for", "(", "Entry", "e", ":", "toUpdate", ".", "getEntries", "(", ")", ")", "e", ".", "recalculateData", "(", ")", ";", "if", "(",...
recalculates data for all entries, that lie on the path from the root to the Entry toUpdate.
[ "recalculates", "data", "for", "all", "entries", "that", "lie", "on", "the", "path", "from", "the", "root", "to", "the", "Entry", "toUpdate", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/clustree/ClusTree.java#L277-L285
28,941
Waikato/moa
moa/src/main/java/moa/clusterers/clustree/ClusTree.java
ClusTree.insertHereWithSplit
private Entry insertHereWithSplit(Entry toInsert, Node insertNode, long timestamp) { //Handle root split if (insertNode.getEntries()[0].getParentEntry()==null){ root.makeOlder(timestamp, negLambda); Entry irrelevantEntry = insertNode.getIrrelevantEntry(this.weightThreshold); i...
java
private Entry insertHereWithSplit(Entry toInsert, Node insertNode, long timestamp) { //Handle root split if (insertNode.getEntries()[0].getParentEntry()==null){ root.makeOlder(timestamp, negLambda); Entry irrelevantEntry = insertNode.getIrrelevantEntry(this.weightThreshold); i...
[ "private", "Entry", "insertHereWithSplit", "(", "Entry", "toInsert", ",", "Node", "insertNode", ",", "long", "timestamp", ")", "{", "//Handle root split", "if", "(", "insertNode", ".", "getEntries", "(", ")", "[", "0", "]", ".", "getParentEntry", "(", ")", "...
Method called by insertBreadthFirst. @param toInsert @param insertNode @param timestamp @return
[ "Method", "called", "by", "insertBreadthFirst", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/clustree/ClusTree.java#L294-L348
28,942
Waikato/moa
moa/src/main/java/moa/clusterers/clustree/ClusTree.java
ClusTree.findBestLeafNode
private Node findBestLeafNode(ClusKernel newPoint) { double minDist = Double.MAX_VALUE; Node bestFit = null; for (Node e: collectLeafNodes(root)){ if (newPoint.calcDistance(e.nearestEntry(newPoint).getData())<minDist){ bestFit = e; minDist = newPoint.calcDistance(e.nearestEntry(newPoi...
java
private Node findBestLeafNode(ClusKernel newPoint) { double minDist = Double.MAX_VALUE; Node bestFit = null; for (Node e: collectLeafNodes(root)){ if (newPoint.calcDistance(e.nearestEntry(newPoint).getData())<minDist){ bestFit = e; minDist = newPoint.calcDistance(e.nearestEntry(newPoi...
[ "private", "Node", "findBestLeafNode", "(", "ClusKernel", "newPoint", ")", "{", "double", "minDist", "=", "Double", ".", "MAX_VALUE", ";", "Node", "bestFit", "=", "null", ";", "for", "(", "Node", "e", ":", "collectLeafNodes", "(", "root", ")", ")", "{", ...
This method calculates the distances between the new point and each Entry in a leaf node. It returns the node that contains the entry with the smallest distance to the new point. @param newPoint @return best fitting node
[ "This", "method", "calculates", "the", "distances", "between", "the", "new", "point", "and", "each", "Entry", "in", "a", "leaf", "node", ".", "It", "returns", "the", "node", "that", "contains", "the", "entry", "with", "the", "smallest", "distance", "to", "...
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/clustree/ClusTree.java#L432-L445
28,943
Waikato/moa
moa/src/main/java/moa/clusterers/clustree/ClusTree.java
ClusTree.calculateBestMergeInNode
private BestMergeInNode calculateBestMergeInNode(Node node) { assert (node.numFreeEntries() == 0); Entry[] entries = node.getEntries(); int toMerge1 = -1; int toMerge2 = -1; double distanceBetweenMergeEntries = Double.NaN; double minDistance = Double.MAX_VALUE; ...
java
private BestMergeInNode calculateBestMergeInNode(Node node) { assert (node.numFreeEntries() == 0); Entry[] entries = node.getEntries(); int toMerge1 = -1; int toMerge2 = -1; double distanceBetweenMergeEntries = Double.NaN; double minDistance = Double.MAX_VALUE; ...
[ "private", "BestMergeInNode", "calculateBestMergeInNode", "(", "Node", "node", ")", "{", "assert", "(", "node", ".", "numFreeEntries", "(", ")", "==", "0", ")", ";", "Entry", "[", "]", "entries", "=", "node", ".", "getEntries", "(", ")", ";", "int", "toM...
Calculates the best merge possible between two nodes in a node. This means that the pair with the smallest distance is found. @param node The node in which these two entries have to be found. @return An object which encodes the two position of the entries with the smallest distance in the node and the distance between ...
[ "Calculates", "the", "best", "merge", "possible", "between", "two", "nodes", "in", "a", "node", ".", "This", "means", "that", "the", "pair", "with", "the", "smallest", "distance", "is", "found", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/clustree/ClusTree.java#L571-L603
28,944
Waikato/moa
moa/src/main/java/moa/tasks/EvaluateClustering.java
EvaluateClustering.setMeasures
protected void setMeasures(boolean[] measures) { this.generalEvalOption.setValue(measures[0]); this.f1Option.setValue(measures[1]); this.entropyOption.setValue(measures[2]); this.cmmOption.setValue(measures[3]); this.ssqOption.setValue(measures[4]); this.separationOption.setValu...
java
protected void setMeasures(boolean[] measures) { this.generalEvalOption.setValue(measures[0]); this.f1Option.setValue(measures[1]); this.entropyOption.setValue(measures[2]); this.cmmOption.setValue(measures[3]); this.ssqOption.setValue(measures[4]); this.separationOption.setValu...
[ "protected", "void", "setMeasures", "(", "boolean", "[", "]", "measures", ")", "{", "this", ".", "generalEvalOption", ".", "setValue", "(", "measures", "[", "0", "]", ")", ";", "this", ".", "f1Option", ".", "setValue", "(", "measures", "[", "1", "]", "...
Given an array summarizing selected measures, set the appropriate flag options
[ "Given", "an", "array", "summarizing", "selected", "measures", "set", "the", "appropriate", "flag", "options" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/tasks/EvaluateClustering.java#L97-L107
28,945
Waikato/moa
moa/src/main/java/moa/clusterers/dstream/GridCluster.java
GridCluster.isConnected
public boolean isConnected() { this.visited = new HashMap<DensityGrid, Boolean>(); Iterator<DensityGrid> initIter = this.grids.keySet().iterator(); DensityGrid dg; if (initIter.hasNext()) { dg = initIter.next(); visited.put(dg, this.grids.get(dg)); boolean changesMade; do{ changesMade ...
java
public boolean isConnected() { this.visited = new HashMap<DensityGrid, Boolean>(); Iterator<DensityGrid> initIter = this.grids.keySet().iterator(); DensityGrid dg; if (initIter.hasNext()) { dg = initIter.next(); visited.put(dg, this.grids.get(dg)); boolean changesMade; do{ changesMade ...
[ "public", "boolean", "isConnected", "(", ")", "{", "this", ".", "visited", "=", "new", "HashMap", "<", "DensityGrid", ",", "Boolean", ">", "(", ")", ";", "Iterator", "<", "DensityGrid", ">", "initIter", "=", "this", ".", "grids", ".", "keySet", "(", ")...
Tests a grid cluster for connectedness according to Definition 3.4, Grid Group, from Chen and Tu 2007. Selects one density grid in the grid cluster as a starting point and iterates repeatedly through its neighbours until no more density grids in the grid cluster can be visited. @return TRUE if the cluster represent o...
[ "Tests", "a", "grid", "cluster", "for", "connectedness", "according", "to", "Definition", "3", ".", "4", "Grid", "Group", "from", "Chen", "and", "Tu", "2007", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/dstream/GridCluster.java#L228-L282
28,946
Waikato/moa
moa/src/main/java/moa/clusterers/dstream/GridCluster.java
GridCluster.getInclusionProbability
@Override public double getInclusionProbability(Instance instance) { Iterator<Map.Entry<DensityGrid, Boolean>> gridIter = grids.entrySet().iterator(); while(gridIter.hasNext()) { Map.Entry<DensityGrid, Boolean> grid = gridIter.next(); DensityGrid dg = grid.getKey(); if(dg.getInclusionProbability(inst...
java
@Override public double getInclusionProbability(Instance instance) { Iterator<Map.Entry<DensityGrid, Boolean>> gridIter = grids.entrySet().iterator(); while(gridIter.hasNext()) { Map.Entry<DensityGrid, Boolean> grid = gridIter.next(); DensityGrid dg = grid.getKey(); if(dg.getInclusionProbability(inst...
[ "@", "Override", "public", "double", "getInclusionProbability", "(", "Instance", "instance", ")", "{", "Iterator", "<", "Map", ".", "Entry", "<", "DensityGrid", ",", "Boolean", ">", ">", "gridIter", "=", "grids", ".", "entrySet", "(", ")", ".", "iterator", ...
Iterates through the DensityGrids in the cluster and calculates the inclusion probability for each. @return 1.0 if instance matches any of the density grids; 0.0 otherwise.
[ "Iterates", "through", "the", "DensityGrids", "in", "the", "cluster", "and", "calculates", "the", "inclusion", "probability", "for", "each", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/dstream/GridCluster.java#L289-L302
28,947
Waikato/moa
moa/src/main/java/moa/clusterers/kmeanspm/ClusteringFeature.java
ClusteringFeature.add
public void add(int numPoints, double[] sumPoints, double sumSquaredPoints) { assert (this.sumPoints.length == sumPoints.length); this.numPoints += numPoints; super.setWeight(this.numPoints); for (int i = 0; i < this.sumPoints.length; i++) { this.sumPoints[i] += sumPoints[i]; } this.sumSquaredLength += s...
java
public void add(int numPoints, double[] sumPoints, double sumSquaredPoints) { assert (this.sumPoints.length == sumPoints.length); this.numPoints += numPoints; super.setWeight(this.numPoints); for (int i = 0; i < this.sumPoints.length; i++) { this.sumPoints[i] += sumPoints[i]; } this.sumSquaredLength += s...
[ "public", "void", "add", "(", "int", "numPoints", ",", "double", "[", "]", "sumPoints", ",", "double", "sumSquaredPoints", ")", "{", "assert", "(", "this", ".", "sumPoints", ".", "length", "==", "sumPoints", ".", "length", ")", ";", "this", ".", "numPoin...
Adds a point to the ClusteringFeature. @param numPoints the number of points to add @param sumPoints the sum of points to add @param sumSquaredPoints the sum of the squared lengths to add
[ "Adds", "a", "point", "to", "the", "ClusteringFeature", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/kmeanspm/ClusteringFeature.java#L95-L103
28,948
Waikato/moa
moa/src/main/java/moa/clusterers/kmeanspm/ClusteringFeature.java
ClusteringFeature.merge
public void merge(ClusteringFeature x) { assert (this.sumPoints.length == x.sumPoints.length); this.numPoints += x.numPoints; super.setWeight(this.numPoints); for (int i = 0; i < this.sumPoints.length; i++) { this.sumPoints[i] += x.sumPoints[i]; } this.sumSquaredLength += x.sumSquaredLength; }
java
public void merge(ClusteringFeature x) { assert (this.sumPoints.length == x.sumPoints.length); this.numPoints += x.numPoints; super.setWeight(this.numPoints); for (int i = 0; i < this.sumPoints.length; i++) { this.sumPoints[i] += x.sumPoints[i]; } this.sumSquaredLength += x.sumSquaredLength; }
[ "public", "void", "merge", "(", "ClusteringFeature", "x", ")", "{", "assert", "(", "this", ".", "sumPoints", ".", "length", "==", "x", ".", "sumPoints", ".", "length", ")", ";", "this", ".", "numPoints", "+=", "x", ".", "numPoints", ";", "super", ".", ...
Merges the ClusteringFeature with an other ClusteringFeature. @param x the ClusteringFeature to merge with
[ "Merges", "the", "ClusteringFeature", "with", "an", "other", "ClusteringFeature", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/kmeanspm/ClusteringFeature.java#L111-L119
28,949
Waikato/moa
moa/src/main/java/moa/clusterers/kmeanspm/ClusteringFeature.java
ClusteringFeature.toCluster
public Cluster toCluster() { double[] output = new double[this.sumPoints.length]; System.arraycopy(this.sumPoints, 0, output, 0, this.sumPoints.length); for (int i = 0; i < output.length; i++) { output[i] /= this.numPoints; } return new SphereCluster(output, getThreshold(), this.numPoints); }
java
public Cluster toCluster() { double[] output = new double[this.sumPoints.length]; System.arraycopy(this.sumPoints, 0, output, 0, this.sumPoints.length); for (int i = 0; i < output.length; i++) { output[i] /= this.numPoints; } return new SphereCluster(output, getThreshold(), this.numPoints); }
[ "public", "Cluster", "toCluster", "(", ")", "{", "double", "[", "]", "output", "=", "new", "double", "[", "this", ".", "sumPoints", ".", "length", "]", ";", "System", ".", "arraycopy", "(", "this", ".", "sumPoints", ",", "0", ",", "output", ",", "0",...
Creates a Cluster of the ClusteringFeature. @return a Cluster
[ "Creates", "a", "Cluster", "of", "the", "ClusteringFeature", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/kmeanspm/ClusteringFeature.java#L126-L133
28,950
Waikato/moa
moa/src/main/java/moa/clusterers/kmeanspm/ClusteringFeature.java
ClusteringFeature.toClusterCenter
public double[] toClusterCenter() { double[] output = new double[this.sumPoints.length + 1]; System.arraycopy(this.sumPoints, 0, output, 1, this.sumPoints.length); output[0] = this.numPoints; for (int i = 1; i < output.length; i++) { output[i] /= this.numPoints; } return output; }
java
public double[] toClusterCenter() { double[] output = new double[this.sumPoints.length + 1]; System.arraycopy(this.sumPoints, 0, output, 1, this.sumPoints.length); output[0] = this.numPoints; for (int i = 1; i < output.length; i++) { output[i] /= this.numPoints; } return output; }
[ "public", "double", "[", "]", "toClusterCenter", "(", ")", "{", "double", "[", "]", "output", "=", "new", "double", "[", "this", ".", "sumPoints", ".", "length", "+", "1", "]", ";", "System", ".", "arraycopy", "(", "this", ".", "sumPoints", ",", "0",...
Creates the cluster center of the ClusteringFeature. @return the cluster center
[ "Creates", "the", "cluster", "center", "of", "the", "ClusteringFeature", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/kmeanspm/ClusteringFeature.java#L140-L148
28,951
Waikato/moa
moa/src/main/java/moa/clusterers/kmeanspm/ClusteringFeature.java
ClusteringFeature.printClusterCenter
public void printClusterCenter(Writer stream) throws IOException { stream.write(String.valueOf(this.numPoints)); for (int j = 0; j < this.sumPoints.length; j++) { stream.write(' '); stream.write(String.valueOf(this.sumPoints[j] / this.numPoints)); } stream.write(System.getProperty("line.separator")); }
java
public void printClusterCenter(Writer stream) throws IOException { stream.write(String.valueOf(this.numPoints)); for (int j = 0; j < this.sumPoints.length; j++) { stream.write(' '); stream.write(String.valueOf(this.sumPoints[j] / this.numPoints)); } stream.write(System.getProperty("line.separator")); }
[ "public", "void", "printClusterCenter", "(", "Writer", "stream", ")", "throws", "IOException", "{", "stream", ".", "write", "(", "String", ".", "valueOf", "(", "this", ".", "numPoints", ")", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", ...
Writes the cluster center to a given stream. @param stream the stream @throws IOException If an I/O error occurs
[ "Writes", "the", "cluster", "center", "to", "a", "given", "stream", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/kmeanspm/ClusteringFeature.java#L158-L165
28,952
Waikato/moa
moa/src/main/java/moa/clusterers/kmeanspm/ClusteringFeature.java
ClusteringFeature.calcKMeansCosts
public double calcKMeansCosts(double[] center) { assert (this.sumPoints.length == center.length); return this.sumSquaredLength - 2 * Metric.dotProduct(this.sumPoints, center) + this.numPoints * Metric.dotProduct(center); }
java
public double calcKMeansCosts(double[] center) { assert (this.sumPoints.length == center.length); return this.sumSquaredLength - 2 * Metric.dotProduct(this.sumPoints, center) + this.numPoints * Metric.dotProduct(center); }
[ "public", "double", "calcKMeansCosts", "(", "double", "[", "]", "center", ")", "{", "assert", "(", "this", ".", "sumPoints", ".", "length", "==", "center", ".", "length", ")", ";", "return", "this", ".", "sumSquaredLength", "-", "2", "*", "Metric", ".", ...
Calculates the k-means costs of the ClusteringFeature too a center. @param center the center too calculate the costs @return the costs
[ "Calculates", "the", "k", "-", "means", "costs", "of", "the", "ClusteringFeature", "too", "a", "center", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/kmeanspm/ClusteringFeature.java#L262-L267
28,953
Waikato/moa
moa/src/main/java/moa/clusterers/kmeanspm/ClusteringFeature.java
ClusteringFeature.calcKMeansCosts
public double calcKMeansCosts(double[] center, double[] point) { assert (this.sumPoints.length == center.length && this.sumPoints.length == point.length); return (this.sumSquaredLength + Metric.distanceSquared(point)) - 2 * Metric.dotProductWithAddition(this.sumPoints, point, center) + (this.numPoints +...
java
public double calcKMeansCosts(double[] center, double[] point) { assert (this.sumPoints.length == center.length && this.sumPoints.length == point.length); return (this.sumSquaredLength + Metric.distanceSquared(point)) - 2 * Metric.dotProductWithAddition(this.sumPoints, point, center) + (this.numPoints +...
[ "public", "double", "calcKMeansCosts", "(", "double", "[", "]", "center", ",", "double", "[", "]", "point", ")", "{", "assert", "(", "this", ".", "sumPoints", ".", "length", "==", "center", ".", "length", "&&", "this", ".", "sumPoints", ".", "length", ...
Calculates the k-means costs of the ClusteringFeature and a point too a center. @param center the center too calculate the costs @param point the point too calculate the costs @return the costs
[ "Calculates", "the", "k", "-", "means", "costs", "of", "the", "ClusteringFeature", "and", "a", "point", "too", "a", "center", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/kmeanspm/ClusteringFeature.java#L279-L285
28,954
Waikato/moa
moa/src/main/java/moa/clusterers/kmeanspm/ClusteringFeature.java
ClusteringFeature.calcKMeansCosts
public double calcKMeansCosts(double[] center, ClusteringFeature points) { assert (this.sumPoints.length == center.length && this.sumPoints.length == points.sumPoints.length); return (this.sumSquaredLength + points.sumSquaredLength) - 2 * Metric.dotProductWithAddition(this.sumPoints, points.sumPoints,...
java
public double calcKMeansCosts(double[] center, ClusteringFeature points) { assert (this.sumPoints.length == center.length && this.sumPoints.length == points.sumPoints.length); return (this.sumSquaredLength + points.sumSquaredLength) - 2 * Metric.dotProductWithAddition(this.sumPoints, points.sumPoints,...
[ "public", "double", "calcKMeansCosts", "(", "double", "[", "]", "center", ",", "ClusteringFeature", "points", ")", "{", "assert", "(", "this", ".", "sumPoints", ".", "length", "==", "center", ".", "length", "&&", "this", ".", "sumPoints", ".", "length", "=...
Calculates the k-means costs of the ClusteringFeature and another ClusteringFeature too a center. @param center the center too calculate the costs @param points the points too calculate the costs @return the costs
[ "Calculates", "the", "k", "-", "means", "costs", "of", "the", "ClusteringFeature", "and", "another", "ClusteringFeature", "too", "a", "center", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/kmeanspm/ClusteringFeature.java#L297-L305
28,955
Waikato/moa
moa/src/main/java/moa/classifiers/meta/OnlineAccuracyUpdatedEnsemble.java
OnlineAccuracyUpdatedEnsemble.computeWeight
protected double computeWeight(int i, Instance example) { int d = this.windowSize; int t = this.processedInstances - this.ensemble[i].birthday; double e_it = 0; double mse_it = 0; double voteSum = 0; try{ double[] votes = this.ensemble[i].clas...
java
protected double computeWeight(int i, Instance example) { int d = this.windowSize; int t = this.processedInstances - this.ensemble[i].birthday; double e_it = 0; double mse_it = 0; double voteSum = 0; try{ double[] votes = this.ensemble[i].clas...
[ "protected", "double", "computeWeight", "(", "int", "i", ",", "Instance", "example", ")", "{", "int", "d", "=", "this", ".", "windowSize", ";", "int", "t", "=", "this", ".", "processedInstances", "-", "this", ".", "ensemble", "[", "i", "]", ".", "birth...
Computes the weight of a learner before training a given example. @param i the identifier (in terms of array learners) of the classifier for which the weight is supposed to be computed @param example the newest example @return the computed weight.
[ "Computes", "the", "weight", "of", "a", "learner", "before", "training", "a", "given", "example", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/meta/OnlineAccuracyUpdatedEnsemble.java#L300-L346
28,956
Waikato/moa
moa/src/main/java/moa/classifiers/meta/OnlineAccuracyUpdatedEnsemble.java
OnlineAccuracyUpdatedEnsemble.getPoorestClassifierIndex
private int getPoorestClassifierIndex() { int minIndex = 0; for (int i = 1; i < this.weights.length; i++) { if(this.weights[i][0] < this.weights[minIndex][0]){ minIndex = i; } } return minIndex; }
java
private int getPoorestClassifierIndex() { int minIndex = 0; for (int i = 1; i < this.weights.length; i++) { if(this.weights[i][0] < this.weights[minIndex][0]){ minIndex = i; } } return minIndex; }
[ "private", "int", "getPoorestClassifierIndex", "(", ")", "{", "int", "minIndex", "=", "0", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "this", ".", "weights", ".", "length", ";", "i", "++", ")", "{", "if", "(", "this", ".", "weights", "...
Finds the index of the classifier with the smallest weight. @return
[ "Finds", "the", "index", "of", "the", "classifier", "with", "the", "smallest", "weight", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/meta/OnlineAccuracyUpdatedEnsemble.java#L406-L416
28,957
Waikato/moa
moa/src/main/java/com/yahoo/labs/samoa/instances/InstanceImpl.java
InstanceImpl.classIndex
@Override public int classIndex() { int classIndex = instanceHeader.classIndex(); // return ? classIndex : 0; if(classIndex == Integer.MAX_VALUE) if(this.instanceHeader.instanceInformation.range!=null) classIndex=instanceHeader.instanceInformation.range.getStart(); ...
java
@Override public int classIndex() { int classIndex = instanceHeader.classIndex(); // return ? classIndex : 0; if(classIndex == Integer.MAX_VALUE) if(this.instanceHeader.instanceInformation.range!=null) classIndex=instanceHeader.instanceInformation.range.getStart(); ...
[ "@", "Override", "public", "int", "classIndex", "(", ")", "{", "int", "classIndex", "=", "instanceHeader", ".", "classIndex", "(", ")", ";", "// return ? classIndex : 0;", "if", "(", "classIndex", "==", "Integer", ".", "MAX_VALUE", ")", "if", "(", "this", "...
Class index. @return the int
[ "Class", "index", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/com/yahoo/labs/samoa/instances/InstanceImpl.java#L287-L297
28,958
Waikato/moa
moa/src/main/java/com/yahoo/labs/samoa/instances/InstanceImpl.java
InstanceImpl.setDataset
@Override public void setDataset(Instances dataset) { if(dataset instanceof InstancesHeader) { this.instanceHeader = (InstancesHeader) dataset; }else { this.instanceHeader = new InstancesHeader(dataset); } }
java
@Override public void setDataset(Instances dataset) { if(dataset instanceof InstancesHeader) { this.instanceHeader = (InstancesHeader) dataset; }else { this.instanceHeader = new InstancesHeader(dataset); } }
[ "@", "Override", "public", "void", "setDataset", "(", "Instances", "dataset", ")", "{", "if", "(", "dataset", "instanceof", "InstancesHeader", ")", "{", "this", ".", "instanceHeader", "=", "(", "InstancesHeader", ")", "dataset", ";", "}", "else", "{", "this"...
Sets the dataset. @param dataset the new dataset
[ "Sets", "the", "dataset", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/com/yahoo/labs/samoa/instances/InstanceImpl.java#L365-L372
28,959
Waikato/moa
moa/src/main/java/com/yahoo/labs/samoa/instances/InstanceImpl.java
InstanceImpl.addSparseValues
@Override public void addSparseValues(int[] indexValues, double[] attributeValues, int numberAttributes) { this.instanceData = new SparseInstanceData(attributeValues, indexValues, numberAttributes); //??? }
java
@Override public void addSparseValues(int[] indexValues, double[] attributeValues, int numberAttributes) { this.instanceData = new SparseInstanceData(attributeValues, indexValues, numberAttributes); //??? }
[ "@", "Override", "public", "void", "addSparseValues", "(", "int", "[", "]", "indexValues", ",", "double", "[", "]", "attributeValues", ",", "int", "numberAttributes", ")", "{", "this", ".", "instanceData", "=", "new", "SparseInstanceData", "(", "attributeValues"...
Adds the sparse values. @param indexValues the index values @param attributeValues the attribute values @param numberAttributes the number attributes
[ "Adds", "the", "sparse", "values", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/com/yahoo/labs/samoa/instances/InstanceImpl.java#L381-L384
28,960
Waikato/moa
moa/src/main/java/moa/classifiers/meta/DACC.java
DACC.initVariables
protected void initVariables(){ int ensembleSize = (int)this.memberCountOption.getValue(); this.ensemble = new Classifier[ensembleSize]; this.ensembleAges = new double[ensembleSize]; this.ensembleWindows = new int[ensembleSize][(int)this.evaluationSizeOption.getValue()]; }
java
protected void initVariables(){ int ensembleSize = (int)this.memberCountOption.getValue(); this.ensemble = new Classifier[ensembleSize]; this.ensembleAges = new double[ensembleSize]; this.ensembleWindows = new int[ensembleSize][(int)this.evaluationSizeOption.getValue()]; }
[ "protected", "void", "initVariables", "(", ")", "{", "int", "ensembleSize", "=", "(", "int", ")", "this", ".", "memberCountOption", ".", "getValue", "(", ")", ";", "this", ".", "ensemble", "=", "new", "Classifier", "[", "ensembleSize", "]", ";", "this", ...
Initializes the method variables
[ "Initializes", "the", "method", "variables" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/meta/DACC.java#L109-L114
28,961
Waikato/moa
moa/src/main/java/moa/classifiers/meta/DACC.java
DACC.trainAndClassify
protected void trainAndClassify(Instance inst){ nbInstances++; boolean mature = true; boolean unmature = true; for (int i = 0; i < getNbActiveClassifiers(); i++) { // check if all adaptive learners are mature if (this.ensembleAges[i] < this.maturit...
java
protected void trainAndClassify(Instance inst){ nbInstances++; boolean mature = true; boolean unmature = true; for (int i = 0; i < getNbActiveClassifiers(); i++) { // check if all adaptive learners are mature if (this.ensembleAges[i] < this.maturit...
[ "protected", "void", "trainAndClassify", "(", "Instance", "inst", ")", "{", "nbInstances", "++", ";", "boolean", "mature", "=", "true", ";", "boolean", "unmature", "=", "true", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "getNbActiveClassifiers",...
Receives a training instance from the stream and updates the adaptive classifiers accordingly @param inst the instance from the stream
[ "Receives", "a", "training", "instance", "from", "the", "stream", "and", "updates", "the", "adaptive", "classifiers", "accordingly" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/meta/DACC.java#L178-L225
28,962
Waikato/moa
moa/src/main/java/moa/classifiers/meta/DACC.java
DACC.discardModel
public void discardModel(int index) { this.ensemble[index].resetLearning(); this.ensembleWeights[index].val = 0; this.ensembleAges[index] = 0; this.ensembleWindows[index]=new int[(int)this.evaluationSizeOption.getValue()]; }
java
public void discardModel(int index) { this.ensemble[index].resetLearning(); this.ensembleWeights[index].val = 0; this.ensembleAges[index] = 0; this.ensembleWindows[index]=new int[(int)this.evaluationSizeOption.getValue()]; }
[ "public", "void", "discardModel", "(", "int", "index", ")", "{", "this", ".", "ensemble", "[", "index", "]", ".", "resetLearning", "(", ")", ";", "this", ".", "ensembleWeights", "[", "index", "]", ".", "val", "=", "0", ";", "this", ".", "ensembleAges",...
Resets a classifier in the ensemble @param index the index of the classifier in the ensemble
[ "Resets", "a", "classifier", "in", "the", "ensemble" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/meta/DACC.java#L231-L236
28,963
Waikato/moa
moa/src/main/java/moa/classifiers/meta/DACC.java
DACC.updateEvaluationWindow
protected double updateEvaluationWindow(int index,int val){ int[] newEnsembleWindows = new int[this.ensembleWindows[index].length]; int wsize = (int)Math.min(this.evaluationSizeOption.getValue(),this.ensembleAges[index]+1); int sum = 0; for (int i = 0; i < wsize-1 ; i++){ ...
java
protected double updateEvaluationWindow(int index,int val){ int[] newEnsembleWindows = new int[this.ensembleWindows[index].length]; int wsize = (int)Math.min(this.evaluationSizeOption.getValue(),this.ensembleAges[index]+1); int sum = 0; for (int i = 0; i < wsize-1 ; i++){ ...
[ "protected", "double", "updateEvaluationWindow", "(", "int", "index", ",", "int", "val", ")", "{", "int", "[", "]", "newEnsembleWindows", "=", "new", "int", "[", "this", ".", "ensembleWindows", "[", "index", "]", ".", "length", "]", ";", "int", "wsize", ...
Updates the evaluation window of a classifier and returns the updated weight value. @param index the index of the classifier in the ensemble @param val the last evaluation record of the classifier @return the updated weight value of the classifier
[ "Updates", "the", "evaluation", "window", "of", "a", "classifier", "and", "returns", "the", "updated", "weight", "value", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/meta/DACC.java#L245-L265
28,964
Waikato/moa
moa/src/main/java/moa/classifiers/meta/DACC.java
DACC.getMAXIndexes
protected ArrayList<Integer> getMAXIndexes(){ ArrayList<Integer> maxWIndex=new ArrayList<Integer>(); Pair[] newEnsembleWeights = new Pair[getNbActiveClassifiers()]; System.arraycopy(ensembleWeights, 0, newEnsembleWeights, 0, newEnsembleWeights.length); Arrays.sort(newEnsembleWeights);...
java
protected ArrayList<Integer> getMAXIndexes(){ ArrayList<Integer> maxWIndex=new ArrayList<Integer>(); Pair[] newEnsembleWeights = new Pair[getNbActiveClassifiers()]; System.arraycopy(ensembleWeights, 0, newEnsembleWeights, 0, newEnsembleWeights.length); Arrays.sort(newEnsembleWeights);...
[ "protected", "ArrayList", "<", "Integer", ">", "getMAXIndexes", "(", ")", "{", "ArrayList", "<", "Integer", ">", "maxWIndex", "=", "new", "ArrayList", "<", "Integer", ">", "(", ")", ";", "Pair", "[", "]", "newEnsembleWeights", "=", "new", "Pair", "[", "g...
Returns the classifiers that vote for the final prediction when the MAX combination function is selected @return the classifiers with the highest weight value
[ "Returns", "the", "classifiers", "that", "vote", "for", "the", "final", "prediction", "when", "the", "MAX", "combination", "function", "is", "selected" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/meta/DACC.java#L299-L317
28,965
Waikato/moa
moa/src/main/java/moa/gui/experimentertab/ImageChart.java
ImageChart.exportIMG
public void exportIMG(String path, String type) throws IOException { switch (type) { case "JPG": try { ChartUtilities.saveChartAsJPEG(new File(path + File.separator + name + ".jpg"), chart, width, height); } catch (IOException e) { ...
java
public void exportIMG(String path, String type) throws IOException { switch (type) { case "JPG": try { ChartUtilities.saveChartAsJPEG(new File(path + File.separator + name + ".jpg"), chart, width, height); } catch (IOException e) { ...
[ "public", "void", "exportIMG", "(", "String", "path", ",", "String", "type", ")", "throws", "IOException", "{", "switch", "(", "type", ")", "{", "case", "\"JPG\"", ":", "try", "{", "ChartUtilities", ".", "saveChartAsJPEG", "(", "new", "File", "(", "path", ...
Export the image to formats JPG, PNG, SVG and EPS. @param path @param type @throws IOException
[ "Export", "the", "image", "to", "formats", "JPG", "PNG", "SVG", "and", "EPS", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/experimentertab/ImageChart.java#L169-L207
28,966
Waikato/moa
moa/src/main/java/moa/gui/active/MeasureOverview.java
MeasureOverview.setActionListener
public void setActionListener(ActionListener listener) { for (int i = 0; i < this.radioButtons.length; i++) { this.radioButtons[i].addActionListener(listener); } }
java
public void setActionListener(ActionListener listener) { for (int i = 0; i < this.radioButtons.length; i++) { this.radioButtons[i].addActionListener(listener); } }
[ "public", "void", "setActionListener", "(", "ActionListener", "listener", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "radioButtons", ".", "length", ";", "i", "++", ")", "{", "this", ".", "radioButtons", "[", "i", "]", "."...
Sets the ActionListener for the radio buttons. @param listener ActionListener assigned to the radio buttons
[ "Sets", "the", "ActionListener", "for", "the", "radio", "buttons", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/active/MeasureOverview.java#L203-L207
28,967
Waikato/moa
moa/src/main/java/moa/gui/active/MeasureOverview.java
MeasureOverview.update
public void update(MeasureCollection[] measures, String variedParamName, double[] variedParamValues) { this.measures = measures; this.variedParamName = variedParamName; this.variedParamValues = variedParamValues; update(); updateParamBox(); }
java
public void update(MeasureCollection[] measures, String variedParamName, double[] variedParamValues) { this.measures = measures; this.variedParamName = variedParamName; this.variedParamValues = variedParamValues; update(); updateParamBox(); }
[ "public", "void", "update", "(", "MeasureCollection", "[", "]", "measures", ",", "String", "variedParamName", ",", "double", "[", "]", "variedParamValues", ")", "{", "this", ".", "measures", "=", "measures", ";", "this", ".", "variedParamName", "=", "variedPar...
Updates the measure overview by assigning new measure collections and varied parameter properties. If no measures are currently to display, reset the display to hyphens. Otherwise display the last measured and mean values. Updates the parameter combo box if needed. @param measures new MeasureCollection[] @param variedP...
[ "Updates", "the", "measure", "overview", "by", "assigning", "new", "measure", "collections", "and", "varied", "parameter", "properties", ".", "If", "no", "measures", "are", "currently", "to", "display", "reset", "the", "display", "to", "hyphens", ".", "Otherwise...
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/active/MeasureOverview.java#L219-L225
28,968
Waikato/moa
moa/src/main/java/moa/gui/active/MeasureOverview.java
MeasureOverview.update
public void update() { if (this.measures == null || this.measures.length == 0) { // no measures to show -> empty entries for (int i = 0; i < this.currentValues.length; i++) { this.currentValues[i].setText("-"); this.meanValues[i].setText("-"); ...
java
public void update() { if (this.measures == null || this.measures.length == 0) { // no measures to show -> empty entries for (int i = 0; i < this.currentValues.length; i++) { this.currentValues[i].setText("-"); this.meanValues[i].setText("-"); ...
[ "public", "void", "update", "(", ")", "{", "if", "(", "this", ".", "measures", "==", "null", "||", "this", ".", "measures", ".", "length", "==", "0", ")", "{", "// no measures to show -> empty entries", "for", "(", "int", "i", "=", "0", ";", "i", "<", ...
Updates the measure overview. If no measures are currently to display, reset the display to hyphens. Otherwise display the last measured and mean values.
[ "Updates", "the", "measure", "overview", ".", "If", "no", "measures", "are", "currently", "to", "display", "reset", "the", "display", "to", "hyphens", ".", "Otherwise", "display", "the", "last", "measured", "and", "mean", "values", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/active/MeasureOverview.java#L232-L267
28,969
Waikato/moa
moa/src/main/java/moa/gui/active/MeasureOverview.java
MeasureOverview.updateParamBox
private void updateParamBox() { if (this.variedParamValues == null || this.variedParamValues.length == 0) { // no varied parameter -> set to empty box this.paramBox.removeAllItems(); this.paramBox.setEnabled(false); } else if (this.paramBox.getItemCount() != this.vari...
java
private void updateParamBox() { if (this.variedParamValues == null || this.variedParamValues.length == 0) { // no varied parameter -> set to empty box this.paramBox.removeAllItems(); this.paramBox.setEnabled(false); } else if (this.paramBox.getItemCount() != this.vari...
[ "private", "void", "updateParamBox", "(", ")", "{", "if", "(", "this", ".", "variedParamValues", "==", "null", "||", "this", ".", "variedParamValues", ".", "length", "==", "0", ")", "{", "// no varied parameter -> set to empty box", "this", ".", "paramBox", ".",...
Updates the parameter combo box. If there is no varied parameter, empty and disable the box. Otherwise display the available parameters.
[ "Updates", "the", "parameter", "combo", "box", ".", "If", "there", "is", "no", "varied", "parameter", "empty", "and", "disable", "the", "box", ".", "Otherwise", "display", "the", "available", "parameters", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/active/MeasureOverview.java#L273-L286
28,970
Waikato/moa
moa/src/main/java/moa/classifiers/rules/AbstractAMRules.java
AbstractAMRules.getModelMeasurementsImpl
@Override protected Measurement[] getModelMeasurementsImpl() { return new Measurement[]{ new Measurement("anomaly detections", this.numAnomaliesDetected), new Measurement("change detections", this.numChangesDetected), new Measurement("rules (number)", this.ruleSet.size()+1)}; }
java
@Override protected Measurement[] getModelMeasurementsImpl() { return new Measurement[]{ new Measurement("anomaly detections", this.numAnomaliesDetected), new Measurement("change detections", this.numChangesDetected), new Measurement("rules (number)", this.ruleSet.size()+1)}; }
[ "@", "Override", "protected", "Measurement", "[", "]", "getModelMeasurementsImpl", "(", ")", "{", "return", "new", "Measurement", "[", "]", "{", "new", "Measurement", "(", "\"anomaly detections\"", ",", "this", ".", "numAnomaliesDetected", ")", ",", "new", "Meas...
print GUI evaluate model
[ "print", "GUI", "evaluate", "model" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/rules/AbstractAMRules.java#L294-L300
28,971
Waikato/moa
moa/src/main/java/moa/classifiers/rules/AbstractAMRules.java
AbstractAMRules.getModelDescription
@Override public void getModelDescription(StringBuilder out, int indent) { indent=0; if(!this.unorderedRulesOption.isSet()){ StringUtils.appendIndented(out, indent, "Method Ordered"); StringUtils.appendNewline(out); }else{ StringUtils.appendIndented(out, indent, "Method Unordered"); StringUtils.appen...
java
@Override public void getModelDescription(StringBuilder out, int indent) { indent=0; if(!this.unorderedRulesOption.isSet()){ StringUtils.appendIndented(out, indent, "Method Ordered"); StringUtils.appendNewline(out); }else{ StringUtils.appendIndented(out, indent, "Method Unordered"); StringUtils.appen...
[ "@", "Override", "public", "void", "getModelDescription", "(", "StringBuilder", "out", ",", "int", "indent", ")", "{", "indent", "=", "0", ";", "if", "(", "!", "this", ".", "unorderedRulesOption", ".", "isSet", "(", ")", ")", "{", "StringUtils", ".", "ap...
print GUI learn model
[ "print", "GUI", "learn", "model" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/rules/AbstractAMRules.java#L305-L331
28,972
Waikato/moa
moa/src/main/java/moa/classifiers/rules/AbstractAMRules.java
AbstractAMRules.debug
protected void debug(String string, int level) { if (VerbosityOption.getValue()>=level){ System.out.println(string); } }
java
protected void debug(String string, int level) { if (VerbosityOption.getValue()>=level){ System.out.println(string); } }
[ "protected", "void", "debug", "(", "String", "string", ",", "int", "level", ")", "{", "if", "(", "VerbosityOption", ".", "getValue", "(", ")", ">=", "level", ")", "{", "System", ".", "out", ".", "println", "(", "string", ")", ";", "}", "}" ]
Print to console @param string
[ "Print", "to", "console" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/rules/AbstractAMRules.java#L337-L341
28,973
Waikato/moa
moa/src/main/java/moa/classifiers/rules/AbstractAMRules.java
AbstractAMRules.getVotes
public Vote getVotes(Instance instance) { ErrorWeightedVote errorWeightedVote=newErrorWeightedVote(); //DoubleVector combinedVote = new DoubleVector(); debug("Test",3); int numberOfRulesCovering = 0; VerboseToConsole(instance); // Verbose to console Dataset name. for (Rule rule : ruleSet) { if (rule...
java
public Vote getVotes(Instance instance) { ErrorWeightedVote errorWeightedVote=newErrorWeightedVote(); //DoubleVector combinedVote = new DoubleVector(); debug("Test",3); int numberOfRulesCovering = 0; VerboseToConsole(instance); // Verbose to console Dataset name. for (Rule rule : ruleSet) { if (rule...
[ "public", "Vote", "getVotes", "(", "Instance", "instance", ")", "{", "ErrorWeightedVote", "errorWeightedVote", "=", "newErrorWeightedVote", "(", ")", ";", "//DoubleVector combinedVote = new DoubleVector();", "debug", "(", "\"Test\"", ",", "3", ")", ";", "int", "number...
getVotes extension of the instance method getVotesForInstance in moa.classifier.java returns the prediction of the instance. Called in WeightedRandomRules
[ "getVotes", "extension", "of", "the", "instance", "method", "getVotesForInstance", "in", "moa", ".", "classifier", ".", "java", "returns", "the", "prediction", "of", "the", "instance", ".", "Called", "in", "WeightedRandomRules" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/rules/AbstractAMRules.java#L403-L438
28,974
Waikato/moa
moa/src/main/java/moa/core/SizeOf.java
SizeOf.isPresent
protected static synchronized boolean isPresent() { if (m_Present == null) { try { SizeOfAgent.fullSizeOf(new Integer(1)); m_Present = true; } catch (Throwable t) { m_Present = false; } } return m_Present; }
java
protected static synchronized boolean isPresent() { if (m_Present == null) { try { SizeOfAgent.fullSizeOf(new Integer(1)); m_Present = true; } catch (Throwable t) { m_Present = false; } } return m_Present; }
[ "protected", "static", "synchronized", "boolean", "isPresent", "(", ")", "{", "if", "(", "m_Present", "==", "null", ")", "{", "try", "{", "SizeOfAgent", ".", "fullSizeOf", "(", "new", "Integer", "(", "1", ")", ")", ";", "m_Present", "=", "true", ";", "...
Checks whteher the agent is present. @return true if the agent is present, false otherwise
[ "Checks", "whteher", "the", "agent", "is", "present", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/core/SizeOf.java#L41-L52
28,975
Waikato/moa
moa/src/main/java/moa/tasks/Plot.java
Plot.createScript
private String createScript(File resultFile) { String newLine = System.getProperty("line.separator"); int sourceFileIdx = 0; // terminal options; String script = "set term " + terminalOptions(Terminal.valueOf(outputTypeOption .getChosenLabel())) + newLine; script += "set output '" + resultFile.getAbsolutePat...
java
private String createScript(File resultFile) { String newLine = System.getProperty("line.separator"); int sourceFileIdx = 0; // terminal options; String script = "set term " + terminalOptions(Terminal.valueOf(outputTypeOption .getChosenLabel())) + newLine; script += "set output '" + resultFile.getAbsolutePat...
[ "private", "String", "createScript", "(", "File", "resultFile", ")", "{", "String", "newLine", "=", "System", ".", "getProperty", "(", "\"line.separator\"", ")", ";", "int", "sourceFileIdx", "=", "0", ";", "// terminal options;", "String", "script", "=", "\"set ...
Creates the content of the gnuplot script. @param resultFile path of the plot output file @return gnuplot script
[ "Creates", "the", "content", "of", "the", "gnuplot", "script", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/tasks/Plot.java#L486-L550
28,976
Waikato/moa
moa/src/main/java/moa/evaluation/CMM_GTAnalysis.java
CMM_GTAnalysis.calculateGTPointQualities
private void calculateGTPointQualities(){ for (int p = 0; p < numPoints; p++) { CMMPoint cmdp = cmmpoints.get(p); if(!cmdp.isNoise()){ cmdp.connectivity = getConnectionValue(cmdp, cmdp.workclass()); cmdp.p.setMeasureValue("Connectivity", cmdp.connectivity)...
java
private void calculateGTPointQualities(){ for (int p = 0; p < numPoints; p++) { CMMPoint cmdp = cmmpoints.get(p); if(!cmdp.isNoise()){ cmdp.connectivity = getConnectionValue(cmdp, cmdp.workclass()); cmdp.p.setMeasureValue("Connectivity", cmdp.connectivity)...
[ "private", "void", "calculateGTPointQualities", "(", ")", "{", "for", "(", "int", "p", "=", "0", ";", "p", "<", "numPoints", ";", "p", "++", ")", "{", "CMMPoint", "cmdp", "=", "cmmpoints", ".", "get", "(", "p", ")", ";", "if", "(", "!", "cmdp", "...
calculate initial connectivities
[ "calculate", "initial", "connectivities" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/evaluation/CMM_GTAnalysis.java#L625-L633
28,977
Waikato/moa
moa/src/main/java/moa/evaluation/CMM_GTAnalysis.java
CMM_GTAnalysis.calculateGTClusterConnections
private void calculateGTClusterConnections(){ for (int c0 = 0; c0 < gt0Clusters.size(); c0++) { for (int c1 = 0; c1 < gt0Clusters.size(); c1++) { gt0Clusters.get(c0).calculateClusterConnection(c1, true); } } boolean changedConnection = true; w...
java
private void calculateGTClusterConnections(){ for (int c0 = 0; c0 < gt0Clusters.size(); c0++) { for (int c1 = 0; c1 < gt0Clusters.size(); c1++) { gt0Clusters.get(c0).calculateClusterConnection(c1, true); } } boolean changedConnection = true; w...
[ "private", "void", "calculateGTClusterConnections", "(", ")", "{", "for", "(", "int", "c0", "=", "0", ";", "c0", "<", "gt0Clusters", ".", "size", "(", ")", ";", "c0", "++", ")", "{", "for", "(", "int", "c1", "=", "0", ";", "c1", "<", "gt0Clusters",...
Calculate connections between clusters and merge clusters accordingly as long as connections exceed threshold
[ "Calculate", "connections", "between", "clusters", "and", "merge", "clusters", "accordingly", "as", "long", "as", "connections", "exceed", "threshold" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/evaluation/CMM_GTAnalysis.java#L641-L687
28,978
Waikato/moa
moa/src/main/java/moa/evaluation/CMM_GTAnalysis.java
CMM_GTAnalysis.getNoiseSeparability
public double getNoiseSeparability(){ if(noise.isEmpty()) return 1; double connectivity = 0; for(int p : noise){ CMMPoint npoint = cmmpoints.get(p); double maxConnection = 0; //TODO: some kind of pruning possible. what about weighting? ...
java
public double getNoiseSeparability(){ if(noise.isEmpty()) return 1; double connectivity = 0; for(int p : noise){ CMMPoint npoint = cmmpoints.get(p); double maxConnection = 0; //TODO: some kind of pruning possible. what about weighting? ...
[ "public", "double", "getNoiseSeparability", "(", ")", "{", "if", "(", "noise", ".", "isEmpty", "(", ")", ")", "return", "1", ";", "double", "connectivity", "=", "0", ";", "for", "(", "int", "p", ":", "noise", ")", "{", "CMMPoint", "npoint", "=", "cmm...
Calculates how well noise is separable from the given clusters Small values indicate bad separability, values close to 1 indicate good separability @return index of noise separability
[ "Calculates", "how", "well", "noise", "is", "separable", "from", "the", "given", "clusters", "Small", "values", "indicate", "bad", "separability", "values", "close", "to", "1", "indicate", "good", "separability" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/evaluation/CMM_GTAnalysis.java#L717-L737
28,979
Waikato/moa
moa/src/main/java/moa/evaluation/CMM_GTAnalysis.java
CMM_GTAnalysis.getModelQuality
public double getModelQuality(){ for(int p = 0; p < numPoints; p++){ CMMPoint cmdp = cmmpoints.get(p); for(int hc = 0; hc < numGTClusters;hc++){ if(gtClustering.get(hc).getGroundTruth() != cmdp.trueClass){ if(gtClustering.get(hc).getInclusionProbabilit...
java
public double getModelQuality(){ for(int p = 0; p < numPoints; p++){ CMMPoint cmdp = cmmpoints.get(p); for(int hc = 0; hc < numGTClusters;hc++){ if(gtClustering.get(hc).getGroundTruth() != cmdp.trueClass){ if(gtClustering.get(hc).getInclusionProbabilit...
[ "public", "double", "getModelQuality", "(", ")", "{", "for", "(", "int", "p", "=", "0", ";", "p", "<", "numPoints", ";", "p", "++", ")", "{", "CMMPoint", "cmdp", "=", "cmmpoints", ".", "get", "(", "p", ")", ";", "for", "(", "int", "hc", "=", "0...
Calculates the relative number of errors being caused by the underlying cluster model @return quality of the model
[ "Calculates", "the", "relative", "number", "of", "errors", "being", "caused", "by", "the", "underlying", "cluster", "model" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/evaluation/CMM_GTAnalysis.java#L744-L763
28,980
Waikato/moa
moa/src/main/java/moa/evaluation/CMM_GTAnalysis.java
CMM_GTAnalysis.distance
private double distance(Instance inst1, double[] inst2){ double distance = 0.0; for (int i = 0; i < numDims; i++) { double d = inst1.value(i) - inst2[i]; distance += d * d; } return Math.sqrt(distance); }
java
private double distance(Instance inst1, double[] inst2){ double distance = 0.0; for (int i = 0; i < numDims; i++) { double d = inst1.value(i) - inst2[i]; distance += d * d; } return Math.sqrt(distance); }
[ "private", "double", "distance", "(", "Instance", "inst1", ",", "double", "[", "]", "inst2", ")", "{", "double", "distance", "=", "0.0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numDims", ";", "i", "++", ")", "{", "double", "d", "="...
Calculates Euclidian distance @param inst1 point as an instance @param inst2 point as double array @return euclidian distance
[ "Calculates", "Euclidian", "distance" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/evaluation/CMM_GTAnalysis.java#L810-L817
28,981
Waikato/moa
moa/src/main/java/moa/evaluation/CMM_GTAnalysis.java
CMM_GTAnalysis.getParameterString
public String getParameterString(){ String para = ""; para+="k="+knnNeighbourhood+";"; if(useExpConnectivity){ para+="lambdaConnX="+lambdaConnX+";"; para+="lambdaConn="+lamdaConn+";"; para+="lambdaConnRef="+lambdaConnRefXValue+";"; } para+="m="+clusterC...
java
public String getParameterString(){ String para = ""; para+="k="+knnNeighbourhood+";"; if(useExpConnectivity){ para+="lambdaConnX="+lambdaConnX+";"; para+="lambdaConn="+lamdaConn+";"; para+="lambdaConnRef="+lambdaConnRefXValue+";"; } para+="m="+clusterC...
[ "public", "String", "getParameterString", "(", ")", "{", "String", "para", "=", "\"\"", ";", "para", "+=", "\"k=\"", "+", "knnNeighbourhood", "+", "\";\"", ";", "if", "(", "useExpConnectivity", ")", "{", "para", "+=", "\"lambdaConnX=\"", "+", "lambdaConnX", ...
String with main CMM parameters @return main CMM parameter
[ "String", "with", "main", "CMM", "parameters" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/evaluation/CMM_GTAnalysis.java#L823-L835
28,982
Waikato/moa
moa/src/main/java/moa/gui/colorGenerator/HSVColorGenerator.java
HSVColorGenerator.generateColors
@Override public Color[] generateColors(int numColors) { Color[] colors = new Color[numColors]; // fix the seed to always get the same colors for the same numColors parameter and ranges for hue, saturation and brightness Random rand = new Random(0); for(int i = 0; i < numColors; ++i) { float hueRatio = i/...
java
@Override public Color[] generateColors(int numColors) { Color[] colors = new Color[numColors]; // fix the seed to always get the same colors for the same numColors parameter and ranges for hue, saturation and brightness Random rand = new Random(0); for(int i = 0; i < numColors; ++i) { float hueRatio = i/...
[ "@", "Override", "public", "Color", "[", "]", "generateColors", "(", "int", "numColors", ")", "{", "Color", "[", "]", "colors", "=", "new", "Color", "[", "numColors", "]", ";", "// fix the seed to always get the same colors for the same numColors parameter and ranges fo...
Generate numColors unique colors which should be easily distinguishable. @param numColors the number of colors to generate @return an array of unique colors
[ "Generate", "numColors", "unique", "colors", "which", "should", "be", "easily", "distinguishable", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/colorGenerator/HSVColorGenerator.java#L67-L84
28,983
Waikato/moa
moa/src/main/java/moa/classifiers/oneclass/HSTreeNode.java
HSTreeNode.updateMass
public void updateMass(Instance inst, boolean referenceWindow) { if(referenceWindow) r++; else l++; if(internalNode) { if(inst.value(this.splitAttribute) > this.splitValue) right.updateMass(inst, referenceWindow); else left.updateMass(inst, referenceWindow); } }
java
public void updateMass(Instance inst, boolean referenceWindow) { if(referenceWindow) r++; else l++; if(internalNode) { if(inst.value(this.splitAttribute) > this.splitValue) right.updateMass(inst, referenceWindow); else left.updateMass(inst, referenceWindow); } }
[ "public", "void", "updateMass", "(", "Instance", "inst", ",", "boolean", "referenceWindow", ")", "{", "if", "(", "referenceWindow", ")", "r", "++", ";", "else", "l", "++", ";", "if", "(", "internalNode", ")", "{", "if", "(", "inst", ".", "value", "(", ...
Update the mass profile of this node. @param inst the instance being passed through the HSTree. @param referenceWindow if the HSTree is in the initial reference window: <b>true</b>, else: <b>false</b>
[ "Update", "the", "mass", "profile", "of", "this", "node", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/oneclass/HSTreeNode.java#L120-L134
28,984
Waikato/moa
moa/src/main/java/moa/classifiers/oneclass/HSTreeNode.java
HSTreeNode.score
public double score(Instance inst, int sizeLimit) { double anomalyScore = 0.0; if(this.internalNode && this.r > sizeLimit) { if(inst.value(this.splitAttribute) > this.splitValue) anomalyScore = right.score(inst, sizeLimit); else anomalyScore = left.score(inst, sizeLimit); } else { anoma...
java
public double score(Instance inst, int sizeLimit) { double anomalyScore = 0.0; if(this.internalNode && this.r > sizeLimit) { if(inst.value(this.splitAttribute) > this.splitValue) anomalyScore = right.score(inst, sizeLimit); else anomalyScore = left.score(inst, sizeLimit); } else { anoma...
[ "public", "double", "score", "(", "Instance", "inst", ",", "int", "sizeLimit", ")", "{", "double", "anomalyScore", "=", "0.0", ";", "if", "(", "this", ".", "internalNode", "&&", "this", ".", "r", ">", "sizeLimit", ")", "{", "if", "(", "inst", ".", "v...
If this node is a leaf node or it has a mass profile of less than sizeLimit, this returns the anomaly score for the argument instance. Otherwise this node determines which of its subordinate nodes the argument instance belongs to and asks it provide the anomaly score. @param inst the instance being passed through the ...
[ "If", "this", "node", "is", "a", "leaf", "node", "or", "it", "has", "a", "mass", "profile", "of", "less", "than", "sizeLimit", "this", "returns", "the", "anomaly", "score", "for", "the", "argument", "instance", ".", "Otherwise", "this", "node", "determines...
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/oneclass/HSTreeNode.java#L161-L178
28,985
Waikato/moa
moa/src/main/java/moa/classifiers/oneclass/HSTreeNode.java
HSTreeNode.printNode
protected void printNode() { System.out.println(this.depth+", "+this.splitAttribute+", "+this.splitValue+", "+this.r); if(this.internalNode) { this.right.printNode(); this.left.printNode(); } }
java
protected void printNode() { System.out.println(this.depth+", "+this.splitAttribute+", "+this.splitValue+", "+this.r); if(this.internalNode) { this.right.printNode(); this.left.printNode(); } }
[ "protected", "void", "printNode", "(", ")", "{", "System", ".", "out", ".", "println", "(", "this", ".", "depth", "+", "\", \"", "+", "this", ".", "splitAttribute", "+", "\", \"", "+", "this", ".", "splitValue", "+", "\", \"", "+", "this", ".", "r", ...
Prints this node to string and, if it is an internal node, prints its children nodes as well. Useful for debugging the entire tree structure.
[ "Prints", "this", "node", "to", "string", "and", "if", "it", "is", "an", "internal", "node", "prints", "its", "children", "nodes", "as", "well", ".", "Useful", "for", "debugging", "the", "entire", "tree", "structure", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/oneclass/HSTreeNode.java#L184-L193
28,986
Waikato/moa
moa/src/main/java/moa/clusterers/dstream/Dstream.java
Dstream.initialClustering
private void initialClustering() { //System.out.println("INITIAL CLUSTERING CALLED"); //printDStreamState(); // 1. Update the density of all grids in grid_list updateGridListDensity(); //printGridList(); // 2. Assign each dense grid to a distinct cluster // and // 3. Label all other grids as NO_CL...
java
private void initialClustering() { //System.out.println("INITIAL CLUSTERING CALLED"); //printDStreamState(); // 1. Update the density of all grids in grid_list updateGridListDensity(); //printGridList(); // 2. Assign each dense grid to a distinct cluster // and // 3. Label all other grids as NO_CL...
[ "private", "void", "initialClustering", "(", ")", "{", "//System.out.println(\"INITIAL CLUSTERING CALLED\");", "//printDStreamState();", "// 1. Update the density of all grids in grid_list", "updateGridListDensity", "(", ")", ";", "//printGridList();", "// 2. Assign each dense grid to a ...
Implements the procedure given in Figure 3 of Chen and Tu 2007
[ "Implements", "the", "procedure", "given", "in", "Figure", "3", "of", "Chen", "and", "Tu", "2007" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/dstream/Dstream.java#L405-L462
28,987
Waikato/moa
moa/src/main/java/moa/clusterers/dstream/Dstream.java
Dstream.adjustForSparseGrid
private HashMap<DensityGrid, CharacteristicVector> adjustForSparseGrid(DensityGrid dg, CharacteristicVector cv, int dgClass) { HashMap<DensityGrid, CharacteristicVector> glNew = new HashMap<DensityGrid, CharacteristicVector>(); //System.out.print("Density grid "+dg.toString()+" is adjusted as a sparse grid at time...
java
private HashMap<DensityGrid, CharacteristicVector> adjustForSparseGrid(DensityGrid dg, CharacteristicVector cv, int dgClass) { HashMap<DensityGrid, CharacteristicVector> glNew = new HashMap<DensityGrid, CharacteristicVector>(); //System.out.print("Density grid "+dg.toString()+" is adjusted as a sparse grid at time...
[ "private", "HashMap", "<", "DensityGrid", ",", "CharacteristicVector", ">", "adjustForSparseGrid", "(", "DensityGrid", "dg", ",", "CharacteristicVector", "cv", ",", "int", "dgClass", ")", "{", "HashMap", "<", "DensityGrid", ",", "CharacteristicVector", ">", "glNew",...
Adjusts the clustering of a sparse density grid. Implements lines 5 and 6 from Figure 4 of Chen and Tu 2007. @param dg the sparse density grid being adjusted @param cv the characteristic vector of dg @param dgClass the cluster to which dg belonged @return a HashMap<DensityGrid, CharacteristicVector> containing densit...
[ "Adjusts", "the", "clustering", "of", "a", "sparse", "density", "grid", ".", "Implements", "lines", "5", "and", "6", "from", "Figure", "4", "of", "Chen", "and", "Tu", "2007", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/dstream/Dstream.java#L641-L661
28,988
Waikato/moa
moa/src/main/java/moa/clusterers/dstream/Dstream.java
Dstream.adjustForTransitionalGrid
private HashMap<DensityGrid, CharacteristicVector> adjustForTransitionalGrid(DensityGrid dg, CharacteristicVector cv, int dgClass) { //System.out.print("Density grid "+dg.toString()+" is adjusted as a transitional grid at time "+this.getCurrTime()+". "); // Among all neighbours of dg, find the grid h whose clus...
java
private HashMap<DensityGrid, CharacteristicVector> adjustForTransitionalGrid(DensityGrid dg, CharacteristicVector cv, int dgClass) { //System.out.print("Density grid "+dg.toString()+" is adjusted as a transitional grid at time "+this.getCurrTime()+". "); // Among all neighbours of dg, find the grid h whose clus...
[ "private", "HashMap", "<", "DensityGrid", ",", "CharacteristicVector", ">", "adjustForTransitionalGrid", "(", "DensityGrid", "dg", ",", "CharacteristicVector", "cv", ",", "int", "dgClass", ")", "{", "//System.out.print(\"Density grid \"+dg.toString()+\" is adjusted as a transit...
Adjusts the clustering of a transitional density grid. Implements lines 20 and 21 from Figure 4 of Chen and Tu 2007. @param dg the dense density grid being adjusted @param cv the characteristic vector of dg @param dgClass the cluster to which dg belonged @return a HashMap<DensityGrid, CharacteristicVector> containing...
[ "Adjusts", "the", "clustering", "of", "a", "transitional", "density", "grid", ".", "Implements", "lines", "20", "and", "21", "from", "Figure", "4", "of", "Chen", "and", "Tu", "2007", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/dstream/Dstream.java#L981-L1035
28,989
Waikato/moa
moa/src/main/java/moa/clusterers/dstream/Dstream.java
Dstream.cleanClusters
private void cleanClusters() { //System.out.println("Clean Clusters"); Iterator<GridCluster> clusIter = this.cluster_list.iterator(); ArrayList<GridCluster> toRem = new ArrayList<GridCluster>(); // Check to see if there are any empty clusters while(clusIter.hasNext()) { GridCluster c = clusIter.next();...
java
private void cleanClusters() { //System.out.println("Clean Clusters"); Iterator<GridCluster> clusIter = this.cluster_list.iterator(); ArrayList<GridCluster> toRem = new ArrayList<GridCluster>(); // Check to see if there are any empty clusters while(clusIter.hasNext()) { GridCluster c = clusIter.next();...
[ "private", "void", "cleanClusters", "(", ")", "{", "//System.out.println(\"Clean Clusters\");", "Iterator", "<", "GridCluster", ">", "clusIter", "=", "this", ".", "cluster_list", ".", "iterator", "(", ")", ";", "ArrayList", "<", "GridCluster", ">", "toRem", "=", ...
Iterates through cluster_list to ensure that all empty clusters have been removed and that all cluster IDs match the cluster's index in cluster_list.
[ "Iterates", "through", "cluster_list", "to", "ensure", "that", "all", "empty", "clusters", "have", "been", "removed", "and", "that", "all", "cluster", "IDs", "match", "the", "cluster", "s", "index", "in", "cluster_list", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/dstream/Dstream.java#L1041-L1095
28,990
Waikato/moa
moa/src/main/java/moa/clusterers/dstream/Dstream.java
Dstream.removeSporadic
private void removeSporadic() { //System.out.println("REMOVE SPORADIC CALLED"); // 1. For each grid g in grid_list // a. If g is sporadic // i. If currTime - tg > gap, delete g from grid_list // ii. Else if (S1 && S2), mark as sporadic // iii. Else, mark as normal // b. Else // ...
java
private void removeSporadic() { //System.out.println("REMOVE SPORADIC CALLED"); // 1. For each grid g in grid_list // a. If g is sporadic // i. If currTime - tg > gap, delete g from grid_list // ii. Else if (S1 && S2), mark as sporadic // iii. Else, mark as normal // b. Else // ...
[ "private", "void", "removeSporadic", "(", ")", "{", "//System.out.println(\"REMOVE SPORADIC CALLED\");", "// 1. For each grid g in grid_list", "// a. If g is sporadic", "// i. If currTime - tg > gap, delete g from grid_list", "// ii. Else if (S1 && S2), mark as sporadic", "// ...
Implements the procedure described in section 4.2 of Chen and Tu 2007
[ "Implements", "the", "procedure", "described", "in", "section", "4", ".", "2", "of", "Chen", "and", "Tu", "2007" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/dstream/Dstream.java#L1149-L1215
28,991
Waikato/moa
moa/src/main/java/moa/clusterers/dstream/Dstream.java
Dstream.checkIfSporadic
private boolean checkIfSporadic(CharacteristicVector cv) { // Check S1 if(cv.getCurrGridDensity(this.getCurrTime(), this.getDecayFactor()) < densityThresholdFunction(cv.getDensityTimeStamp(), this.cl, this.getDecayFactor(), this.N)) { // Check S2 if(cv.getRemoveTime() == -1 || this.getCurrTime() >= ((1 + t...
java
private boolean checkIfSporadic(CharacteristicVector cv) { // Check S1 if(cv.getCurrGridDensity(this.getCurrTime(), this.getDecayFactor()) < densityThresholdFunction(cv.getDensityTimeStamp(), this.cl, this.getDecayFactor(), this.N)) { // Check S2 if(cv.getRemoveTime() == -1 || this.getCurrTime() >= ((1 + t...
[ "private", "boolean", "checkIfSporadic", "(", "CharacteristicVector", "cv", ")", "{", "// Check S1", "if", "(", "cv", ".", "getCurrGridDensity", "(", "this", ".", "getCurrTime", "(", ")", ",", "this", ".", "getDecayFactor", "(", ")", ")", "<", "densityThreshol...
Determines whether a sparse density grid is sporadic using rules S1 and S2 of Chen and Tu 2007 @param cv - the CharacteristicVector of the density grid being assessed for sporadicity
[ "Determines", "whether", "a", "sparse", "density", "grid", "is", "sporadic", "using", "rules", "S1", "and", "S2", "of", "Chen", "and", "Tu", "2007" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/dstream/Dstream.java#L1222-L1233
28,992
Waikato/moa
moa/src/main/java/moa/clusterers/dstream/Dstream.java
Dstream.densityThresholdFunction
private double densityThresholdFunction(int tg, double cl, double decayFactor, int N) { return (cl * (1.0 - Math.pow(decayFactor, (this.getCurrTime()-tg+1.0))))/(N * (1.0 - decayFactor)); }
java
private double densityThresholdFunction(int tg, double cl, double decayFactor, int N) { return (cl * (1.0 - Math.pow(decayFactor, (this.getCurrTime()-tg+1.0))))/(N * (1.0 - decayFactor)); }
[ "private", "double", "densityThresholdFunction", "(", "int", "tg", ",", "double", "cl", ",", "double", "decayFactor", ",", "int", "N", ")", "{", "return", "(", "cl", "*", "(", "1.0", "-", "Math", ".", "pow", "(", "decayFactor", ",", "(", "this", ".", ...
Implements the function pi given in Definition 4.1 of Chen and Tu 2007 @param tg - the update time in the density grid's characteristic vector @param cl - user defined parameter which controls the threshold for sparse grids @param decayFactor - user defined parameter which is represented as lambda in Chen and Tu 2007 ...
[ "Implements", "the", "function", "pi", "given", "in", "Definition", "4", ".", "1", "of", "Chen", "and", "Tu", "2007" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/dstream/Dstream.java#L1243-L1246
28,993
Waikato/moa
moa/src/main/java/moa/clusterers/dstream/Dstream.java
Dstream.mergeClusters
private void mergeClusters (int smallClus, int bigClus) { //System.out.println("Merge clusters "+smallClus+" and "+bigClus+"."); // Iterate through the density grids in grid_list to find those which are in highClass for (Map.Entry<DensityGrid, CharacteristicVector> grid : grid_list.entrySet()) { DensityGr...
java
private void mergeClusters (int smallClus, int bigClus) { //System.out.println("Merge clusters "+smallClus+" and "+bigClus+"."); // Iterate through the density grids in grid_list to find those which are in highClass for (Map.Entry<DensityGrid, CharacteristicVector> grid : grid_list.entrySet()) { DensityGr...
[ "private", "void", "mergeClusters", "(", "int", "smallClus", ",", "int", "bigClus", ")", "{", "//System.out.println(\"Merge clusters \"+smallClus+\" and \"+bigClus+\".\");", "// Iterate through the density grids in grid_list to find those which are in highClass", "for", "(", "Map", "...
Reassign all grids belonging in the small cluster to the big cluster Merge the GridCluster objects representing each cluster @param smallClus - the index of the smaller cluster @param bigClus - the index of the bigger cluster
[ "Reassign", "all", "grids", "belonging", "in", "the", "small", "cluster", "to", "the", "big", "cluster", "Merge", "the", "GridCluster", "objects", "representing", "each", "cluster" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/dstream/Dstream.java#L1255-L1280
28,994
Waikato/moa
moa/src/main/java/moa/clusterers/dstream/Dstream.java
Dstream.updateGridListDensity
private void updateGridListDensity() { for (Map.Entry<DensityGrid, CharacteristicVector> grid : grid_list.entrySet()) { DensityGrid dg = grid.getKey(); CharacteristicVector cvOfG = grid.getValue(); dg.setVisited(false); cvOfG.updateGridDensity(this.getCurrTime(), this.getDecayFactor(), this.getDL(), t...
java
private void updateGridListDensity() { for (Map.Entry<DensityGrid, CharacteristicVector> grid : grid_list.entrySet()) { DensityGrid dg = grid.getKey(); CharacteristicVector cvOfG = grid.getValue(); dg.setVisited(false); cvOfG.updateGridDensity(this.getCurrTime(), this.getDecayFactor(), this.getDL(), t...
[ "private", "void", "updateGridListDensity", "(", ")", "{", "for", "(", "Map", ".", "Entry", "<", "DensityGrid", ",", "CharacteristicVector", ">", "grid", ":", "grid_list", ".", "entrySet", "(", ")", ")", "{", "DensityGrid", "dg", "=", "grid", ".", "getKey"...
Iterates through grid_list and updates the density for each density grid therein. Also marks each density grid as unvisited for this call to adjustClustering.
[ "Iterates", "through", "grid_list", "and", "updates", "the", "density", "for", "each", "density", "grid", "therein", ".", "Also", "marks", "each", "density", "grid", "as", "unvisited", "for", "this", "call", "to", "adjustClustering", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/dstream/Dstream.java#L1286-L1298
28,995
Waikato/moa
moa/src/main/java/moa/clusterers/dstream/Dstream.java
Dstream.printGridList
public void printGridList() { System.out.println("Grid List. Size "+this.grid_list.size()+"."); for (Map.Entry<DensityGrid, CharacteristicVector> grid : grid_list.entrySet()) { DensityGrid dg = grid.getKey(); CharacteristicVector cv = grid.getValue(); if (cv.getAttribute() != SPARSE) { double...
java
public void printGridList() { System.out.println("Grid List. Size "+this.grid_list.size()+"."); for (Map.Entry<DensityGrid, CharacteristicVector> grid : grid_list.entrySet()) { DensityGrid dg = grid.getKey(); CharacteristicVector cv = grid.getValue(); if (cv.getAttribute() != SPARSE) { double...
[ "public", "void", "printGridList", "(", ")", "{", "System", ".", "out", ".", "println", "(", "\"Grid List. Size \"", "+", "this", ".", "grid_list", ".", "size", "(", ")", "+", "\".\"", ")", ";", "for", "(", "Map", ".", "Entry", "<", "DensityGrid", ",",...
Iterates through grid_list and prints out each density grid therein as a string. @see moa.clusterers.dstream.Dstream.grid_list @see moa.clusterers.dstream.DensityGrid.toString
[ "Iterates", "through", "grid_list", "and", "prints", "out", "each", "density", "grid", "therein", "as", "a", "string", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/dstream/Dstream.java#L1379-L1393
28,996
Waikato/moa
moa/src/main/java/moa/clusterers/dstream/Dstream.java
Dstream.printGridClusters
public void printGridClusters() { System.out.println("List of Clusters. Total "+this.cluster_list.size()+"."); for(GridCluster gc : this.cluster_list) { System.out.println(gc.getClusterLabel()+": "+gc.getWeight()+" {"+gc.toString()+"}"); } }
java
public void printGridClusters() { System.out.println("List of Clusters. Total "+this.cluster_list.size()+"."); for(GridCluster gc : this.cluster_list) { System.out.println(gc.getClusterLabel()+": "+gc.getWeight()+" {"+gc.toString()+"}"); } }
[ "public", "void", "printGridClusters", "(", ")", "{", "System", ".", "out", ".", "println", "(", "\"List of Clusters. Total \"", "+", "this", ".", "cluster_list", ".", "size", "(", ")", "+", "\".\"", ")", ";", "for", "(", "GridCluster", "gc", ":", "this", ...
Iterates through cluster_list and prints out each grid cluster therein as a string. @see moa.clusterers.dstream.Dstream.cluster_list @see moa.clusterers.dstream.GridCluster.toString
[ "Iterates", "through", "cluster_list", "and", "prints", "out", "each", "grid", "cluster", "therein", "as", "a", "string", "." ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/dstream/Dstream.java#L1401-L1408
28,997
Waikato/moa
moa/src/main/java/moa/clusterers/outliers/AnyOut/util/DataSet.java
DataSet.addObject
public void addObject(DataSet dataSet) throws Exception { DataObject[] dataObjects = dataSet.getDataObjectArray(); for (int i = 0; i < dataObjects.length; i++) { this.addObject(dataObjects[i]); } }
java
public void addObject(DataSet dataSet) throws Exception { DataObject[] dataObjects = dataSet.getDataObjectArray(); for (int i = 0; i < dataObjects.length; i++) { this.addObject(dataObjects[i]); } }
[ "public", "void", "addObject", "(", "DataSet", "dataSet", ")", "throws", "Exception", "{", "DataObject", "[", "]", "dataObjects", "=", "dataSet", ".", "getDataObjectArray", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "dataObjects", "....
Adds all objects in the given data set @see addObject(DataObject newData) @param dataSet @throws InconsistentDimensionException
[ "Adds", "all", "objects", "in", "the", "given", "data", "set" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/outliers/AnyOut/util/DataSet.java#L95-L100
28,998
Waikato/moa
moa/src/main/java/moa/clusterers/outliers/AnyOut/util/DataSet.java
DataSet.getNrOfClasses
public int getNrOfClasses() { HashMap<Integer, Integer> classes = new HashMap<Integer, Integer>(); for (DataObject currentObject : dataList) { if (!classes.containsKey(currentObject.getClassLabel())) classes.put(currentObject.getClassLabel(), 1); } return classes.size(); }
java
public int getNrOfClasses() { HashMap<Integer, Integer> classes = new HashMap<Integer, Integer>(); for (DataObject currentObject : dataList) { if (!classes.containsKey(currentObject.getClassLabel())) classes.put(currentObject.getClassLabel(), 1); } return classes.size(); }
[ "public", "int", "getNrOfClasses", "(", ")", "{", "HashMap", "<", "Integer", ",", "Integer", ">", "classes", "=", "new", "HashMap", "<", "Integer", ",", "Integer", ">", "(", ")", ";", "for", "(", "DataObject", "currentObject", ":", "dataList", ")", "{", ...
Counts the number of classes that are present in the data set. !!! It does not check whether all classes are contained !!! @return the number of distinct class labels
[ "Counts", "the", "number", "of", "classes", "that", "are", "present", "in", "the", "data", "set", ".", "!!!", "It", "does", "not", "check", "whether", "all", "classes", "are", "contained", "!!!" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/outliers/AnyOut/util/DataSet.java#L136-L145
28,999
Waikato/moa
moa/src/main/java/moa/clusterers/outliers/AnyOut/util/DataSet.java
DataSet.getDataSetsPerClass
public DataSet[] getDataSetsPerClass() throws Exception { DataSet[] dataSetsPerClass = new DataSet[this.getNrOfClasses()]; // create a new data set for each class for (int i = 0; i < dataSetsPerClass.length; i++) { dataSetsPerClass[i] = new DataSet(this.nrOfDimensions); } // fill the data...
java
public DataSet[] getDataSetsPerClass() throws Exception { DataSet[] dataSetsPerClass = new DataSet[this.getNrOfClasses()]; // create a new data set for each class for (int i = 0; i < dataSetsPerClass.length; i++) { dataSetsPerClass[i] = new DataSet(this.nrOfDimensions); } // fill the data...
[ "public", "DataSet", "[", "]", "getDataSetsPerClass", "(", ")", "throws", "Exception", "{", "DataSet", "[", "]", "dataSetsPerClass", "=", "new", "DataSet", "[", "this", ".", "getNrOfClasses", "(", ")", "]", ";", "// create a new data set for each class", "for", ...
Separates the objects in this data set according to their class label @return an array of DataSets, one for each class
[ "Separates", "the", "objects", "in", "this", "data", "set", "according", "to", "their", "class", "label" ]
395982e5100bfe75a3a4d26115462ce2cc74cbb0
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/outliers/AnyOut/util/DataSet.java#L183-L196