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
53,000
EdwardRaff/JSAT
JSAT/src/jsat/utils/IntSortedSet.java
IntSortedSet.batch_insert
private void batch_insert(Collection<Integer> set, boolean parallel) { for(int i : set) store[size++] = i; if(parallel) Arrays.parallelSort(store, 0, size); else Arrays.sort(store, 0, size); }
java
private void batch_insert(Collection<Integer> set, boolean parallel) { for(int i : set) store[size++] = i; if(parallel) Arrays.parallelSort(store, 0, size); else Arrays.sort(store, 0, size); }
[ "private", "void", "batch_insert", "(", "Collection", "<", "Integer", ">", "set", ",", "boolean", "parallel", ")", "{", "for", "(", "int", "i", ":", "set", ")", "store", "[", "size", "++", "]", "=", "i", ";", "if", "(", "parallel", ")", "Arrays", "...
more efficient insertion of many items by placing them all into the backing store, and then doing one large sort. @param set @param parallel
[ "more", "efficient", "insertion", "of", "many", "items", "by", "placing", "them", "all", "into", "the", "backing", "store", "and", "then", "doing", "one", "large", "sort", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/IntSortedSet.java#L71-L79
53,001
EdwardRaff/JSAT
JSAT/src/jsat/distributions/LogUniform.java
LogUniform.setMinMax
public void setMinMax(double min, double max) { if(min <= 0 || Double.isNaN(min) || Double.isInfinite(min)) throw new IllegalArgumentException("min value must be positive, not " + min); else if(min >= max || Double.isNaN(max) || Double.isInfinite(max)) throw new IllegalArgume...
java
public void setMinMax(double min, double max) { if(min <= 0 || Double.isNaN(min) || Double.isInfinite(min)) throw new IllegalArgumentException("min value must be positive, not " + min); else if(min >= max || Double.isNaN(max) || Double.isInfinite(max)) throw new IllegalArgume...
[ "public", "void", "setMinMax", "(", "double", "min", ",", "double", "max", ")", "{", "if", "(", "min", "<=", "0", "||", "Double", ".", "isNaN", "(", "min", ")", "||", "Double", ".", "isInfinite", "(", "min", ")", ")", "throw", "new", "IllegalArgument...
Sets the minimum and maximum values for this distribution @param min the minimum value, must be positive @param max the maximum value, must be larger than {@code min}
[ "Sets", "the", "minimum", "and", "maximum", "values", "for", "this", "distribution" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/LogUniform.java#L59-L71
53,002
EdwardRaff/JSAT
JSAT/src/jsat/io/LIBSVMLoader.java
LIBSVMLoader.write
public static void write(ClassificationDataSet data, OutputStream os) { PrintWriter writer = new PrintWriter(os); for(int i = 0; i < data.size(); i++) { int pred = data.getDataPointCategory(i); Vec vals = data.getDataPoint(i).getNumericalValues(); writer.w...
java
public static void write(ClassificationDataSet data, OutputStream os) { PrintWriter writer = new PrintWriter(os); for(int i = 0; i < data.size(); i++) { int pred = data.getDataPointCategory(i); Vec vals = data.getDataPoint(i).getNumericalValues(); writer.w...
[ "public", "static", "void", "write", "(", "ClassificationDataSet", "data", ",", "OutputStream", "os", ")", "{", "PrintWriter", "writer", "=", "new", "PrintWriter", "(", "os", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "data", ".", "size...
Writes out the given classification data set as a LIBSVM data file @param data the data set to write to a file @param os the output stream to write to. The stream will not be closed or flushed by this method
[ "Writes", "out", "the", "given", "classification", "data", "set", "as", "a", "LIBSVM", "data", "file" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/io/LIBSVMLoader.java#L514-L534
53,003
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/svm/DCDs.java
DCDs.eq24
protected static double eq24(final double beta_i, final double gN, final double gP, final double U) { //6.2.2 double vi = 0;//Used as "other" value if(beta_i == 0)//if beta_i = 0 ... { //if beta_i = 0 and g'n(beta_i) >= 0 if(gN >= 0) ...
java
protected static double eq24(final double beta_i, final double gN, final double gP, final double U) { //6.2.2 double vi = 0;//Used as "other" value if(beta_i == 0)//if beta_i = 0 ... { //if beta_i = 0 and g'n(beta_i) >= 0 if(gN >= 0) ...
[ "protected", "static", "double", "eq24", "(", "final", "double", "beta_i", ",", "final", "double", "gN", ",", "final", "double", "gP", ",", "final", "double", "U", ")", "{", "//6.2.2\r", "double", "vi", "=", "0", ";", "//Used as \"other\" value\r", "if", "...
returns the result of evaluation equation 24 of an individual index @param beta_i the weight coefficent value @param gN the g'<sub>n</sub>(beta_i) value @param gP the g'<sub>p</sub>(beta_i) value @param U the upper bound value obtained from {@link #getU(double) } @return the result of equation 24
[ "returns", "the", "result", "of", "evaluation", "equation", "24", "of", "an", "individual", "index" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/svm/DCDs.java#L678-L715
53,004
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/trees/DecisionStump.java
DecisionStump.getSplittingAttribute
public int getSplittingAttribute() { //TODO refactor the splittingAttribute to just be in this order already if(splittingAttribute < catAttributes.length)//categorical feature return numNumericFeatures+splittingAttribute; //else, is Numerical attribute int numerAttribute ...
java
public int getSplittingAttribute() { //TODO refactor the splittingAttribute to just be in this order already if(splittingAttribute < catAttributes.length)//categorical feature return numNumericFeatures+splittingAttribute; //else, is Numerical attribute int numerAttribute ...
[ "public", "int", "getSplittingAttribute", "(", ")", "{", "//TODO refactor the splittingAttribute to just be in this order already", "if", "(", "splittingAttribute", "<", "catAttributes", ".", "length", ")", "//categorical feature", "return", "numNumericFeatures", "+", "splittin...
Returns the attribute that this stump has decided to use to compute results. Numeric features start from 0, and categorical features start from the number of numeric features. @return the attribute that this stump has decided to use to compute results.
[ "Returns", "the", "attribute", "that", "this", "stump", "has", "decided", "to", "use", "to", "compute", "results", ".", "Numeric", "features", "start", "from", "0", "and", "categorical", "features", "start", "from", "the", "number", "of", "numeric", "features"...
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/trees/DecisionStump.java#L176-L184
53,005
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/trees/DecisionStump.java
DecisionStump.getGain
protected double getGain(ImpurityScore origScore, ClassificationDataSet source, List<IntList> aSplit) { ImpurityScore[] scores = getSplitScores(source, aSplit); return ImpurityScore.gain(origScore, scores); }
java
protected double getGain(ImpurityScore origScore, ClassificationDataSet source, List<IntList> aSplit) { ImpurityScore[] scores = getSplitScores(source, aSplit); return ImpurityScore.gain(origScore, scores); }
[ "protected", "double", "getGain", "(", "ImpurityScore", "origScore", ",", "ClassificationDataSet", "source", ",", "List", "<", "IntList", ">", "aSplit", ")", "{", "ImpurityScore", "[", "]", "scores", "=", "getSplitScores", "(", "source", ",", "aSplit", ")", ";...
From the score for the original set that is being split, this computes the gain as the improvement in classification from the original split. @param origScore the score of the unsplit set @param source @param aSplit the splitting of the data points @return the gain score for this split
[ "From", "the", "score", "for", "the", "original", "set", "that", "is", "being", "split", "this", "computes", "the", "gain", "as", "the", "improvement", "in", "classification", "from", "the", "original", "split", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/trees/DecisionStump.java#L233-L239
53,006
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/trees/DecisionStump.java
DecisionStump.whichPath
public int whichPath(DataPoint data) { int paths = getNumberOfPaths(); if(paths < 0) return paths;//Not trained else if(paths == 1)//ONLY one option, entropy was zero return 0; else if(splittingAttribute < catAttributes.length)//Same for classification and reg...
java
public int whichPath(DataPoint data) { int paths = getNumberOfPaths(); if(paths < 0) return paths;//Not trained else if(paths == 1)//ONLY one option, entropy was zero return 0; else if(splittingAttribute < catAttributes.length)//Same for classification and reg...
[ "public", "int", "whichPath", "(", "DataPoint", "data", ")", "{", "int", "paths", "=", "getNumberOfPaths", "(", ")", ";", "if", "(", "paths", "<", "0", ")", "return", "paths", ";", "//Not trained", "else", "if", "(", "paths", "==", "1", ")", "//ONLY on...
Determines which split path this data point would follow from this decision stump. Works for both classification and regression. @param data the data point in question @return the integer indicating which path to take. -1 returned if stump is not trained
[ "Determines", "which", "split", "path", "this", "data", "point", "would", "follow", "from", "this", "decision", "stump", ".", "Works", "for", "both", "classification", "and", "regression", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/trees/DecisionStump.java#L265-L295
53,007
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/trees/DecisionStump.java
DecisionStump.result
public CategoricalResults result(int i) { if(i < 0 || i >= getNumberOfPaths()) throw new IndexOutOfBoundsException("Invalid path, can to return a result for path " + i); return results[i]; }
java
public CategoricalResults result(int i) { if(i < 0 || i >= getNumberOfPaths()) throw new IndexOutOfBoundsException("Invalid path, can to return a result for path " + i); return results[i]; }
[ "public", "CategoricalResults", "result", "(", "int", "i", ")", "{", "if", "(", "i", "<", "0", "||", "i", ">=", "getNumberOfPaths", "(", ")", ")", "throw", "new", "IndexOutOfBoundsException", "(", "\"Invalid path, can to return a result for path \"", "+", "i", "...
Returns the categorical result of the i'th path. @param i the path to get the result for @return the result that would be returned if a data point went down the given path @throws IndexOutOfBoundsException if an invalid path is given @throws NullPointerException if the stump has not been trained for classification
[ "Returns", "the", "categorical", "result", "of", "the", "i", "th", "path", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/trees/DecisionStump.java#L345-L350
53,008
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/trees/DecisionStump.java
DecisionStump.trainC
public List<ClassificationDataSet> trainC(ClassificationDataSet dataPoints, Set<Integer> options) { return trainC(dataPoints, options, false); }
java
public List<ClassificationDataSet> trainC(ClassificationDataSet dataPoints, Set<Integer> options) { return trainC(dataPoints, options, false); }
[ "public", "List", "<", "ClassificationDataSet", ">", "trainC", "(", "ClassificationDataSet", "dataPoints", ",", "Set", "<", "Integer", ">", "options", ")", "{", "return", "trainC", "(", "dataPoints", ",", "options", ",", "false", ")", ";", "}" ]
This is a helper function that does the work of training this stump. It may be called directly by other classes that are creating decision trees to avoid redundant repackaging of lists. @param dataPoints the lists of datapoint to train on, paired with the true category of each training point @param options the set of ...
[ "This", "is", "a", "helper", "function", "that", "does", "the", "work", "of", "training", "this", "stump", ".", "It", "may", "be", "called", "directly", "by", "other", "classes", "that", "are", "creating", "decision", "trees", "to", "avoid", "redundant", "...
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/trees/DecisionStump.java#L373-L376
53,009
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/trees/DecisionStump.java
DecisionStump.distributMissing
static protected <T> void distributMissing(List<ClassificationDataSet> splits, double[] fracs, ClassificationDataSet source, IntList hadMissing) { for (int i : hadMissing) { DataPoint dp = source.getDataPoint(i); for (int j = 0; j < fracs.length; j++) { double nw = fracs[j] * source.getWeight(i)...
java
static protected <T> void distributMissing(List<ClassificationDataSet> splits, double[] fracs, ClassificationDataSet source, IntList hadMissing) { for (int i : hadMissing) { DataPoint dp = source.getDataPoint(i); for (int j = 0; j < fracs.length; j++) { double nw = fracs[j] * source.getWeight(i)...
[ "static", "protected", "<", "T", ">", "void", "distributMissing", "(", "List", "<", "ClassificationDataSet", ">", "splits", ",", "double", "[", "]", "fracs", ",", "ClassificationDataSet", "source", ",", "IntList", "hadMissing", ")", "{", "for", "(", "int", "...
Distributes a list of datapoints that had missing values to each split, re-weighted by the indicated fractions @param <T> @param splits a list of lists, where each inner list is a split @param fracs the fraction of weight to each split, should sum to one @param source @param hadMissing the list of datapoints that had m...
[ "Distributes", "a", "list", "of", "datapoints", "that", "had", "missing", "values", "to", "each", "split", "re", "-", "weighted", "by", "the", "indicated", "fractions" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/trees/DecisionStump.java#L723-L740
53,010
EdwardRaff/JSAT
JSAT/src/jsat/text/tokenizer/NaiveTokenizer.java
NaiveTokenizer.setMaxTokenLength
public void setMaxTokenLength(int maxTokenLength) { if(maxTokenLength < 1) throw new IllegalArgumentException("Max token length must be positive, not " + maxTokenLength); if(maxTokenLength <= minTokenLength) throw new IllegalArgumentException("Max token length must be larger ...
java
public void setMaxTokenLength(int maxTokenLength) { if(maxTokenLength < 1) throw new IllegalArgumentException("Max token length must be positive, not " + maxTokenLength); if(maxTokenLength <= minTokenLength) throw new IllegalArgumentException("Max token length must be larger ...
[ "public", "void", "setMaxTokenLength", "(", "int", "maxTokenLength", ")", "{", "if", "(", "maxTokenLength", "<", "1", ")", "throw", "new", "IllegalArgumentException", "(", "\"Max token length must be positive, not \"", "+", "maxTokenLength", ")", ";", "if", "(", "ma...
Sets the maximum allowed length for any token. Any token discovered exceeding the length will not be accepted and skipped over. The default is unbounded. @param maxTokenLength the maximum token length to accept as a valid token
[ "Sets", "the", "maximum", "allowed", "length", "for", "any", "token", ".", "Any", "token", "discovered", "exceeding", "the", "length", "will", "not", "be", "accepted", "and", "skipped", "over", ".", "The", "default", "is", "unbounded", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/text/tokenizer/NaiveTokenizer.java#L137-L144
53,011
EdwardRaff/JSAT
JSAT/src/jsat/text/tokenizer/NaiveTokenizer.java
NaiveTokenizer.setMinTokenLength
public void setMinTokenLength(int minTokenLength) { if(minTokenLength < 0) throw new IllegalArgumentException("Minimum token length must be non negative, not " + minTokenLength); if(minTokenLength > maxTokenLength) throw new IllegalArgumentException("Minimum token length can ...
java
public void setMinTokenLength(int minTokenLength) { if(minTokenLength < 0) throw new IllegalArgumentException("Minimum token length must be non negative, not " + minTokenLength); if(minTokenLength > maxTokenLength) throw new IllegalArgumentException("Minimum token length can ...
[ "public", "void", "setMinTokenLength", "(", "int", "minTokenLength", ")", "{", "if", "(", "minTokenLength", "<", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"Minimum token length must be non negative, not \"", "+", "minTokenLength", ")", ";", "if", "(...
Sets the minimum allowed token length. Any token discovered shorter than the minimum length will not be accepted and skipped over. The default is 0. @param minTokenLength the minimum length for a token to be used
[ "Sets", "the", "minimum", "allowed", "token", "length", ".", "Any", "token", "discovered", "shorter", "than", "the", "minimum", "length", "will", "not", "be", "accepted", "and", "skipped", "over", ".", "The", "default", "is", "0", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/text/tokenizer/NaiveTokenizer.java#L161-L168
53,012
EdwardRaff/JSAT
JSAT/src/jsat/distributions/kernels/KernelPoints.java
KernelPoints.addNewKernelPoint
public void addNewKernelPoint() { KernelPoint source = points.get(0); KernelPoint toAdd = new KernelPoint(k, errorTolerance); toAdd.setMaxBudget(maxBudget); toAdd.setBudgetStrategy(budgetStrategy); standardMove(toAdd, source); toAdd.kernelAccel = source.kerne...
java
public void addNewKernelPoint() { KernelPoint source = points.get(0); KernelPoint toAdd = new KernelPoint(k, errorTolerance); toAdd.setMaxBudget(maxBudget); toAdd.setBudgetStrategy(budgetStrategy); standardMove(toAdd, source); toAdd.kernelAccel = source.kerne...
[ "public", "void", "addNewKernelPoint", "(", ")", "{", "KernelPoint", "source", "=", "points", ".", "get", "(", "0", ")", ";", "KernelPoint", "toAdd", "=", "new", "KernelPoint", "(", "k", ",", "errorTolerance", ")", ";", "toAdd", ".", "setMaxBudget", "(", ...
Adds a new Kernel Point to the internal list this object represents. The new Kernel Point will be equivalent to creating a new KernelPoint directly.
[ "Adds", "a", "new", "Kernel", "Point", "to", "the", "internal", "list", "this", "object", "represents", ".", "The", "new", "Kernel", "Point", "will", "be", "equivalent", "to", "creating", "a", "new", "KernelPoint", "directly", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/kernels/KernelPoints.java#L579-L593
53,013
EdwardRaff/JSAT
JSAT/src/jsat/distributions/kernels/KernelPoints.java
KernelPoints.standardMove
private void standardMove(KernelPoint destination, KernelPoint source) { destination.InvK = source.InvK; destination.InvKExpanded = source.InvKExpanded; destination.K = source.K; destination.KExpanded = source.KExpanded; }
java
private void standardMove(KernelPoint destination, KernelPoint source) { destination.InvK = source.InvK; destination.InvKExpanded = source.InvKExpanded; destination.K = source.K; destination.KExpanded = source.KExpanded; }
[ "private", "void", "standardMove", "(", "KernelPoint", "destination", ",", "KernelPoint", "source", ")", "{", "destination", ".", "InvK", "=", "source", ".", "InvK", ";", "destination", ".", "InvKExpanded", "=", "source", ".", "InvKExpanded", ";", "destination",...
Updates the gram matrix storage of the destination to point at the exact same objects as the ones from the source. @param destination the destination object @param source the source object
[ "Updates", "the", "gram", "matrix", "storage", "of", "the", "destination", "to", "point", "at", "the", "exact", "same", "objects", "as", "the", "ones", "from", "the", "source", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/kernels/KernelPoints.java#L601-L607
53,014
EdwardRaff/JSAT
JSAT/src/jsat/distributions/kernels/KernelPoints.java
KernelPoints.getRawBasisVecs
public List<Vec> getRawBasisVecs() { List<Vec> vecs = new ArrayList<Vec>(getBasisSize()); vecs.addAll(this.points.get(0).vecs); return vecs; }
java
public List<Vec> getRawBasisVecs() { List<Vec> vecs = new ArrayList<Vec>(getBasisSize()); vecs.addAll(this.points.get(0).vecs); return vecs; }
[ "public", "List", "<", "Vec", ">", "getRawBasisVecs", "(", ")", "{", "List", "<", "Vec", ">", "vecs", "=", "new", "ArrayList", "<", "Vec", ">", "(", "getBasisSize", "(", ")", ")", ";", "vecs", ".", "addAll", "(", "this", ".", "points", ".", "get", ...
Returns a list of the raw vectors being used by the kernel points. Altering this vectors will alter the same vectors used by these objects and will cause inconsistent results. @return the list of raw basis vectors used by the Kernel points
[ "Returns", "a", "list", "of", "the", "raw", "vectors", "being", "used", "by", "the", "kernel", "points", ".", "Altering", "this", "vectors", "will", "alter", "the", "same", "vectors", "used", "by", "these", "objects", "and", "will", "cause", "inconsistent", ...
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/kernels/KernelPoints.java#L628-L633
53,015
EdwardRaff/JSAT
JSAT/src/jsat/distributions/kernels/KernelPoints.java
KernelPoints.addMissingZeros
private void addMissingZeros() { //go back and add 0s for the onces we missed for (int i = 0; i < points.size(); i++) while(points.get(i).alpha.size() < this.points.get(0).vecs.size()) points.get(i).alpha.add(0.0); }
java
private void addMissingZeros() { //go back and add 0s for the onces we missed for (int i = 0; i < points.size(); i++) while(points.get(i).alpha.size() < this.points.get(0).vecs.size()) points.get(i).alpha.add(0.0); }
[ "private", "void", "addMissingZeros", "(", ")", "{", "//go back and add 0s for the onces we missed", "for", "(", "int", "i", "=", "0", ";", "i", "<", "points", ".", "size", "(", ")", ";", "i", "++", ")", "while", "(", "points", ".", "get", "(", "i", ")...
Adds zeros to all alpha vecs that are not of the same length as the vec list
[ "Adds", "zeros", "to", "all", "alpha", "vecs", "that", "are", "not", "of", "the", "same", "length", "as", "the", "vec", "list" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/kernels/KernelPoints.java#L654-L660
53,016
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/linear/kernelized/OSKL.java
OSKL.updateAverage
private void updateAverage() { if(t == last_t || t < burnIn) return; else if(last_t < burnIn)//first update since done burning { for(int i = 0; i < alphaAveraged.size(); i++) alphaAveraged.set(i, alphas.get(i)); } double w = t-last_t;/...
java
private void updateAverage() { if(t == last_t || t < burnIn) return; else if(last_t < burnIn)//first update since done burning { for(int i = 0; i < alphaAveraged.size(); i++) alphaAveraged.set(i, alphas.get(i)); } double w = t-last_t;/...
[ "private", "void", "updateAverage", "(", ")", "{", "if", "(", "t", "==", "last_t", "||", "t", "<", "burnIn", ")", "return", ";", "else", "if", "(", "last_t", "<", "burnIn", ")", "//first update since done burning ", "{", "for", "(", "int", "i", "=", "0...
Updates the average model to reflect the current time average
[ "Updates", "the", "average", "model", "to", "reflect", "the", "current", "time", "average" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/kernelized/OSKL.java#L419-L435
53,017
EdwardRaff/JSAT
JSAT/src/jsat/distributions/kernels/GeneralRBFKernel.java
GeneralRBFKernel.setSigma
public void setSigma(double sigma) { if(sigma <= 0 || Double.isNaN(sigma) || Double.isInfinite(sigma)) throw new IllegalArgumentException("Sigma must be a positive constant, not " + sigma); this.sigma = sigma; this.sigmaSqrd2Inv = 0.5/(sigma*sigma); }
java
public void setSigma(double sigma) { if(sigma <= 0 || Double.isNaN(sigma) || Double.isInfinite(sigma)) throw new IllegalArgumentException("Sigma must be a positive constant, not " + sigma); this.sigma = sigma; this.sigmaSqrd2Inv = 0.5/(sigma*sigma); }
[ "public", "void", "setSigma", "(", "double", "sigma", ")", "{", "if", "(", "sigma", "<=", "0", "||", "Double", ".", "isNaN", "(", "sigma", ")", "||", "Double", ".", "isInfinite", "(", "sigma", ")", ")", "throw", "new", "IllegalArgumentException", "(", ...
Sets the kernel width parameter, which must be a positive value. Larger values indicate a larger width @param sigma the sigma value
[ "Sets", "the", "kernel", "width", "parameter", "which", "must", "be", "a", "positive", "value", ".", "Larger", "values", "indicate", "a", "larger", "width" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/kernels/GeneralRBFKernel.java#L57-L63
53,018
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/linear/StochasticSTLinearL1.java
StochasticSTLinearL1.setMaxScaled
public void setMaxScaled(double maxFeature) { if(Double.isNaN(maxFeature)) throw new ArithmeticException("NaN is not a valid feature value"); else if(maxFeature > 1) throw new ArithmeticException("Maximum possible feature value is 1, can not use " + maxFeature); else ...
java
public void setMaxScaled(double maxFeature) { if(Double.isNaN(maxFeature)) throw new ArithmeticException("NaN is not a valid feature value"); else if(maxFeature > 1) throw new ArithmeticException("Maximum possible feature value is 1, can not use " + maxFeature); else ...
[ "public", "void", "setMaxScaled", "(", "double", "maxFeature", ")", "{", "if", "(", "Double", ".", "isNaN", "(", "maxFeature", ")", ")", "throw", "new", "ArithmeticException", "(", "\"NaN is not a valid feature value\"", ")", ";", "else", "if", "(", "maxFeature"...
Sets the maximum value of any feature after scaling is applied. This value can be no greater than 1. @param maxFeature the maximum feature value after scaling
[ "Sets", "the", "maximum", "value", "of", "any", "feature", "after", "scaling", "is", "applied", ".", "This", "value", "can", "be", "no", "greater", "than", "1", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/StochasticSTLinearL1.java#L233-L242
53,019
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/linear/StochasticSTLinearL1.java
StochasticSTLinearL1.setMinScaled
public void setMinScaled(double minFeature) { if(Double.isNaN(minFeature)) throw new ArithmeticException("NaN is not a valid feature value"); else if(minFeature < -1) throw new ArithmeticException("Minimum possible feature value is -1, can not use " + minFeature); els...
java
public void setMinScaled(double minFeature) { if(Double.isNaN(minFeature)) throw new ArithmeticException("NaN is not a valid feature value"); else if(minFeature < -1) throw new ArithmeticException("Minimum possible feature value is -1, can not use " + minFeature); els...
[ "public", "void", "setMinScaled", "(", "double", "minFeature", ")", "{", "if", "(", "Double", ".", "isNaN", "(", "minFeature", ")", ")", "throw", "new", "ArithmeticException", "(", "\"NaN is not a valid feature value\"", ")", ";", "else", "if", "(", "minFeature"...
Sets the minimum value of any feature after scaling is applied. This value can be no smaller than -1 @param minFeature the minimum feature value after scaling
[ "Sets", "the", "minimum", "value", "of", "any", "feature", "after", "scaling", "is", "applied", ".", "This", "value", "can", "be", "no", "smaller", "than", "-", "1" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/StochasticSTLinearL1.java#L258-L267
53,020
EdwardRaff/JSAT
JSAT/src/jsat/distributions/kernels/PukKernel.java
PukKernel.setOmega
public void setOmega(double omega) { if(omega <= 0 || Double.isNaN(omega) || Double.isInfinite(omega)) throw new ArithmeticException("omega must be positive, not " + omega); this.omega = omega; this.cnst = Math.sqrt(Math.pow(2, 1/omega)-1); }
java
public void setOmega(double omega) { if(omega <= 0 || Double.isNaN(omega) || Double.isInfinite(omega)) throw new ArithmeticException("omega must be positive, not " + omega); this.omega = omega; this.cnst = Math.sqrt(Math.pow(2, 1/omega)-1); }
[ "public", "void", "setOmega", "(", "double", "omega", ")", "{", "if", "(", "omega", "<=", "0", "||", "Double", ".", "isNaN", "(", "omega", ")", "||", "Double", ".", "isInfinite", "(", "omega", ")", ")", "throw", "new", "ArithmeticException", "(", "\"om...
Sets the omega parameter value, which controls the shape of the kernel @param omega the positive parameter value
[ "Sets", "the", "omega", "parameter", "value", "which", "controls", "the", "shape", "of", "the", "kernel" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/kernels/PukKernel.java#L47-L53
53,021
EdwardRaff/JSAT
JSAT/src/jsat/distributions/kernels/PukKernel.java
PukKernel.setSigma
public void setSigma(double sigma) { if(sigma <= 0 || Double.isNaN(sigma) || Double.isInfinite(sigma)) throw new ArithmeticException("sigma must be positive, not " + sigma); this.sigma = sigma; }
java
public void setSigma(double sigma) { if(sigma <= 0 || Double.isNaN(sigma) || Double.isInfinite(sigma)) throw new ArithmeticException("sigma must be positive, not " + sigma); this.sigma = sigma; }
[ "public", "void", "setSigma", "(", "double", "sigma", ")", "{", "if", "(", "sigma", "<=", "0", "||", "Double", ".", "isNaN", "(", "sigma", ")", "||", "Double", ".", "isInfinite", "(", "sigma", ")", ")", "throw", "new", "ArithmeticException", "(", "\"si...
Sets the sigma parameter value, which controls the width of the kernel @param sigma the positive parameter value
[ "Sets", "the", "sigma", "parameter", "value", "which", "controls", "the", "width", "of", "the", "kernel" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/kernels/PukKernel.java#L64-L69
53,022
EdwardRaff/JSAT
JSAT/src/jsat/datatransform/PCA.java
PCA.getColumn
private static Vec getColumn(Matrix x) { Vec t; for(int i = 0; i < x.cols(); i++) { t = x.getColumn(i); if(t.dot(t) > 0 ) return t; } throw new ArithmeticException("Matrix is essentially zero"); }
java
private static Vec getColumn(Matrix x) { Vec t; for(int i = 0; i < x.cols(); i++) { t = x.getColumn(i); if(t.dot(t) > 0 ) return t; } throw new ArithmeticException("Matrix is essentially zero"); }
[ "private", "static", "Vec", "getColumn", "(", "Matrix", "x", ")", "{", "Vec", "t", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "x", ".", "cols", "(", ")", ";", "i", "++", ")", "{", "t", "=", "x", ".", "getColumn", "(", "i", ")", ...
Returns the first non zero column @param x the matrix to get a column from @return the first non zero column
[ "Returns", "the", "first", "non", "zero", "column" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/datatransform/PCA.java#L246-L258
53,023
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/linear/LinearBatch.java
LinearBatch.doWarmStartIfNotNull
private void doWarmStartIfNotNull(Object warmSolution) throws FailedToFitException { if(warmSolution != null ) { if(warmSolution instanceof SimpleWeightVectorModel) { SimpleWeightVectorModel warm = (SimpleWeightVectorModel) warmSolution; if(war...
java
private void doWarmStartIfNotNull(Object warmSolution) throws FailedToFitException { if(warmSolution != null ) { if(warmSolution instanceof SimpleWeightVectorModel) { SimpleWeightVectorModel warm = (SimpleWeightVectorModel) warmSolution; if(war...
[ "private", "void", "doWarmStartIfNotNull", "(", "Object", "warmSolution", ")", "throws", "FailedToFitException", "{", "if", "(", "warmSolution", "!=", "null", ")", "{", "if", "(", "warmSolution", "instanceof", "SimpleWeightVectorModel", ")", "{", "SimpleWeightVectorMo...
Performs a warm start if the given object is of the appropriate class. Nothing happens if input it null. @param warmSolution @throws FailedToFitException
[ "Performs", "a", "warm", "start", "if", "the", "given", "object", "is", "of", "the", "appropriate", "class", ".", "Nothing", "happens", "if", "input", "it", "null", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/LinearBatch.java#L328-L347
53,024
EdwardRaff/JSAT
JSAT/src/jsat/utils/ListUtils.java
ListUtils.mergedView
public static <T> List<T> mergedView(final List<T> left, final List<T> right) { List<T> merged = new AbstractList<T>() { @Override public T get(int index) { if(index < left.size()) return left.get(index); else ...
java
public static <T> List<T> mergedView(final List<T> left, final List<T> right) { List<T> merged = new AbstractList<T>() { @Override public T get(int index) { if(index < left.size()) return left.get(index); else ...
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "mergedView", "(", "final", "List", "<", "T", ">", "left", ",", "final", "List", "<", "T", ">", "right", ")", "{", "List", "<", "T", ">", "merged", "=", "new", "AbstractList", "<", "T", ...
Returns a new unmodifiable view that is the merging of two lists @param <T> the type the lists hold @param left the left portion of the merged view @param right the right portion of the merged view @return a list view that contains bot the left and right lists
[ "Returns", "a", "new", "unmodifiable", "view", "that", "is", "the", "merging", "of", "two", "lists" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/ListUtils.java#L66-L89
53,025
EdwardRaff/JSAT
JSAT/src/jsat/utils/ListUtils.java
ListUtils.collectFutures
public static <T> List<T> collectFutures(Collection<Future<T>> futures) throws ExecutionException, InterruptedException { ArrayList<T> collected = new ArrayList<T>(futures.size()); for (Future<T> future : futures) collected.add(future.get()); return collected; }
java
public static <T> List<T> collectFutures(Collection<Future<T>> futures) throws ExecutionException, InterruptedException { ArrayList<T> collected = new ArrayList<T>(futures.size()); for (Future<T> future : futures) collected.add(future.get()); return collected; }
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "collectFutures", "(", "Collection", "<", "Future", "<", "T", ">", ">", "futures", ")", "throws", "ExecutionException", ",", "InterruptedException", "{", "ArrayList", "<", "T", ">", "collected", "="...
Collects all future values in a collection into a list, and returns said list. This method will block until all future objects are collected. @param <T> the type of future object @param futures the collection of future objects @return a list containing the object from the future. @throws ExecutionException @throws Inte...
[ "Collects", "all", "future", "values", "in", "a", "collection", "into", "a", "list", "and", "returns", "said", "list", ".", "This", "method", "will", "block", "until", "all", "future", "objects", "are", "collected", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/ListUtils.java#L112-L120
53,026
EdwardRaff/JSAT
JSAT/src/jsat/utils/ListUtils.java
ListUtils.range
public static IntList range(int start, int to, int step) { if(to < start) throw new RuntimeException("starting index " + start + " must be less than or equal to ending index" + to); else if(step < 1) throw new RuntimeException("Step size must be a positive integer, not " + st...
java
public static IntList range(int start, int to, int step) { if(to < start) throw new RuntimeException("starting index " + start + " must be less than or equal to ending index" + to); else if(step < 1) throw new RuntimeException("Step size must be a positive integer, not " + st...
[ "public", "static", "IntList", "range", "(", "int", "start", ",", "int", "to", ",", "int", "step", ")", "{", "if", "(", "to", "<", "start", ")", "throw", "new", "RuntimeException", "(", "\"starting index \"", "+", "start", "+", "\" must be less than or equal...
Returns a list of integers with values in the given range @param start the starting integer value (inclusive) @param to the ending integer value (exclusive) @param step the step size between values @return a list of integers containing the specified range of integers
[ "Returns", "a", "list", "of", "integers", "with", "values", "in", "the", "given", "range" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/ListUtils.java#L160-L170
53,027
EdwardRaff/JSAT
JSAT/src/jsat/distributions/discrete/DiscreteDistribution.java
DiscreteDistribution.invCdfRootFinding
protected double invCdfRootFinding(double p, double tol) { if (p < 0 || p > 1) throw new ArithmeticException("Value of p must be in the range [0,1], not " + p); //two special case checks, as they can cause a failure to get a positive and negative value on the ends, which means we can...
java
protected double invCdfRootFinding(double p, double tol) { if (p < 0 || p > 1) throw new ArithmeticException("Value of p must be in the range [0,1], not " + p); //two special case checks, as they can cause a failure to get a positive and negative value on the ends, which means we can...
[ "protected", "double", "invCdfRootFinding", "(", "double", "p", ",", "double", "tol", ")", "{", "if", "(", "p", "<", "0", "||", "p", ">", "1", ")", "throw", "new", "ArithmeticException", "(", "\"Value of p must be in the range [0,1], not \"", "+", "p", ")", ...
Helper method that computes the inverse CDF by performing root-finding on the CDF of the function. This provides a convenient default method for any invCdfRootFinding implementation, but may not be as fast or accurate as possible. @param p the probability value @param tol the search tolerance @return the value such th...
[ "Helper", "method", "that", "computes", "the", "inverse", "CDF", "by", "performing", "root", "-", "finding", "on", "the", "CDF", "of", "the", "function", ".", "This", "provides", "a", "convenient", "default", "method", "for", "any", "invCdfRootFinding", "imple...
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/discrete/DiscreteDistribution.java#L87-L122
53,028
EdwardRaff/JSAT
JSAT/src/jsat/math/optimization/stochastic/SGDMomentum.java
SGDMomentum.setMomentum
public void setMomentum(double momentum) { if(momentum <= 0 || momentum >= 1 || Double.isNaN(momentum)) throw new IllegalArgumentException("Momentum must be in (0,1) not " + momentum); this.momentum = momentum; }
java
public void setMomentum(double momentum) { if(momentum <= 0 || momentum >= 1 || Double.isNaN(momentum)) throw new IllegalArgumentException("Momentum must be in (0,1) not " + momentum); this.momentum = momentum; }
[ "public", "void", "setMomentum", "(", "double", "momentum", ")", "{", "if", "(", "momentum", "<=", "0", "||", "momentum", ">=", "1", "||", "Double", ".", "isNaN", "(", "momentum", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"Momentum must be...
Sets the momentum for accumulating gradients. @param momentum the momentum buildup term in (0, 1)
[ "Sets", "the", "momentum", "for", "accumulating", "gradients", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/optimization/stochastic/SGDMomentum.java#L70-L75
53,029
EdwardRaff/JSAT
JSAT/src/jsat/distributions/Normal.java
Normal.logPdf
public static double logPdf(double x, double mu, double sigma) { return -0.5*log(2*PI) - log(sigma) + -pow(x-mu,2)/(2*sigma*sigma); }
java
public static double logPdf(double x, double mu, double sigma) { return -0.5*log(2*PI) - log(sigma) + -pow(x-mu,2)/(2*sigma*sigma); }
[ "public", "static", "double", "logPdf", "(", "double", "x", ",", "double", "mu", ",", "double", "sigma", ")", "{", "return", "-", "0.5", "*", "log", "(", "2", "*", "PI", ")", "-", "log", "(", "sigma", ")", "+", "-", "pow", "(", "x", "-", "mu", ...
Computes the log probability of a given value @param x the value to the get log(pdf) of @param mu the mean of the distribution @param sigma the standard deviation of the distribution @return the log probability
[ "Computes", "the", "log", "probability", "of", "a", "given", "value" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/Normal.java#L152-L155
53,030
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/linear/SMIDAS.java
SMIDAS.setEta
public void setEta(double eta) { if(Double.isNaN(eta) || Double.isInfinite(eta) || eta <= 0) throw new ArithmeticException("convergence parameter must be a positive value"); this.eta = eta; }
java
public void setEta(double eta) { if(Double.isNaN(eta) || Double.isInfinite(eta) || eta <= 0) throw new ArithmeticException("convergence parameter must be a positive value"); this.eta = eta; }
[ "public", "void", "setEta", "(", "double", "eta", ")", "{", "if", "(", "Double", ".", "isNaN", "(", "eta", ")", "||", "Double", ".", "isInfinite", "(", "eta", ")", "||", "eta", "<=", "0", ")", "throw", "new", "ArithmeticException", "(", "\"convergence ...
Sets the learning rate used during training @param eta the learning rate to use
[ "Sets", "the", "learning", "rate", "used", "during", "training" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/SMIDAS.java#L90-L95
53,031
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/knn/DANN.java
DANN.setEpsilon
public void setEpsilon(double eps) { if(eps < 0 || Double.isInfinite(eps) || Double.isNaN(eps)) throw new ArithmeticException("Regularization must be a positive value"); this.eps = eps; }
java
public void setEpsilon(double eps) { if(eps < 0 || Double.isInfinite(eps) || Double.isNaN(eps)) throw new ArithmeticException("Regularization must be a positive value"); this.eps = eps; }
[ "public", "void", "setEpsilon", "(", "double", "eps", ")", "{", "if", "(", "eps", "<", "0", "||", "Double", ".", "isInfinite", "(", "eps", ")", "||", "Double", ".", "isNaN", "(", "eps", ")", ")", "throw", "new", "ArithmeticException", "(", "\"Regulariz...
Sets the regularization to apply the the diagonal of the scatter matrix when creating each new metric. @param eps the regularization value
[ "Sets", "the", "regularization", "to", "apply", "the", "the", "diagonal", "of", "the", "scatter", "matrix", "when", "creating", "each", "new", "metric", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/knn/DANN.java#L212-L217
53,032
EdwardRaff/JSAT
JSAT/src/jsat/clustering/OPTICS.java
OPTICS.threshHoldExtractCluster
private int threshHoldExtractCluster(List<Integer> orderedFile, int[] designations) { int clustersFound = 0; OnLineStatistics stats = new OnLineStatistics(); for(double r : reach_d) if(!Double.isInfinite(r)) stats.add(r); double thresh = stats.get...
java
private int threshHoldExtractCluster(List<Integer> orderedFile, int[] designations) { int clustersFound = 0; OnLineStatistics stats = new OnLineStatistics(); for(double r : reach_d) if(!Double.isInfinite(r)) stats.add(r); double thresh = stats.get...
[ "private", "int", "threshHoldExtractCluster", "(", "List", "<", "Integer", ">", "orderedFile", ",", "int", "[", "]", "designations", ")", "{", "int", "clustersFound", "=", "0", ";", "OnLineStatistics", "stats", "=", "new", "OnLineStatistics", "(", ")", ";", ...
Finds clusters by segmenting the reachability plot witha line that is the mean reachability distance times @param orderedFile the ordering of the data points @param designations the storage array for their cluster assignment @return the number of clusters found
[ "Finds", "clusters", "by", "segmenting", "the", "reachability", "plot", "witha", "line", "that", "is", "the", "mean", "reachability", "distance", "times" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/clustering/OPTICS.java#L334-L356
53,033
EdwardRaff/JSAT
JSAT/src/jsat/text/topicmodel/OnlineLDAsvi.java
OnlineLDAsvi.setK
public void setK(final int K) { if(K < 2) throw new IllegalArgumentException("At least 2 topics must be learned"); this.K = K; gammaLocal = new ThreadLocal<Vec>() { @Override protected Vec initialValue() { return new Den...
java
public void setK(final int K) { if(K < 2) throw new IllegalArgumentException("At least 2 topics must be learned"); this.K = K; gammaLocal = new ThreadLocal<Vec>() { @Override protected Vec initialValue() { return new Den...
[ "public", "void", "setK", "(", "final", "int", "K", ")", "{", "if", "(", "K", "<", "2", ")", "throw", "new", "IllegalArgumentException", "(", "\"At least 2 topics must be learned\"", ")", ";", "this", ".", "K", "=", "K", ";", "gammaLocal", "=", "new", "T...
Sets the number of topics that LDA will try to learn @param K the number of topics to learn
[ "Sets", "the", "number", "of", "topics", "that", "LDA", "will", "try", "to", "learn" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/text/topicmodel/OnlineLDAsvi.java#L165-L196
53,034
EdwardRaff/JSAT
JSAT/src/jsat/text/topicmodel/OnlineLDAsvi.java
OnlineLDAsvi.setTau0
public void setTau0(double tau0) { if(tau0 <= 0 || Double.isInfinite(tau0) || Double.isNaN(tau0)) throw new IllegalArgumentException("Eta must be a positive constant, not " + tau0); this.tau0 = tau0; }
java
public void setTau0(double tau0) { if(tau0 <= 0 || Double.isInfinite(tau0) || Double.isNaN(tau0)) throw new IllegalArgumentException("Eta must be a positive constant, not " + tau0); this.tau0 = tau0; }
[ "public", "void", "setTau0", "(", "double", "tau0", ")", "{", "if", "(", "tau0", "<=", "0", "||", "Double", ".", "isInfinite", "(", "tau0", ")", "||", "Double", ".", "isNaN", "(", "tau0", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"Et...
A learning rate constant to control the influence of early iterations on the solution. Larger values reduce the influence of earlier iterations, smaller values increase the weight of earlier iterations. @param tau0 a learning rate parameter that must be greater than 0 (usually at least 1)
[ "A", "learning", "rate", "constant", "to", "control", "the", "influence", "of", "early", "iterations", "on", "the", "solution", ".", "Larger", "values", "reduce", "the", "influence", "of", "earlier", "iterations", "smaller", "values", "increase", "the", "weight"...
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/text/topicmodel/OnlineLDAsvi.java#L299-L304
53,035
EdwardRaff/JSAT
JSAT/src/jsat/text/topicmodel/OnlineLDAsvi.java
OnlineLDAsvi.setKappa
public void setKappa(double kappa) { if(kappa < 0.5 || kappa > 1.0 || Double.isNaN(kappa)) throw new IllegalArgumentException("Kapp must be in [0.5, 1], not " + kappa); this.kappa = kappa; }
java
public void setKappa(double kappa) { if(kappa < 0.5 || kappa > 1.0 || Double.isNaN(kappa)) throw new IllegalArgumentException("Kapp must be in [0.5, 1], not " + kappa); this.kappa = kappa; }
[ "public", "void", "setKappa", "(", "double", "kappa", ")", "{", "if", "(", "kappa", "<", "0.5", "||", "kappa", ">", "1.0", "||", "Double", ".", "isNaN", "(", "kappa", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"Kapp must be in [0.5, 1], not...
The "forgetfulness" factor in the learning rate. Larger values increase the rate at which old information is "forgotten" @param kappa the forgetfulness factor in [0.5, 1]
[ "The", "forgetfulness", "factor", "in", "the", "learning", "rate", ".", "Larger", "values", "increase", "the", "rate", "at", "which", "old", "information", "is", "forgotten" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/text/topicmodel/OnlineLDAsvi.java#L331-L336
53,036
EdwardRaff/JSAT
JSAT/src/jsat/text/topicmodel/OnlineLDAsvi.java
OnlineLDAsvi.getTopicVec
public Vec getTopicVec(int k) { return new ScaledVector(1.0/lambda.get(k).sum(), lambda.get(k)); }
java
public Vec getTopicVec(int k) { return new ScaledVector(1.0/lambda.get(k).sum(), lambda.get(k)); }
[ "public", "Vec", "getTopicVec", "(", "int", "k", ")", "{", "return", "new", "ScaledVector", "(", "1.0", "/", "lambda", ".", "get", "(", "k", ")", ".", "sum", "(", ")", ",", "lambda", ".", "get", "(", "k", ")", ")", ";", "}" ]
Returns the topic vector for a given topic. The vector should not be altered, and is scaled so that the sum of all term weights sums to one. @param k the topic to get the vector for @return the raw topic vector for the requested topic.
[ "Returns", "the", "topic", "vector", "for", "a", "given", "topic", ".", "The", "vector", "should", "not", "be", "altered", "and", "is", "scaled", "so", "that", "the", "sum", "of", "all", "term", "weights", "sums", "to", "one", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/text/topicmodel/OnlineLDAsvi.java#L365-L368
53,037
EdwardRaff/JSAT
JSAT/src/jsat/text/topicmodel/OnlineLDAsvi.java
OnlineLDAsvi.model
public void model(DataSet dataSet, int topics, ExecutorService ex) { if(ex == null) ex = new FakeExecutor(); //Use notation same as original paper setK(topics); setD(dataSet.size()); setVocabSize(dataSet.getNumNumericalVars()); final List<Vec> doc...
java
public void model(DataSet dataSet, int topics, ExecutorService ex) { if(ex == null) ex = new FakeExecutor(); //Use notation same as original paper setK(topics); setD(dataSet.size()); setVocabSize(dataSet.getNumNumericalVars()); final List<Vec> doc...
[ "public", "void", "model", "(", "DataSet", "dataSet", ",", "int", "topics", ",", "ExecutorService", "ex", ")", "{", "if", "(", "ex", "==", "null", ")", "ex", "=", "new", "FakeExecutor", "(", ")", ";", "//Use notation same as original paper", "setK", "(", "...
Fits the LDA model against the given data set @param dataSet the data set to learn a topic model for @param topics the number of topics to learn @param ex the source of threads for parallel execution
[ "Fits", "the", "LDA", "model", "against", "the", "given", "data", "set" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/text/topicmodel/OnlineLDAsvi.java#L560-L581
53,038
EdwardRaff/JSAT
JSAT/src/jsat/text/topicmodel/OnlineLDAsvi.java
OnlineLDAsvi.prepareGammaTheta
private void prepareGammaTheta(Vec gamma_i, Vec eLogTheta_i, Vec expLogTheta_i, Random rand) { final double lambdaInv = (W * K) / (D * 100.0); for (int j = 0; j < gamma_i.length(); j++) gamma_i.set(j, sampleExpoDist(lambdaInv, rand.nextDouble()) + eta); expandPsiMinusPsiSum(gamm...
java
private void prepareGammaTheta(Vec gamma_i, Vec eLogTheta_i, Vec expLogTheta_i, Random rand) { final double lambdaInv = (W * K) / (D * 100.0); for (int j = 0; j < gamma_i.length(); j++) gamma_i.set(j, sampleExpoDist(lambdaInv, rand.nextDouble()) + eta); expandPsiMinusPsiSum(gamm...
[ "private", "void", "prepareGammaTheta", "(", "Vec", "gamma_i", ",", "Vec", "eLogTheta_i", ",", "Vec", "expLogTheta_i", ",", "Random", "rand", ")", "{", "final", "double", "lambdaInv", "=", "(", "W", "*", "K", ")", "/", "(", "D", "*", "100.0", ")", ";",...
Prepares gamma and the associated theta expectations are initialized so that the iterative updates to them can begin. @param gamma_i will be completely overwritten @param eLogTheta_i will be completely overwritten @param expLogTheta_i will be completely overwritten @param rand the source of randomness
[ "Prepares", "gamma", "and", "the", "associated", "theta", "expectations", "are", "initialized", "so", "that", "the", "iterative", "updates", "to", "them", "can", "begin", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/text/topicmodel/OnlineLDAsvi.java#L678-L687
53,039
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/bayesian/graphicalmodel/DirectedGraph.java
DirectedGraph.addNode
public void addNode(N node) { if(!nodes.containsKey(node)) nodes.put(node, new Pair<HashSet<N>, HashSet<N>>(new HashSet<N>(), new HashSet<N>())); }
java
public void addNode(N node) { if(!nodes.containsKey(node)) nodes.put(node, new Pair<HashSet<N>, HashSet<N>>(new HashSet<N>(), new HashSet<N>())); }
[ "public", "void", "addNode", "(", "N", "node", ")", "{", "if", "(", "!", "nodes", ".", "containsKey", "(", "node", ")", ")", "nodes", ".", "put", "(", "node", ",", "new", "Pair", "<", "HashSet", "<", "N", ">", ",", "HashSet", "<", "N", ">", ">"...
Adds a new node to the graph @param node the object to make a node
[ "Adds", "a", "new", "node", "to", "the", "graph" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/bayesian/graphicalmodel/DirectedGraph.java#L108-L112
53,040
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/bayesian/graphicalmodel/DirectedGraph.java
DirectedGraph.getParents
public Set<N> getParents(N n) { Pair<HashSet<N>, HashSet<N>> p = nodes.get(n); if(p == null) return null; return p.getIncoming(); }
java
public Set<N> getParents(N n) { Pair<HashSet<N>, HashSet<N>> p = nodes.get(n); if(p == null) return null; return p.getIncoming(); }
[ "public", "Set", "<", "N", ">", "getParents", "(", "N", "n", ")", "{", "Pair", "<", "HashSet", "<", "N", ">", ",", "HashSet", "<", "N", ">", ">", "p", "=", "nodes", ".", "get", "(", "n", ")", ";", "if", "(", "p", "==", "null", ")", "return"...
Returns the set of all parents of the requested node, or null if the node does not exist in the graph @param n the node to obtain the parents of @return the set of parents, or null if the node is not in the graph
[ "Returns", "the", "set", "of", "all", "parents", "of", "the", "requested", "node", "or", "null", "if", "the", "node", "does", "not", "exist", "in", "the", "graph" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/bayesian/graphicalmodel/DirectedGraph.java#L119-L127
53,041
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/bayesian/graphicalmodel/DirectedGraph.java
DirectedGraph.getChildren
public Set<N> getChildren(N n) { Pair<HashSet<N>, HashSet<N>> p = nodes.get(n); if(p == null) return null; return p.getOutgoing(); }
java
public Set<N> getChildren(N n) { Pair<HashSet<N>, HashSet<N>> p = nodes.get(n); if(p == null) return null; return p.getOutgoing(); }
[ "public", "Set", "<", "N", ">", "getChildren", "(", "N", "n", ")", "{", "Pair", "<", "HashSet", "<", "N", ">", ",", "HashSet", "<", "N", ">", ">", "p", "=", "nodes", ".", "get", "(", "n", ")", ";", "if", "(", "p", "==", "null", ")", "return...
Returns the set of all children of the requested node, or null if the node does not exist in the graph. @param n the node to obtain the children of @return the set of parents, or null if the node is not in the graph
[ "Returns", "the", "set", "of", "all", "children", "of", "the", "requested", "node", "or", "null", "if", "the", "node", "does", "not", "exist", "in", "the", "graph", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/bayesian/graphicalmodel/DirectedGraph.java#L134-L142
53,042
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/bayesian/graphicalmodel/DirectedGraph.java
DirectedGraph.removeNode
public void removeNode(N node) { Pair<HashSet<N>, HashSet<N>> p = nodes.remove(node); if(p == null) return; //Outgoing edges we can ignore removint he node drops them. We need to avoid dangling incoming edges to this node we have removed HashSet<N> incomingNodes = p.getIn...
java
public void removeNode(N node) { Pair<HashSet<N>, HashSet<N>> p = nodes.remove(node); if(p == null) return; //Outgoing edges we can ignore removint he node drops them. We need to avoid dangling incoming edges to this node we have removed HashSet<N> incomingNodes = p.getIn...
[ "public", "void", "removeNode", "(", "N", "node", ")", "{", "Pair", "<", "HashSet", "<", "N", ">", ",", "HashSet", "<", "N", ">", ">", "p", "=", "nodes", ".", "remove", "(", "node", ")", ";", "if", "(", "p", "==", "null", ")", "return", ";", ...
Removes the specified node from the graph. If the node was not in the graph, not change occurs @param node the node to remove from the graph
[ "Removes", "the", "specified", "node", "from", "the", "graph", ".", "If", "the", "node", "was", "not", "in", "the", "graph", "not", "change", "occurs" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/bayesian/graphicalmodel/DirectedGraph.java#L148-L157
53,043
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/bayesian/graphicalmodel/DiscreteBayesNetwork.java
DiscreteBayesNetwork.depends
public void depends(int parent, int child) { dag.addNode(child); dag.addNode(parent); dag.addEdge(parent, child); }
java
public void depends(int parent, int child) { dag.addNode(child); dag.addNode(parent); dag.addEdge(parent, child); }
[ "public", "void", "depends", "(", "int", "parent", ",", "int", "child", ")", "{", "dag", ".", "addNode", "(", "child", ")", ";", "dag", ".", "addNode", "(", "parent", ")", ";", "dag", ".", "addEdge", "(", "parent", ",", "child", ")", ";", "}" ]
Adds a dependency relation ship between two variables that will be in the network. The integer value corresponds the the index of the i'th categorical variable, where the class target's value is the number of categorical variables. @param parent the parent variable, which will be explained in part by the child @param...
[ "Adds", "a", "dependency", "relation", "ship", "between", "two", "variables", "that", "will", "be", "in", "the", "network", ".", "The", "integer", "value", "corresponds", "the", "the", "index", "of", "the", "i", "th", "categorical", "variable", "where", "the...
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/bayesian/graphicalmodel/DiscreteBayesNetwork.java#L98-L103
53,044
EdwardRaff/JSAT
JSAT/src/jsat/math/decayrates/PowerDecay.java
PowerDecay.setTau
public void setTau(double tau) { if(tau <= 0 || Double.isInfinite(tau) || Double.isNaN(tau)) throw new IllegalArgumentException("tau must be a positive constant, not " + tau); this.tau = tau; }
java
public void setTau(double tau) { if(tau <= 0 || Double.isInfinite(tau) || Double.isNaN(tau)) throw new IllegalArgumentException("tau must be a positive constant, not " + tau); this.tau = tau; }
[ "public", "void", "setTau", "(", "double", "tau", ")", "{", "if", "(", "tau", "<=", "0", "||", "Double", ".", "isInfinite", "(", "tau", ")", "||", "Double", ".", "isNaN", "(", "tau", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"tau mus...
Controls the rate early in time, but has a decreasing impact on the rate returned as time goes forward. Larger values of &tau; dampen the initial rates returned, while lower values let the initial rates start higher. @param tau the early rate dampening parameter
[ "Controls", "the", "rate", "early", "in", "time", "but", "has", "a", "decreasing", "impact", "on", "the", "rate", "returned", "as", "time", "goes", "forward", ".", "Larger", "values", "of", "&tau", ";", "dampen", "the", "initial", "rates", "returned", "whi...
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/decayrates/PowerDecay.java#L75-L80
53,045
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/trees/TreeNodeVisitor.java
TreeNodeVisitor.regress
public double regress(DataPoint dp) { TreeNodeVisitor node = this; while(!node.isLeaf()) { int path = node.getPath(dp); if(path < 0 )//missing value case { double sum = 0; double resultSum = 0; for(int child ...
java
public double regress(DataPoint dp) { TreeNodeVisitor node = this; while(!node.isLeaf()) { int path = node.getPath(dp); if(path < 0 )//missing value case { double sum = 0; double resultSum = 0; for(int child ...
[ "public", "double", "regress", "(", "DataPoint", "dp", ")", "{", "TreeNodeVisitor", "node", "=", "this", ";", "while", "(", "!", "node", ".", "isLeaf", "(", ")", ")", "{", "int", "path", "=", "node", ".", "getPath", "(", "dp", ")", ";", "if", "(", ...
Performs regression on the given data point by following it down the tree until it finds the correct terminal node. @param dp the data point to regress @return the regression result from the tree starting from the current node
[ "Performs", "regression", "on", "the", "given", "data", "point", "by", "following", "it", "down", "the", "tree", "until", "it", "finds", "the", "correct", "terminal", "node", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/trees/TreeNodeVisitor.java#L185-L216
53,046
EdwardRaff/JSAT
JSAT/src/jsat/utils/concurrent/AtomicDouble.java
AtomicDouble.updateAndGet
public final double updateAndGet(DoubleUnaryOperator updateFunction) { double prev, next; do { prev = get(); next = updateFunction.applyAsDouble(prev); } while (!compareAndSet(prev, next)); return next; }
java
public final double updateAndGet(DoubleUnaryOperator updateFunction) { double prev, next; do { prev = get(); next = updateFunction.applyAsDouble(prev); } while (!compareAndSet(prev, next)); return next; }
[ "public", "final", "double", "updateAndGet", "(", "DoubleUnaryOperator", "updateFunction", ")", "{", "double", "prev", ",", "next", ";", "do", "{", "prev", "=", "get", "(", ")", ";", "next", "=", "updateFunction", ".", "applyAsDouble", "(", "prev", ")", ";...
Atomically updates the current value with the results of applying the given function, returning the updated value. The function should be side-effect-free, since it may be re-applied when attempted updates fail due to contention among threads. @param updateFunction a side-effect-free function @return the updated value
[ "Atomically", "updates", "the", "current", "value", "with", "the", "results", "of", "applying", "the", "given", "function", "returning", "the", "updated", "value", ".", "The", "function", "should", "be", "side", "-", "effect", "-", "free", "since", "it", "ma...
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/concurrent/AtomicDouble.java#L72-L82
53,047
EdwardRaff/JSAT
JSAT/src/jsat/utils/concurrent/AtomicDouble.java
AtomicDouble.getAndAccumulate
public final double getAndAccumulate(double x, DoubleBinaryOperator accumulatorFunction) { double prev, next; do { prev = get(); next = accumulatorFunction.applyAsDouble(prev, x); } while (!compareAndSet(prev, next)); return prev; ...
java
public final double getAndAccumulate(double x, DoubleBinaryOperator accumulatorFunction) { double prev, next; do { prev = get(); next = accumulatorFunction.applyAsDouble(prev, x); } while (!compareAndSet(prev, next)); return prev; ...
[ "public", "final", "double", "getAndAccumulate", "(", "double", "x", ",", "DoubleBinaryOperator", "accumulatorFunction", ")", "{", "double", "prev", ",", "next", ";", "do", "{", "prev", "=", "get", "(", ")", ";", "next", "=", "accumulatorFunction", ".", "app...
Atomically updates the current value with the results of applying the given function to the current and given values, returning the previous value. The function should be side-effect-free, since it may be re-applied when attempted updates fail due to contention among threads. The function is applied with the current v...
[ "Atomically", "updates", "the", "current", "value", "with", "the", "results", "of", "applying", "the", "given", "function", "to", "the", "current", "and", "given", "values", "returning", "the", "previous", "value", ".", "The", "function", "should", "be", "side...
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/concurrent/AtomicDouble.java#L118-L128
53,048
EdwardRaff/JSAT
JSAT/src/jsat/text/stemming/Stemmer.java
Stemmer.applyTo
public void applyTo(List<String> list) { for(int i = 0; i < list.size(); i++) list.set(i, stem(list.get(i))); }
java
public void applyTo(List<String> list) { for(int i = 0; i < list.size(); i++) list.set(i, stem(list.get(i))); }
[ "public", "void", "applyTo", "(", "List", "<", "String", ">", "list", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "list", ".", "size", "(", ")", ";", "i", "++", ")", "list", ".", "set", "(", "i", ",", "stem", "(", "list", "."...
Replaces each value in the list with the stemmed version of the word @param list the list to apply stemming to
[ "Replaces", "each", "value", "in", "the", "list", "with", "the", "stemmed", "version", "of", "the", "word" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/text/stemming/Stemmer.java#L34-L38
53,049
EdwardRaff/JSAT
JSAT/src/jsat/text/stemming/Stemmer.java
Stemmer.applyTo
public void applyTo(String[] arr) { for(int i = 0; i < arr.length; i++) arr[i] = stem(arr[i]); }
java
public void applyTo(String[] arr) { for(int i = 0; i < arr.length; i++) arr[i] = stem(arr[i]); }
[ "public", "void", "applyTo", "(", "String", "[", "]", "arr", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arr", ".", "length", ";", "i", "++", ")", "arr", "[", "i", "]", "=", "stem", "(", "arr", "[", "i", "]", ")", ";", "}"...
Replaces each value in the array with the stemmed version of the word @param arr the array to apply stemming to
[ "Replaces", "each", "value", "in", "the", "array", "with", "the", "stemmed", "version", "of", "the", "word" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/text/stemming/Stemmer.java#L44-L48
53,050
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/svm/PlattSMO.java
PlattSMO.updateSetsLabeled
private void updateSetsLabeled(int i1, final double a1, final double C) { final double y_i = label[i1]; I1[i1] = a1 == 0 && y_i == 1; I2[i1] = a1 == C && y_i == -1; I3[i1] = a1 == C && y_i == 1; I4[i1] = a1 == 0 && y_i == -1; }
java
private void updateSetsLabeled(int i1, final double a1, final double C) { final double y_i = label[i1]; I1[i1] = a1 == 0 && y_i == 1; I2[i1] = a1 == C && y_i == -1; I3[i1] = a1 == C && y_i == 1; I4[i1] = a1 == 0 && y_i == -1; }
[ "private", "void", "updateSetsLabeled", "(", "int", "i1", ",", "final", "double", "a1", ",", "final", "double", "C", ")", "{", "final", "double", "y_i", "=", "label", "[", "i1", "]", ";", "I1", "[", "i1", "]", "=", "a1", "==", "0", "&&", "y_i", "...
Updates the index sets @param i1 the index to update for @param a1 the alphas value for the index @param C the regularization value to use for this datum
[ "Updates", "the", "index", "sets" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/svm/PlattSMO.java#L469-L476
53,051
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/svm/PlattSMO.java
PlattSMO.updateThreshold
private void updateThreshold(int i) { double Fi = fcache[i]; double F_tilde_i = b_low; if (I0_b[i] || I2[i]) F_tilde_i = Fi + epsilon; else if (I0_a[i] || I1[i]) F_tilde_i = Fi - epsilon; double F_bar_i = b_up; if (I0_a[i] || ...
java
private void updateThreshold(int i) { double Fi = fcache[i]; double F_tilde_i = b_low; if (I0_b[i] || I2[i]) F_tilde_i = Fi + epsilon; else if (I0_a[i] || I1[i]) F_tilde_i = Fi - epsilon; double F_bar_i = b_up; if (I0_a[i] || ...
[ "private", "void", "updateThreshold", "(", "int", "i", ")", "{", "double", "Fi", "=", "fcache", "[", "i", "]", ";", "double", "F_tilde_i", "=", "b_low", ";", "if", "(", "I0_b", "[", "i", "]", "||", "I2", "[", "i", "]", ")", "F_tilde_i", "=", "Fi"...
Updates the threshold for regression based off of "using only i1, i2, and indices in I_0" @param i the index to update from that MUST have a value in {@link #fcache}
[ "Updates", "the", "threshold", "for", "regression", "based", "off", "of", "using", "only", "i1", "i2", "and", "indices", "in", "I_0" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/svm/PlattSMO.java#L822-L851
53,052
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/svm/PlattSMO.java
PlattSMO.decisionFunction
protected double decisionFunction(int v) { double sum = 0; for(int i = 0; i < vecs.size(); i++) if(alphas[i] > 0) sum += alphas[i] * label[i] * kEval(v, i); return sum; }
java
protected double decisionFunction(int v) { double sum = 0; for(int i = 0; i < vecs.size(); i++) if(alphas[i] > 0) sum += alphas[i] * label[i] * kEval(v, i); return sum; }
[ "protected", "double", "decisionFunction", "(", "int", "v", ")", "{", "double", "sum", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "vecs", ".", "size", "(", ")", ";", "i", "++", ")", "if", "(", "alphas", "[", "i", "]", ">"...
Returns the local decision function for classification training purposes without the bias term @param v the index of the point to select @return the decision function output sans bias
[ "Returns", "the", "local", "decision", "function", "for", "classification", "training", "purposes", "without", "the", "bias", "term" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/svm/PlattSMO.java#L1047-L1055
53,053
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/svm/PlattSMO.java
PlattSMO.decisionFunctionR
protected double decisionFunctionR(int v) { double sum = 0; for (int i = 0; i < vecs.size(); i++) if (alphas[i] != alpha_s[i])//multipler would be zero sum += (alphas[i] - alpha_s[i]) * kEval(v, i); return sum; }
java
protected double decisionFunctionR(int v) { double sum = 0; for (int i = 0; i < vecs.size(); i++) if (alphas[i] != alpha_s[i])//multipler would be zero sum += (alphas[i] - alpha_s[i]) * kEval(v, i); return sum; }
[ "protected", "double", "decisionFunctionR", "(", "int", "v", ")", "{", "double", "sum", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "vecs", ".", "size", "(", ")", ";", "i", "++", ")", "if", "(", "alphas", "[", "i", "]", "!...
Returns the local decision function for regression training purposes without the bias term @param v the index of the point to select @return the decision function output sans bias
[ "Returns", "the", "local", "decision", "function", "for", "regression", "training", "purposes", "without", "the", "bias", "term" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/svm/PlattSMO.java#L1063-L1071
53,054
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/svm/PlattSMO.java
PlattSMO.setEpsilon
public void setEpsilon(double epsilon) { if(Double.isNaN(epsilon) || Double.isInfinite(epsilon) || epsilon <= 0) throw new IllegalArgumentException("epsilon must be in (0, infty), not " + epsilon); this.epsilon = epsilon; }
java
public void setEpsilon(double epsilon) { if(Double.isNaN(epsilon) || Double.isInfinite(epsilon) || epsilon <= 0) throw new IllegalArgumentException("epsilon must be in (0, infty), not " + epsilon); this.epsilon = epsilon; }
[ "public", "void", "setEpsilon", "(", "double", "epsilon", ")", "{", "if", "(", "Double", ".", "isNaN", "(", "epsilon", ")", "||", "Double", ".", "isInfinite", "(", "epsilon", ")", "||", "epsilon", "<=", "0", ")", "throw", "new", "IllegalArgumentException",...
Sets the epsilon for the epsilon insensitive loss when performing regression. This variable has no impact during classification problems. For regression problems, any predicated value that is within the epsilon of the target will be treated as "correct". Increasing epsilon usually decreases the number of support vector...
[ "Sets", "the", "epsilon", "for", "the", "epsilon", "insensitive", "loss", "when", "performing", "regression", ".", "This", "variable", "has", "no", "impact", "during", "classification", "problems", ".", "For", "regression", "problems", "any", "predicated", "value"...
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/svm/PlattSMO.java#L1213-L1218
53,055
EdwardRaff/JSAT
JSAT/src/jsat/regression/RANSAC.java
RANSAC.setMaxPointError
public void setMaxPointError(double maxPointError) { if(maxPointError < 0 || Double.isInfinite(maxPointError) || Double.isNaN(maxPointError)) throw new ArithmeticException("The error must be a positive value, not " + maxPointError ); this.maxPointError = maxPointError; }
java
public void setMaxPointError(double maxPointError) { if(maxPointError < 0 || Double.isInfinite(maxPointError) || Double.isNaN(maxPointError)) throw new ArithmeticException("The error must be a positive value, not " + maxPointError ); this.maxPointError = maxPointError; }
[ "public", "void", "setMaxPointError", "(", "double", "maxPointError", ")", "{", "if", "(", "maxPointError", "<", "0", "||", "Double", ".", "isInfinite", "(", "maxPointError", ")", "||", "Double", ".", "isNaN", "(", "maxPointError", ")", ")", "throw", "new", ...
Each data point not in the initial training set will be tested against. If a data points error is sufficiently small, it will be added to the set of inliers. @param maxPointError the new maximum error a data point may have to be considered an inlier.
[ "Each", "data", "point", "not", "in", "the", "initial", "training", "set", "will", "be", "tested", "against", ".", "If", "a", "data", "points", "error", "is", "sufficiently", "small", "it", "will", "be", "added", "to", "the", "set", "of", "inliers", "." ...
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/regression/RANSAC.java#L258-L263
53,056
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/boosting/LogitBoost.java
LogitBoost.P
protected double P(DataPoint x) { /** * F(x) * e * p(x) = --------------- * F(x) - F(x) * e + e */ double fx = F(x); double efx = Math.exp(fx); double enfx = Math.exp(-fx); if...
java
protected double P(DataPoint x) { /** * F(x) * e * p(x) = --------------- * F(x) - F(x) * e + e */ double fx = F(x); double efx = Math.exp(fx); double enfx = Math.exp(-fx); if...
[ "protected", "double", "P", "(", "DataPoint", "x", ")", "{", "/**\n * F(x)\n * e\n * p(x) = ---------------\n * F(x) - F(x)\n * e + e\n */", "double", "fx", "=", "F", "(", "x", ")", ";", ...
Returns the probability that a given data point belongs to class 1 @param x the data point in question @return P(y = 1 | x)
[ "Returns", "the", "probability", "that", "a", "given", "data", "point", "belongs", "to", "class", "1" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/boosting/LogitBoost.java#L195-L210
53,057
EdwardRaff/JSAT
JSAT/src/jsat/lossfunctions/LogisticLoss.java
LogisticLoss.loss
public static double loss(double pred, double y) { final double x = -y * pred; if (x >= 30)//as x -> inf, L(x) -> x. At 30 exp(x) is O(10^13), getting unstable. L(x)-x at this value is O(10^-14), also avoids exp and log ops return x; else if (x <= -30) return 0; ...
java
public static double loss(double pred, double y) { final double x = -y * pred; if (x >= 30)//as x -> inf, L(x) -> x. At 30 exp(x) is O(10^13), getting unstable. L(x)-x at this value is O(10^-14), also avoids exp and log ops return x; else if (x <= -30) return 0; ...
[ "public", "static", "double", "loss", "(", "double", "pred", ",", "double", "y", ")", "{", "final", "double", "x", "=", "-", "y", "*", "pred", ";", "if", "(", "x", ">=", "30", ")", "//as x -> inf, L(x) -> x. At 30 exp(x) is O(10^13), getting unstable. L(x)-x at ...
Computes the logistic loss @param pred the predicted value @param y the true value @return the logistic loss
[ "Computes", "the", "logistic", "loss" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/lossfunctions/LogisticLoss.java#L30-L38
53,058
EdwardRaff/JSAT
JSAT/src/jsat/lossfunctions/LogisticLoss.java
LogisticLoss.deriv
public static double deriv(double pred, double y) { final double x = y * pred; if (x >= 30) return 0; else if (x <= -30) return y; return -y / (1 + exp(y * pred)); }
java
public static double deriv(double pred, double y) { final double x = y * pred; if (x >= 30) return 0; else if (x <= -30) return y; return -y / (1 + exp(y * pred)); }
[ "public", "static", "double", "deriv", "(", "double", "pred", ",", "double", "y", ")", "{", "final", "double", "x", "=", "y", "*", "pred", ";", "if", "(", "x", ">=", "30", ")", "return", "0", ";", "else", "if", "(", "x", "<=", "-", "30", ")", ...
Computes the first derivative of the logistic loss @param pred the predicted value @param y the true value @return the first derivative of the logistic loss
[ "Computes", "the", "first", "derivative", "of", "the", "logistic", "loss" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/lossfunctions/LogisticLoss.java#L47-L56
53,059
EdwardRaff/JSAT
JSAT/src/jsat/lossfunctions/LogisticLoss.java
LogisticLoss.deriv2
public static double deriv2(double pred, double y) { final double x = y * pred; if (x >= 30) return 0; else if (x <= -30) return 0; final double p = 1 / (1 + exp(y * pred)); return p * (1 - p); }
java
public static double deriv2(double pred, double y) { final double x = y * pred; if (x >= 30) return 0; else if (x <= -30) return 0; final double p = 1 / (1 + exp(y * pred)); return p * (1 - p); }
[ "public", "static", "double", "deriv2", "(", "double", "pred", ",", "double", "y", ")", "{", "final", "double", "x", "=", "y", "*", "pred", ";", "if", "(", "x", ">=", "30", ")", "return", "0", ";", "else", "if", "(", "x", "<=", "-", "30", ")", ...
Computes the second derivative of the logistic loss @param pred the predicted value @param y the true value @return the second derivative of the logistic loss
[ "Computes", "the", "second", "derivative", "of", "the", "logistic", "loss" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/lossfunctions/LogisticLoss.java#L65-L76
53,060
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/trees/MDA.java
MDA.walkCorruptedPath
private TreeNodeVisitor walkCorruptedPath(TreeLearner model, DataPoint dp, int j, Random rand) { TreeNodeVisitor curNode = model.getTreeNodeVisitor(); while(!curNode.isLeaf()) { int path = curNode.getPath(dp); int numChild = curNode.childrenCount(); if(cur...
java
private TreeNodeVisitor walkCorruptedPath(TreeLearner model, DataPoint dp, int j, Random rand) { TreeNodeVisitor curNode = model.getTreeNodeVisitor(); while(!curNode.isLeaf()) { int path = curNode.getPath(dp); int numChild = curNode.childrenCount(); if(cur...
[ "private", "TreeNodeVisitor", "walkCorruptedPath", "(", "TreeLearner", "model", ",", "DataPoint", "dp", ",", "int", "j", ",", "Random", "rand", ")", "{", "TreeNodeVisitor", "curNode", "=", "model", ".", "getTreeNodeVisitor", "(", ")", ";", "while", "(", "!", ...
walks the tree down to a leaf node, adding corruption for a specific feature @param model the tree model to walk @param dp the data point to push down the tree @param j the feature index to corrupt @param rand source of randomness @return the leaf node
[ "walks", "the", "tree", "down", "to", "a", "leaf", "node", "adding", "corruption", "for", "a", "specific", "feature" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/trees/MDA.java#L139-L158
53,061
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/linear/AROW.java
AROW.setR
public void setR(double r) { if(Double.isNaN(r) || Double.isInfinite(r) || r <= 0) throw new IllegalArgumentException("r must be a postive constant, not " + r); this.r = r; }
java
public void setR(double r) { if(Double.isNaN(r) || Double.isInfinite(r) || r <= 0) throw new IllegalArgumentException("r must be a postive constant, not " + r); this.r = r; }
[ "public", "void", "setR", "(", "double", "r", ")", "{", "if", "(", "Double", ".", "isNaN", "(", "r", ")", "||", "Double", ".", "isInfinite", "(", "r", ")", "||", "r", "<=", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"r must be a posti...
Sets the r parameter of AROW, which controls the regularization. Larger values reduce the change in the model on each update. @param r the regularization parameter in (0, Inf)
[ "Sets", "the", "r", "parameter", "of", "AROW", "which", "controls", "the", "regularization", ".", "Larger", "values", "reduce", "the", "change", "in", "the", "model", "on", "each", "update", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/AROW.java#L125-L130
53,062
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/boosting/Bagging.java
Bagging.sampleWithReplacement
static public void sampleWithReplacement(int[] sampleCounts, int samples, Random rand) { Arrays.fill(sampleCounts, 0); for(int i = 0; i < samples; i++) sampleCounts[rand.nextInt(sampleCounts.length)]++; }
java
static public void sampleWithReplacement(int[] sampleCounts, int samples, Random rand) { Arrays.fill(sampleCounts, 0); for(int i = 0; i < samples; i++) sampleCounts[rand.nextInt(sampleCounts.length)]++; }
[ "static", "public", "void", "sampleWithReplacement", "(", "int", "[", "]", "sampleCounts", ",", "int", "samples", ",", "Random", "rand", ")", "{", "Arrays", ".", "fill", "(", "sampleCounts", ",", "0", ")", ";", "for", "(", "int", "i", "=", "0", ";", ...
Performs the sampling based on the number of data points, storing the counts in an array to be constructed from XXXX @param sampleCounts an array to keep count of how many times each data point was sampled. The array will be filled with zeros before sampling starts @param samples the number of samples to take from the ...
[ "Performs", "the", "sampling", "based", "on", "the", "number", "of", "data", "points", "storing", "the", "counts", "in", "an", "array", "to", "be", "constructed", "from", "XXXX" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/boosting/Bagging.java#L369-L374
53,063
EdwardRaff/JSAT
JSAT/src/jsat/regression/StochasticGradientBoosting.java
StochasticGradientBoosting.setTrainingProportion
public void setTrainingProportion(double trainingProportion) { //+- Inf case captured in >1 <= 0 case if(trainingProportion > 1 || trainingProportion <= 0 || Double.isNaN(trainingProportion)) throw new ArithmeticException("Training Proportion is invalid"); this.trainingProportion...
java
public void setTrainingProportion(double trainingProportion) { //+- Inf case captured in >1 <= 0 case if(trainingProportion > 1 || trainingProportion <= 0 || Double.isNaN(trainingProportion)) throw new ArithmeticException("Training Proportion is invalid"); this.trainingProportion...
[ "public", "void", "setTrainingProportion", "(", "double", "trainingProportion", ")", "{", "//+- Inf case captured in >1 <= 0 case", "if", "(", "trainingProportion", ">", "1", "||", "trainingProportion", "<=", "0", "||", "Double", ".", "isNaN", "(", "trainingProportion",...
The GB version uses the whole data set at each iteration. SGB can use a fraction of the data set at each iteration in order to reduce overfitting and add randomness. @param trainingProportion the fraction of training the data set to use for each iteration of SGB @throws ArithmeticException if the trainingPortion is no...
[ "The", "GB", "version", "uses", "the", "whole", "data", "set", "at", "each", "iteration", ".", "SGB", "can", "use", "a", "fraction", "of", "the", "data", "set", "at", "each", "iteration", "in", "order", "to", "reduce", "overfitting", "and", "add", "rando...
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/regression/StochasticGradientBoosting.java#L197-L203
53,064
EdwardRaff/JSAT
JSAT/src/jsat/regression/StochasticGradientBoosting.java
StochasticGradientBoosting.getDerivativeFunc
private Function1D getDerivativeFunc(final RegressionDataSet backingResidsList, final Regressor h) { final Function1D fhPrime = (double x) -> { double c1 = x;//c2=c1-eps double eps = 1e-5; double c1Pc2 = c1 * 2 - eps;//c1+c2 = c1+c1-eps double result =...
java
private Function1D getDerivativeFunc(final RegressionDataSet backingResidsList, final Regressor h) { final Function1D fhPrime = (double x) -> { double c1 = x;//c2=c1-eps double eps = 1e-5; double c1Pc2 = c1 * 2 - eps;//c1+c2 = c1+c1-eps double result =...
[ "private", "Function1D", "getDerivativeFunc", "(", "final", "RegressionDataSet", "backingResidsList", ",", "final", "Regressor", "h", ")", "{", "final", "Function1D", "fhPrime", "=", "(", "double", "x", ")", "->", "{", "double", "c1", "=", "x", ";", "//c2=c1-e...
Returns a function object that approximates the derivative of the squared error of the Regressor as a function of the constant factor multiplied on the Regressor's output. @param backingResidsList the DataPointPair list of residuals @param h the regressor that is having the error of its output minimized @return a Func...
[ "Returns", "a", "function", "object", "that", "approximates", "the", "derivative", "of", "the", "squared", "error", "of", "the", "Regressor", "as", "a", "function", "of", "the", "constant", "factor", "multiplied", "on", "the", "Regressor", "s", "output", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/regression/StochasticGradientBoosting.java#L320-L365
53,065
EdwardRaff/JSAT
JSAT/src/jsat/io/ARFFLoader.java
ARFFLoader.loadArffFile
public static SimpleDataSet loadArffFile(File file) { try { return loadArffFile(new FileReader(file)); } catch (FileNotFoundException ex) { Logger.getLogger(ARFFLoader.class.getName()).log(Level.SEVERE, null, ex); return null; } ...
java
public static SimpleDataSet loadArffFile(File file) { try { return loadArffFile(new FileReader(file)); } catch (FileNotFoundException ex) { Logger.getLogger(ARFFLoader.class.getName()).log(Level.SEVERE, null, ex); return null; } ...
[ "public", "static", "SimpleDataSet", "loadArffFile", "(", "File", "file", ")", "{", "try", "{", "return", "loadArffFile", "(", "new", "FileReader", "(", "file", ")", ")", ";", "}", "catch", "(", "FileNotFoundException", "ex", ")", "{", "Logger", ".", "getL...
Uses the given file path to load a data set from an ARFF file. @param file the path to the ARFF file to load @return the data set from the ARFF file, or null if the file could not be loaded.
[ "Uses", "the", "given", "file", "path", "to", "load", "a", "data", "set", "from", "an", "ARFF", "file", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/io/ARFFLoader.java#L38-L49
53,066
EdwardRaff/JSAT
JSAT/src/jsat/io/ARFFLoader.java
ARFFLoader.nameTrim
private static String nameTrim(String in) { in = in.trim(); if(in.startsWith("'") || in.startsWith("\"")) in = in.substring(1); if(in.endsWith("'") || in.startsWith("\"")) in = in.substring(0, in.length()-1); return in.trim(); }
java
private static String nameTrim(String in) { in = in.trim(); if(in.startsWith("'") || in.startsWith("\"")) in = in.substring(1); if(in.endsWith("'") || in.startsWith("\"")) in = in.substring(0, in.length()-1); return in.trim(); }
[ "private", "static", "String", "nameTrim", "(", "String", "in", ")", "{", "in", "=", "in", ".", "trim", "(", ")", ";", "if", "(", "in", ".", "startsWith", "(", "\"'\"", ")", "||", "in", ".", "startsWith", "(", "\"\\\"\"", ")", ")", "in", "=", "in...
Removes the quotes at the end and front of a string if there are any, as well as spaces at the front and end @param in the string to trim @return the white space and quote trimmed string
[ "Removes", "the", "quotes", "at", "the", "end", "and", "front", "of", "a", "string", "if", "there", "are", "any", "as", "well", "as", "spaces", "at", "the", "front", "and", "end" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/io/ARFFLoader.java#L341-L349
53,067
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/neuralnetwork/SOM.java
SOM.setInitialLearningRate
public void setInitialLearningRate(double initialLearningRate) { if(Double.isInfinite(initialLearningRate) || Double.isNaN(initialLearningRate) || initialLearningRate <= 0) throw new ArithmeticException("Learning rate must be a positive constant, not " + initialLearningRate); this.initia...
java
public void setInitialLearningRate(double initialLearningRate) { if(Double.isInfinite(initialLearningRate) || Double.isNaN(initialLearningRate) || initialLearningRate <= 0) throw new ArithmeticException("Learning rate must be a positive constant, not " + initialLearningRate); this.initia...
[ "public", "void", "setInitialLearningRate", "(", "double", "initialLearningRate", ")", "{", "if", "(", "Double", ".", "isInfinite", "(", "initialLearningRate", ")", "||", "Double", ".", "isNaN", "(", "initialLearningRate", ")", "||", "initialLearningRate", "<=", "...
Sets the rate at which input is incorporated at each iteration of the SOM algorithm @param initialLearningRate the rate the SOM learns at
[ "Sets", "the", "rate", "at", "which", "input", "is", "incorporated", "at", "each", "iteration", "of", "the", "SOM", "algorithm" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/neuralnetwork/SOM.java#L180-L185
53,068
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/CategoricalResults.java
CategoricalResults.setProb
public void setProb(int cat, double prob) { if(cat > probabilities.length) throw new IndexOutOfBoundsException("There are only " + probabilities.length + " posibilties, " + cat + " is invalid"); else if(prob < 0 || Double.isInfinite(prob) || Double.isNaN(prob)) throw new Arit...
java
public void setProb(int cat, double prob) { if(cat > probabilities.length) throw new IndexOutOfBoundsException("There are only " + probabilities.length + " posibilties, " + cat + " is invalid"); else if(prob < 0 || Double.isInfinite(prob) || Double.isNaN(prob)) throw new Arit...
[ "public", "void", "setProb", "(", "int", "cat", ",", "double", "prob", ")", "{", "if", "(", "cat", ">", "probabilities", ".", "length", ")", "throw", "new", "IndexOutOfBoundsException", "(", "\"There are only \"", "+", "probabilities", ".", "length", "+", "\...
Sets the probability that a sample belongs to a given category. @param cat the category @param prob the value to set, may be greater then one. @throws IndexOutOfBoundsException if a non existent category is specified @throws ArithmeticException if the value set is negative or not a number
[ "Sets", "the", "probability", "that", "a", "sample", "belongs", "to", "a", "given", "category", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/CategoricalResults.java#L56-L63
53,069
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/CategoricalResults.java
CategoricalResults.mostLikely
public int mostLikely() { int top = 0; for(int i = 1; i < probabilities.length; i++) { if(probabilities[i] > probabilities[top]) top = i; } return top; }
java
public int mostLikely() { int top = 0; for(int i = 1; i < probabilities.length; i++) { if(probabilities[i] > probabilities[top]) top = i; } return top; }
[ "public", "int", "mostLikely", "(", ")", "{", "int", "top", "=", "0", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "probabilities", ".", "length", ";", "i", "++", ")", "{", "if", "(", "probabilities", "[", "i", "]", ">", "probabilities",...
Returns the category that is the most likely according to the current probability values @return the the most likely category
[ "Returns", "the", "category", "that", "is", "the", "most", "likely", "according", "to", "the", "current", "probability", "values" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/CategoricalResults.java#L85-L95
53,070
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/boosting/Wagging.java
Wagging.setWeakLearner
public void setWeakLearner(Classifier weakL) { if(weakL == null) throw new NullPointerException(); this.weakL = weakL; if(weakL instanceof Regressor) this.weakR = (Regressor) weakL; }
java
public void setWeakLearner(Classifier weakL) { if(weakL == null) throw new NullPointerException(); this.weakL = weakL; if(weakL instanceof Regressor) this.weakR = (Regressor) weakL; }
[ "public", "void", "setWeakLearner", "(", "Classifier", "weakL", ")", "{", "if", "(", "weakL", "==", "null", ")", "throw", "new", "NullPointerException", "(", ")", ";", "this", ".", "weakL", "=", "weakL", ";", "if", "(", "weakL", "instanceof", "Regressor", ...
Sets the weak learner used for classification. If it also supports regressions that will be set as well. @param weakL the weak learner to use
[ "Sets", "the", "weak", "learner", "used", "for", "classification", ".", "If", "it", "also", "supports", "regressions", "that", "will", "be", "set", "as", "well", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/boosting/Wagging.java#L111-L118
53,071
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/boosting/Wagging.java
Wagging.setWeakLearner
public void setWeakLearner(Regressor weakR) { if(weakR == null) throw new NullPointerException(); this.weakR = weakR; if(weakR instanceof Classifier) this.weakL = (Classifier) weakR; }
java
public void setWeakLearner(Regressor weakR) { if(weakR == null) throw new NullPointerException(); this.weakR = weakR; if(weakR instanceof Classifier) this.weakL = (Classifier) weakR; }
[ "public", "void", "setWeakLearner", "(", "Regressor", "weakR", ")", "{", "if", "(", "weakR", "==", "null", ")", "throw", "new", "NullPointerException", "(", ")", ";", "this", ".", "weakR", "=", "weakR", ";", "if", "(", "weakR", "instanceof", "Classifier", ...
Sets the weak learner used for regressions . If it also supports classification that will be set as well. @param weakR the weak learner to use
[ "Sets", "the", "weak", "learner", "used", "for", "regressions", ".", "If", "it", "also", "supports", "classification", "that", "will", "be", "set", "as", "well", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/boosting/Wagging.java#L134-L141
53,072
EdwardRaff/JSAT
JSAT/src/jsat/linear/HessenbergForm.java
HessenbergForm.hess
public static void hess(Matrix A, ExecutorService threadpool) { if(!A.isSquare()) throw new ArithmeticException("Only square matrices can be converted to Upper Hessenberg form"); int m = A.rows(); /** * Space used to store the vector for updating the columns of A ...
java
public static void hess(Matrix A, ExecutorService threadpool) { if(!A.isSquare()) throw new ArithmeticException("Only square matrices can be converted to Upper Hessenberg form"); int m = A.rows(); /** * Space used to store the vector for updating the columns of A ...
[ "public", "static", "void", "hess", "(", "Matrix", "A", ",", "ExecutorService", "threadpool", ")", "{", "if", "(", "!", "A", ".", "isSquare", "(", ")", ")", "throw", "new", "ArithmeticException", "(", "\"Only square matrices can be converted to Upper Hessenberg form...
Alters the matrix A such that it is in upper Hessenberg form. @param A the matrix to transform into upper Hessenberg form
[ "Alters", "the", "matrix", "A", "such", "that", "it", "is", "in", "upper", "Hessenberg", "form", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/HessenbergForm.java#L25-L96
53,073
EdwardRaff/JSAT
JSAT/src/jsat/distributions/empirical/KernelDensityEstimator.java
KernelDensityEstimator.autoKernel
public static KernelFunction autoKernel(Vec dataPoints ) { if(dataPoints.length() < 30) return GaussKF.getInstance(); else if(dataPoints.length() < 1000) return EpanechnikovKF.getInstance(); else//For very large data sets, Uniform is FAST and just as accurate ...
java
public static KernelFunction autoKernel(Vec dataPoints ) { if(dataPoints.length() < 30) return GaussKF.getInstance(); else if(dataPoints.length() < 1000) return EpanechnikovKF.getInstance(); else//For very large data sets, Uniform is FAST and just as accurate ...
[ "public", "static", "KernelFunction", "autoKernel", "(", "Vec", "dataPoints", ")", "{", "if", "(", "dataPoints", ".", "length", "(", ")", "<", "30", ")", "return", "GaussKF", ".", "getInstance", "(", ")", ";", "else", "if", "(", "dataPoints", ".", "lengt...
Automatically selects a good Kernel function for the data set that balances Execution time and accuracy @param dataPoints @return a kernel that will work well for the given distribution
[ "Automatically", "selects", "a", "good", "Kernel", "function", "for", "the", "data", "set", "that", "balances", "Execution", "time", "and", "accuracy" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/empirical/KernelDensityEstimator.java#L65-L73
53,074
EdwardRaff/JSAT
JSAT/src/jsat/distributions/empirical/KernelDensityEstimator.java
KernelDensityEstimator.pdf
private double pdf(double x, int j) { /* * n * ===== /x - x \ * 1 \ | i| * f(x) = --- > K|------| * n h / \ h / * ===== * i = 1 * */ ...
java
private double pdf(double x, int j) { /* * n * ===== /x - x \ * 1 \ | i| * f(x) = --- > K|------| * n h / \ h / * ===== * i = 1 * */ ...
[ "private", "double", "pdf", "(", "double", "x", ",", "int", "j", ")", "{", "/*\n * n\n * ===== /x - x \\\n * 1 \\ | i|\n * f(x) = --- > K|------|\n * n h / \\ h /\n * =====\...
Computes the Leave One Out PDF of the estimator @param x the value to get the pdf of @param j the sorted index of the value to leave. If a negative value is given, the PDF with all values is returned @return the pdf with the given index left out
[ "Computes", "the", "Leave", "One", "Out", "PDF", "of", "the", "estimator" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/empirical/KernelDensityEstimator.java#L185-L216
53,075
EdwardRaff/JSAT
JSAT/src/jsat/lossfunctions/EpsilonInsensitiveLoss.java
EpsilonInsensitiveLoss.loss
public static double loss(double pred, double y, double eps) { final double x = Math.abs(pred - y); return Math.max(0, x-eps); }
java
public static double loss(double pred, double y, double eps) { final double x = Math.abs(pred - y); return Math.max(0, x-eps); }
[ "public", "static", "double", "loss", "(", "double", "pred", ",", "double", "y", ",", "double", "eps", ")", "{", "final", "double", "x", "=", "Math", ".", "abs", "(", "pred", "-", "y", ")", ";", "return", "Math", ".", "max", "(", "0", ",", "x", ...
Computes the &epsilon;-insensitive loss @param pred the predicted value @param y the true value @param eps the epsilon tolerance @return the &epsilon;-insensitive loss
[ "Computes", "the", "&epsilon", ";", "-", "insensitive", "loss" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/lossfunctions/EpsilonInsensitiveLoss.java#L24-L28
53,076
EdwardRaff/JSAT
JSAT/src/jsat/lossfunctions/EpsilonInsensitiveLoss.java
EpsilonInsensitiveLoss.deriv
public static double deriv(double pred, double y, double eps) { final double x = pred - y; if(eps < Math.abs(x)) return Math.signum(x); else return 0; }
java
public static double deriv(double pred, double y, double eps) { final double x = pred - y; if(eps < Math.abs(x)) return Math.signum(x); else return 0; }
[ "public", "static", "double", "deriv", "(", "double", "pred", ",", "double", "y", ",", "double", "eps", ")", "{", "final", "double", "x", "=", "pred", "-", "y", ";", "if", "(", "eps", "<", "Math", ".", "abs", "(", "x", ")", ")", "return", "Math",...
Computes the first derivative of the &epsilon;-insensitive loss @param pred the predicted value @param y the true value @param eps the epsilon tolerance @return the first derivative of the &epsilon;-insensitive loss
[ "Computes", "the", "first", "derivative", "of", "the", "&epsilon", ";", "-", "insensitive", "loss" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/lossfunctions/EpsilonInsensitiveLoss.java#L38-L45
53,077
EdwardRaff/JSAT
JSAT/src/jsat/utils/GridDataGenerator.java
GridDataGenerator.generateData
public SimpleDataSet generateData(int samples) { int totalClasses = 1; for(int d : dimensions) totalClasses *= d; catDataInfo = new CategoricalData[] { new CategoricalData(totalClasses) } ; List<DataPoint> dataPoints = new ArrayList<DataPoint>(totalClasses*samples);...
java
public SimpleDataSet generateData(int samples) { int totalClasses = 1; for(int d : dimensions) totalClasses *= d; catDataInfo = new CategoricalData[] { new CategoricalData(totalClasses) } ; List<DataPoint> dataPoints = new ArrayList<DataPoint>(totalClasses*samples);...
[ "public", "SimpleDataSet", "generateData", "(", "int", "samples", ")", "{", "int", "totalClasses", "=", "1", ";", "for", "(", "int", "d", ":", "dimensions", ")", "totalClasses", "*=", ";", "catDataInfo", "=", "new", "CategoricalData", "[", "]", "{", "new",...
Generates a new data set. @param samples the number of sample data points to create for each class in the data set. @return A data set the contains the data points with matching class labels.
[ "Generates", "a", "new", "data", "set", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/GridDataGenerator.java#L118-L135
53,078
EdwardRaff/JSAT
JSAT/src/jsat/math/decayrates/ExponetialDecay.java
ExponetialDecay.setMinRate
public void setMinRate(double min) { if(min <= 0 || Double.isNaN(min) || Double.isInfinite(min)) throw new RuntimeException("minRate should be positive, not " + min); this.min = min; }
java
public void setMinRate(double min) { if(min <= 0 || Double.isNaN(min) || Double.isInfinite(min)) throw new RuntimeException("minRate should be positive, not " + min); this.min = min; }
[ "public", "void", "setMinRate", "(", "double", "min", ")", "{", "if", "(", "min", "<=", "0", "||", "Double", ".", "isNaN", "(", "min", ")", "||", "Double", ".", "isInfinite", "(", "min", ")", ")", "throw", "new", "RuntimeException", "(", "\"minRate sho...
Sets the minimum learning rate to return @param min the minimum learning rate to return
[ "Sets", "the", "minimum", "learning", "rate", "to", "return" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/decayrates/ExponetialDecay.java#L65-L70
53,079
EdwardRaff/JSAT
JSAT/src/jsat/math/FastMath.java
FastMath.digamma
public static double digamma(double x) { if(x == 0) return Double.NaN;//complex infinity else if(x < 0)//digamma(1-x) == digamma(x)+pi/tan(pi*x), to make x positive { if(Math.rint(x) == x) return Double.NaN;//the zeros are complex infinity ...
java
public static double digamma(double x) { if(x == 0) return Double.NaN;//complex infinity else if(x < 0)//digamma(1-x) == digamma(x)+pi/tan(pi*x), to make x positive { if(Math.rint(x) == x) return Double.NaN;//the zeros are complex infinity ...
[ "public", "static", "double", "digamma", "(", "double", "x", ")", "{", "if", "(", "x", "==", "0", ")", "return", "Double", ".", "NaN", ";", "//complex infinity", "else", "if", "(", "x", "<", "0", ")", "//digamma(1-x) == digamma(x)+pi/tan(pi*x), to make x posit...
Computes the digamma function of the input @param x the input value @return &psi;(x)
[ "Computes", "the", "digamma", "function", "of", "the", "input" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/FastMath.java#L225-L244
53,080
EdwardRaff/JSAT
JSAT/src/jsat/clustering/hierarchical/NNChainHAC.java
NNChainHAC.fixMergeOrderAndAssign
private void fixMergeOrderAndAssign(double[] mergedDistance, IntList merge_kept, IntList merge_removed, int lowK, final int N, int highK, int[] designations) { //Now that we are done clustering, we need to re-order the merges so that the smallest distances are mergered first IndexTable it = new Inde...
java
private void fixMergeOrderAndAssign(double[] mergedDistance, IntList merge_kept, IntList merge_removed, int lowK, final int N, int highK, int[] designations) { //Now that we are done clustering, we need to re-order the merges so that the smallest distances are mergered first IndexTable it = new Inde...
[ "private", "void", "fixMergeOrderAndAssign", "(", "double", "[", "]", "mergedDistance", ",", "IntList", "merge_kept", ",", "IntList", "merge_removed", ",", "int", "lowK", ",", "final", "int", "N", ",", "int", "highK", ",", "int", "[", "]", "designations", ")...
After clustering, we need to fix up the merge order - since the NNchain only gets the merges correct, not their ordering. This also figures out what number of clusters to use @param mergedDistance @param merge_kept @param merge_removed @param lowK @param N @param highK @param designations
[ "After", "clustering", "we", "need", "to", "fix", "up", "the", "merge", "order", "-", "since", "the", "NNchain", "only", "gets", "the", "merges", "correct", "not", "their", "ordering", ".", "This", "also", "figures", "out", "what", "number", "of", "cluster...
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/clustering/hierarchical/NNChainHAC.java#L412-L456
53,081
EdwardRaff/JSAT
JSAT/src/jsat/utils/concurrent/TreeBarrier.java
TreeBarrier.await
public void await(int ID) throws InterruptedException { if(parties == 1)//what are you doing?! return; final boolean startCondition = competitionCondition; int competingFor = (locks.length*2-1-ID)/2; while (competingFor >= 0) { final Lock node...
java
public void await(int ID) throws InterruptedException { if(parties == 1)//what are you doing?! return; final boolean startCondition = competitionCondition; int competingFor = (locks.length*2-1-ID)/2; while (competingFor >= 0) { final Lock node...
[ "public", "void", "await", "(", "int", "ID", ")", "throws", "InterruptedException", "{", "if", "(", "parties", "==", "1", ")", "//what are you doing?!", "return", ";", "final", "boolean", "startCondition", "=", "competitionCondition", ";", "int", "competingFor", ...
Waits for all threads to reach this barrier. @param ID the id of the thread attempting to reach the barrier. @throws InterruptedException if one of the threads was interrupted while waiting on the barrier
[ "Waits", "for", "all", "threads", "to", "reach", "this", "barrier", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/concurrent/TreeBarrier.java#L45-L79
53,082
EdwardRaff/JSAT
JSAT/src/jsat/math/optimization/ModifiedOWLQN.java
ModifiedOWLQN.setBeta
public void setBeta(double beta) { if(beta <= 0 || beta >= 1 || Double.isNaN(beta)) throw new IllegalArgumentException("shrinkage term must be in (0, 1), not " + beta); this.beta = beta; }
java
public void setBeta(double beta) { if(beta <= 0 || beta >= 1 || Double.isNaN(beta)) throw new IllegalArgumentException("shrinkage term must be in (0, 1), not " + beta); this.beta = beta; }
[ "public", "void", "setBeta", "(", "double", "beta", ")", "{", "if", "(", "beta", "<=", "0", "||", "beta", ">=", "1", "||", "Double", ".", "isNaN", "(", "beta", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"shrinkage term must be in (0, 1), no...
Sets the shrinkage term used for the line search. @param beta the line search shrinkage term
[ "Sets", "the", "shrinkage", "term", "used", "for", "the", "line", "search", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/optimization/ModifiedOWLQN.java#L176-L181
53,083
EdwardRaff/JSAT
JSAT/src/jsat/utils/DoubleList.java
DoubleList.unmodifiableView
public static List<Double> unmodifiableView(double[] array, int length) { return Collections.unmodifiableList(view(array, length)); }
java
public static List<Double> unmodifiableView(double[] array, int length) { return Collections.unmodifiableList(view(array, length)); }
[ "public", "static", "List", "<", "Double", ">", "unmodifiableView", "(", "double", "[", "]", "array", ",", "int", "length", ")", "{", "return", "Collections", ".", "unmodifiableList", "(", "view", "(", "array", ",", "length", ")", ")", ";", "}" ]
Creates an returns an unmodifiable view of the given double array that requires only a small object allocation. @param array the array to wrap into an unmodifiable list @param length the number of values of the array to use, starting from zero @return an unmodifiable list view of the array
[ "Creates", "an", "returns", "an", "unmodifiable", "view", "of", "the", "given", "double", "array", "that", "requires", "only", "a", "small", "object", "allocation", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/DoubleList.java#L285-L288
53,084
EdwardRaff/JSAT
JSAT/src/jsat/utils/DoubleList.java
DoubleList.view
public static DoubleList view(double[] array, int length) { if(length > array.length || length < 0) throw new IllegalArgumentException("length must be non-negative and no more than the size of the array("+array.length+"), not " + length); return new DoubleList(array, length); }
java
public static DoubleList view(double[] array, int length) { if(length > array.length || length < 0) throw new IllegalArgumentException("length must be non-negative and no more than the size of the array("+array.length+"), not " + length); return new DoubleList(array, length); }
[ "public", "static", "DoubleList", "view", "(", "double", "[", "]", "array", ",", "int", "length", ")", "{", "if", "(", "length", ">", "array", ".", "length", "||", "length", "<", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"length must be ...
Creates and returns a view of the given double array that requires only a small object allocation. Changes to the list will be reflected in the array up to a point. If the modification would require increasing the capacity of the array, a new array will be allocated - at which point operations will no longer be reflect...
[ "Creates", "and", "returns", "a", "view", "of", "the", "given", "double", "array", "that", "requires", "only", "a", "small", "object", "allocation", ".", "Changes", "to", "the", "list", "will", "be", "reflected", "in", "the", "array", "up", "to", "a", "p...
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/DoubleList.java#L302-L307
53,085
EdwardRaff/JSAT
JSAT/src/jsat/datatransform/AutoDeskewTransform.java
AutoDeskewTransform.updateStats
private void updateStats(final List<Double> lambdas, OnLineStatistics[][] stats, int indx, double val, double[] mins, double weight) { for (int k = 0; k < lambdas.size(); k++) stats[k][indx].add(transform(val, lambdas.get(k), mins[indx]), weight); }
java
private void updateStats(final List<Double> lambdas, OnLineStatistics[][] stats, int indx, double val, double[] mins, double weight) { for (int k = 0; k < lambdas.size(); k++) stats[k][indx].add(transform(val, lambdas.get(k), mins[indx]), weight); }
[ "private", "void", "updateStats", "(", "final", "List", "<", "Double", ">", "lambdas", ",", "OnLineStatistics", "[", "]", "[", "]", "stats", ",", "int", "indx", ",", "double", "val", ",", "double", "[", "]", "mins", ",", "double", "weight", ")", "{", ...
Updates the online stats for each value of lambda @param lambdas the list of lambda values @param stats the array of statistics trackers @param indx the feature index to add to @param val the value at the given feature index @param mins the minimum value array @param weight the weight to the given update
[ "Updates", "the", "online", "stats", "for", "each", "value", "of", "lambda" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/datatransform/AutoDeskewTransform.java#L312-L316
53,086
EdwardRaff/JSAT
JSAT/src/jsat/linear/ConcatenatedVec.java
ConcatenatedVec.increment
@Override public void increment(int index, double val) { int baseIndex = getBaseIndex(index); vecs[baseIndex].increment(index-lengthSums[baseIndex], val); }
java
@Override public void increment(int index, double val) { int baseIndex = getBaseIndex(index); vecs[baseIndex].increment(index-lengthSums[baseIndex], val); }
[ "@", "Override", "public", "void", "increment", "(", "int", "index", ",", "double", "val", ")", "{", "int", "baseIndex", "=", "getBaseIndex", "(", "index", ")", ";", "vecs", "[", "baseIndex", "]", ".", "increment", "(", "index", "-", "lengthSums", "[", ...
The following are implemented only for performance reasons
[ "The", "following", "are", "implemented", "only", "for", "performance", "reasons" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/ConcatenatedVec.java#L77-L82
53,087
EdwardRaff/JSAT
JSAT/src/jsat/distributions/kernels/RationalQuadraticKernel.java
RationalQuadraticKernel.setC
public void setC(double c) { if(c <= 0 || Double.isNaN(c) || Double.isInfinite(c)) throw new IllegalArgumentException("coefficient must be in (0, Inf), not " + c); this.c = c; }
java
public void setC(double c) { if(c <= 0 || Double.isNaN(c) || Double.isInfinite(c)) throw new IllegalArgumentException("coefficient must be in (0, Inf), not " + c); this.c = c; }
[ "public", "void", "setC", "(", "double", "c", ")", "{", "if", "(", "c", "<=", "0", "||", "Double", ".", "isNaN", "(", "c", ")", "||", "Double", ".", "isInfinite", "(", "c", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"coefficient must ...
Sets the positive additive coefficient @param c the positive additive coefficient
[ "Sets", "the", "positive", "additive", "coefficient" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/kernels/RationalQuadraticKernel.java#L36-L41
53,088
EdwardRaff/JSAT
JSAT/src/jsat/linear/RowColumnOps.java
RowColumnOps.addDiag
public static void addDiag(Matrix A, int start, int to, double c) { for(int i = start; i < to; i++) A.increment(i, i, c); }
java
public static void addDiag(Matrix A, int start, int to, double c) { for(int i = start; i < to; i++) A.increment(i, i, c); }
[ "public", "static", "void", "addDiag", "(", "Matrix", "A", ",", "int", "start", ",", "int", "to", ",", "double", "c", ")", "{", "for", "(", "int", "i", "=", "start", ";", "i", "<", "to", ";", "i", "++", ")", "A", ".", "increment", "(", "i", "...
Updates the values along the main diagonal of the matrix by adding a constant to them @param A the matrix to perform the update on @param start the first index of the diagonals to update (inclusive) @param to the last index of the diagonals to update (exclusive) @param c the constant to add to the diagonal
[ "Updates", "the", "values", "along", "the", "main", "diagonal", "of", "the", "matrix", "by", "adding", "a", "constant", "to", "them" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/RowColumnOps.java#L17-L21
53,089
EdwardRaff/JSAT
JSAT/src/jsat/linear/RowColumnOps.java
RowColumnOps.fillRow
public static void fillRow(Matrix A, int i, int from, int to, double val) { for(int j = from; j < to; j++) A.set(i, j, val); }
java
public static void fillRow(Matrix A, int i, int from, int to, double val) { for(int j = from; j < to; j++) A.set(i, j, val); }
[ "public", "static", "void", "fillRow", "(", "Matrix", "A", ",", "int", "i", ",", "int", "from", ",", "int", "to", ",", "double", "val", ")", "{", "for", "(", "int", "j", "=", "from", ";", "j", "<", "to", ";", "j", "++", ")", "A", ".", "set", ...
Fills the values in a row of the matrix @param A the matrix in question @param i the row of the matrix @param from the first column index to fill (inclusive) @param to the last column index to fill (exclusive) @param val the value to fill into the matrix
[ "Fills", "the", "values", "in", "a", "row", "of", "the", "matrix" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/RowColumnOps.java#L418-L422
53,090
EdwardRaff/JSAT
JSAT/src/jsat/utils/IntPriorityQueue.java
IntPriorityQueue.indexArrayStore
private void indexArrayStore(int e, int i) { if (valueIndexStore.length < e) { int oldLength = valueIndexStore.length; valueIndexStore = Arrays.copyOf(valueIndexStore, e + 2); Arrays.fill(valueIndexStore, oldLength, valueIndexStore.length, -1); } v...
java
private void indexArrayStore(int e, int i) { if (valueIndexStore.length < e) { int oldLength = valueIndexStore.length; valueIndexStore = Arrays.copyOf(valueIndexStore, e + 2); Arrays.fill(valueIndexStore, oldLength, valueIndexStore.length, -1); } v...
[ "private", "void", "indexArrayStore", "(", "int", "e", ",", "int", "i", ")", "{", "if", "(", "valueIndexStore", ".", "length", "<", "e", ")", "{", "int", "oldLength", "=", "valueIndexStore", ".", "length", ";", "valueIndexStore", "=", "Arrays", ".", "cop...
Sets the given index to use the specific value @param e the value to store the index of @param i the index of the value
[ "Sets", "the", "given", "index", "to", "use", "the", "specific", "value" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/IntPriorityQueue.java#L214-L223
53,091
EdwardRaff/JSAT
JSAT/src/jsat/utils/IntPriorityQueue.java
IntPriorityQueue.heapifyUp
private void heapifyUp(int i) { int iP = parent(i); while(i != 0 && cmp(i, iP) < 0)//Should not be greater then our parent { swapHeapValues(iP, i); i = iP; iP = parent(i); } }
java
private void heapifyUp(int i) { int iP = parent(i); while(i != 0 && cmp(i, iP) < 0)//Should not be greater then our parent { swapHeapValues(iP, i); i = iP; iP = parent(i); } }
[ "private", "void", "heapifyUp", "(", "int", "i", ")", "{", "int", "iP", "=", "parent", "(", "i", ")", ";", "while", "(", "i", "!=", "0", "&&", "cmp", "(", "i", ",", "iP", ")", "<", "0", ")", "//Should not be greater then our parent", "{", "swapHeapVa...
Heapify up from the given index in the heap and make sure everything is correct. Stops when the child value is in correct order with its parent. @param i the index in the heap to start checking from.
[ "Heapify", "up", "from", "the", "given", "index", "in", "the", "heap", "and", "make", "sure", "everything", "is", "correct", ".", "Stops", "when", "the", "child", "value", "is", "in", "correct", "order", "with", "its", "parent", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/IntPriorityQueue.java#L272-L281
53,092
EdwardRaff/JSAT
JSAT/src/jsat/utils/IntPriorityQueue.java
IntPriorityQueue.swapHeapValues
private void swapHeapValues(int i, int j) { if(fastValueRemove == Mode.HASH) { valueIndexMap.put(heap[i], j); valueIndexMap.put(heap[j], i); } else if(fastValueRemove == Mode.BOUNDED) { //Already in the array, so just need to set ...
java
private void swapHeapValues(int i, int j) { if(fastValueRemove == Mode.HASH) { valueIndexMap.put(heap[i], j); valueIndexMap.put(heap[j], i); } else if(fastValueRemove == Mode.BOUNDED) { //Already in the array, so just need to set ...
[ "private", "void", "swapHeapValues", "(", "int", "i", ",", "int", "j", ")", "{", "if", "(", "fastValueRemove", "==", "Mode", ".", "HASH", ")", "{", "valueIndexMap", ".", "put", "(", "heap", "[", "i", "]", ",", "j", ")", ";", "valueIndexMap", ".", "...
Swaps the values stored in the heap for the given indices @param i the first index to be swapped @param j the second index to be swapped
[ "Swaps", "the", "values", "stored", "in", "the", "heap", "for", "the", "given", "indices" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/IntPriorityQueue.java#L288-L304
53,093
EdwardRaff/JSAT
JSAT/src/jsat/utils/IntPriorityQueue.java
IntPriorityQueue.removeHeapNode
protected int removeHeapNode(int i) { int val = heap[i]; int rightMost = --size; heap[i] = heap[rightMost]; heap[rightMost] = 0; if(fastValueRemove == Mode.HASH) { valueIndexMap.remove(val); if(size != 0) valueIndexMap.put(heap[...
java
protected int removeHeapNode(int i) { int val = heap[i]; int rightMost = --size; heap[i] = heap[rightMost]; heap[rightMost] = 0; if(fastValueRemove == Mode.HASH) { valueIndexMap.remove(val); if(size != 0) valueIndexMap.put(heap[...
[ "protected", "int", "removeHeapNode", "(", "int", "i", ")", "{", "int", "val", "=", "heap", "[", "i", "]", ";", "int", "rightMost", "=", "--", "size", ";", "heap", "[", "i", "]", "=", "heap", "[", "rightMost", "]", ";", "heap", "[", "rightMost", ...
Removes the node specified from the heap @param i the valid heap node index to remove from the heap @return the value that was stored in the heap node
[ "Removes", "the", "node", "specified", "from", "the", "heap" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/IntPriorityQueue.java#L321-L339
53,094
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/neuralnetwork/regularizers/Max2NormRegularizer.java
Max2NormRegularizer.setMaxNorm
public void setMaxNorm(double maxNorm) { if(Double.isNaN(maxNorm) || Double.isInfinite(maxNorm) || maxNorm <= 0) throw new IllegalArgumentException("The maximum norm must be a positive constant, not " + maxNorm); this.maxNorm = maxNorm; }
java
public void setMaxNorm(double maxNorm) { if(Double.isNaN(maxNorm) || Double.isInfinite(maxNorm) || maxNorm <= 0) throw new IllegalArgumentException("The maximum norm must be a positive constant, not " + maxNorm); this.maxNorm = maxNorm; }
[ "public", "void", "setMaxNorm", "(", "double", "maxNorm", ")", "{", "if", "(", "Double", ".", "isNaN", "(", "maxNorm", ")", "||", "Double", ".", "isInfinite", "(", "maxNorm", ")", "||", "maxNorm", "<=", "0", ")", "throw", "new", "IllegalArgumentException",...
Sets the maximum allowed 2 norm for a single neuron's weights @param maxNorm the maximum norm per neuron's weights
[ "Sets", "the", "maximum", "allowed", "2", "norm", "for", "a", "single", "neuron", "s", "weights" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/neuralnetwork/regularizers/Max2NormRegularizer.java#L34-L39
53,095
EdwardRaff/JSAT
JSAT/src/jsat/lossfunctions/HuberLoss.java
HuberLoss.loss
public static double loss(double pred, double y, double c) { final double x = y - pred; if (Math.abs(x) <= c) return x * x * 0.5; else return c * (Math.abs(x) - c / 2); }
java
public static double loss(double pred, double y, double c) { final double x = y - pred; if (Math.abs(x) <= c) return x * x * 0.5; else return c * (Math.abs(x) - c / 2); }
[ "public", "static", "double", "loss", "(", "double", "pred", ",", "double", "y", ",", "double", "c", ")", "{", "final", "double", "x", "=", "y", "-", "pred", ";", "if", "(", "Math", ".", "abs", "(", "x", ")", "<=", "c", ")", "return", "x", "*",...
Computes the HuberLoss loss @param pred the predicted value @param y the true value @param c the threshold value @return the HuberLoss loss
[ "Computes", "the", "HuberLoss", "loss" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/lossfunctions/HuberLoss.java#L43-L50
53,096
EdwardRaff/JSAT
JSAT/src/jsat/lossfunctions/HuberLoss.java
HuberLoss.deriv
public static double deriv(double pred, double y, double c) { double x = pred-y; if (Math.abs(x) <= c) return x; else return c * Math.signum(x); }
java
public static double deriv(double pred, double y, double c) { double x = pred-y; if (Math.abs(x) <= c) return x; else return c * Math.signum(x); }
[ "public", "static", "double", "deriv", "(", "double", "pred", ",", "double", "y", ",", "double", "c", ")", "{", "double", "x", "=", "pred", "-", "y", ";", "if", "(", "Math", ".", "abs", "(", "x", ")", "<=", "c", ")", "return", "x", ";", "else",...
Computes the first derivative of the HuberLoss loss @param pred the predicted value @param y the true value @param c the threshold value @return the first derivative of the HuberLoss loss
[ "Computes", "the", "first", "derivative", "of", "the", "HuberLoss", "loss" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/lossfunctions/HuberLoss.java#L60-L68
53,097
EdwardRaff/JSAT
JSAT/src/jsat/linear/CholeskyDecomposition.java
CholeskyDecomposition.solve
public Vec solve(Vec b) { //Solve A x = L L^T x = b, for x //First solve L y = b Vec y = forwardSub(L, b); //Sole L^T x = y Vec x = backSub(L, y); return x; }
java
public Vec solve(Vec b) { //Solve A x = L L^T x = b, for x //First solve L y = b Vec y = forwardSub(L, b); //Sole L^T x = y Vec x = backSub(L, y); return x; }
[ "public", "Vec", "solve", "(", "Vec", "b", ")", "{", "//Solve A x = L L^T x = b, for x ", "//First solve L y = b", "Vec", "y", "=", "forwardSub", "(", "L", ",", "b", ")", ";", "//Sole L^T x = y", "Vec", "x", "=", "backSub", "(", "L", ",", "y", ")", ";", ...
Solves the linear system of equations A x = b @param b the vectors of values @return the vector x such that A x = b
[ "Solves", "the", "linear", "system", "of", "equations", "A", "x", "=", "b" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/CholeskyDecomposition.java#L136-L146
53,098
EdwardRaff/JSAT
JSAT/src/jsat/linear/CholeskyDecomposition.java
CholeskyDecomposition.solve
public Matrix solve(Matrix B) { //Solve A x = L L^T x = b, for x //First solve L y = b Matrix y = forwardSub(L, B); //Sole L^T x = y Matrix x = backSub(L, y); return x; }
java
public Matrix solve(Matrix B) { //Solve A x = L L^T x = b, for x //First solve L y = b Matrix y = forwardSub(L, B); //Sole L^T x = y Matrix x = backSub(L, y); return x; }
[ "public", "Matrix", "solve", "(", "Matrix", "B", ")", "{", "//Solve A x = L L^T x = b, for x ", "//First solve L y = b", "Matrix", "y", "=", "forwardSub", "(", "L", ",", "B", ")", ";", "//Sole L^T x = y", "Matrix", "x", "=", "backSub", "(", "L", ",", "y", "...
Solves the linear system of equations A x = B @param B the matrix of values @return the matrix c such that A x = B
[ "Solves", "the", "linear", "system", "of", "equations", "A", "x", "=", "B" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/CholeskyDecomposition.java#L153-L163
53,099
EdwardRaff/JSAT
JSAT/src/jsat/linear/CholeskyDecomposition.java
CholeskyDecomposition.getDet
public double getDet() { double det = 1; for(int i = 0; i < L.rows(); i++) det *= L.get(i, i); return det; }
java
public double getDet() { double det = 1; for(int i = 0; i < L.rows(); i++) det *= L.get(i, i); return det; }
[ "public", "double", "getDet", "(", ")", "{", "double", "det", "=", "1", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "L", ".", "rows", "(", ")", ";", "i", "++", ")", "det", "*=", "L", ".", "get", "(", "i", ",", "i", ")", ";", "...
Computes the determinant of A @return the determinant of A
[ "Computes", "the", "determinant", "of", "A" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/CholeskyDecomposition.java#L187-L193