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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 ε-insensitive loss
@param pred the predicted value
@param y the true value
@param eps the epsilon tolerance
@return the ε-insensitive loss | [
"Computes",
"the",
"&epsilon",
";",
"-",
"insensitive",
"loss"
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/lossfunctions/EpsilonInsensitiveLoss.java#L24-L28 | train |
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 ε-insensitive loss
@param pred the predicted value
@param y the true value
@param eps the epsilon tolerance
@return the first derivative of the ε-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 | train |
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 | train |
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 | train |
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 ψ(x) | [
"Computes",
"the",
"digamma",
"function",
"of",
"the",
"input"
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/FastMath.java#L225-L244 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/linear/LinearSGD.java | LinearSGD.applyL2Reg | private void applyL2Reg(final double eta_t)
{
if(lambda0 > 0)//apply L2 regularization
for(Vec v : ws)
v.mutableMultiply(1-eta_t*lambda0);
} | java | private void applyL2Reg(final double eta_t)
{
if(lambda0 > 0)//apply L2 regularization
for(Vec v : ws)
v.mutableMultiply(1-eta_t*lambda0);
} | [
"private",
"void",
"applyL2Reg",
"(",
"final",
"double",
"eta_t",
")",
"{",
"if",
"(",
"lambda0",
">",
"0",
")",
"//apply L2 regularization",
"for",
"(",
"Vec",
"v",
":",
"ws",
")",
"v",
".",
"mutableMultiply",
"(",
"1",
"-",
"eta_t",
"*",
"lambda0",
"... | Applies L2 regularization to the model
@param eta_t the learning rate in use | [
"Applies",
"L2",
"regularization",
"to",
"the",
"model"
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/LinearSGD.java#L449-L454 | train |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/linear/LinearSGD.java | LinearSGD.applyL1Reg | private void applyL1Reg(final double eta_t, Vec x)
{
//apply l1 regularization
if(lambda1 > 0)
{
l1U += eta_t*lambda1;//line 6: in Tsuruoka et al paper, figure 2
for(int k = 0; k < ws.length; k++)
{
final Vec w_k = ws[k];
fi... | java | private void applyL1Reg(final double eta_t, Vec x)
{
//apply l1 regularization
if(lambda1 > 0)
{
l1U += eta_t*lambda1;//line 6: in Tsuruoka et al paper, figure 2
for(int k = 0; k < ws.length; k++)
{
final Vec w_k = ws[k];
fi... | [
"private",
"void",
"applyL1Reg",
"(",
"final",
"double",
"eta_t",
",",
"Vec",
"x",
")",
"{",
"//apply l1 regularization",
"if",
"(",
"lambda1",
">",
"0",
")",
"{",
"l1U",
"+=",
"eta_t",
"*",
"lambda1",
";",
"//line 6: in Tsuruoka et al paper, figure 2",
"for",
... | Applies L1 regularization to the model
@param eta_t the learning rate in use
@param x the input vector the update is from | [
"Applies",
"L1",
"regularization",
"to",
"the",
"model"
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/LinearSGD.java#L461-L486 | train |
EdwardRaff/JSAT | JSAT/src/jsat/linear/vectorcollection/lsh/RandomProjectionLSH.java | RandomProjectionLSH.projectVector | private void projectVector(Vec vec, int slot, int[] projLocation, Vec projected)
{
randProjMatrix.multiply(vec, 1.0, projected);
int pos = 0;
int bitsLeft = Integer.SIZE;
int curVal = 0;
while(pos < slotsPerEntry)
{
while(bitsLeft > 0)
... | java | private void projectVector(Vec vec, int slot, int[] projLocation, Vec projected)
{
randProjMatrix.multiply(vec, 1.0, projected);
int pos = 0;
int bitsLeft = Integer.SIZE;
int curVal = 0;
while(pos < slotsPerEntry)
{
while(bitsLeft > 0)
... | [
"private",
"void",
"projectVector",
"(",
"Vec",
"vec",
",",
"int",
"slot",
",",
"int",
"[",
"]",
"projLocation",
",",
"Vec",
"projected",
")",
"{",
"randProjMatrix",
".",
"multiply",
"(",
"vec",
",",
"1.0",
",",
"projected",
")",
";",
"int",
"pos",
"="... | Projects a given vector into the array of integers.
@param vecs the vector to project
@param slot the index into the array to start placing the bit values
@param projected a vector full of zeros of the same length as
{@link #getSignatureBitLength() } to use as a temp space. | [
"Projects",
"a",
"given",
"vector",
"into",
"the",
"array",
"of",
"integers",
"."
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/vectorcollection/lsh/RandomProjectionLSH.java#L223-L244 | train |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/trees/TreePruner.java | TreePruner.prune | public static void prune(TreeNodeVisitor root, PruningMethod method, ClassificationDataSet testSet)
{
//TODO add vargs for extra arguments that may be used by pruning methods
if(method == PruningMethod.NONE )
return;
else if(method == PruningMethod.REDUCED_ERROR)
prun... | java | public static void prune(TreeNodeVisitor root, PruningMethod method, ClassificationDataSet testSet)
{
//TODO add vargs for extra arguments that may be used by pruning methods
if(method == PruningMethod.NONE )
return;
else if(method == PruningMethod.REDUCED_ERROR)
prun... | [
"public",
"static",
"void",
"prune",
"(",
"TreeNodeVisitor",
"root",
",",
"PruningMethod",
"method",
",",
"ClassificationDataSet",
"testSet",
")",
"{",
"//TODO add vargs for extra arguments that may be used by pruning methods",
"if",
"(",
"method",
"==",
"PruningMethod",
".... | Performs pruning starting from the root node of a tree
@param root the root node of a decision tree
@param method the pruning method to use
@param testSet the test set of data points to use for pruning | [
"Performs",
"pruning",
"starting",
"from",
"the",
"root",
"node",
"of",
"a",
"tree"
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/trees/TreePruner.java#L66-L77 | train |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/trees/TreePruner.java | TreePruner.pruneReduceError | private static int pruneReduceError(TreeNodeVisitor parent, int pathFollowed, TreeNodeVisitor current, ClassificationDataSet testSet)
{
if(current == null)
return 0;
int nodesPruned = 0;
//If we are not a leaf, prune our children
if(!current.isLeaf())
{
... | java | private static int pruneReduceError(TreeNodeVisitor parent, int pathFollowed, TreeNodeVisitor current, ClassificationDataSet testSet)
{
if(current == null)
return 0;
int nodesPruned = 0;
//If we are not a leaf, prune our children
if(!current.isLeaf())
{
... | [
"private",
"static",
"int",
"pruneReduceError",
"(",
"TreeNodeVisitor",
"parent",
",",
"int",
"pathFollowed",
",",
"TreeNodeVisitor",
"current",
",",
"ClassificationDataSet",
"testSet",
")",
"{",
"if",
"(",
"current",
"==",
"null",
")",
"return",
"0",
";",
"int"... | Performs pruning to reduce error on the testing set
@param parent the parent of the current node, may be null
@param pathFollowed the path from the parent that lead to the current node
@param current the current node being considered
@param testSet the set of testing points to apply to this node
@return the number of n... | [
"Performs",
"pruning",
"to",
"reduce",
"error",
"on",
"the",
"testing",
"set"
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/trees/TreePruner.java#L87-L156 | train |
EdwardRaff/JSAT | JSAT/src/jsat/distributions/Levy.java | Levy.setScale | public void setScale(double scale)
{
if(scale <= 0 || Double.isNaN(scale) || Double.isInfinite(scale))
throw new ArithmeticException("Scale must be a positive value, not " + scale);
this.scale = scale;
this.logScale = log(scale);
} | java | public void setScale(double scale)
{
if(scale <= 0 || Double.isNaN(scale) || Double.isInfinite(scale))
throw new ArithmeticException("Scale must be a positive value, not " + scale);
this.scale = scale;
this.logScale = log(scale);
} | [
"public",
"void",
"setScale",
"(",
"double",
"scale",
")",
"{",
"if",
"(",
"scale",
"<=",
"0",
"||",
"Double",
".",
"isNaN",
"(",
"scale",
")",
"||",
"Double",
".",
"isInfinite",
"(",
"scale",
")",
")",
"throw",
"new",
"ArithmeticException",
"(",
"\"Sc... | Sets the scale of the Levy distribution
@param scale the new scale value, must be positive | [
"Sets",
"the",
"scale",
"of",
"the",
"Levy",
"distribution"
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/Levy.java#L33-L39 | train |
EdwardRaff/JSAT | JSAT/src/jsat/distributions/Levy.java | Levy.setLocation | public void setLocation(double location)
{
if(Double.isNaN(location) || Double.isInfinite(location))
throw new ArithmeticException("location must be a real number");
this.location = location;
} | java | public void setLocation(double location)
{
if(Double.isNaN(location) || Double.isInfinite(location))
throw new ArithmeticException("location must be a real number");
this.location = location;
} | [
"public",
"void",
"setLocation",
"(",
"double",
"location",
")",
"{",
"if",
"(",
"Double",
".",
"isNaN",
"(",
"location",
")",
"||",
"Double",
".",
"isInfinite",
"(",
"location",
")",
")",
"throw",
"new",
"ArithmeticException",
"(",
"\"location must be a real ... | Sets location of the Levy distribution.
@param location the new location | [
"Sets",
"location",
"of",
"the",
"Levy",
"distribution",
"."
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/Levy.java#L54-L59 | train |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/svm/extended/CPM.java | CPM.sgdTrain | private void sgdTrain(ClassificationDataSet D, MatrixOfVecs W, Vec b, int sign_mul, boolean parallel)
{
IntList order = new IntList(D.size());
ListUtils.addRange(order, 0, D.size(), 1);
final double lambda_adj = lambda/(D.size()*epochs);
int[] owned = new int[K];//h... | java | private void sgdTrain(ClassificationDataSet D, MatrixOfVecs W, Vec b, int sign_mul, boolean parallel)
{
IntList order = new IntList(D.size());
ListUtils.addRange(order, 0, D.size(), 1);
final double lambda_adj = lambda/(D.size()*epochs);
int[] owned = new int[K];//h... | [
"private",
"void",
"sgdTrain",
"(",
"ClassificationDataSet",
"D",
",",
"MatrixOfVecs",
"W",
",",
"Vec",
"b",
",",
"int",
"sign_mul",
",",
"boolean",
"parallel",
")",
"{",
"IntList",
"order",
"=",
"new",
"IntList",
"(",
"D",
".",
"size",
"(",
")",
")",
... | Training procedure that can be applied to each version of the CPM
sub-problem.
@param D the dataset to train on
@param W the weight matrix of vectors to use
@param b a vector that stores the associated bias terms for each weigh
vector.
@param sign_mul Either positive or negative 1. Controls whether or not
the positive... | [
"Training",
"procedure",
"that",
"can",
"be",
"applied",
"to",
"each",
"version",
"of",
"the",
"CPM",
"sub",
"-",
"problem",
"."
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/svm/extended/CPM.java#L413-L482 | train |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/linear/STGD.java | STGD.setLearningRate | public void setLearningRate(double learningRate)
{
if(Double.isInfinite(learningRate) || Double.isNaN(learningRate) || learningRate <= 0)
throw new IllegalArgumentException("Learning rate must be positive, not " + learningRate);
this.learningRate = learningRate;
} | java | public void setLearningRate(double learningRate)
{
if(Double.isInfinite(learningRate) || Double.isNaN(learningRate) || learningRate <= 0)
throw new IllegalArgumentException("Learning rate must be positive, not " + learningRate);
this.learningRate = learningRate;
} | [
"public",
"void",
"setLearningRate",
"(",
"double",
"learningRate",
")",
"{",
"if",
"(",
"Double",
".",
"isInfinite",
"(",
"learningRate",
")",
"||",
"Double",
".",
"isNaN",
"(",
"learningRate",
")",
"||",
"learningRate",
"<=",
"0",
")",
"throw",
"new",
"I... | Sets the learning rate to use
@param learningRate the learning rate > 0. | [
"Sets",
"the",
"learning",
"rate",
"to",
"use"
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/STGD.java#L108-L113 | train |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/linear/STGD.java | STGD.setThreshold | public void setThreshold(double threshold)
{
if(Double.isNaN(threshold) || threshold <= 0)
throw new IllegalArgumentException("Threshold must be positive, not " + threshold);
this.threshold = threshold;
} | java | public void setThreshold(double threshold)
{
if(Double.isNaN(threshold) || threshold <= 0)
throw new IllegalArgumentException("Threshold must be positive, not " + threshold);
this.threshold = threshold;
} | [
"public",
"void",
"setThreshold",
"(",
"double",
"threshold",
")",
"{",
"if",
"(",
"Double",
".",
"isNaN",
"(",
"threshold",
")",
"||",
"threshold",
"<=",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Threshold must be positive, not \"",
"+",
"th... | Sets the threshold for a coefficient value to avoid regularization. While
a coefficient reaches this magnitude, regularization will not be applied.
@param threshold the coefficient regularization threshold in
( 0, Infinity ] | [
"Sets",
"the",
"threshold",
"for",
"a",
"coefficient",
"value",
"to",
"avoid",
"regularization",
".",
"While",
"a",
"coefficient",
"reaches",
"this",
"magnitude",
"regularization",
"will",
"not",
"be",
"applied",
"."
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/STGD.java#L130-L135 | train |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/linear/STGD.java | STGD.setGravity | public void setGravity(double gravity)
{
if(Double.isInfinite(gravity) || Double.isNaN(gravity) || gravity <= 0)
throw new IllegalArgumentException("Gravity must be positive, not " + gravity);
this.gravity = gravity;
} | java | public void setGravity(double gravity)
{
if(Double.isInfinite(gravity) || Double.isNaN(gravity) || gravity <= 0)
throw new IllegalArgumentException("Gravity must be positive, not " + gravity);
this.gravity = gravity;
} | [
"public",
"void",
"setGravity",
"(",
"double",
"gravity",
")",
"{",
"if",
"(",
"Double",
".",
"isInfinite",
"(",
"gravity",
")",
"||",
"Double",
".",
"isNaN",
"(",
"gravity",
")",
"||",
"gravity",
"<=",
"0",
")",
"throw",
"new",
"IllegalArgumentException",... | Sets the gravity regularization parameter that "weighs down" the
coefficient values. Larger gravity values impose stronger regularization,
and encourage greater sparsity.
@param gravity the regularization parameter in ( 0, Infinity ) | [
"Sets",
"the",
"gravity",
"regularization",
"parameter",
"that",
"weighs",
"down",
"the",
"coefficient",
"values",
".",
"Larger",
"gravity",
"values",
"impose",
"stronger",
"regularization",
"and",
"encourage",
"greater",
"sparsity",
"."
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/STGD.java#L153-L158 | train |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/linear/STGD.java | STGD.performUpdate | private void performUpdate(final Vec x, final double y, final double yHat)
{
for(IndexValue iv : x)
{
final int j = iv.getIndex();
w.set(j,
T(w.get(j)+2*learningRate*(y-yHat)*iv.getValue(),
((time-t[j])/K)*gravity*learningRate,
... | java | private void performUpdate(final Vec x, final double y, final double yHat)
{
for(IndexValue iv : x)
{
final int j = iv.getIndex();
w.set(j,
T(w.get(j)+2*learningRate*(y-yHat)*iv.getValue(),
((time-t[j])/K)*gravity*learningRate,
... | [
"private",
"void",
"performUpdate",
"(",
"final",
"Vec",
"x",
",",
"final",
"double",
"y",
",",
"final",
"double",
"yHat",
")",
"{",
"for",
"(",
"IndexValue",
"iv",
":",
"x",
")",
"{",
"final",
"int",
"j",
"=",
"iv",
".",
"getIndex",
"(",
")",
";",... | Performs the sparse update of the weight vector
@param x the input vector
@param y the true value
@param yHat the predicted value | [
"Performs",
"the",
"sparse",
"update",
"of",
"the",
"weight",
"vector"
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/STGD.java#L277-L289 | train |
EdwardRaff/JSAT | JSAT/src/jsat/datatransform/featureselection/SFS.java | SFS.SFSSelectFeature | static protected int SFSSelectFeature(Set<Integer> available,
DataSet dataSet, Set<Integer> catToRemove, Set<Integer> numToRemove,
Set<Integer> catSelecteed, Set<Integer> numSelected,
Object evaluater, int folds, Random rand, double[] PbestScore,
int minFeatures)
{... | java | static protected int SFSSelectFeature(Set<Integer> available,
DataSet dataSet, Set<Integer> catToRemove, Set<Integer> numToRemove,
Set<Integer> catSelecteed, Set<Integer> numSelected,
Object evaluater, int folds, Random rand, double[] PbestScore,
int minFeatures)
{... | [
"static",
"protected",
"int",
"SFSSelectFeature",
"(",
"Set",
"<",
"Integer",
">",
"available",
",",
"DataSet",
"dataSet",
",",
"Set",
"<",
"Integer",
">",
"catToRemove",
",",
"Set",
"<",
"Integer",
">",
"numToRemove",
",",
"Set",
"<",
"Integer",
">",
"cat... | Attempts to add one feature to the list of features while increasing or
maintaining the current accuracy
@param available the set of available features from [0, n) to consider
for adding
@param dataSet the original data set to perform feature selection from
@param catToRemove the current set of categorical features to... | [
"Attempts",
"to",
"add",
"one",
"feature",
"to",
"the",
"list",
"of",
"features",
"while",
"increasing",
"or",
"maintaining",
"the",
"current",
"accuracy"
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/datatransform/featureselection/SFS.java#L256-L297 | train |
EdwardRaff/JSAT | JSAT/src/jsat/datatransform/featureselection/SFS.java | SFS.getScore | protected static double getScore(DataSet workOn, Object evaluater, int folds, Random rand)
{
if(workOn instanceof ClassificationDataSet)
{
ClassificationModelEvaluation cme =
new ClassificationModelEvaluation((Classifier)evaluater,
(Classification... | java | protected static double getScore(DataSet workOn, Object evaluater, int folds, Random rand)
{
if(workOn instanceof ClassificationDataSet)
{
ClassificationModelEvaluation cme =
new ClassificationModelEvaluation((Classifier)evaluater,
(Classification... | [
"protected",
"static",
"double",
"getScore",
"(",
"DataSet",
"workOn",
",",
"Object",
"evaluater",
",",
"int",
"folds",
",",
"Random",
"rand",
")",
"{",
"if",
"(",
"workOn",
"instanceof",
"ClassificationDataSet",
")",
"{",
"ClassificationModelEvaluation",
"cme",
... | The score function for a data set and a learner by cross validation of a
classifier
@param workOn the transformed data set to test from with cross validation
@param evaluater the learning algorithm to use
@param folds the number of cross validation folds to perform
@param rand the source of randomness
@return the scor... | [
"The",
"score",
"function",
"for",
"a",
"data",
"set",
"and",
"a",
"learner",
"by",
"cross",
"validation",
"of",
"a",
"classifier"
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/datatransform/featureselection/SFS.java#L309-L330 | train |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/bayesian/AODE.java | AODE.setM | public void setM(double m)
{
if(m < 0 || Double.isInfinite(m) || Double.isNaN(m))
throw new ArithmeticException("The minimum count must be a non negative number");
this.m = m;
} | java | public void setM(double m)
{
if(m < 0 || Double.isInfinite(m) || Double.isNaN(m))
throw new ArithmeticException("The minimum count must be a non negative number");
this.m = m;
} | [
"public",
"void",
"setM",
"(",
"double",
"m",
")",
"{",
"if",
"(",
"m",
"<",
"0",
"||",
"Double",
".",
"isInfinite",
"(",
"m",
")",
"||",
"Double",
".",
"isNaN",
"(",
"m",
")",
")",
"throw",
"new",
"ArithmeticException",
"(",
"\"The minimum count must ... | Sets the minimum prior observation value needed for an attribute
combination to have enough support to be included in the final estimate.
@param m the minimum needed score | [
"Sets",
"the",
"minimum",
"prior",
"observation",
"value",
"needed",
"for",
"an",
"attribute",
"combination",
"to",
"have",
"enough",
"support",
"to",
"be",
"included",
"in",
"the",
"final",
"estimate",
"."
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/bayesian/AODE.java#L133-L138 | train |
EdwardRaff/JSAT | JSAT/src/jsat/linear/VecPaired.java | VecPaired.extractTrueVec | public static Vec extractTrueVec(Vec b)
{
while(b instanceof VecPaired)
b = ((VecPaired) b).getVector();
return b;
} | java | public static Vec extractTrueVec(Vec b)
{
while(b instanceof VecPaired)
b = ((VecPaired) b).getVector();
return b;
} | [
"public",
"static",
"Vec",
"extractTrueVec",
"(",
"Vec",
"b",
")",
"{",
"while",
"(",
"b",
"instanceof",
"VecPaired",
")",
"b",
"=",
"(",
"(",
"VecPaired",
")",
"b",
")",
".",
"getVector",
"(",
")",
";",
"return",
"b",
";",
"}"
] | This method is used assuming multiple VecPaired are used together. The
implementation of the vector may have logic to handle the case that
the other vector is of the same type. This will go through every layer
of VecPaired to return the final base vector.
@param b a Vec, that may or may not be an instance of {@link Ve... | [
"This",
"method",
"is",
"used",
"assuming",
"multiple",
"VecPaired",
"are",
"used",
"together",
".",
"The",
"implementation",
"of",
"the",
"vector",
"may",
"have",
"logic",
"to",
"handle",
"the",
"case",
"that",
"the",
"other",
"vector",
"is",
"of",
"the",
... | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/VecPaired.java#L316-L321 | train |
EdwardRaff/JSAT | JSAT/src/jsat/text/TextDataLoader.java | TextDataLoader.addWord | private boolean addWord(String word, SparseVector vec, Integer value)
{
Integer indx = wordIndex.get(word);
if(indx == null)//this word has never been seen before!
{
Integer index_for_new_word;
if((index_for_new_word = wordIndex.putIfAbsent(word, -1)) == null)//I won ... | java | private boolean addWord(String word, SparseVector vec, Integer value)
{
Integer indx = wordIndex.get(word);
if(indx == null)//this word has never been seen before!
{
Integer index_for_new_word;
if((index_for_new_word = wordIndex.putIfAbsent(word, -1)) == null)//I won ... | [
"private",
"boolean",
"addWord",
"(",
"String",
"word",
",",
"SparseVector",
"vec",
",",
"Integer",
"value",
")",
"{",
"Integer",
"indx",
"=",
"wordIndex",
".",
"get",
"(",
"word",
")",
";",
"if",
"(",
"indx",
"==",
"null",
")",
"//this word has never been... | Does the work to add a given word to the sparse vector. May not succeed
in race conditions when two ore more threads are trying to add a word at
the same time.
@param word the word to add to the vector
@param vec the location to store the word occurrence
@param entry the number of times the word occurred
@return {@cod... | [
"Does",
"the",
"work",
"to",
"add",
"a",
"given",
"word",
"to",
"the",
"sparse",
"vector",
".",
"May",
"not",
"succeed",
"in",
"race",
"conditions",
"when",
"two",
"ore",
"more",
"threads",
"are",
"trying",
"to",
"add",
"a",
"word",
"at",
"the",
"same"... | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/text/TextDataLoader.java#L215-L268 | train |
EdwardRaff/JSAT | JSAT/src/jsat/distributions/discrete/Poisson.java | Poisson.setLambda | public void setLambda(double lambda)
{
if (Double.isNaN(lambda) || lambda <= 0 || Double.isInfinite(lambda))
throw new IllegalArgumentException("lambda must be positive, not " + lambda);
this.lambda = lambda;
} | java | public void setLambda(double lambda)
{
if (Double.isNaN(lambda) || lambda <= 0 || Double.isInfinite(lambda))
throw new IllegalArgumentException("lambda must be positive, not " + lambda);
this.lambda = lambda;
} | [
"public",
"void",
"setLambda",
"(",
"double",
"lambda",
")",
"{",
"if",
"(",
"Double",
".",
"isNaN",
"(",
"lambda",
")",
"||",
"lambda",
"<=",
"0",
"||",
"Double",
".",
"isInfinite",
"(",
"lambda",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(... | Sets the average rate of the event occurring in a unit of time
@param lambda the average rate of the event occurring | [
"Sets",
"the",
"average",
"rate",
"of",
"the",
"event",
"occurring",
"in",
"a",
"unit",
"of",
"time"
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/discrete/Poisson.java#L58-L63 | train |
EdwardRaff/JSAT | JSAT/src/jsat/linear/vectorcollection/KDTree.java | KDTree.getMedianIndex | public int getMedianIndex(final List<Integer> data, int pivot)
{
int medianIndex = data.size()/2;
//What if more than one point have the samve value? Keep incrementing until that dosn't happen
while(medianIndex < data.size()-1 && allVecs.get(data.get(medianIndex)).get(pivot) == allVecs.get(d... | java | public int getMedianIndex(final List<Integer> data, int pivot)
{
int medianIndex = data.size()/2;
//What if more than one point have the samve value? Keep incrementing until that dosn't happen
while(medianIndex < data.size()-1 && allVecs.get(data.get(medianIndex)).get(pivot) == allVecs.get(d... | [
"public",
"int",
"getMedianIndex",
"(",
"final",
"List",
"<",
"Integer",
">",
"data",
",",
"int",
"pivot",
")",
"{",
"int",
"medianIndex",
"=",
"data",
".",
"size",
"(",
")",
"/",
"2",
";",
"//What if more than one point have the samve value? Keep incrementing unt... | Returns the index for the median, adjusted incase multiple features have the same value.
@param data the dataset to get the median index of
@param pivot the dimension to pivot on, and ensure the median index has a different value on the left side
@return | [
"Returns",
"the",
"index",
"for",
"the",
"median",
"adjusted",
"incase",
"multiple",
"features",
"have",
"the",
"same",
"value",
"."
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/vectorcollection/KDTree.java#L615-L622 | train |
EdwardRaff/JSAT | JSAT/src/jsat/distributions/discrete/Zipf.java | Zipf.setCardinality | public void setCardinality(double cardinality)
{
if (cardinality < 0 || Double.isNaN(cardinality))
throw new IllegalArgumentException("Cardinality must be a positive integer or infinity, not " + cardinality);
this.cardinality = Math.ceil(cardinality);
fixCache();
} | java | public void setCardinality(double cardinality)
{
if (cardinality < 0 || Double.isNaN(cardinality))
throw new IllegalArgumentException("Cardinality must be a positive integer or infinity, not " + cardinality);
this.cardinality = Math.ceil(cardinality);
fixCache();
} | [
"public",
"void",
"setCardinality",
"(",
"double",
"cardinality",
")",
"{",
"if",
"(",
"cardinality",
"<",
"0",
"||",
"Double",
".",
"isNaN",
"(",
"cardinality",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cardinality must be a positive integer or ... | Sets the cardinality of the distribution, defining the maximum number of
items that Zipf can return.
@param cardinality the maximum output range of the distribution, can be
{@link Double#POSITIVE_INFINITY infinite}. | [
"Sets",
"the",
"cardinality",
"of",
"the",
"distribution",
"defining",
"the",
"maximum",
"number",
"of",
"items",
"that",
"Zipf",
"can",
"return",
"."
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/discrete/Zipf.java#L87-L93 | train |
EdwardRaff/JSAT | JSAT/src/jsat/distributions/discrete/Zipf.java | Zipf.setSkew | public void setSkew(double skew)
{
if(skew <= 0 || Double.isNaN(skew) || Double.isInfinite(skew))
throw new IllegalArgumentException("Skew must be a positive value, not " + skew);
this.skew = skew;
fixCache();
} | java | public void setSkew(double skew)
{
if(skew <= 0 || Double.isNaN(skew) || Double.isInfinite(skew))
throw new IllegalArgumentException("Skew must be a positive value, not " + skew);
this.skew = skew;
fixCache();
} | [
"public",
"void",
"setSkew",
"(",
"double",
"skew",
")",
"{",
"if",
"(",
"skew",
"<=",
"0",
"||",
"Double",
".",
"isNaN",
"(",
"skew",
")",
"||",
"Double",
".",
"isInfinite",
"(",
"skew",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Sk... | Sets the skewness of the distribution. Lower values spread out the
probability distribution, while higher values concentrate on the lowest
ranks.
@param skew the positive value for the distribution's skew | [
"Sets",
"the",
"skewness",
"of",
"the",
"distribution",
".",
"Lower",
"values",
"spread",
"out",
"the",
"probability",
"distribution",
"while",
"higher",
"values",
"concentrate",
"on",
"the",
"lowest",
"ranks",
"."
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/discrete/Zipf.java#L111-L117 | train |
EdwardRaff/JSAT | JSAT/src/jsat/io/DataWriter.java | DataWriter.writePoint | public void writePoint(double weight, DataPoint dp, double label) throws IOException
{
ByteArrayOutputStream baos = local_baos.get();
pointToBytes(weight, dp, label, baos);
if(baos.size() >= LOCAL_BUFFER_SIZE)//We've got a big chunk of data, lets dump it
synchronized(out)
... | java | public void writePoint(double weight, DataPoint dp, double label) throws IOException
{
ByteArrayOutputStream baos = local_baos.get();
pointToBytes(weight, dp, label, baos);
if(baos.size() >= LOCAL_BUFFER_SIZE)//We've got a big chunk of data, lets dump it
synchronized(out)
... | [
"public",
"void",
"writePoint",
"(",
"double",
"weight",
",",
"DataPoint",
"dp",
",",
"double",
"label",
")",
"throws",
"IOException",
"{",
"ByteArrayOutputStream",
"baos",
"=",
"local_baos",
".",
"get",
"(",
")",
";",
"pointToBytes",
"(",
"weight",
",",
"dp... | Write out the given data point to the output stream
@param weight weight of the given data point to write out
@param dp the data point to write to the file
@param label The associated label for this dataum. If {@link #type} is a
{@link DataSetType#SIMPLE} set, this value will be ignored. If
{@link DataSetType#CLASSIFIC... | [
"Write",
"out",
"the",
"given",
"data",
"point",
"to",
"the",
"output",
"stream"
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/io/DataWriter.java#L114-L124 | train |
EdwardRaff/JSAT | JSAT/src/jsat/datatransform/PolynomialTransform.java | PolynomialTransform.increment | private int increment(int[] setTo, int max, int curCount)
{
setTo[0]++;
curCount++;
if(curCount <= max)
return curCount;
int carryPos = 0;
while(carryPos < setTo.length-1 && curCount > max)
{
curCount-=setTo[carryPos]... | java | private int increment(int[] setTo, int max, int curCount)
{
setTo[0]++;
curCount++;
if(curCount <= max)
return curCount;
int carryPos = 0;
while(carryPos < setTo.length-1 && curCount > max)
{
curCount-=setTo[carryPos]... | [
"private",
"int",
"increment",
"(",
"int",
"[",
"]",
"setTo",
",",
"int",
"max",
",",
"int",
"curCount",
")",
"{",
"setTo",
"[",
"0",
"]",
"++",
";",
"curCount",
"++",
";",
"if",
"(",
"curCount",
"<=",
"max",
")",
"return",
"curCount",
";",
"int",
... | Increments the array to contain representation of the next combination of
values in the polynomial
@param setTo the array of values marking how many multiples of that value
will be used in construction of the point
@param max the degree of the polynomial
@param curCount the current sum of all counts in the array <tt>s... | [
"Increments",
"the",
"array",
"to",
"contain",
"representation",
"of",
"the",
"next",
"combination",
"of",
"values",
"in",
"the",
"polynomial"
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/datatransform/PolynomialTransform.java#L91-L110 | train |
EdwardRaff/JSAT | JSAT/src/jsat/parameters/ModelSearch.java | ModelSearch.getParameterByName | protected Parameter getParameterByName(String name) throws IllegalArgumentException
{
Parameter param;
if (baseClassifier != null)
param = ((Parameterized) baseClassifier).getParameter(name);
else
param = ((Parameterized) baseRegressor).getParameter(name);
... | java | protected Parameter getParameterByName(String name) throws IllegalArgumentException
{
Parameter param;
if (baseClassifier != null)
param = ((Parameterized) baseClassifier).getParameter(name);
else
param = ((Parameterized) baseRegressor).getParameter(name);
... | [
"protected",
"Parameter",
"getParameterByName",
"(",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"Parameter",
"param",
";",
"if",
"(",
"baseClassifier",
"!=",
"null",
")",
"param",
"=",
"(",
"(",
"Parameterized",
")",
"baseClassifier",
")",
... | Finds the parameter object with the given name, or throws an exception if
a parameter with the given name does not exist.
@param name the name to search for
@return the parameter object in question
@throws IllegalArgumentException if the name is not found | [
"Finds",
"the",
"parameter",
"object",
"with",
"the",
"given",
"name",
"or",
"throws",
"an",
"exception",
"if",
"a",
"parameter",
"with",
"the",
"given",
"name",
"does",
"not",
"exist",
"."
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/parameters/ModelSearch.java#L319-L329 | train |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/linear/kernelized/CSKLR.java | CSKLR.getPreScore | private double getPreScore(Vec x)
{
return k.evalSum(vecs, accelCache, alpha.getBackingArray(), x, 0, alpha.size());
} | java | private double getPreScore(Vec x)
{
return k.evalSum(vecs, accelCache, alpha.getBackingArray(), x, 0, alpha.size());
} | [
"private",
"double",
"getPreScore",
"(",
"Vec",
"x",
")",
"{",
"return",
"k",
".",
"evalSum",
"(",
"vecs",
",",
"accelCache",
",",
"alpha",
".",
"getBackingArray",
"(",
")",
",",
"x",
",",
"0",
",",
"alpha",
".",
"size",
"(",
")",
")",
";",
"}"
] | Computes the margin score for the given data point
@param x the input vector
@return the margin score | [
"Computes",
"the",
"margin",
"score",
"for",
"the",
"given",
"data",
"point"
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/kernelized/CSKLR.java#L372-L375 | train |
EdwardRaff/JSAT | JSAT/src/jsat/distributions/multivariate/NormalM.java | NormalM.setCovariance | public void setCovariance(Matrix covMatrix)
{
if(!covMatrix.isSquare())
throw new ArithmeticException("Covariance matrix must be square");
else if(covMatrix.rows() != this.mean.length())
throw new ArithmeticException("Covariance matrix does not agree with the mean");
... | java | public void setCovariance(Matrix covMatrix)
{
if(!covMatrix.isSquare())
throw new ArithmeticException("Covariance matrix must be square");
else if(covMatrix.rows() != this.mean.length())
throw new ArithmeticException("Covariance matrix does not agree with the mean");
... | [
"public",
"void",
"setCovariance",
"(",
"Matrix",
"covMatrix",
")",
"{",
"if",
"(",
"!",
"covMatrix",
".",
"isSquare",
"(",
")",
")",
"throw",
"new",
"ArithmeticException",
"(",
"\"Covariance matrix must be square\"",
")",
";",
"else",
"if",
"(",
"covMatrix",
... | Sets the covariance matrix for this matrix.
@param covMatrix set the covariance matrix used for this distribution
@throws ArithmeticException if the covariance matrix is not square,
does not agree with the mean, or is not positive definite. An
exception may not be throw for all bad matrices. | [
"Sets",
"the",
"covariance",
"matrix",
"for",
"this",
"matrix",
"."
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/multivariate/NormalM.java#L96-L123 | train |
EdwardRaff/JSAT | JSAT/src/jsat/clustering/PAM.java | PAM.cluster | protected double cluster(DataSet data, boolean doInit, int[] medioids, int[] assignments, List<Double> cacheAccel, boolean parallel)
{
DoubleAdder totalDistance =new DoubleAdder();
LongAdder changes = new LongAdder();
Arrays.fill(assignments, -1);//-1, invalid category!
int[... | java | protected double cluster(DataSet data, boolean doInit, int[] medioids, int[] assignments, List<Double> cacheAccel, boolean parallel)
{
DoubleAdder totalDistance =new DoubleAdder();
LongAdder changes = new LongAdder();
Arrays.fill(assignments, -1);//-1, invalid category!
int[... | [
"protected",
"double",
"cluster",
"(",
"DataSet",
"data",
",",
"boolean",
"doInit",
",",
"int",
"[",
"]",
"medioids",
",",
"int",
"[",
"]",
"assignments",
",",
"List",
"<",
"Double",
">",
"cacheAccel",
",",
"boolean",
"parallel",
")",
"{",
"DoubleAdder",
... | Performs the actual work of PAM.
@param data the data set to apply PAM to
@param doInit {@code true} if the initialization procedure of training the distance metric, initiating its cache, and selecting he seeds, should be done.
@param medioids the array to store the indices that get chosen as the medoids. The length o... | [
"Performs",
"the",
"actual",
"work",
"of",
"PAM",
"."
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/clustering/PAM.java#L167-L246 | train |
EdwardRaff/JSAT | JSAT/src/jsat/math/optimization/stochastic/AdaDelta.java | AdaDelta.setRho | public void setRho(double rho)
{
if(rho <= 0 || rho >= 1 || Double.isNaN(rho))
throw new IllegalArgumentException("Rho must be in (0, 1)");
this.rho = rho;
} | java | public void setRho(double rho)
{
if(rho <= 0 || rho >= 1 || Double.isNaN(rho))
throw new IllegalArgumentException("Rho must be in (0, 1)");
this.rho = rho;
} | [
"public",
"void",
"setRho",
"(",
"double",
"rho",
")",
"{",
"if",
"(",
"rho",
"<=",
"0",
"||",
"rho",
">=",
"1",
"||",
"Double",
".",
"isNaN",
"(",
"rho",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Rho must be in (0, 1)\"",
")",
";",
... | Sets the decay rate used by AdaDelta. Lower values focus more on the
current gradient, where higher values incorporate a longer history.
@param rho the decay rate in (0, 1) to use | [
"Sets",
"the",
"decay",
"rate",
"used",
"by",
"AdaDelta",
".",
"Lower",
"values",
"focus",
"more",
"on",
"the",
"current",
"gradient",
"where",
"higher",
"values",
"incorporate",
"a",
"longer",
"history",
"."
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/optimization/stochastic/AdaDelta.java#L70-L75 | train |
EdwardRaff/JSAT | JSAT/src/jsat/math/ExponentialMovingStatistics.java | ExponentialMovingStatistics.setSmoothing | public void setSmoothing(double smoothing)
{
if (smoothing <= 0 || smoothing > 1 || Double.isNaN(smoothing))
throw new IllegalArgumentException("Smoothing must be in (0, 1], not " + smoothing);
this.smoothing = smoothing;
} | java | public void setSmoothing(double smoothing)
{
if (smoothing <= 0 || smoothing > 1 || Double.isNaN(smoothing))
throw new IllegalArgumentException("Smoothing must be in (0, 1], not " + smoothing);
this.smoothing = smoothing;
} | [
"public",
"void",
"setSmoothing",
"(",
"double",
"smoothing",
")",
"{",
"if",
"(",
"smoothing",
"<=",
"0",
"||",
"smoothing",
">",
"1",
"||",
"Double",
".",
"isNaN",
"(",
"smoothing",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Smoothing mu... | Sets the smoothing parameter value to use. Must be in the range (0, 1].
Changing this value will impact how quickly the statistics adapt to
changes, with larger values increasing rate of change and smaller values
decreasing it.
@param smoothing the smoothing value to use | [
"Sets",
"the",
"smoothing",
"parameter",
"value",
"to",
"use",
".",
"Must",
"be",
"in",
"the",
"range",
"(",
"0",
"1",
"]",
".",
"Changing",
"this",
"value",
"will",
"impact",
"how",
"quickly",
"the",
"statistics",
"adapt",
"to",
"changes",
"with",
"larg... | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/ExponentialMovingStatistics.java#L86-L91 | train |
EdwardRaff/JSAT | JSAT/src/jsat/math/ExponentialMovingStatistics.java | ExponentialMovingStatistics.add | public void add(double x)
{
if (Double.isNaN(mean))//fist case
{
mean = x;
variance = 0;
}
else//general case
{
//first update stnd deviation
variance = (1-smoothing)*(variance + smoothing*Math.pow(x-mean, 2));
mean... | java | public void add(double x)
{
if (Double.isNaN(mean))//fist case
{
mean = x;
variance = 0;
}
else//general case
{
//first update stnd deviation
variance = (1-smoothing)*(variance + smoothing*Math.pow(x-mean, 2));
mean... | [
"public",
"void",
"add",
"(",
"double",
"x",
")",
"{",
"if",
"(",
"Double",
".",
"isNaN",
"(",
"mean",
")",
")",
"//fist case",
"{",
"mean",
"=",
"x",
";",
"variance",
"=",
"0",
";",
"}",
"else",
"//general case",
"{",
"//first update stnd deviation ",
... | Adds the given data point to the statistics
@param x the new value to add to the moving statistics | [
"Adds",
"the",
"given",
"data",
"point",
"to",
"the",
"statistics"
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/ExponentialMovingStatistics.java#L107-L121 | train |
EdwardRaff/JSAT | JSAT/src/jsat/distributions/discrete/UniformDiscrete.java | UniformDiscrete.setMinMax | public void setMinMax(int min, int max)
{
if(min >= max)
throw new IllegalArgumentException("The input minimum (" + min + ") must be less than the given max (" + max + ")");
this.min = min;
this.max = max;
} | java | public void setMinMax(int min, int max)
{
if(min >= max)
throw new IllegalArgumentException("The input minimum (" + min + ") must be less than the given max (" + max + ")");
this.min = min;
this.max = max;
} | [
"public",
"void",
"setMinMax",
"(",
"int",
"min",
",",
"int",
"max",
")",
"{",
"if",
"(",
"min",
">=",
"max",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The input minimum (\"",
"+",
"min",
"+",
"\") must be less than the given max (\"",
"+",
"max",... | Sets the minimum and maximum values at the same time, this is useful if
setting them one at a time may have caused a conflict with the previous
values
@param min the new minimum value to occur
@param max the new maximum value to occur | [
"Sets",
"the",
"minimum",
"and",
"maximum",
"values",
"at",
"the",
"same",
"time",
"this",
"is",
"useful",
"if",
"setting",
"them",
"one",
"at",
"a",
"time",
"may",
"have",
"caused",
"a",
"conflict",
"with",
"the",
"previous",
"values"
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/discrete/UniformDiscrete.java#L55-L61 | train |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/linear/NHERD.java | NHERD.setC | public void setC(double C)
{
if(Double.isNaN(C) || Double.isInfinite(C) || C <= 0)
throw new IllegalArgumentException("C must be a postive constant, not " + C);
this.C = C;
} | java | public void setC(double C)
{
if(Double.isNaN(C) || Double.isInfinite(C) || C <= 0)
throw new IllegalArgumentException("C must be a postive constant, not " + C);
this.C = C;
} | [
"public",
"void",
"setC",
"(",
"double",
"C",
")",
"{",
"if",
"(",
"Double",
".",
"isNaN",
"(",
"C",
")",
"||",
"Double",
".",
"isInfinite",
"(",
"C",
")",
"||",
"C",
"<=",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"C must be a posti... | Set the aggressiveness parameter. Increasing the value of this parameter
increases the aggressiveness of the algorithm. It must be a positive
value. This parameter essentially performs a type of regularization on
the updates
@param C the positive aggressiveness parameter | [
"Set",
"the",
"aggressiveness",
"parameter",
".",
"Increasing",
"the",
"value",
"of",
"this",
"parameter",
"increases",
"the",
"aggressiveness",
"of",
"the",
"algorithm",
".",
"It",
"must",
"be",
"a",
"positive",
"value",
".",
"This",
"parameter",
"essentially",... | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/NHERD.java#L130-L135 | train |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/linear/kernelized/BOGD.java | BOGD.guessRegularization | public static Distribution guessRegularization(DataSet d)
{
double T2 = d.size();
T2*=T2;
return new LogUniform(Math.pow(2, -3)/T2, Math.pow(2, 3)/T2);
} | java | public static Distribution guessRegularization(DataSet d)
{
double T2 = d.size();
T2*=T2;
return new LogUniform(Math.pow(2, -3)/T2, Math.pow(2, 3)/T2);
} | [
"public",
"static",
"Distribution",
"guessRegularization",
"(",
"DataSet",
"d",
")",
"{",
"double",
"T2",
"=",
"d",
".",
"size",
"(",
")",
";",
"T2",
"*=",
"T2",
";",
"return",
"new",
"LogUniform",
"(",
"Math",
".",
"pow",
"(",
"2",
",",
"-",
"3",
... | Guesses the distribution to use for the Regularization parameter
@param d the dataset to get the guess for
@return the guess for the Regularization parameter
@see #setRegularization(double) | [
"Guesses",
"the",
"distribution",
"to",
"use",
"for",
"the",
"Regularization",
"parameter"
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/kernelized/BOGD.java#L388-L394 | train |
EdwardRaff/JSAT | JSAT/src/jsat/utils/IndexTable.java | IndexTable.getReverse | public static <T> Comparator<T> getReverse(final Comparator<T> cmp)
{
return (T o1, T o2) -> -cmp.compare(o1, o2);
} | java | public static <T> Comparator<T> getReverse(final Comparator<T> cmp)
{
return (T o1, T o2) -> -cmp.compare(o1, o2);
} | [
"public",
"static",
"<",
"T",
">",
"Comparator",
"<",
"T",
">",
"getReverse",
"(",
"final",
"Comparator",
"<",
"T",
">",
"cmp",
")",
"{",
"return",
"(",
"T",
"o1",
",",
"T",
"o2",
")",
"->",
"-",
"cmp",
".",
"compare",
"(",
"o1",
",",
"o2",
")"... | Obtains the reverse order comparator
@param <T> the data type
@param cmp the original comparator
@return the reverse order comparator | [
"Obtains",
"the",
"reverse",
"order",
"comparator"
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/IndexTable.java#L38-L41 | train |
EdwardRaff/JSAT | JSAT/src/jsat/utils/IndexTable.java | IndexTable.reset | public void reset()
{
for(int i = 0; i < index.size(); i++)
index.set(i, i);
} | java | public void reset()
{
for(int i = 0; i < index.size(); i++)
index.set(i, i);
} | [
"public",
"void",
"reset",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"index",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"index",
".",
"set",
"(",
"i",
",",
"i",
")",
";",
"}"
] | Resets the index table so that the returned indices are in linear order,
meaning the original input would be returned in its original order
instead of sorted order. | [
"Resets",
"the",
"index",
"table",
"so",
"that",
"the",
"returned",
"indices",
"are",
"in",
"linear",
"order",
"meaning",
"the",
"original",
"input",
"would",
"be",
"returned",
"in",
"its",
"original",
"order",
"instead",
"of",
"sorted",
"order",
"."
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/IndexTable.java#L111-L115 | train |
EdwardRaff/JSAT | JSAT/src/jsat/utils/IndexTable.java | IndexTable.sort | public <T extends Comparable<T>> void sort(List<T> list)
{
sort(list, defaultComp);
} | java | public <T extends Comparable<T>> void sort(List<T> list)
{
sort(list, defaultComp);
} | [
"public",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"void",
"sort",
"(",
"List",
"<",
"T",
">",
"list",
")",
"{",
"sort",
"(",
"list",
",",
"defaultComp",
")",
";",
"}"
] | Adjust this index table to contain the sorted index order for the given
list
@param <T> the data type
@param list the list of objects | [
"Adjust",
"this",
"index",
"table",
"to",
"contain",
"the",
"sorted",
"index",
"order",
"for",
"the",
"given",
"list"
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/IndexTable.java#L151-L154 | train |
EdwardRaff/JSAT | JSAT/src/jsat/utils/IndexTable.java | IndexTable.sortR | public <T extends Comparable<T>> void sortR(List<T> list)
{
sort(list, getReverse(defaultComp));
} | java | public <T extends Comparable<T>> void sortR(List<T> list)
{
sort(list, getReverse(defaultComp));
} | [
"public",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"void",
"sortR",
"(",
"List",
"<",
"T",
">",
"list",
")",
"{",
"sort",
"(",
"list",
",",
"getReverse",
"(",
"defaultComp",
")",
")",
";",
"}"
] | Adjusts this index table to contain the reverse sorted index order for
the given list
@param <T> the data type
@param list the list of objects | [
"Adjusts",
"this",
"index",
"table",
"to",
"contain",
"the",
"reverse",
"sorted",
"index",
"order",
"for",
"the",
"given",
"list"
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/IndexTable.java#L162-L165 | train |
EdwardRaff/JSAT | JSAT/src/jsat/utils/IndexTable.java | IndexTable.sort | public <T> void sort(List<T> list, Comparator<T> cmp)
{
if(index.size() < list.size())
for(int i = index.size(); i < list.size(); i++ )
index.add(i);
if(list.size() == index.size())
Collections.sort(index, new IndexViewCompList(list, cmp));
else
... | java | public <T> void sort(List<T> list, Comparator<T> cmp)
{
if(index.size() < list.size())
for(int i = index.size(); i < list.size(); i++ )
index.add(i);
if(list.size() == index.size())
Collections.sort(index, new IndexViewCompList(list, cmp));
else
... | [
"public",
"<",
"T",
">",
"void",
"sort",
"(",
"List",
"<",
"T",
">",
"list",
",",
"Comparator",
"<",
"T",
">",
"cmp",
")",
"{",
"if",
"(",
"index",
".",
"size",
"(",
")",
"<",
"list",
".",
"size",
"(",
")",
")",
"for",
"(",
"int",
"i",
"=",... | Sets up the index table based on the given list of the same size and
comparator.
@param <T> the type in use
@param list the list of points to obtain a sorted IndexTable for
@param cmp the comparator to determined the sorted order | [
"Sets",
"up",
"the",
"index",
"table",
"based",
"on",
"the",
"given",
"list",
"of",
"the",
"same",
"size",
"and",
"comparator",
"."
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/IndexTable.java#L176-L189 | train |
EdwardRaff/JSAT | JSAT/src/jsat/SimpleDataSet.java | SimpleDataSet.asClassificationDataSet | public ClassificationDataSet asClassificationDataSet(int index)
{
if(index < 0)
throw new IllegalArgumentException("Index must be a non-negative value");
else if(getNumCategoricalVars() == 0)
throw new IllegalArgumentException("Dataset has no categorical variables, can n... | java | public ClassificationDataSet asClassificationDataSet(int index)
{
if(index < 0)
throw new IllegalArgumentException("Index must be a non-negative value");
else if(getNumCategoricalVars() == 0)
throw new IllegalArgumentException("Dataset has no categorical variables, can n... | [
"public",
"ClassificationDataSet",
"asClassificationDataSet",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"index",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Index must be a non-negative value\"",
")",
";",
"else",
"if",
"(",
"getNumCategoricalVa... | Converts this dataset into one meant for classification problems. The
given categorical feature index is removed from the data and made the
target variable for the classification problem.
@param index the classification variable index, should be in the range
[0, {@link #getNumCategoricalVars() })
@return a new dataset... | [
"Converts",
"this",
"dataset",
"into",
"one",
"meant",
"for",
"classification",
"problems",
".",
"The",
"given",
"categorical",
"feature",
"index",
"is",
"removed",
"from",
"the",
"data",
"and",
"made",
"the",
"target",
"variable",
"for",
"the",
"classification"... | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/SimpleDataSet.java#L88-L97 | train |
EdwardRaff/JSAT | JSAT/src/jsat/SimpleDataSet.java | SimpleDataSet.asRegressionDataSet | public RegressionDataSet asRegressionDataSet(int index)
{
if(index < 0)
throw new IllegalArgumentException("Index must be a non-negative value");
else if(getNumNumericalVars()== 0)
throw new IllegalArgumentException("Dataset has no numeric variables, can not create regre... | java | public RegressionDataSet asRegressionDataSet(int index)
{
if(index < 0)
throw new IllegalArgumentException("Index must be a non-negative value");
else if(getNumNumericalVars()== 0)
throw new IllegalArgumentException("Dataset has no numeric variables, can not create regre... | [
"public",
"RegressionDataSet",
"asRegressionDataSet",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"index",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Index must be a non-negative value\"",
")",
";",
"else",
"if",
"(",
"getNumNumericalVars",
"("... | Converts this dataset into one meant for regression problems. The
given numeric feature index is removed from the data and made the
target variable for the regression problem.
@param index the regression variable index, should be in the range
[0, {@link #getNumNumericalVars() })
@return a new dataset where one numeric... | [
"Converts",
"this",
"dataset",
"into",
"one",
"meant",
"for",
"regression",
"problems",
".",
"The",
"given",
"numeric",
"feature",
"index",
"is",
"removed",
"from",
"the",
"data",
"and",
"made",
"the",
"target",
"variable",
"for",
"the",
"regression",
"problem... | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/SimpleDataSet.java#L109-L122 | train |
EdwardRaff/JSAT | JSAT/src/jsat/math/optimization/NelderMead.java | NelderMead.setReflection | public void setReflection(double reflection)
{
if(reflection <=0 || Double.isNaN(reflection) || Double.isInfinite(reflection) )
throw new ArithmeticException("Reflection constant must be > 0, not " + reflection);
this.reflection = reflection;
} | java | public void setReflection(double reflection)
{
if(reflection <=0 || Double.isNaN(reflection) || Double.isInfinite(reflection) )
throw new ArithmeticException("Reflection constant must be > 0, not " + reflection);
this.reflection = reflection;
} | [
"public",
"void",
"setReflection",
"(",
"double",
"reflection",
")",
"{",
"if",
"(",
"reflection",
"<=",
"0",
"||",
"Double",
".",
"isNaN",
"(",
"reflection",
")",
"||",
"Double",
".",
"isInfinite",
"(",
"reflection",
")",
")",
"throw",
"new",
"ArithmeticE... | Sets the reflection constant, which must be greater than 0
@param reflection the reflection constant | [
"Sets",
"the",
"reflection",
"constant",
"which",
"must",
"be",
"greater",
"than",
"0"
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/optimization/NelderMead.java#L61-L66 | train |
EdwardRaff/JSAT | JSAT/src/jsat/math/optimization/NelderMead.java | NelderMead.setExpansion | public void setExpansion(double expansion)
{
if(expansion <= 1 || Double.isNaN(expansion) || Double.isInfinite(expansion) )
throw new ArithmeticException("Expansion constant must be > 1, not " + expansion);
else if(expansion <= reflection)
throw new ArithmeticException("Expa... | java | public void setExpansion(double expansion)
{
if(expansion <= 1 || Double.isNaN(expansion) || Double.isInfinite(expansion) )
throw new ArithmeticException("Expansion constant must be > 1, not " + expansion);
else if(expansion <= reflection)
throw new ArithmeticException("Expa... | [
"public",
"void",
"setExpansion",
"(",
"double",
"expansion",
")",
"{",
"if",
"(",
"expansion",
"<=",
"1",
"||",
"Double",
".",
"isNaN",
"(",
"expansion",
")",
"||",
"Double",
".",
"isInfinite",
"(",
"expansion",
")",
")",
"throw",
"new",
"ArithmeticExcept... | Sets the expansion constant, which must be greater than 1 and the reflection constant
@param expansion | [
"Sets",
"the",
"expansion",
"constant",
"which",
"must",
"be",
"greater",
"than",
"1",
"and",
"the",
"reflection",
"constant"
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/optimization/NelderMead.java#L72-L79 | train |
EdwardRaff/JSAT | JSAT/src/jsat/linear/Matrix.java | Matrix.transpose | public Matrix transpose()
{
Matrix toReturn = new DenseMatrix(cols(), rows());
this.transpose(toReturn);
return toReturn;
} | java | public Matrix transpose()
{
Matrix toReturn = new DenseMatrix(cols(), rows());
this.transpose(toReturn);
return toReturn;
} | [
"public",
"Matrix",
"transpose",
"(",
")",
"{",
"Matrix",
"toReturn",
"=",
"new",
"DenseMatrix",
"(",
"cols",
"(",
")",
",",
"rows",
"(",
")",
")",
";",
"this",
".",
"transpose",
"(",
"toReturn",
")",
";",
"return",
"toReturn",
";",
"}"
] | Returns a new matrix that is the transpose of this matrix.
@return a new matrix <tt>A</tt>' | [
"Returns",
"a",
"new",
"matrix",
"that",
"is",
"the",
"transpose",
"of",
"this",
"matrix",
"."
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/Matrix.java#L440-L445 | train |
EdwardRaff/JSAT | JSAT/src/jsat/linear/Matrix.java | Matrix.copyTo | public void copyTo(Matrix other)
{
if (this.rows() != other.rows() || this.cols() != other.cols())
throw new ArithmeticException("Matrices are not of the same dimension");
for(int i = 0; i < rows(); i++)
this.getRowView(i).copyTo(other.getRowView(i));
} | java | public void copyTo(Matrix other)
{
if (this.rows() != other.rows() || this.cols() != other.cols())
throw new ArithmeticException("Matrices are not of the same dimension");
for(int i = 0; i < rows(); i++)
this.getRowView(i).copyTo(other.getRowView(i));
} | [
"public",
"void",
"copyTo",
"(",
"Matrix",
"other",
")",
"{",
"if",
"(",
"this",
".",
"rows",
"(",
")",
"!=",
"other",
".",
"rows",
"(",
")",
"||",
"this",
".",
"cols",
"(",
")",
"!=",
"other",
".",
"cols",
"(",
")",
")",
"throw",
"new",
"Arith... | Copes the values of this matrix into the other matrix of the same dimensions
@param other the matrix to overwrite the values of | [
"Copes",
"the",
"values",
"of",
"this",
"matrix",
"into",
"the",
"other",
"matrix",
"of",
"the",
"same",
"dimensions"
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/Matrix.java#L849-L855 | train |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/svm/SupportVectorLearner.java | SupportVectorLearner.accessingRow | protected void accessingRow(int r)
{
if (r < 0)
{
specific_row_cache_row = -1;
specific_row_cache_values = null;
return;
}
if(cacheMode == CacheMode.ROWS)
{
double[] cache = partialCache.get(r);
if (cache ==... | java | protected void accessingRow(int r)
{
if (r < 0)
{
specific_row_cache_row = -1;
specific_row_cache_values = null;
return;
}
if(cacheMode == CacheMode.ROWS)
{
double[] cache = partialCache.get(r);
if (cache ==... | [
"protected",
"void",
"accessingRow",
"(",
"int",
"r",
")",
"{",
"if",
"(",
"r",
"<",
"0",
")",
"{",
"specific_row_cache_row",
"=",
"-",
"1",
";",
"specific_row_cache_values",
"=",
"null",
";",
"return",
";",
"}",
"if",
"(",
"cacheMode",
"==",
"CacheMode"... | This method allows the caller to hint that they are about to access many
kernel values for a specific row. The row may be selected out from the
cache into its own location to avoid excess LRU overhead. Giving a
negative index indicates that we are done with the row, and removes it.
This method may be called multiple ti... | [
"This",
"method",
"allows",
"the",
"caller",
"to",
"hint",
"that",
"they",
"are",
"about",
"to",
"access",
"many",
"kernel",
"values",
"for",
"a",
"specific",
"row",
".",
"The",
"row",
"may",
"be",
"selected",
"out",
"from",
"the",
"cache",
"into",
"its"... | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/svm/SupportVectorLearner.java#L409-L434 | train |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/svm/SupportVectorLearner.java | SupportVectorLearner.k | protected double k(int a, int b)
{
evalCount++;
return kernel.eval(a, b, vecs, accelCache);
} | java | protected double k(int a, int b)
{
evalCount++;
return kernel.eval(a, b, vecs, accelCache);
} | [
"protected",
"double",
"k",
"(",
"int",
"a",
",",
"int",
"b",
")",
"{",
"evalCount",
"++",
";",
"return",
"kernel",
".",
"eval",
"(",
"a",
",",
"b",
",",
"vecs",
",",
"accelCache",
")",
";",
"}"
] | Internal kernel eval source. Only call directly if you KNOW you will not
be re-using the resulting value and intentionally wish to skip the
caching system
@param a the first vector index
@param b the second vector index
@return the kernel evaluation of k(a, b) | [
"Internal",
"kernel",
"eval",
"source",
".",
"Only",
"call",
"directly",
"if",
"you",
"KNOW",
"you",
"will",
"not",
"be",
"re",
"-",
"using",
"the",
"resulting",
"value",
"and",
"intentionally",
"wish",
"to",
"skip",
"the",
"caching",
"system"
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/svm/SupportVectorLearner.java#L445-L449 | train |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/svm/SupportVectorLearner.java | SupportVectorLearner.sparsify | protected void sparsify()
{
final int N = vecs.size();
int accSize = accelCache == null ? 0 : accelCache.size()/N;
int svCount = 0;
for(int i = 0; i < N; i++)
if(alphas[i] != 0)//Its a support vector
{
ListUtils.swap(vecs, svCount, i);
... | java | protected void sparsify()
{
final int N = vecs.size();
int accSize = accelCache == null ? 0 : accelCache.size()/N;
int svCount = 0;
for(int i = 0; i < N; i++)
if(alphas[i] != 0)//Its a support vector
{
ListUtils.swap(vecs, svCount, i);
... | [
"protected",
"void",
"sparsify",
"(",
")",
"{",
"final",
"int",
"N",
"=",
"vecs",
".",
"size",
"(",
")",
";",
"int",
"accSize",
"=",
"accelCache",
"==",
"null",
"?",
"0",
":",
"accelCache",
".",
"size",
"(",
")",
"/",
"N",
";",
"int",
"svCount",
... | Sparsifies the SVM by removing the vectors with α = 0 from the
dataset. | [
"Sparsifies",
"the",
"SVM",
"by",
"removing",
"the",
"vectors",
"with",
"&alpha",
";",
"=",
"0",
"from",
"the",
"dataset",
"."
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/svm/SupportVectorLearner.java#L455-L472 | train |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/linear/SDCA.java | SDCA.setLambda | @Parameter.WarmParameter(prefLowToHigh = false)
public void setLambda(double lambda)
{
if(lambda <= 0 || Double.isInfinite(lambda) || Double.isNaN(lambda))
throw new IllegalArgumentException("Regularization term lambda must be a positive value, not " + lambda);
this.lambda = lambda;
... | java | @Parameter.WarmParameter(prefLowToHigh = false)
public void setLambda(double lambda)
{
if(lambda <= 0 || Double.isInfinite(lambda) || Double.isNaN(lambda))
throw new IllegalArgumentException("Regularization term lambda must be a positive value, not " + lambda);
this.lambda = lambda;
... | [
"@",
"Parameter",
".",
"WarmParameter",
"(",
"prefLowToHigh",
"=",
"false",
")",
"public",
"void",
"setLambda",
"(",
"double",
"lambda",
")",
"{",
"if",
"(",
"lambda",
"<=",
"0",
"||",
"Double",
".",
"isInfinite",
"(",
"lambda",
")",
"||",
"Double",
".",... | Sets the regularization term, where larger values indicate a larger
regularization penalty.
@param lambda the positive regularization term | [
"Sets",
"the",
"regularization",
"term",
"where",
"larger",
"values",
"indicate",
"a",
"larger",
"regularization",
"penalty",
"."
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/SDCA.java#L172-L178 | train |
EdwardRaff/JSAT | JSAT/src/jsat/regression/RegressionDataSet.java | RegressionDataSet.addDataPoint | public void addDataPoint(Vec numerical, int[] categories, double val)
{
if(numerical.length() != numNumerVals)
throw new RuntimeException("Data point does not contain enough numerical data points");
if(categories.length != categories.length)
throw new RuntimeException("D... | java | public void addDataPoint(Vec numerical, int[] categories, double val)
{
if(numerical.length() != numNumerVals)
throw new RuntimeException("Data point does not contain enough numerical data points");
if(categories.length != categories.length)
throw new RuntimeException("D... | [
"public",
"void",
"addDataPoint",
"(",
"Vec",
"numerical",
",",
"int",
"[",
"]",
"categories",
",",
"double",
"val",
")",
"{",
"if",
"(",
"numerical",
".",
"length",
"(",
")",
"!=",
"numNumerVals",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"Data poin... | Creates a new data point to be added to the data set. The arguments will
be used directly, modifying them after will effect the data set.
@param numerical the numerical values for the data point
@param categories the categorical values for the data point
@param val the target value to predict
@throws IllegalArgumentEx... | [
"Creates",
"a",
"new",
"data",
"point",
"to",
"be",
"added",
"to",
"the",
"data",
"set",
".",
"The",
"arguments",
"will",
"be",
"used",
"directly",
"modifying",
"them",
"after",
"will",
"effect",
"the",
"data",
"set",
"."
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/regression/RegressionDataSet.java#L164-L177 | train |
EdwardRaff/JSAT | JSAT/src/jsat/regression/RegressionDataSet.java | RegressionDataSet.getDataPointPair | public DataPointPair<Double> getDataPointPair(int i)
{
return new DataPointPair<>(getDataPoint(i), targets.get(i));
} | java | public DataPointPair<Double> getDataPointPair(int i)
{
return new DataPointPair<>(getDataPoint(i), targets.get(i));
} | [
"public",
"DataPointPair",
"<",
"Double",
">",
"getDataPointPair",
"(",
"int",
"i",
")",
"{",
"return",
"new",
"DataPointPair",
"<>",
"(",
"getDataPoint",
"(",
"i",
")",
",",
"targets",
".",
"get",
"(",
"i",
")",
")",
";",
"}"
] | Returns the i'th data point in the data set paired with its target regressor value.
Modifying the DataPointPair will effect the data set.
@param i the index of the data point to obtain
@return the i'th DataPOintPair | [
"Returns",
"the",
"i",
"th",
"data",
"point",
"in",
"the",
"data",
"set",
"paired",
"with",
"its",
"target",
"regressor",
"value",
".",
"Modifying",
"the",
"DataPointPair",
"will",
"effect",
"the",
"data",
"set",
"."
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/regression/RegressionDataSet.java#L219-L222 | train |
EdwardRaff/JSAT | JSAT/src/jsat/datatransform/RemoveAttributeTransform.java | RemoveAttributeTransform.getReverseNumericMap | public Map<Integer, Integer> getReverseNumericMap()
{
Map<Integer, Integer> map = new HashMap<Integer, Integer>();
for(int newIndex = 0; newIndex < numIndexMap.length; newIndex++)
map.put(newIndex, numIndexMap[newIndex]);
return map;
} | java | public Map<Integer, Integer> getReverseNumericMap()
{
Map<Integer, Integer> map = new HashMap<Integer, Integer>();
for(int newIndex = 0; newIndex < numIndexMap.length; newIndex++)
map.put(newIndex, numIndexMap[newIndex]);
return map;
} | [
"public",
"Map",
"<",
"Integer",
",",
"Integer",
">",
"getReverseNumericMap",
"(",
")",
"{",
"Map",
"<",
"Integer",
",",
"Integer",
">",
"map",
"=",
"new",
"HashMap",
"<",
"Integer",
",",
"Integer",
">",
"(",
")",
";",
"for",
"(",
"int",
"newIndex",
... | Returns a mapping from the numeric indices in the transformed space back
to their original indices
@return a mapping from the transformed numeric space to the original one | [
"Returns",
"a",
"mapping",
"from",
"the",
"numeric",
"indices",
"in",
"the",
"transformed",
"space",
"back",
"to",
"their",
"original",
"indices"
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/datatransform/RemoveAttributeTransform.java#L91-L97 | train |
EdwardRaff/JSAT | JSAT/src/jsat/datatransform/RemoveAttributeTransform.java | RemoveAttributeTransform.getReverseNominalMap | public Map<Integer, Integer> getReverseNominalMap()
{
Map<Integer, Integer> map = new HashMap<Integer, Integer>();
for(int newIndex = 0; newIndex < catIndexMap.length; newIndex++)
map.put(newIndex, catIndexMap[newIndex]);
return map;
} | java | public Map<Integer, Integer> getReverseNominalMap()
{
Map<Integer, Integer> map = new HashMap<Integer, Integer>();
for(int newIndex = 0; newIndex < catIndexMap.length; newIndex++)
map.put(newIndex, catIndexMap[newIndex]);
return map;
} | [
"public",
"Map",
"<",
"Integer",
",",
"Integer",
">",
"getReverseNominalMap",
"(",
")",
"{",
"Map",
"<",
"Integer",
",",
"Integer",
">",
"map",
"=",
"new",
"HashMap",
"<",
"Integer",
",",
"Integer",
">",
"(",
")",
";",
"for",
"(",
"int",
"newIndex",
... | Returns a mapping from the nominal indices in the transformed space back
to their original indices
@return a mapping from the transformed nominal space to the original one | [
"Returns",
"a",
"mapping",
"from",
"the",
"nominal",
"indices",
"in",
"the",
"transformed",
"space",
"back",
"to",
"their",
"original",
"indices"
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/datatransform/RemoveAttributeTransform.java#L115-L121 | train |
EdwardRaff/JSAT | JSAT/src/jsat/datatransform/RemoveAttributeTransform.java | RemoveAttributeTransform.setUp | protected final void setUp(DataSet dataSet, Set<Integer> categoricalToRemove, Set<Integer> numericalToRemove)
{
for(int i : categoricalToRemove)
if (i >= dataSet.getNumCategoricalVars())
throw new RuntimeException("The data set does not have a categorical value " + i + " to remov... | java | protected final void setUp(DataSet dataSet, Set<Integer> categoricalToRemove, Set<Integer> numericalToRemove)
{
for(int i : categoricalToRemove)
if (i >= dataSet.getNumCategoricalVars())
throw new RuntimeException("The data set does not have a categorical value " + i + " to remov... | [
"protected",
"final",
"void",
"setUp",
"(",
"DataSet",
"dataSet",
",",
"Set",
"<",
"Integer",
">",
"categoricalToRemove",
",",
"Set",
"<",
"Integer",
">",
"numericalToRemove",
")",
"{",
"for",
"(",
"int",
"i",
":",
"categoricalToRemove",
")",
"if",
"(",
"i... | Sets up the Remove Attribute Transform properly
@param dataSet the data set to remove the attributes from
@param categoricalToRemove the categorical attributes to remove
@param numericalToRemove the numeric attributes to remove | [
"Sets",
"up",
"the",
"Remove",
"Attribute",
"Transform",
"properly"
] | 0ff53b7b39684b2379cc1da522f5b3a954b15cfb | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/datatransform/RemoveAttributeTransform.java#L137-L164 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.