id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
17,300 | haifengl/smile | math/src/main/java/smile/stat/distribution/GaussianDistribution.java | GaussianDistribution.randInverseCDF | public double randInverseCDF() {
final double a0 = 2.50662823884;
final double a1 = -18.61500062529;
final double a2 = 41.39119773534;
final double a3 = -25.44106049637;
final double b0 = -8.47351093090;
final double b1 = 23.08336743743;
final double b2 = -21.0622... | java | public double randInverseCDF() {
final double a0 = 2.50662823884;
final double a1 = -18.61500062529;
final double a2 = 41.39119773534;
final double a3 = -25.44106049637;
final double b0 = -8.47351093090;
final double b1 = 23.08336743743;
final double b2 = -21.0622... | [
"public",
"double",
"randInverseCDF",
"(",
")",
"{",
"final",
"double",
"a0",
"=",
"2.50662823884",
";",
"final",
"double",
"a1",
"=",
"-",
"18.61500062529",
";",
"final",
"double",
"a2",
"=",
"41.39119773534",
";",
"final",
"double",
"a3",
"=",
"-",
"25.4... | Uses Inverse CDF method to generate a Gaussian deviate. | [
"Uses",
"Inverse",
"CDF",
"method",
"to",
"generate",
"a",
"Gaussian",
"deviate",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/stat/distribution/GaussianDistribution.java#L172-L218 |
17,301 | haifengl/smile | core/src/main/java/smile/classification/AdaBoost.java | AdaBoost.predict | @Override
public int predict(double[] x, double[] posteriori) {
Arrays.fill(posteriori, 0.0);
for (int i = 0; i < trees.length; i++) {
posteriori[trees[i].predict(x)] += alpha[i];
}
double sum = Math.sum(posteriori);
for (int i = 0; i < k; i++) {
pos... | java | @Override
public int predict(double[] x, double[] posteriori) {
Arrays.fill(posteriori, 0.0);
for (int i = 0; i < trees.length; i++) {
posteriori[trees[i].predict(x)] += alpha[i];
}
double sum = Math.sum(posteriori);
for (int i = 0; i < k; i++) {
pos... | [
"@",
"Override",
"public",
"int",
"predict",
"(",
"double",
"[",
"]",
"x",
",",
"double",
"[",
"]",
"posteriori",
")",
"{",
"Arrays",
".",
"fill",
"(",
"posteriori",
",",
"0.0",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"trees",
... | Predicts the class label of an instance and also calculate a posteriori
probabilities. Not supported. | [
"Predicts",
"the",
"class",
"label",
"of",
"an",
"instance",
"and",
"also",
"calculate",
"a",
"posteriori",
"probabilities",
".",
"Not",
"supported",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/classification/AdaBoost.java#L413-L427 |
17,302 | haifengl/smile | math/src/main/java/smile/sort/IQAgent.java | IQAgent.quantile | public double quantile(double p) {
if (nd > 0) {
update();
}
int jl = 0, jh = nq - 1, j;
while (jh - jl > 1) {
j = (jh + jl) >> 1;
if (p > pval[j]) {
jl = j;
} else {
jh = j;
}
}
j... | java | public double quantile(double p) {
if (nd > 0) {
update();
}
int jl = 0, jh = nq - 1, j;
while (jh - jl > 1) {
j = (jh + jl) >> 1;
if (p > pval[j]) {
jl = j;
} else {
jh = j;
}
}
j... | [
"public",
"double",
"quantile",
"(",
"double",
"p",
")",
"{",
"if",
"(",
"nd",
">",
"0",
")",
"{",
"update",
"(",
")",
";",
"}",
"int",
"jl",
"=",
"0",
",",
"jh",
"=",
"nq",
"-",
"1",
",",
"j",
";",
"while",
"(",
"jh",
"-",
"jl",
">",
"1"... | Returns the estimated p-quantile for the data seen so far. For example,
p = 0.5 for median. | [
"Returns",
"the",
"estimated",
"p",
"-",
"quantile",
"for",
"the",
"data",
"seen",
"so",
"far",
".",
"For",
"example",
"p",
"=",
"0",
".",
"5",
"for",
"median",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/sort/IQAgent.java#L149-L165 |
17,303 | haifengl/smile | nlp/src/main/java/smile/nlp/Trie.java | Trie.put | public void put(K[] key, V value) {
Node child = root.get(key[0]);
if (child == null) {
child = new Node(key[0]);
root.put(key[0], child);
}
child.addChild(key, value, 1);
} | java | public void put(K[] key, V value) {
Node child = root.get(key[0]);
if (child == null) {
child = new Node(key[0]);
root.put(key[0], child);
}
child.addChild(key, value, 1);
} | [
"public",
"void",
"put",
"(",
"K",
"[",
"]",
"key",
",",
"V",
"value",
")",
"{",
"Node",
"child",
"=",
"root",
".",
"get",
"(",
"key",
"[",
"0",
"]",
")",
";",
"if",
"(",
"child",
"==",
"null",
")",
"{",
"child",
"=",
"new",
"Node",
"(",
"k... | Add a key with associated value to the trie.
@param key the key.
@param value the value. | [
"Add",
"a",
"key",
"with",
"associated",
"value",
"to",
"the",
"trie",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/nlp/src/main/java/smile/nlp/Trie.java#L136-L143 |
17,304 | haifengl/smile | nlp/src/main/java/smile/nlp/Trie.java | Trie.get | public V get(K[] key) {
Node child = root.get(key[0]);
if (child != null) {
return child.getChild(key, 1);
}
return null;
} | java | public V get(K[] key) {
Node child = root.get(key[0]);
if (child != null) {
return child.getChild(key, 1);
}
return null;
} | [
"public",
"V",
"get",
"(",
"K",
"[",
"]",
"key",
")",
"{",
"Node",
"child",
"=",
"root",
".",
"get",
"(",
"key",
"[",
"0",
"]",
")",
";",
"if",
"(",
"child",
"!=",
"null",
")",
"{",
"return",
"child",
".",
"getChild",
"(",
"key",
",",
"1",
... | Returns the associated value of a given key.
Returns null if the key doesn't exist in the trie.
@param key the key.
@return the associated value or null. | [
"Returns",
"the",
"associated",
"value",
"of",
"a",
"given",
"key",
".",
"Returns",
"null",
"if",
"the",
"key",
"doesn",
"t",
"exist",
"in",
"the",
"trie",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/nlp/src/main/java/smile/nlp/Trie.java#L151-L157 |
17,305 | haifengl/smile | math/src/main/java/smile/math/matrix/LU.java | LU.inverse | public DenseMatrix inverse() {
int m = lu.nrows();
int n = lu.ncols();
if (m != n) {
throw new IllegalArgumentException(String.format("Matrix is not square: %d x %d", m, n));
}
DenseMatrix inv = Matrix.zeros(n, n);
for (int i = 0; i < n; i++) {
i... | java | public DenseMatrix inverse() {
int m = lu.nrows();
int n = lu.ncols();
if (m != n) {
throw new IllegalArgumentException(String.format("Matrix is not square: %d x %d", m, n));
}
DenseMatrix inv = Matrix.zeros(n, n);
for (int i = 0; i < n; i++) {
i... | [
"public",
"DenseMatrix",
"inverse",
"(",
")",
"{",
"int",
"m",
"=",
"lu",
".",
"nrows",
"(",
")",
";",
"int",
"n",
"=",
"lu",
".",
"ncols",
"(",
")",
";",
"if",
"(",
"m",
"!=",
"n",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Stri... | Returns the matrix inverse. For pseudo inverse, use QRDecomposition. | [
"Returns",
"the",
"matrix",
"inverse",
".",
"For",
"pseudo",
"inverse",
"use",
"QRDecomposition",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/matrix/LU.java#L118-L133 |
17,306 | haifengl/smile | core/src/main/java/smile/clustering/GMeans.java | GMeans.AndersonDarling | private static double AndersonDarling(double[] x) {
int n = x.length;
Arrays.sort(x);
for (int i = 0; i < n; i++) {
x[i] = GaussianDistribution.getInstance().cdf(x[i]);
// in case overflow when taking log later.
if (x[i] == 0) x[i] = 0.0000001;
if... | java | private static double AndersonDarling(double[] x) {
int n = x.length;
Arrays.sort(x);
for (int i = 0; i < n; i++) {
x[i] = GaussianDistribution.getInstance().cdf(x[i]);
// in case overflow when taking log later.
if (x[i] == 0) x[i] = 0.0000001;
if... | [
"private",
"static",
"double",
"AndersonDarling",
"(",
"double",
"[",
"]",
"x",
")",
"{",
"int",
"n",
"=",
"x",
".",
"length",
";",
"Arrays",
".",
"sort",
"(",
"x",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++... | Calculates the Anderson-Darling statistic for one-dimensional normality test.
@param x the samples to test if drawn from a Gaussian distribution. | [
"Calculates",
"the",
"Anderson",
"-",
"Darling",
"statistic",
"for",
"one",
"-",
"dimensional",
"normality",
"test",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/clustering/GMeans.java#L183-L203 |
17,307 | haifengl/smile | demo/src/main/java/smile/demo/util/ParameterParser.java | ParameterParser.get | public String get(String name) {
Parameter param = parameters.get(name);
if (param != null)
return param.value;
else
return null;
} | java | public String get(String name) {
Parameter param = parameters.get(name);
if (param != null)
return param.value;
else
return null;
} | [
"public",
"String",
"get",
"(",
"String",
"name",
")",
"{",
"Parameter",
"param",
"=",
"parameters",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"param",
"!=",
"null",
")",
"return",
"param",
".",
"value",
";",
"else",
"return",
"null",
";",
"}"
] | Returns the value of a given parameter. Null if the parameter
does not present. | [
"Returns",
"the",
"value",
"of",
"a",
"given",
"parameter",
".",
"Null",
"if",
"the",
"parameter",
"does",
"not",
"present",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/demo/src/main/java/smile/demo/util/ParameterParser.java#L121-L127 |
17,308 | haifengl/smile | demo/src/main/java/smile/demo/util/ParameterParser.java | ParameterParser.filterMonadics | private List<String> filterMonadics(String[] args) {// name-value for monads
List<String> filteredArgs = new ArrayList<>(); // Y <- return List
for (String arg : args) { // iterate over args
filteredArgs.add(arg);
Parameter param = parameters.get(arg)... | java | private List<String> filterMonadics(String[] args) {// name-value for monads
List<String> filteredArgs = new ArrayList<>(); // Y <- return List
for (String arg : args) { // iterate over args
filteredArgs.add(arg);
Parameter param = parameters.get(arg)... | [
"private",
"List",
"<",
"String",
">",
"filterMonadics",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"// name-value for monads",
"List",
"<",
"String",
">",
"filteredArgs",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"// Y <- return List",
"for",
"(",
"Stri... | Parses the args array looking for monads, arguments without value
such as "-verbose" and if found inserts, forces, a value of "1" and
returns the transformed args as a List
@param args array of input values
@return a list of expanded name-value pair if monads are detected | [
"Parses",
"the",
"args",
"array",
"looking",
"for",
"monads",
"arguments",
"without",
"value",
"such",
"as",
"-",
"verbose",
"and",
"if",
"found",
"inserts",
"forces",
"a",
"value",
"of",
"1",
"and",
"returns",
"the",
"transformed",
"args",
"as",
"a",
"Lis... | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/demo/src/main/java/smile/demo/util/ParameterParser.java#L137-L147 |
17,309 | haifengl/smile | demo/src/main/java/smile/demo/util/ParameterParser.java | ParameterParser.parse | public List<String> parse(String[] args) { // merge args & defaults
List<String> extras = new ArrayList<>();
List<String> filteredArgs = filterMonadics(args); // detect and fill mons
for (int i = 0; i < filteredArgs.size(); i++) {
String key = filteredArgs.get(i);
... | java | public List<String> parse(String[] args) { // merge args & defaults
List<String> extras = new ArrayList<>();
List<String> filteredArgs = filterMonadics(args); // detect and fill mons
for (int i = 0; i < filteredArgs.size(); i++) {
String key = filteredArgs.get(i);
... | [
"public",
"List",
"<",
"String",
">",
"parse",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"// merge args & defaults",
"List",
"<",
"String",
">",
"extras",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"List",
"<",
"String",
">",
"filteredArgs",
"=",
"... | Parse the arguments.
@param args arguments
@return a list of strings which are not parameters, e.g. a list of file
name. | [
"Parse",
"the",
"arguments",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/demo/src/main/java/smile/demo/util/ParameterParser.java#L155-L208 |
17,310 | haifengl/smile | core/src/main/java/smile/classification/RandomForest.java | RandomForest.getTrees | public DecisionTree[] getTrees() {
DecisionTree[] forest = new DecisionTree[trees.size()];
for (int i = 0; i < forest.length; i++)
forest[i] = trees.get(i).tree;
return forest;
} | java | public DecisionTree[] getTrees() {
DecisionTree[] forest = new DecisionTree[trees.size()];
for (int i = 0; i < forest.length; i++)
forest[i] = trees.get(i).tree;
return forest;
} | [
"public",
"DecisionTree",
"[",
"]",
"getTrees",
"(",
")",
"{",
"DecisionTree",
"[",
"]",
"forest",
"=",
"new",
"DecisionTree",
"[",
"trees",
".",
"size",
"(",
")",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"forest",
".",
"length",
... | Returns the decision trees. | [
"Returns",
"the",
"decision",
"trees",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/classification/RandomForest.java#L859-L865 |
17,311 | haifengl/smile | plot/src/main/java/smile/swing/table/ButtonCellRenderer.java | ButtonCellRenderer.setMnemonic | public void setMnemonic(int mnemonic) {
this.mnemonic = mnemonic;
renderButton.setMnemonic(mnemonic);
editButton.setMnemonic(mnemonic);
} | java | public void setMnemonic(int mnemonic) {
this.mnemonic = mnemonic;
renderButton.setMnemonic(mnemonic);
editButton.setMnemonic(mnemonic);
} | [
"public",
"void",
"setMnemonic",
"(",
"int",
"mnemonic",
")",
"{",
"this",
".",
"mnemonic",
"=",
"mnemonic",
";",
"renderButton",
".",
"setMnemonic",
"(",
"mnemonic",
")",
";",
"editButton",
".",
"setMnemonic",
"(",
"mnemonic",
")",
";",
"}"
] | The mnemonic to activate the button when the cell has focus
@param mnemonic the mnemonic | [
"The",
"mnemonic",
"to",
"activate",
"the",
"button",
"when",
"the",
"cell",
"has",
"focus"
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/swing/table/ButtonCellRenderer.java#L122-L126 |
17,312 | haifengl/smile | core/src/main/java/smile/association/TotalSupportTree.java | TotalSupportTree.add | private void add(Node node, int size, int index, int[] itemset, int support) {
if (node.children == null) {
node.children = new Node[size];
}
int item = order[itemset[index]];
if (node.children[item] == null) {
node.children[item] = new Node(itemset[index]);
... | java | private void add(Node node, int size, int index, int[] itemset, int support) {
if (node.children == null) {
node.children = new Node[size];
}
int item = order[itemset[index]];
if (node.children[item] == null) {
node.children[item] = new Node(itemset[index]);
... | [
"private",
"void",
"add",
"(",
"Node",
"node",
",",
"int",
"size",
",",
"int",
"index",
",",
"int",
"[",
"]",
"itemset",
",",
"int",
"support",
")",
"{",
"if",
"(",
"node",
".",
"children",
"==",
"null",
")",
"{",
"node",
".",
"children",
"=",
"n... | Inserts a node into a T-tree.
@param node the root of subtree.
@param size the size of the current array in T-tree.
@param index the index of the last item in the item set, which is also
used as a level counter.
@param itemset the given item set.
@param support the support value associated with the given item set. | [
"Inserts",
"a",
"node",
"into",
"a",
"T",
"-",
"tree",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/association/TotalSupportTree.java#L108-L123 |
17,313 | haifengl/smile | core/src/main/java/smile/association/TotalSupportTree.java | TotalSupportTree.getSupport | public int getSupport(int[] itemset) {
if (root.children != null) {
return getSupport(itemset, itemset.length - 1, root);
} else {
return 0;
}
} | java | public int getSupport(int[] itemset) {
if (root.children != null) {
return getSupport(itemset, itemset.length - 1, root);
} else {
return 0;
}
} | [
"public",
"int",
"getSupport",
"(",
"int",
"[",
"]",
"itemset",
")",
"{",
"if",
"(",
"root",
".",
"children",
"!=",
"null",
")",
"{",
"return",
"getSupport",
"(",
"itemset",
",",
"itemset",
".",
"length",
"-",
"1",
",",
"root",
")",
";",
"}",
"else... | Returns the support value for the given item set.
@param itemset the given item set. The items in the set has to be in the
descending order according to their frequency.
@return the support value (0 if not found) | [
"Returns",
"the",
"support",
"value",
"for",
"the",
"given",
"item",
"set",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/association/TotalSupportTree.java#L131-L137 |
17,314 | haifengl/smile | core/src/main/java/smile/association/TotalSupportTree.java | TotalSupportTree.getSupport | private int getSupport(int[] itemset, int index, Node node) {
int item = order[itemset[index]];
Node child = node.children[item];
if (child != null) {
// If the index is 0, then this is the last element (i.e the
// input is a 1 itemset) and therefore item set found
... | java | private int getSupport(int[] itemset, int index, Node node) {
int item = order[itemset[index]];
Node child = node.children[item];
if (child != null) {
// If the index is 0, then this is the last element (i.e the
// input is a 1 itemset) and therefore item set found
... | [
"private",
"int",
"getSupport",
"(",
"int",
"[",
"]",
"itemset",
",",
"int",
"index",
",",
"Node",
"node",
")",
"{",
"int",
"item",
"=",
"order",
"[",
"itemset",
"[",
"index",
"]",
"]",
";",
"Node",
"child",
"=",
"node",
".",
"children",
"[",
"item... | Returns the support value for the given item set if found in the T-tree
and 0 otherwise.
@param itemset the given item set.
@param index the current index in the given item set.
@param nodes the nodes of the current T-tree level.
@return the support value (0 if not found) | [
"Returns",
"the",
"support",
"value",
"for",
"the",
"given",
"item",
"set",
"if",
"found",
"in",
"the",
"T",
"-",
"tree",
"and",
"0",
"otherwise",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/association/TotalSupportTree.java#L147-L163 |
17,315 | haifengl/smile | data/src/main/java/smile/data/parser/ArffParser.java | ArffParser.initTokenizer | private void initTokenizer(StreamTokenizer tokenizer) {
tokenizer.resetSyntax();
tokenizer.whitespaceChars(0, ' ');
tokenizer.wordChars(' ' + 1, '\u00FF');
tokenizer.whitespaceChars(',', ',');
tokenizer.commentChar('%');
tokenizer.quoteChar('"');
tokenizer.quoteCh... | java | private void initTokenizer(StreamTokenizer tokenizer) {
tokenizer.resetSyntax();
tokenizer.whitespaceChars(0, ' ');
tokenizer.wordChars(' ' + 1, '\u00FF');
tokenizer.whitespaceChars(',', ',');
tokenizer.commentChar('%');
tokenizer.quoteChar('"');
tokenizer.quoteCh... | [
"private",
"void",
"initTokenizer",
"(",
"StreamTokenizer",
"tokenizer",
")",
"{",
"tokenizer",
".",
"resetSyntax",
"(",
")",
";",
"tokenizer",
".",
"whitespaceChars",
"(",
"0",
",",
"'",
"'",
")",
";",
"tokenizer",
".",
"wordChars",
"(",
"'",
"'",
"+",
... | Initializes the StreamTokenizer used for reading the ARFF file. | [
"Initializes",
"the",
"StreamTokenizer",
"used",
"for",
"reading",
"the",
"ARFF",
"file",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/data/src/main/java/smile/data/parser/ArffParser.java#L118-L129 |
17,316 | haifengl/smile | data/src/main/java/smile/data/parser/ArffParser.java | ArffParser.getFirstToken | private void getFirstToken(StreamTokenizer tokenizer) throws IOException {
while (tokenizer.nextToken() == StreamTokenizer.TT_EOL) {
}
if ((tokenizer.ttype == '\'') || (tokenizer.ttype == '"')) {
tokenizer.ttype = StreamTokenizer.TT_WORD;
} else if ((tokenizer.ttype == Strea... | java | private void getFirstToken(StreamTokenizer tokenizer) throws IOException {
while (tokenizer.nextToken() == StreamTokenizer.TT_EOL) {
}
if ((tokenizer.ttype == '\'') || (tokenizer.ttype == '"')) {
tokenizer.ttype = StreamTokenizer.TT_WORD;
} else if ((tokenizer.ttype == Strea... | [
"private",
"void",
"getFirstToken",
"(",
"StreamTokenizer",
"tokenizer",
")",
"throws",
"IOException",
"{",
"while",
"(",
"tokenizer",
".",
"nextToken",
"(",
")",
"==",
"StreamTokenizer",
".",
"TT_EOL",
")",
"{",
"}",
"if",
"(",
"(",
"tokenizer",
".",
"ttype... | Gets next token, skipping empty lines.
@throws IOException if reading the next token fails | [
"Gets",
"next",
"token",
"skipping",
"empty",
"lines",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/data/src/main/java/smile/data/parser/ArffParser.java#L136-L145 |
17,317 | haifengl/smile | data/src/main/java/smile/data/parser/ArffParser.java | ArffParser.getLastToken | private void getLastToken(StreamTokenizer tokenizer, boolean endOfFileOk) throws IOException, ParseException {
if ((tokenizer.nextToken() != StreamTokenizer.TT_EOL) && ((tokenizer.ttype != StreamTokenizer.TT_EOF) || !endOfFileOk)) {
throw new ParseException("end of line expected", tokenizer.lineno()... | java | private void getLastToken(StreamTokenizer tokenizer, boolean endOfFileOk) throws IOException, ParseException {
if ((tokenizer.nextToken() != StreamTokenizer.TT_EOL) && ((tokenizer.ttype != StreamTokenizer.TT_EOF) || !endOfFileOk)) {
throw new ParseException("end of line expected", tokenizer.lineno()... | [
"private",
"void",
"getLastToken",
"(",
"StreamTokenizer",
"tokenizer",
",",
"boolean",
"endOfFileOk",
")",
"throws",
"IOException",
",",
"ParseException",
"{",
"if",
"(",
"(",
"tokenizer",
".",
"nextToken",
"(",
")",
"!=",
"StreamTokenizer",
".",
"TT_EOL",
")",... | Gets token and checks if it's end of line.
@param endOfFileOk true if EOF is OK
@throws IllegalStateException if it doesn't find an end of line | [
"Gets",
"token",
"and",
"checks",
"if",
"it",
"s",
"end",
"of",
"line",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/data/src/main/java/smile/data/parser/ArffParser.java#L153-L157 |
17,318 | haifengl/smile | data/src/main/java/smile/data/parser/ArffParser.java | ArffParser.getNextToken | private void getNextToken(StreamTokenizer tokenizer) throws IOException, ParseException {
if (tokenizer.nextToken() == StreamTokenizer.TT_EOL) {
throw new ParseException("premature end of line", tokenizer.lineno());
}
if (tokenizer.ttype == StreamTokenizer.TT_EOF) {
throw... | java | private void getNextToken(StreamTokenizer tokenizer) throws IOException, ParseException {
if (tokenizer.nextToken() == StreamTokenizer.TT_EOL) {
throw new ParseException("premature end of line", tokenizer.lineno());
}
if (tokenizer.ttype == StreamTokenizer.TT_EOF) {
throw... | [
"private",
"void",
"getNextToken",
"(",
"StreamTokenizer",
"tokenizer",
")",
"throws",
"IOException",
",",
"ParseException",
"{",
"if",
"(",
"tokenizer",
".",
"nextToken",
"(",
")",
"==",
"StreamTokenizer",
".",
"TT_EOL",
")",
"{",
"throw",
"new",
"ParseExceptio... | Gets next token, checking for a premature and of line.
@throws IllegalStateException if it finds a premature end of line | [
"Gets",
"next",
"token",
"checking",
"for",
"a",
"premature",
"and",
"of",
"line",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/data/src/main/java/smile/data/parser/ArffParser.java#L164-L175 |
17,319 | haifengl/smile | data/src/main/java/smile/data/parser/ArffParser.java | ArffParser.readHeader | private String readHeader(StreamTokenizer tokenizer, List<Attribute> attributes) throws IOException, ParseException {
/// The name of dataset.
String relationName = null;
// clear attribute set, which may be from previous parsing of other datasets.
attributes.clear();
// Get nam... | java | private String readHeader(StreamTokenizer tokenizer, List<Attribute> attributes) throws IOException, ParseException {
/// The name of dataset.
String relationName = null;
// clear attribute set, which may be from previous parsing of other datasets.
attributes.clear();
// Get nam... | [
"private",
"String",
"readHeader",
"(",
"StreamTokenizer",
"tokenizer",
",",
"List",
"<",
"Attribute",
">",
"attributes",
")",
"throws",
"IOException",
",",
"ParseException",
"{",
"/// The name of dataset.",
"String",
"relationName",
"=",
"null",
";",
"// clear attrib... | Reads and stores header of an ARFF file.
@param attributes the set of attributes in this relation.
@return the name of relation.
@throws IllegalStateException if the information is not read successfully | [
"Reads",
"and",
"stores",
"header",
"of",
"an",
"ARFF",
"file",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/data/src/main/java/smile/data/parser/ArffParser.java#L184-L228 |
17,320 | haifengl/smile | data/src/main/java/smile/data/parser/ArffParser.java | ArffParser.parseAttribute | private Attribute parseAttribute(StreamTokenizer tokenizer) throws IOException, ParseException {
Attribute attribute = null;
// Get attribute name.
getNextToken(tokenizer);
String attributeName = tokenizer.sval;
getNextToken(tokenizer);
// Check if attribute is nominal.... | java | private Attribute parseAttribute(StreamTokenizer tokenizer) throws IOException, ParseException {
Attribute attribute = null;
// Get attribute name.
getNextToken(tokenizer);
String attributeName = tokenizer.sval;
getNextToken(tokenizer);
// Check if attribute is nominal.... | [
"private",
"Attribute",
"parseAttribute",
"(",
"StreamTokenizer",
"tokenizer",
")",
"throws",
"IOException",
",",
"ParseException",
"{",
"Attribute",
"attribute",
"=",
"null",
";",
"// Get attribute name.",
"getNextToken",
"(",
"tokenizer",
")",
";",
"String",
"attrib... | Parses the attribute declaration.
@return an attributes in this relation
@throws IOException if the information is not read
successfully | [
"Parses",
"the",
"attribute",
"declaration",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/data/src/main/java/smile/data/parser/ArffParser.java#L237-L314 |
17,321 | haifengl/smile | data/src/main/java/smile/data/parser/ArffParser.java | ArffParser.readTillEOL | private void readTillEOL(StreamTokenizer tokenizer) throws IOException {
while (tokenizer.nextToken() != StreamTokenizer.TT_EOL) {
}
tokenizer.pushBack();
} | java | private void readTillEOL(StreamTokenizer tokenizer) throws IOException {
while (tokenizer.nextToken() != StreamTokenizer.TT_EOL) {
}
tokenizer.pushBack();
} | [
"private",
"void",
"readTillEOL",
"(",
"StreamTokenizer",
"tokenizer",
")",
"throws",
"IOException",
"{",
"while",
"(",
"tokenizer",
".",
"nextToken",
"(",
")",
"!=",
"StreamTokenizer",
".",
"TT_EOL",
")",
"{",
"}",
"tokenizer",
".",
"pushBack",
"(",
")",
";... | Reads and skips all tokens before next end of line token.
@throws IOException in case something goes wrong | [
"Reads",
"and",
"skips",
"all",
"tokens",
"before",
"next",
"end",
"of",
"line",
"token",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/data/src/main/java/smile/data/parser/ArffParser.java#L321-L326 |
17,322 | haifengl/smile | data/src/main/java/smile/data/parser/ArffParser.java | ArffParser.getAttributes | public static Attribute[] getAttributes(InputStream stream) throws IOException, ParseException {
Reader r = new BufferedReader(new InputStreamReader(stream));
StreamTokenizer tokenizer = new StreamTokenizer(r);
ArffParser parser = new ArffParser();
parser.initTokenizer(tokenizer... | java | public static Attribute[] getAttributes(InputStream stream) throws IOException, ParseException {
Reader r = new BufferedReader(new InputStreamReader(stream));
StreamTokenizer tokenizer = new StreamTokenizer(r);
ArffParser parser = new ArffParser();
parser.initTokenizer(tokenizer... | [
"public",
"static",
"Attribute",
"[",
"]",
"getAttributes",
"(",
"InputStream",
"stream",
")",
"throws",
"IOException",
",",
"ParseException",
"{",
"Reader",
"r",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"stream",
")",
")",
";",
"Str... | Returns the attribute set of given stream. | [
"Returns",
"the",
"attribute",
"set",
"of",
"given",
"stream",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/data/src/main/java/smile/data/parser/ArffParser.java#L355-L366 |
17,323 | haifengl/smile | data/src/main/java/smile/data/parser/ArffParser.java | ArffParser.parse | public AttributeDataset parse(InputStream stream) throws IOException, ParseException {
try (Reader r = new BufferedReader(new InputStreamReader(stream))) {
StreamTokenizer tokenizer = new StreamTokenizer(r);
initTokenizer(tokenizer);
List<Attribute> attributes = new ArrayLis... | java | public AttributeDataset parse(InputStream stream) throws IOException, ParseException {
try (Reader r = new BufferedReader(new InputStreamReader(stream))) {
StreamTokenizer tokenizer = new StreamTokenizer(r);
initTokenizer(tokenizer);
List<Attribute> attributes = new ArrayLis... | [
"public",
"AttributeDataset",
"parse",
"(",
"InputStream",
"stream",
")",
"throws",
"IOException",
",",
"ParseException",
"{",
"try",
"(",
"Reader",
"r",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"stream",
")",
")",
")",
"{",
"StreamT... | Parse a dataset from given stream. | [
"Parse",
"a",
"dataset",
"from",
"given",
"stream",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/data/src/main/java/smile/data/parser/ArffParser.java#L395-L449 |
17,324 | haifengl/smile | data/src/main/java/smile/data/parser/ArffParser.java | ArffParser.readInstance | private void readInstance(StreamTokenizer tokenizer, AttributeDataset data, Attribute[] attributes) throws IOException, ParseException {
double[] x = responseIndex >= 0 ? new double[attributes.length - 1] : new double[attributes.length];
double y = Double.NaN;
// Get values for all attr... | java | private void readInstance(StreamTokenizer tokenizer, AttributeDataset data, Attribute[] attributes) throws IOException, ParseException {
double[] x = responseIndex >= 0 ? new double[attributes.length - 1] : new double[attributes.length];
double y = Double.NaN;
// Get values for all attr... | [
"private",
"void",
"readInstance",
"(",
"StreamTokenizer",
"tokenizer",
",",
"AttributeDataset",
"data",
",",
"Attribute",
"[",
"]",
"attributes",
")",
"throws",
"IOException",
",",
"ParseException",
"{",
"double",
"[",
"]",
"x",
"=",
"responseIndex",
">=",
"0",... | Reads a single instance.
@throws ParseException if the information is not read successfully | [
"Reads",
"a",
"single",
"instance",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/data/src/main/java/smile/data/parser/ArffParser.java#L455-L482 |
17,325 | haifengl/smile | data/src/main/java/smile/data/parser/ArffParser.java | ArffParser.readSparseInstance | private void readSparseInstance(StreamTokenizer tokenizer, AttributeDataset data, Attribute[] attributes) throws IOException, ParseException {
double[] x = responseIndex >= 0 ? new double[attributes.length - 1] : new double[attributes.length];
double y = Double.NaN;
int index = -1;
... | java | private void readSparseInstance(StreamTokenizer tokenizer, AttributeDataset data, Attribute[] attributes) throws IOException, ParseException {
double[] x = responseIndex >= 0 ? new double[attributes.length - 1] : new double[attributes.length];
double y = Double.NaN;
int index = -1;
... | [
"private",
"void",
"readSparseInstance",
"(",
"StreamTokenizer",
"tokenizer",
",",
"AttributeDataset",
"data",
",",
"Attribute",
"[",
"]",
"attributes",
")",
"throws",
"IOException",
",",
"ParseException",
"{",
"double",
"[",
"]",
"x",
"=",
"responseIndex",
">=",
... | Reads a sparse instance using the tokenizer.
@throws ParseException if the information is not read successfully | [
"Reads",
"a",
"sparse",
"instance",
"using",
"the",
"tokenizer",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/data/src/main/java/smile/data/parser/ArffParser.java#L488-L532 |
17,326 | haifengl/smile | math/src/main/java/smile/math/matrix/Lanczos.java | Lanczos.startv | private static double startv(Matrix A, double[][] q, double[][] wptr, int step) {
// get initial vector; default is random
double rnm = Math.dot(wptr[0], wptr[0]);
double[] r = wptr[0];
for (int id = 0; id < 3; id++) {
if (id > 0 || step > 0 || rnm == 0) {
for... | java | private static double startv(Matrix A, double[][] q, double[][] wptr, int step) {
// get initial vector; default is random
double rnm = Math.dot(wptr[0], wptr[0]);
double[] r = wptr[0];
for (int id = 0; id < 3; id++) {
if (id > 0 || step > 0 || rnm == 0) {
for... | [
"private",
"static",
"double",
"startv",
"(",
"Matrix",
"A",
",",
"double",
"[",
"]",
"[",
"]",
"q",
",",
"double",
"[",
"]",
"[",
"]",
"wptr",
",",
"int",
"step",
")",
"{",
"// get initial vector; default is random",
"double",
"rnm",
"=",
"Math",
".",
... | Generate a starting vector in r and returns |r|. It returns zero if the
range is spanned, and throws exception if no starting vector within range
of operator can be found.
@param step starting index for a Lanczos run | [
"Generate",
"a",
"starting",
"vector",
"in",
"r",
"and",
"returns",
"|r|",
".",
"It",
"returns",
"zero",
"if",
"the",
"range",
"is",
"spanned",
"and",
"throws",
"exception",
"if",
"no",
"starting",
"vector",
"within",
"range",
"of",
"operator",
"can",
"be"... | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/matrix/Lanczos.java#L322-L367 |
17,327 | haifengl/smile | math/src/main/java/smile/math/matrix/Lanczos.java | Lanczos.ortbnd | private static void ortbnd(double[] alf, double[] bet, double[] eta, double[] oldeta, int step, double rnm, double eps) {
if (step < 1) {
return;
}
if (0 != rnm) {
if (step > 1) {
oldeta[0] = (bet[1] * eta[1] + (alf[0] - alf[step]) * eta[0] - bet[step] * ... | java | private static void ortbnd(double[] alf, double[] bet, double[] eta, double[] oldeta, int step, double rnm, double eps) {
if (step < 1) {
return;
}
if (0 != rnm) {
if (step > 1) {
oldeta[0] = (bet[1] * eta[1] + (alf[0] - alf[step]) * eta[0] - bet[step] * ... | [
"private",
"static",
"void",
"ortbnd",
"(",
"double",
"[",
"]",
"alf",
",",
"double",
"[",
"]",
"bet",
",",
"double",
"[",
"]",
"eta",
",",
"double",
"[",
"]",
"oldeta",
",",
"int",
"step",
",",
"double",
"rnm",
",",
"double",
"eps",
")",
"{",
"i... | Update the eta recurrence.
@param alf array to store diagonal of the tridiagonal matrix T
@param bet array to store off-diagonal of T
@param eta on input, orthogonality estimate of Lanczos vectors at step j.
On output, orthogonality estimate of Lanczos vectors at step j+1 .
@param oldeta on input, orth... | [
"Update",
"the",
"eta",
"recurrence",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/matrix/Lanczos.java#L381-L404 |
17,328 | haifengl/smile | math/src/main/java/smile/math/matrix/Lanczos.java | Lanczos.purge | private static double purge(int ll, double[][] Q, double[] r, double[] q, double[] ra, double[] qa, double[] eta, double[] oldeta, int step, double rnm, double tol, double eps, double reps) {
if (step < ll + 2) {
return rnm;
}
double t, tq, tr;
int k = idamax(step - (ll + 1)... | java | private static double purge(int ll, double[][] Q, double[] r, double[] q, double[] ra, double[] qa, double[] eta, double[] oldeta, int step, double rnm, double tol, double eps, double reps) {
if (step < ll + 2) {
return rnm;
}
double t, tq, tr;
int k = idamax(step - (ll + 1)... | [
"private",
"static",
"double",
"purge",
"(",
"int",
"ll",
",",
"double",
"[",
"]",
"[",
"]",
"Q",
",",
"double",
"[",
"]",
"r",
",",
"double",
"[",
"]",
"q",
",",
"double",
"[",
"]",
"ra",
",",
"double",
"[",
"]",
"qa",
",",
"double",
"[",
"]... | Examine the state of orthogonality between the new Lanczos
vector and the previous ones to decide whether re-orthogonalization
should be performed.
@param ll number of intitial Lanczos vectors in local orthog.
@param r on input, residual vector to become next Lanczos vector.
On output, residual vector orth... | [
"Examine",
"the",
"state",
"of",
"orthogonality",
"between",
"the",
"new",
"Lanczos",
"vector",
"and",
"the",
"previous",
"ones",
"to",
"decide",
"whether",
"re",
"-",
"orthogonalization",
"should",
"be",
"performed",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/matrix/Lanczos.java#L420-L465 |
17,329 | haifengl/smile | math/src/main/java/smile/math/matrix/Lanczos.java | Lanczos.idamax | private static int idamax(int n, double[] dx, int ix0, int incx) {
int ix, imax;
double dmax;
if (n < 1) {
return -1;
}
if (n == 1) {
return 0;
}
if (incx == 0) {
return -1;
}
ix = (incx < 0) ? ix0 + ((-n + 1) * ... | java | private static int idamax(int n, double[] dx, int ix0, int incx) {
int ix, imax;
double dmax;
if (n < 1) {
return -1;
}
if (n == 1) {
return 0;
}
if (incx == 0) {
return -1;
}
ix = (incx < 0) ? ix0 + ((-n + 1) * ... | [
"private",
"static",
"int",
"idamax",
"(",
"int",
"n",
",",
"double",
"[",
"]",
"dx",
",",
"int",
"ix0",
",",
"int",
"incx",
")",
"{",
"int",
"ix",
",",
"imax",
";",
"double",
"dmax",
";",
"if",
"(",
"n",
"<",
"1",
")",
"{",
"return",
"-",
"1... | Find the index of element having maximum absolute value. | [
"Find",
"the",
"index",
"of",
"element",
"having",
"maximum",
"absolute",
"value",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/matrix/Lanczos.java#L470-L494 |
17,330 | haifengl/smile | math/src/main/java/smile/math/matrix/Lanczos.java | Lanczos.store | private static void store(double[][] q, int j, double[] s) {
if (null == q[j]) {
q[j] = s.clone();
} else {
Math.copy(s, q[j]);
}
} | java | private static void store(double[][] q, int j, double[] s) {
if (null == q[j]) {
q[j] = s.clone();
} else {
Math.copy(s, q[j]);
}
} | [
"private",
"static",
"void",
"store",
"(",
"double",
"[",
"]",
"[",
"]",
"q",
",",
"int",
"j",
",",
"double",
"[",
"]",
"s",
")",
"{",
"if",
"(",
"null",
"==",
"q",
"[",
"j",
"]",
")",
"{",
"q",
"[",
"j",
"]",
"=",
"s",
".",
"clone",
"(",... | Based on the input operation flag, stores to or retrieves from memory a vector.
@param s contains the vector to be stored | [
"Based",
"on",
"the",
"input",
"operation",
"flag",
"stores",
"to",
"or",
"retrieves",
"from",
"memory",
"a",
"vector",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/matrix/Lanczos.java#L565-L571 |
17,331 | haifengl/smile | math/src/main/java/smile/math/distance/ChebyshevDistance.java | ChebyshevDistance.d | public static double d(int[] x, int[] y) {
if (x.length != y.length)
throw new IllegalArgumentException(String.format("Arrays have different length: x[%d], y[%d]", x.length, y.length));
double dist = 0.0;
for (int i = 0; i < x.length; i++) {
double d = Math.abs(x[i] - y[... | java | public static double d(int[] x, int[] y) {
if (x.length != y.length)
throw new IllegalArgumentException(String.format("Arrays have different length: x[%d], y[%d]", x.length, y.length));
double dist = 0.0;
for (int i = 0; i < x.length; i++) {
double d = Math.abs(x[i] - y[... | [
"public",
"static",
"double",
"d",
"(",
"int",
"[",
"]",
"x",
",",
"int",
"[",
"]",
"y",
")",
"{",
"if",
"(",
"x",
".",
"length",
"!=",
"y",
".",
"length",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"Array... | Chebyshev distance between the two arrays of type integer. | [
"Chebyshev",
"distance",
"between",
"the",
"two",
"arrays",
"of",
"type",
"integer",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/distance/ChebyshevDistance.java#L43-L55 |
17,332 | haifengl/smile | demo/src/main/java/smile/demo/SmileDemo.java | SmileDemo.valueChanged | @Override
public void valueChanged(TreeSelectionEvent e) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
if (node != null && node.isLeaf()) {
int pos = workspace.getDividerLocation();
workspace.setTopComponent((JPanel) node.getUs... | java | @Override
public void valueChanged(TreeSelectionEvent e) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
if (node != null && node.isLeaf()) {
int pos = workspace.getDividerLocation();
workspace.setTopComponent((JPanel) node.getUs... | [
"@",
"Override",
"public",
"void",
"valueChanged",
"(",
"TreeSelectionEvent",
"e",
")",
"{",
"DefaultMutableTreeNode",
"node",
"=",
"(",
"DefaultMutableTreeNode",
")",
"tree",
".",
"getLastSelectedPathComponent",
"(",
")",
";",
"if",
"(",
"node",
"!=",
"null",
"... | Required by TreeSelectionListener interface. | [
"Required",
"by",
"TreeSelectionListener",
"interface",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/demo/src/main/java/smile/demo/SmileDemo.java#L183-L192 |
17,333 | haifengl/smile | core/src/main/java/smile/feature/FeatureTransform.java | FeatureTransform.learn | public void learn(double[][] data) {
int p = data[0].length;
Attribute[] attributes = new Attribute[p];
for (int i = 0; i < p; i++) {
attributes[i] = new NumericAttribute("V"+i);
}
learn(attributes, data);
} | java | public void learn(double[][] data) {
int p = data[0].length;
Attribute[] attributes = new Attribute[p];
for (int i = 0; i < p; i++) {
attributes[i] = new NumericAttribute("V"+i);
}
learn(attributes, data);
} | [
"public",
"void",
"learn",
"(",
"double",
"[",
"]",
"[",
"]",
"data",
")",
"{",
"int",
"p",
"=",
"data",
"[",
"0",
"]",
".",
"length",
";",
"Attribute",
"[",
"]",
"attributes",
"=",
"new",
"Attribute",
"[",
"p",
"]",
";",
"for",
"(",
"int",
"i"... | Learns transformation parameters from a dataset.
All features are assumed numeric.
@param data The training data. | [
"Learns",
"transformation",
"parameters",
"from",
"a",
"dataset",
".",
"All",
"features",
"are",
"assumed",
"numeric",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/feature/FeatureTransform.java#L55-L62 |
17,334 | haifengl/smile | core/src/main/java/smile/feature/FeatureTransform.java | FeatureTransform.transform | public double[][] transform(double[][] x) {
double[][] y = new double[x.length][];
for (int i = 0; i < y.length; i++) {
y[i] = transform(x[i]);
}
return y;
} | java | public double[][] transform(double[][] x) {
double[][] y = new double[x.length][];
for (int i = 0; i < y.length; i++) {
y[i] = transform(x[i]);
}
return y;
} | [
"public",
"double",
"[",
"]",
"[",
"]",
"transform",
"(",
"double",
"[",
"]",
"[",
"]",
"x",
")",
"{",
"double",
"[",
"]",
"[",
"]",
"y",
"=",
"new",
"double",
"[",
"x",
".",
"length",
"]",
"[",
"",
"]",
";",
"for",
"(",
"int",
"i",
"=",
... | Transform an array of feature vectors.
@param x an array of feature vectors. The feature
vectors may be modified on output if copy is false.
@return the transformed feature vectors. | [
"Transform",
"an",
"array",
"of",
"feature",
"vectors",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/feature/FeatureTransform.java#L86-L93 |
17,335 | haifengl/smile | math/src/main/java/smile/math/distance/CorrelationDistance.java | CorrelationDistance.d | @Override
public double d(double[] x, double[] y) {
if (x.length != y.length)
throw new IllegalArgumentException(String.format("Arrays have different length: x[%d], y[%d]", x.length, y.length));
return 1 - Math.cor(x, y);
} | java | @Override
public double d(double[] x, double[] y) {
if (x.length != y.length)
throw new IllegalArgumentException(String.format("Arrays have different length: x[%d], y[%d]", x.length, y.length));
return 1 - Math.cor(x, y);
} | [
"@",
"Override",
"public",
"double",
"d",
"(",
"double",
"[",
"]",
"x",
",",
"double",
"[",
"]",
"y",
")",
"{",
"if",
"(",
"x",
".",
"length",
"!=",
"y",
".",
"length",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
... | Pearson correlation distance between the two arrays of type double. | [
"Pearson",
"correlation",
"distance",
"between",
"the",
"two",
"arrays",
"of",
"type",
"double",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/distance/CorrelationDistance.java#L44-L50 |
17,336 | haifengl/smile | math/src/main/java/smile/math/distance/CorrelationDistance.java | CorrelationDistance.pearson | public static double pearson(int[] x, int[] y) {
if (x.length != y.length)
throw new IllegalArgumentException(String.format("Arrays have different length: x[%d], y[%d]", x.length, y.length));
return 1 - Math.cor(x, y);
} | java | public static double pearson(int[] x, int[] y) {
if (x.length != y.length)
throw new IllegalArgumentException(String.format("Arrays have different length: x[%d], y[%d]", x.length, y.length));
return 1 - Math.cor(x, y);
} | [
"public",
"static",
"double",
"pearson",
"(",
"int",
"[",
"]",
"x",
",",
"int",
"[",
"]",
"y",
")",
"{",
"if",
"(",
"x",
".",
"length",
"!=",
"y",
".",
"length",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\... | Pearson correlation distance between the two arrays of type int. | [
"Pearson",
"correlation",
"distance",
"between",
"the",
"two",
"arrays",
"of",
"type",
"int",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/distance/CorrelationDistance.java#L55-L60 |
17,337 | haifengl/smile | math/src/main/java/smile/math/distance/CorrelationDistance.java | CorrelationDistance.spearman | public static double spearman(int[] x, int[] y) {
if (x.length != y.length)
throw new IllegalArgumentException(String.format("Arrays have different length: x[%d], y[%d]", x.length, y.length));
return 1 - Math.spearman(x, y);
} | java | public static double spearman(int[] x, int[] y) {
if (x.length != y.length)
throw new IllegalArgumentException(String.format("Arrays have different length: x[%d], y[%d]", x.length, y.length));
return 1 - Math.spearman(x, y);
} | [
"public",
"static",
"double",
"spearman",
"(",
"int",
"[",
"]",
"x",
",",
"int",
"[",
"]",
"y",
")",
"{",
"if",
"(",
"x",
".",
"length",
"!=",
"y",
".",
"length",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"... | Spearman correlation distance between the two arrays of type int. | [
"Spearman",
"correlation",
"distance",
"between",
"the",
"two",
"arrays",
"of",
"type",
"int",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/distance/CorrelationDistance.java#L85-L90 |
17,338 | haifengl/smile | math/src/main/java/smile/math/distance/CorrelationDistance.java | CorrelationDistance.kendall | public static double kendall(int[] x, int[] y) {
if (x.length != y.length)
throw new IllegalArgumentException(String.format("Arrays have different length: x[%d], y[%d]", x.length, y.length));
return 1 - Math.kendall(x, y);
} | java | public static double kendall(int[] x, int[] y) {
if (x.length != y.length)
throw new IllegalArgumentException(String.format("Arrays have different length: x[%d], y[%d]", x.length, y.length));
return 1 - Math.kendall(x, y);
} | [
"public",
"static",
"double",
"kendall",
"(",
"int",
"[",
"]",
"x",
",",
"int",
"[",
"]",
"y",
")",
"{",
"if",
"(",
"x",
".",
"length",
"!=",
"y",
".",
"length",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\... | Kendall rank correlation distance between the two arrays of type int. | [
"Kendall",
"rank",
"correlation",
"distance",
"between",
"the",
"two",
"arrays",
"of",
"type",
"int",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/distance/CorrelationDistance.java#L115-L120 |
17,339 | haifengl/smile | math/src/main/java/smile/sort/SortUtils.java | SortUtils.swap | public static void swap(float arr[], int i, int j) {
float a = arr[i];
arr[i] = arr[j];
arr[j] = a;
} | java | public static void swap(float arr[], int i, int j) {
float a = arr[i];
arr[i] = arr[j];
arr[j] = a;
} | [
"public",
"static",
"void",
"swap",
"(",
"float",
"arr",
"[",
"]",
",",
"int",
"i",
",",
"int",
"j",
")",
"{",
"float",
"a",
"=",
"arr",
"[",
"i",
"]",
";",
"arr",
"[",
"i",
"]",
"=",
"arr",
"[",
"j",
"]",
";",
"arr",
"[",
"j",
"]",
"=",
... | Swap two positions. | [
"Swap",
"two",
"positions",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/sort/SortUtils.java#L43-L47 |
17,340 | haifengl/smile | core/src/main/java/smile/clustering/BBDTree.java | BBDTree.getNodeCost | private double getNodeCost(Node node, double[] center) {
int d = center.length;
double scatter = 0.0;
for (int i = 0; i < d; i++) {
double x = (node.sum[i] / node.count) - center[i];
scatter += x * x;
}
return node.cost + node.count * scatter;
} | java | private double getNodeCost(Node node, double[] center) {
int d = center.length;
double scatter = 0.0;
for (int i = 0; i < d; i++) {
double x = (node.sum[i] / node.count) - center[i];
scatter += x * x;
}
return node.cost + node.count * scatter;
} | [
"private",
"double",
"getNodeCost",
"(",
"Node",
"node",
",",
"double",
"[",
"]",
"center",
")",
"{",
"int",
"d",
"=",
"center",
".",
"length",
";",
"double",
"scatter",
"=",
"0.0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"d",
";",
... | Returns the total contribution of all data in the given kd-tree node,
assuming they are all assigned to a mean at the given location.
sum_{x \in node} ||x - mean||^2.
If c denotes the mean of mass of the data in this node and n denotes
the number of data in it, then this quantity is given by
n * ||c - mean||^2 + sum... | [
"Returns",
"the",
"total",
"contribution",
"of",
"all",
"data",
"in",
"the",
"given",
"kd",
"-",
"tree",
"node",
"assuming",
"they",
"are",
"all",
"assigned",
"to",
"a",
"mean",
"at",
"the",
"given",
"location",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/clustering/BBDTree.java#L241-L249 |
17,341 | haifengl/smile | core/src/main/java/smile/clustering/BBDTree.java | BBDTree.clustering | public double clustering(double[][] centroids, double[][] sums, int[] counts, int[] membership) {
int k = centroids.length;
Arrays.fill(counts, 0);
int[] candidates = new int[k];
for (int i = 0; i < k; i++) {
candidates[i] = i;
Arrays.fill(sums[i], 0.0);
... | java | public double clustering(double[][] centroids, double[][] sums, int[] counts, int[] membership) {
int k = centroids.length;
Arrays.fill(counts, 0);
int[] candidates = new int[k];
for (int i = 0; i < k; i++) {
candidates[i] = i;
Arrays.fill(sums[i], 0.0);
... | [
"public",
"double",
"clustering",
"(",
"double",
"[",
"]",
"[",
"]",
"centroids",
",",
"double",
"[",
"]",
"[",
"]",
"sums",
",",
"int",
"[",
"]",
"counts",
",",
"int",
"[",
"]",
"membership",
")",
"{",
"int",
"k",
"=",
"centroids",
".",
"length",
... | Given k cluster centroids, this method assigns data to nearest centroids.
The return value is the distortion to the centroids. The parameter sums
will hold the sum of data for each cluster. The parameter counts hold
the number of data of each cluster. If membership is
not null, it should be an array of size n that will... | [
"Given",
"k",
"cluster",
"centroids",
"this",
"method",
"assigns",
"data",
"to",
"nearest",
"centroids",
".",
"The",
"return",
"value",
"is",
"the",
"distortion",
"to",
"the",
"centroids",
".",
"The",
"parameter",
"sums",
"will",
"hold",
"the",
"sum",
"of",
... | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/clustering/BBDTree.java#L259-L270 |
17,342 | haifengl/smile | core/src/main/java/smile/imputation/KMeansImputation.java | KMeansImputation.columnAverageImpute | static void columnAverageImpute(double[][] data) throws MissingValueImputationException {
for (int j = 0; j < data[0].length; j++) {
int n = 0;
double sum = 0.0;
for (int i = 0; i < data.length; i++) {
if (!Double.isNaN(data[i][j])) {
n++;... | java | static void columnAverageImpute(double[][] data) throws MissingValueImputationException {
for (int j = 0; j < data[0].length; j++) {
int n = 0;
double sum = 0.0;
for (int i = 0; i < data.length; i++) {
if (!Double.isNaN(data[i][j])) {
n++;... | [
"static",
"void",
"columnAverageImpute",
"(",
"double",
"[",
"]",
"[",
"]",
"data",
")",
"throws",
"MissingValueImputationException",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"data",
"[",
"0",
"]",
".",
"length",
";",
"j",
"++",
")",
"{"... | Impute the missing values with column averages.
@param data data with missing values.
@throws smile.imputation.MissingValueImputationException | [
"Impute",
"the",
"missing",
"values",
"with",
"column",
"averages",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/imputation/KMeansImputation.java#L111-L136 |
17,343 | haifengl/smile | core/src/main/java/smile/validation/Validation.java | Validation.loocv | public static <T> double loocv(ClassifierTrainer<T> trainer, T[] x, int[] y) {
int m = 0;
int n = x.length;
LOOCV loocv = new LOOCV(n);
for (int i = 0; i < n; i++) {
T[] trainx = Math.slice(x, loocv.train[i]);
int[] trainy = Math.slice(y, loocv.train[i]);... | java | public static <T> double loocv(ClassifierTrainer<T> trainer, T[] x, int[] y) {
int m = 0;
int n = x.length;
LOOCV loocv = new LOOCV(n);
for (int i = 0; i < n; i++) {
T[] trainx = Math.slice(x, loocv.train[i]);
int[] trainy = Math.slice(y, loocv.train[i]);... | [
"public",
"static",
"<",
"T",
">",
"double",
"loocv",
"(",
"ClassifierTrainer",
"<",
"T",
">",
"trainer",
",",
"T",
"[",
"]",
"x",
",",
"int",
"[",
"]",
"y",
")",
"{",
"int",
"m",
"=",
"0",
";",
"int",
"n",
"=",
"x",
".",
"length",
";",
"LOOC... | Leave-one-out cross validation of a classification model.
@param <T> the data type of input objects.
@param trainer a classifier trainer that is properly parameterized.
@param x the test data set.
@param y the test data labels.
@return the accuracy on test dataset | [
"Leave",
"-",
"one",
"-",
"out",
"cross",
"validation",
"of",
"a",
"classification",
"model",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/validation/Validation.java#L169-L186 |
17,344 | haifengl/smile | core/src/main/java/smile/validation/Validation.java | Validation.cv | public static <T> double cv(int k, ClassifierTrainer<T> trainer, T[] x, int[] y, ClassificationMeasure measure) {
if (k < 2) {
throw new IllegalArgumentException("Invalid k for k-fold cross validation: " + k);
}
int n = x.length;
int[] predictions = new int[n];
... | java | public static <T> double cv(int k, ClassifierTrainer<T> trainer, T[] x, int[] y, ClassificationMeasure measure) {
if (k < 2) {
throw new IllegalArgumentException("Invalid k for k-fold cross validation: " + k);
}
int n = x.length;
int[] predictions = new int[n];
... | [
"public",
"static",
"<",
"T",
">",
"double",
"cv",
"(",
"int",
"k",
",",
"ClassifierTrainer",
"<",
"T",
">",
"trainer",
",",
"T",
"[",
"]",
"x",
",",
"int",
"[",
"]",
"y",
",",
"ClassificationMeasure",
"measure",
")",
"{",
"if",
"(",
"k",
"<",
"2... | Cross validation of a classification model.
@param <T> the data type of input objects.
@param k k-fold cross validation.
@param trainer a classifier trainer that is properly parameterized.
@param x the test data set.
@param y the test data labels.
@param measure the performance measure of classification.
@return the t... | [
"Cross",
"validation",
"of",
"a",
"classification",
"model",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/validation/Validation.java#L410-L431 |
17,345 | haifengl/smile | core/src/main/java/smile/validation/Validation.java | Validation.cv | public static <T> double cv(int k, RegressionTrainer<T> trainer, T[] x, double[] y, RegressionMeasure measure) {
if (k < 2) {
throw new IllegalArgumentException("Invalid k for k-fold cross validation: " + k);
}
int n = x.length;
double[] predictions = new double[n];
... | java | public static <T> double cv(int k, RegressionTrainer<T> trainer, T[] x, double[] y, RegressionMeasure measure) {
if (k < 2) {
throw new IllegalArgumentException("Invalid k for k-fold cross validation: " + k);
}
int n = x.length;
double[] predictions = new double[n];
... | [
"public",
"static",
"<",
"T",
">",
"double",
"cv",
"(",
"int",
"k",
",",
"RegressionTrainer",
"<",
"T",
">",
"trainer",
",",
"T",
"[",
"]",
"x",
",",
"double",
"[",
"]",
"y",
",",
"RegressionMeasure",
"measure",
")",
"{",
"if",
"(",
"k",
"<",
"2"... | Cross validation of a regression model.
@param <T> the data type of input objects.
@param k k-fold cross validation.
@param trainer a regression model trainer that is properly parameterized.
@param x the test data set.
@param y the test data response values.
@param measure the performance measure of regression.
@retur... | [
"Cross",
"validation",
"of",
"a",
"regression",
"model",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/validation/Validation.java#L484-L505 |
17,346 | haifengl/smile | core/src/main/java/smile/validation/Validation.java | Validation.bootstrap | public static <T> double[] bootstrap(int k, ClassifierTrainer<T> trainer, T[] x, int[] y) {
if (k < 2) {
throw new IllegalArgumentException("Invalid k for k-fold bootstrap: " + k);
}
int n = x.length;
double[] results = new double[k];
Accuracy measure = new A... | java | public static <T> double[] bootstrap(int k, ClassifierTrainer<T> trainer, T[] x, int[] y) {
if (k < 2) {
throw new IllegalArgumentException("Invalid k for k-fold bootstrap: " + k);
}
int n = x.length;
double[] results = new double[k];
Accuracy measure = new A... | [
"public",
"static",
"<",
"T",
">",
"double",
"[",
"]",
"bootstrap",
"(",
"int",
"k",
",",
"ClassifierTrainer",
"<",
"T",
">",
"trainer",
",",
"T",
"[",
"]",
"x",
",",
"int",
"[",
"]",
"y",
")",
"{",
"if",
"(",
"k",
"<",
"2",
")",
"{",
"throw"... | Bootstrap accuracy estimation of a classification model.
@param <T> the data type of input objects.
@param k k-round bootstrap estimation.
@param trainer a classifier trainer that is properly parameterized.
@param x the test data set.
@param y the test data labels.
@return the k-round accuracies | [
"Bootstrap",
"accuracy",
"estimation",
"of",
"a",
"classification",
"model",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/validation/Validation.java#L557-L586 |
17,347 | haifengl/smile | core/src/main/java/smile/validation/Validation.java | Validation.bootstrap | public static <T> double[] bootstrap(int k, RegressionTrainer<T> trainer, T[] x, double[] y, RegressionMeasure measure) {
if (k < 2) {
throw new IllegalArgumentException("Invalid k for k-fold bootstrap: " + k);
}
int n = x.length;
double[] results = new double[k];
... | java | public static <T> double[] bootstrap(int k, RegressionTrainer<T> trainer, T[] x, double[] y, RegressionMeasure measure) {
if (k < 2) {
throw new IllegalArgumentException("Invalid k for k-fold bootstrap: " + k);
}
int n = x.length;
double[] results = new double[k];
... | [
"public",
"static",
"<",
"T",
">",
"double",
"[",
"]",
"bootstrap",
"(",
"int",
"k",
",",
"RegressionTrainer",
"<",
"T",
">",
"trainer",
",",
"T",
"[",
"]",
"x",
",",
"double",
"[",
"]",
"y",
",",
"RegressionMeasure",
"measure",
")",
"{",
"if",
"("... | Bootstrap performance estimation of a regression model.
@param <T> the data type of input objects.
@param k k-fold bootstrap estimation.
@param trainer a regression model trainer that is properly parameterized.
@param x the test data set.
@param y the test data response values.
@param measure the performance measure o... | [
"Bootstrap",
"performance",
"estimation",
"of",
"a",
"regression",
"model",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/validation/Validation.java#L728-L756 |
17,348 | haifengl/smile | data/src/main/java/smile/data/BinarySparseDataset.java | BinarySparseDataset.toSparseMatrix | public SparseMatrix toSparseMatrix() {
int[] pos = new int[numColumns];
int[] colIndex = new int[numColumns + 1];
for (int i = 0; i < numColumns; i++) {
colIndex[i + 1] = colIndex[i] + colSize[i];
}
int nrows = size();
int[] rowIndex = new int[n];
dou... | java | public SparseMatrix toSparseMatrix() {
int[] pos = new int[numColumns];
int[] colIndex = new int[numColumns + 1];
for (int i = 0; i < numColumns; i++) {
colIndex[i + 1] = colIndex[i] + colSize[i];
}
int nrows = size();
int[] rowIndex = new int[n];
dou... | [
"public",
"SparseMatrix",
"toSparseMatrix",
"(",
")",
"{",
"int",
"[",
"]",
"pos",
"=",
"new",
"int",
"[",
"numColumns",
"]",
";",
"int",
"[",
"]",
"colIndex",
"=",
"new",
"int",
"[",
"numColumns",
"+",
"1",
"]",
";",
"for",
"(",
"int",
"i",
"=",
... | Convert into Harwell-Boeing column-compressed sparse matrix format. | [
"Convert",
"into",
"Harwell",
"-",
"Boeing",
"column",
"-",
"compressed",
"sparse",
"matrix",
"format",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/data/src/main/java/smile/data/BinarySparseDataset.java#L165-L187 |
17,349 | haifengl/smile | nlp/src/main/java/smile/nlp/SimpleCorpus.java | SimpleCorpus.add | public Text add(String id, String title, String body) {
ArrayList<String> bag = new ArrayList<>();
for (String sentence : splitter.split(body)) {
String[] tokens = tokenizer.split(sentence);
for (int i = 0; i < tokens.length; i++) {
tokens[i] = tokens[i].... | java | public Text add(String id, String title, String body) {
ArrayList<String> bag = new ArrayList<>();
for (String sentence : splitter.split(body)) {
String[] tokens = tokenizer.split(sentence);
for (int i = 0; i < tokens.length; i++) {
tokens[i] = tokens[i].... | [
"public",
"Text",
"add",
"(",
"String",
"id",
",",
"String",
"title",
",",
"String",
"body",
")",
"{",
"ArrayList",
"<",
"String",
">",
"bag",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"String",
"sentence",
":",
"splitter",
".",
"spli... | Add a document to the corpus. | [
"Add",
"a",
"document",
"to",
"the",
"corpus",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/nlp/src/main/java/smile/nlp/SimpleCorpus.java#L108-L176 |
17,350 | haifengl/smile | graph/src/main/java/smile/graph/AdjacencyMatrix.java | AdjacencyMatrix.dijkstra | public double[] dijkstra(int s, boolean weighted) {
double[] wt = new double[n];
Arrays.fill(wt, Double.POSITIVE_INFINITY);
PriorityQueue queue = new PriorityQueue(wt);
for (int v = 0; v < n; v++) {
queue.insert(v);
}
wt[s] = 0.0;
queue.lower(s);
... | java | public double[] dijkstra(int s, boolean weighted) {
double[] wt = new double[n];
Arrays.fill(wt, Double.POSITIVE_INFINITY);
PriorityQueue queue = new PriorityQueue(wt);
for (int v = 0; v < n; v++) {
queue.insert(v);
}
wt[s] = 0.0;
queue.lower(s);
... | [
"public",
"double",
"[",
"]",
"dijkstra",
"(",
"int",
"s",
",",
"boolean",
"weighted",
")",
"{",
"double",
"[",
"]",
"wt",
"=",
"new",
"double",
"[",
"n",
"]",
";",
"Arrays",
".",
"fill",
"(",
"wt",
",",
"Double",
".",
"POSITIVE_INFINITY",
")",
";"... | Calculates the shortest path by Dijkstra algorithm.
@param s The source vertex.
@param weighted True to calculate weighted path. Otherwise, the edge weights will be ignored.
@return The distance to all vertices from the source. | [
"Calculates",
"the",
"shortest",
"path",
"by",
"Dijkstra",
"algorithm",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/graph/src/main/java/smile/graph/AdjacencyMatrix.java#L508-L536 |
17,351 | haifengl/smile | demo/src/main/java/smile/demo/data/classification/ToyData.java | ToyData.sample | public double[][] sample(int n) {
double[][] samples = new double[2 * n][];
MultivariateGaussianDistribution[] gauss = new MultivariateGaussianDistribution[k];
for (int i = 0; i < k; i++) {
gauss[i] = new MultivariateGaussianDistribution(m[i], v);
}
for (int i = 0; ... | java | public double[][] sample(int n) {
double[][] samples = new double[2 * n][];
MultivariateGaussianDistribution[] gauss = new MultivariateGaussianDistribution[k];
for (int i = 0; i < k; i++) {
gauss[i] = new MultivariateGaussianDistribution(m[i], v);
}
for (int i = 0; ... | [
"public",
"double",
"[",
"]",
"[",
"]",
"sample",
"(",
"int",
"n",
")",
"{",
"double",
"[",
"]",
"[",
"]",
"samples",
"=",
"new",
"double",
"[",
"2",
"*",
"n",
"]",
"[",
"",
"]",
";",
"MultivariateGaussianDistribution",
"[",
"]",
"gauss",
"=",
"n... | Generate n samples from each class. | [
"Generate",
"n",
"samples",
"from",
"each",
"class",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/demo/src/main/java/smile/demo/data/classification/ToyData.java#L66-L87 |
17,352 | haifengl/smile | core/src/main/java/smile/vq/NeuralMap.java | NeuralMap.purge | public int purge(int minPts) {
List<Neuron> outliers = new ArrayList<>();
for (Neuron neuron : neurons) {
if (neuron.n < minPts) {
outliers.add(neuron);
}
}
neurons.removeAll(outliers);
for (Neuron neuron : neurons) {
n... | java | public int purge(int minPts) {
List<Neuron> outliers = new ArrayList<>();
for (Neuron neuron : neurons) {
if (neuron.n < minPts) {
outliers.add(neuron);
}
}
neurons.removeAll(outliers);
for (Neuron neuron : neurons) {
n... | [
"public",
"int",
"purge",
"(",
"int",
"minPts",
")",
"{",
"List",
"<",
"Neuron",
">",
"outliers",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"Neuron",
"neuron",
":",
"neurons",
")",
"{",
"if",
"(",
"neuron",
".",
"n",
"<",
"minPts",
... | Removes neurons with the number of samples less than a given threshold.
The neurons without neighbors will also be removed.
@param minPts neurons will be removed if the number of its points is
less than minPts.
@return the number of neurons after purging. | [
"Removes",
"neurons",
"with",
"the",
"number",
"of",
"samples",
"less",
"than",
"a",
"given",
"threshold",
".",
"The",
"neurons",
"without",
"neighbors",
"will",
"also",
"be",
"removed",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/vq/NeuralMap.java#L532-L554 |
17,353 | haifengl/smile | core/src/main/java/smile/clustering/XMeans.java | XMeans.bic | private double bic(int n, int d, double distortion) {
double variance = distortion / (n - 1);
double p1 = -n * LOG2PI;
double p2 = -n * d * Math.log(variance);
double p3 = -(n - 1);
double L = (p1 + p2 + p3) / 2;
int numParameters = d + 1;
return L - 0.5 * numPa... | java | private double bic(int n, int d, double distortion) {
double variance = distortion / (n - 1);
double p1 = -n * LOG2PI;
double p2 = -n * d * Math.log(variance);
double p3 = -(n - 1);
double L = (p1 + p2 + p3) / 2;
int numParameters = d + 1;
return L - 0.5 * numPa... | [
"private",
"double",
"bic",
"(",
"int",
"n",
",",
"int",
"d",
",",
"double",
"distortion",
")",
"{",
"double",
"variance",
"=",
"distortion",
"/",
"(",
"n",
"-",
"1",
")",
";",
"double",
"p1",
"=",
"-",
"n",
"*",
"LOG2PI",
";",
"double",
"p2",
"=... | Calculates the BIC for single cluster.
@param n the total number of samples.
@param d the dimensionality of data.
@param distortion the distortion of clusters.
@return the BIC score. | [
"Calculates",
"the",
"BIC",
"for",
"single",
"cluster",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/clustering/XMeans.java#L182-L192 |
17,354 | haifengl/smile | core/src/main/java/smile/clustering/XMeans.java | XMeans.bic | private double bic(int k, int n, int d, double distortion, int[] clusterSize) {
double variance = distortion / (n - k);
double L = 0.0;
for (int i = 0; i < k; i++) {
L += logLikelihood(k, n, clusterSize[i], d, variance);
}
int numParameters = k + k * d;
retu... | java | private double bic(int k, int n, int d, double distortion, int[] clusterSize) {
double variance = distortion / (n - k);
double L = 0.0;
for (int i = 0; i < k; i++) {
L += logLikelihood(k, n, clusterSize[i], d, variance);
}
int numParameters = k + k * d;
retu... | [
"private",
"double",
"bic",
"(",
"int",
"k",
",",
"int",
"n",
",",
"int",
"d",
",",
"double",
"distortion",
",",
"int",
"[",
"]",
"clusterSize",
")",
"{",
"double",
"variance",
"=",
"distortion",
"/",
"(",
"n",
"-",
"k",
")",
";",
"double",
"L",
... | Calculates the BIC for the given set of centers.
@param k the number of clusters.
@param n the total number of samples.
@param d the dimensionality of data.
@param distortion the distortion of clusters.
@param clusterSize the number of samples in each cluster.
@return the BIC score. | [
"Calculates",
"the",
"BIC",
"for",
"the",
"given",
"set",
"of",
"centers",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/clustering/XMeans.java#L203-L213 |
17,355 | haifengl/smile | core/src/main/java/smile/clustering/XMeans.java | XMeans.logLikelihood | private static double logLikelihood(int k, int n, int ni, int d, double variance) {
double p1 = -ni * LOG2PI;
double p2 = -ni * d * Math.log(variance);
double p3 = -(ni - k);
double p4 = ni * Math.log(ni);
double p5 = -ni * Math.log(n);
double loglike = (p1 + p2 + p3) / 2... | java | private static double logLikelihood(int k, int n, int ni, int d, double variance) {
double p1 = -ni * LOG2PI;
double p2 = -ni * d * Math.log(variance);
double p3 = -(ni - k);
double p4 = ni * Math.log(ni);
double p5 = -ni * Math.log(n);
double loglike = (p1 + p2 + p3) / 2... | [
"private",
"static",
"double",
"logLikelihood",
"(",
"int",
"k",
",",
"int",
"n",
",",
"int",
"ni",
",",
"int",
"d",
",",
"double",
"variance",
")",
"{",
"double",
"p1",
"=",
"-",
"ni",
"*",
"LOG2PI",
";",
"double",
"p2",
"=",
"-",
"ni",
"*",
"d"... | Estimate the log-likelihood of the data for the given model.
@param k the number of clusters.
@param n the total number of samples.
@param ni the number of samples belong to this cluster.
@param d the dimensionality of data.
@param variance the estimated variance of clusters.
@return the likelihood estimate | [
"Estimate",
"the",
"log",
"-",
"likelihood",
"of",
"the",
"data",
"for",
"the",
"given",
"model",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/clustering/XMeans.java#L225-L233 |
17,356 | haifengl/smile | math/src/main/java/smile/math/Random.java | Random.nextDoubles | public void nextDoubles(double[] d, double lo, double hi) {
real.nextDoubles(d);
double l = hi - lo;
int n = d.length;
for (int i = 0; i < n; i++) {
d[i] = lo + l * d[i];
}
} | java | public void nextDoubles(double[] d, double lo, double hi) {
real.nextDoubles(d);
double l = hi - lo;
int n = d.length;
for (int i = 0; i < n; i++) {
d[i] = lo + l * d[i];
}
} | [
"public",
"void",
"nextDoubles",
"(",
"double",
"[",
"]",
"d",
",",
"double",
"lo",
",",
"double",
"hi",
")",
"{",
"real",
".",
"nextDoubles",
"(",
"d",
")",
";",
"double",
"l",
"=",
"hi",
"-",
"lo",
";",
"int",
"n",
"=",
"d",
".",
"length",
";... | Generate n uniform random numbers in the range [lo, hi)
@param lo lower limit of range
@param hi upper limit of range
@param d array of random numbers to be generated | [
"Generate",
"n",
"uniform",
"random",
"numbers",
"in",
"the",
"range",
"[",
"lo",
"hi",
")"
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/Random.java#L81-L89 |
17,357 | haifengl/smile | math/src/main/java/smile/math/Random.java | Random.permutate | public int[] permutate(int n) {
int[] x = new int[n];
for (int i = 0; i < n; i++) {
x[i] = i;
}
permutate(x);
return x;
} | java | public int[] permutate(int n) {
int[] x = new int[n];
for (int i = 0; i < n; i++) {
x[i] = i;
}
permutate(x);
return x;
} | [
"public",
"int",
"[",
"]",
"permutate",
"(",
"int",
"n",
")",
"{",
"int",
"[",
"]",
"x",
"=",
"new",
"int",
"[",
"n",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"x",
"[",
"i",
"]",
"=",
"... | Generates a permutation of 0, 1, 2, ..., n-1, which is useful for
sampling without replacement. | [
"Generates",
"a",
"permutation",
"of",
"0",
"1",
"2",
"...",
"n",
"-",
"1",
"which",
"is",
"useful",
"for",
"sampling",
"without",
"replacement",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/Random.java#L121-L130 |
17,358 | haifengl/smile | core/src/main/java/smile/clustering/BIRCH.java | BIRCH.add | public void add(double[] x) {
if (root == null) {
root = new Node();
root.add(new Leaf(x));
root.update(x);
} else {
root.add(x);
}
} | java | public void add(double[] x) {
if (root == null) {
root = new Node();
root.add(new Leaf(x));
root.update(x);
} else {
root.add(x);
}
} | [
"public",
"void",
"add",
"(",
"double",
"[",
"]",
"x",
")",
"{",
"if",
"(",
"root",
"==",
"null",
")",
"{",
"root",
"=",
"new",
"Node",
"(",
")",
";",
"root",
".",
"add",
"(",
"new",
"Leaf",
"(",
"x",
")",
")",
";",
"root",
".",
"update",
"... | Add a data point into CF tree. | [
"Add",
"a",
"data",
"point",
"into",
"CF",
"tree",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/clustering/BIRCH.java#L345-L353 |
17,359 | haifengl/smile | plot/src/main/java/smile/plot/Graphics.java | Graphics.setGraphics | public void setGraphics(java.awt.Graphics2D g2d) {
this.g2d = g2d;
// anti-aliasing methods
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
} | java | public void setGraphics(java.awt.Graphics2D g2d) {
this.g2d = g2d;
// anti-aliasing methods
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
} | [
"public",
"void",
"setGraphics",
"(",
"java",
".",
"awt",
".",
"Graphics2D",
"g2d",
")",
"{",
"this",
".",
"g2d",
"=",
"g2d",
";",
"// anti-aliasing methods",
"g2d",
".",
"setRenderingHint",
"(",
"RenderingHints",
".",
"KEY_ANTIALIASING",
",",
"RenderingHints",
... | Set the Java2D graphics object. | [
"Set",
"the",
"Java2D",
"graphics",
"object",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Graphics.java#L84-L89 |
17,360 | haifengl/smile | plot/src/main/java/smile/plot/Graphics.java | Graphics.clip | public void clip() {
int x = (int) (projection.canvas.getWidth() * projection.canvas.margin);
int y = (int) (projection.canvas.getHeight() * projection.canvas.margin);
int w = (int) (projection.canvas.getWidth() * (1 - 2 * projection.canvas.margin));
int h = (int) (projection.canvas.getH... | java | public void clip() {
int x = (int) (projection.canvas.getWidth() * projection.canvas.margin);
int y = (int) (projection.canvas.getHeight() * projection.canvas.margin);
int w = (int) (projection.canvas.getWidth() * (1 - 2 * projection.canvas.margin));
int h = (int) (projection.canvas.getH... | [
"public",
"void",
"clip",
"(",
")",
"{",
"int",
"x",
"=",
"(",
"int",
")",
"(",
"projection",
".",
"canvas",
".",
"getWidth",
"(",
")",
"*",
"projection",
".",
"canvas",
".",
"margin",
")",
";",
"int",
"y",
"=",
"(",
"int",
")",
"(",
"projection"... | Restrict the draw area to the valid base coordinate space. | [
"Restrict",
"the",
"draw",
"area",
"to",
"the",
"valid",
"base",
"coordinate",
"space",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Graphics.java#L168-L175 |
17,361 | haifengl/smile | plot/src/main/java/smile/plot/Graphics.java | Graphics.drawLine | private void drawLine(int[]... coord) {
int[] x = new int[coord.length];
for (int i = 0; i < coord.length; i++) {
x[i] = coord[i][0];
}
int[] y = new int[coord.length];
for (int i = 0; i < coord.length; i++) {
y[i] = coord[i][1];
}
g2d.dr... | java | private void drawLine(int[]... coord) {
int[] x = new int[coord.length];
for (int i = 0; i < coord.length; i++) {
x[i] = coord[i][0];
}
int[] y = new int[coord.length];
for (int i = 0; i < coord.length; i++) {
y[i] = coord[i][1];
}
g2d.dr... | [
"private",
"void",
"drawLine",
"(",
"int",
"[",
"]",
"...",
"coord",
")",
"{",
"int",
"[",
"]",
"x",
"=",
"new",
"int",
"[",
"coord",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"coord",
".",
"length",
";",
"i",
... | Draw poly line. | [
"Draw",
"poly",
"line",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Graphics.java#L302-L314 |
17,362 | haifengl/smile | plot/src/main/java/smile/plot/Graphics.java | Graphics.drawLine | public void drawLine(double[]... coord) {
int[][] sc = new int[coord.length][];
for (int i = 0; i < sc.length; i++) {
sc[i] = projection.screenProjection(coord[i]);
}
drawLine(sc);
} | java | public void drawLine(double[]... coord) {
int[][] sc = new int[coord.length][];
for (int i = 0; i < sc.length; i++) {
sc[i] = projection.screenProjection(coord[i]);
}
drawLine(sc);
} | [
"public",
"void",
"drawLine",
"(",
"double",
"[",
"]",
"...",
"coord",
")",
"{",
"int",
"[",
"]",
"[",
"]",
"sc",
"=",
"new",
"int",
"[",
"coord",
".",
"length",
"]",
"[",
"",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"sc",... | Draw poly line. The coordinates are in logical coordinates. | [
"Draw",
"poly",
"line",
".",
"The",
"coordinates",
"are",
"in",
"logical",
"coordinates",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Graphics.java#L319-L326 |
17,363 | haifengl/smile | plot/src/main/java/smile/plot/Graphics.java | Graphics.drawLineBaseRatio | public void drawLineBaseRatio(double[]... coord) {
int[][] sc = new int[coord.length][];
for (int i = 0; i < sc.length; i++) {
sc[i] = projection.screenProjectionBaseRatio(coord[i]);
}
drawLine(sc);
} | java | public void drawLineBaseRatio(double[]... coord) {
int[][] sc = new int[coord.length][];
for (int i = 0; i < sc.length; i++) {
sc[i] = projection.screenProjectionBaseRatio(coord[i]);
}
drawLine(sc);
} | [
"public",
"void",
"drawLineBaseRatio",
"(",
"double",
"[",
"]",
"...",
"coord",
")",
"{",
"int",
"[",
"]",
"[",
"]",
"sc",
"=",
"new",
"int",
"[",
"coord",
".",
"length",
"]",
"[",
"",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<"... | Draw poly line. The logical coordinates are proportional to the base
coordinates. | [
"Draw",
"poly",
"line",
".",
"The",
"logical",
"coordinates",
"are",
"proportional",
"to",
"the",
"base",
"coordinates",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Graphics.java#L332-L339 |
17,364 | haifengl/smile | plot/src/main/java/smile/plot/Graphics.java | Graphics.drawPoint | public void drawPoint(char dot, double... coord) {
int size = 2;
int midSize = 3;
int bigSize = 4;
int[] sc = projection.screenProjection(coord);
int x = sc[0];
int y = sc[1];
switch (dot) {
case '+':
g2d.drawLine(x - size, y, x + si... | java | public void drawPoint(char dot, double... coord) {
int size = 2;
int midSize = 3;
int bigSize = 4;
int[] sc = projection.screenProjection(coord);
int x = sc[0];
int y = sc[1];
switch (dot) {
case '+':
g2d.drawLine(x - size, y, x + si... | [
"public",
"void",
"drawPoint",
"(",
"char",
"dot",
",",
"double",
"...",
"coord",
")",
"{",
"int",
"size",
"=",
"2",
";",
"int",
"midSize",
"=",
"3",
";",
"int",
"bigSize",
"=",
"4",
";",
"int",
"[",
"]",
"sc",
"=",
"projection",
".",
"screenProjec... | Draw a dot with given pattern. The coordinates are in logical coordinates.
@param dot the pattern of dot:
<ul>
<li> . : dot
<li> + : cross
<li> - : -
<li> | : |
<li> * : star
<li> x : x
<li> o : circle
<li> O : large circle
<li> @ : solid circle
<li> # : large sollid circle
<li> s : square
<li> S : large square
<li> q ... | [
"Draw",
"a",
"dot",
"with",
"given",
"pattern",
".",
"The",
"coordinates",
"are",
"in",
"logical",
"coordinates",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Graphics.java#L368-L440 |
17,365 | haifengl/smile | plot/src/main/java/smile/plot/Graphics.java | Graphics.fillPolygon | public void fillPolygon(double[]... coord) {
int[][] c = new int[coord.length][2];
for (int i = 0; i < coord.length; i++) {
c[i] = projection.screenProjection(coord[i]);
}
int[] x = new int[c.length];
for (int i = 0; i < c.length; i++) {
x[i] = c[i][0];
... | java | public void fillPolygon(double[]... coord) {
int[][] c = new int[coord.length][2];
for (int i = 0; i < coord.length; i++) {
c[i] = projection.screenProjection(coord[i]);
}
int[] x = new int[c.length];
for (int i = 0; i < c.length; i++) {
x[i] = c[i][0];
... | [
"public",
"void",
"fillPolygon",
"(",
"double",
"[",
"]",
"...",
"coord",
")",
"{",
"int",
"[",
"]",
"[",
"]",
"c",
"=",
"new",
"int",
"[",
"coord",
".",
"length",
"]",
"[",
"2",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"c... | Fill polygon. The coordinates are in logical coordinates. | [
"Fill",
"polygon",
".",
"The",
"coordinates",
"are",
"in",
"logical",
"coordinates",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Graphics.java#L465-L481 |
17,366 | haifengl/smile | plot/src/main/java/smile/plot/Graphics.java | Graphics.fillPolygon | public void fillPolygon(float alpha, double[]... coord) {
int[][] c = new int[coord.length][2];
for (int i = 0; i < coord.length; i++) {
c[i] = projection.screenProjection(coord[i]);
}
int[] x = new int[c.length];
for (int i = 0; i < c.length; i++) {
x[i]... | java | public void fillPolygon(float alpha, double[]... coord) {
int[][] c = new int[coord.length][2];
for (int i = 0; i < coord.length; i++) {
c[i] = projection.screenProjection(coord[i]);
}
int[] x = new int[c.length];
for (int i = 0; i < c.length; i++) {
x[i]... | [
"public",
"void",
"fillPolygon",
"(",
"float",
"alpha",
",",
"double",
"[",
"]",
"...",
"coord",
")",
"{",
"int",
"[",
"]",
"[",
"]",
"c",
"=",
"new",
"int",
"[",
"coord",
".",
"length",
"]",
"[",
"2",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"... | Fill polygon. The coordinates are in logical coordinates. This also supports
basic alpha compositing rules for combining source and destination
colors to achieve blending and transparency effects with graphics and images.
@param alpha the constant alpha to be multiplied with the alpha of the
source. alpha must be a fl... | [
"Fill",
"polygon",
".",
"The",
"coordinates",
"are",
"in",
"logical",
"coordinates",
".",
"This",
"also",
"supports",
"basic",
"alpha",
"compositing",
"rules",
"for",
"combining",
"source",
"and",
"destination",
"colors",
"to",
"achieve",
"blending",
"and",
"tra... | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Graphics.java#L492-L513 |
17,367 | haifengl/smile | plot/src/main/java/smile/plot/Graphics.java | Graphics.drawRect | public void drawRect(double[] topLeft, double[] rightBottom) {
if (!(projection instanceof Projection2D)) {
throw new UnsupportedOperationException("Only 2D graphics supports drawing rectangles.");
}
int[] sc = projection.screenProjection(topLeft);
int[] sc2 = projection.scr... | java | public void drawRect(double[] topLeft, double[] rightBottom) {
if (!(projection instanceof Projection2D)) {
throw new UnsupportedOperationException("Only 2D graphics supports drawing rectangles.");
}
int[] sc = projection.screenProjection(topLeft);
int[] sc2 = projection.scr... | [
"public",
"void",
"drawRect",
"(",
"double",
"[",
"]",
"topLeft",
",",
"double",
"[",
"]",
"rightBottom",
")",
"{",
"if",
"(",
"!",
"(",
"projection",
"instanceof",
"Projection2D",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Only ... | Draw the outline of the specified rectangle. | [
"Draw",
"the",
"outline",
"of",
"the",
"specified",
"rectangle",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Graphics.java#L518-L527 |
17,368 | haifengl/smile | plot/src/main/java/smile/plot/Graphics.java | Graphics.drawRectBaseRatio | public void drawRectBaseRatio(double[] topLeft, double[] rightBottom) {
if (!(projection instanceof Projection2D)) {
throw new UnsupportedOperationException("Only 2D graphics supports drawing rectangles.");
}
int[] sc = projection.screenProjectionBaseRatio(topLeft);
int[] sc... | java | public void drawRectBaseRatio(double[] topLeft, double[] rightBottom) {
if (!(projection instanceof Projection2D)) {
throw new UnsupportedOperationException("Only 2D graphics supports drawing rectangles.");
}
int[] sc = projection.screenProjectionBaseRatio(topLeft);
int[] sc... | [
"public",
"void",
"drawRectBaseRatio",
"(",
"double",
"[",
"]",
"topLeft",
",",
"double",
"[",
"]",
"rightBottom",
")",
"{",
"if",
"(",
"!",
"(",
"projection",
"instanceof",
"Projection2D",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
... | Draw the outline of the specified rectangle. The logical coordinates
are proportional to the base coordinates. | [
"Draw",
"the",
"outline",
"of",
"the",
"specified",
"rectangle",
".",
"The",
"logical",
"coordinates",
"are",
"proportional",
"to",
"the",
"base",
"coordinates",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Graphics.java#L533-L542 |
17,369 | haifengl/smile | plot/src/main/java/smile/plot/Graphics.java | Graphics.fillRectBaseRatio | public void fillRectBaseRatio(double[] topLeft, double[] rightBottom) {
if (!(projection instanceof Projection2D)) {
throw new UnsupportedOperationException("Only 2D graphics supports drawing rectangles.");
}
int[] sc = projection.screenProjectionBaseRatio(topLeft);
int[] sc... | java | public void fillRectBaseRatio(double[] topLeft, double[] rightBottom) {
if (!(projection instanceof Projection2D)) {
throw new UnsupportedOperationException("Only 2D graphics supports drawing rectangles.");
}
int[] sc = projection.screenProjectionBaseRatio(topLeft);
int[] sc... | [
"public",
"void",
"fillRectBaseRatio",
"(",
"double",
"[",
"]",
"topLeft",
",",
"double",
"[",
"]",
"rightBottom",
")",
"{",
"if",
"(",
"!",
"(",
"projection",
"instanceof",
"Projection2D",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
... | Fill the specified rectangle. The logical coordinates are proportional
to the base coordinates. | [
"Fill",
"the",
"specified",
"rectangle",
".",
"The",
"logical",
"coordinates",
"are",
"proportional",
"to",
"the",
"base",
"coordinates",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Graphics.java#L562-L571 |
17,370 | haifengl/smile | plot/src/main/java/smile/plot/Graphics.java | Graphics.rotate | public void rotate(double x, double y) {
if (!(projection instanceof Projection3D)) {
throw new UnsupportedOperationException("Only 3D graphics supports rotation.");
}
((Projection3D) projection).rotate(x, y);
} | java | public void rotate(double x, double y) {
if (!(projection instanceof Projection3D)) {
throw new UnsupportedOperationException("Only 3D graphics supports rotation.");
}
((Projection3D) projection).rotate(x, y);
} | [
"public",
"void",
"rotate",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"if",
"(",
"!",
"(",
"projection",
"instanceof",
"Projection3D",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Only 3D graphics supports rotation.\"",
")",
";... | Rotate the 3D view based on the changes on mouse position.
@param x changes of mouse position on the x axis.
@param y changes on mouse position on the y axis. | [
"Rotate",
"the",
"3D",
"view",
"based",
"on",
"the",
"changes",
"on",
"mouse",
"position",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Graphics.java#L578-L584 |
17,371 | haifengl/smile | core/src/main/java/smile/projection/GHA.java | GHA.learn | public double learn(double[] x) {
if (x.length != n) {
throw new IllegalArgumentException(String.format("Invalid input vector size: %d, expected: %d", x.length, n));
}
projection.ax(x, y);
for (int j = 0; j < p; j++) {
for (int i = 0; i < n; i++) {
... | java | public double learn(double[] x) {
if (x.length != n) {
throw new IllegalArgumentException(String.format("Invalid input vector size: %d, expected: %d", x.length, n));
}
projection.ax(x, y);
for (int j = 0; j < p; j++) {
for (int i = 0; i < n; i++) {
... | [
"public",
"double",
"learn",
"(",
"double",
"[",
"]",
"x",
")",
"{",
"if",
"(",
"x",
".",
"length",
"!=",
"n",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"Invalid input vector size: %d, expected: %d\"",
",",
"x... | Update the model with a new sample.
@param x the centered learning sample whose E(x) = 0.
@return the approximation error for input sample. | [
"Update",
"the",
"model",
"with",
"a",
"new",
"sample",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/projection/GHA.java#L182-L206 |
17,372 | haifengl/smile | core/src/main/java/smile/classification/RBFNetwork.java | RBFNetwork.rep | private static RadialBasisFunction[] rep(RadialBasisFunction rbf, int k) {
RadialBasisFunction[] arr = new RadialBasisFunction[k];
Arrays.fill(arr, rbf);
return arr;
} | java | private static RadialBasisFunction[] rep(RadialBasisFunction rbf, int k) {
RadialBasisFunction[] arr = new RadialBasisFunction[k];
Arrays.fill(arr, rbf);
return arr;
} | [
"private",
"static",
"RadialBasisFunction",
"[",
"]",
"rep",
"(",
"RadialBasisFunction",
"rbf",
",",
"int",
"k",
")",
"{",
"RadialBasisFunction",
"[",
"]",
"arr",
"=",
"new",
"RadialBasisFunction",
"[",
"k",
"]",
";",
"Arrays",
".",
"fill",
"(",
"arr",
","... | Returns an array of radial basis functions initialized with given values.
@param rbf the initial value of array.
@param k the size of array.
@return an array of radial basis functions initialized with given values | [
"Returns",
"an",
"array",
"of",
"radial",
"basis",
"functions",
"initialized",
"with",
"given",
"values",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/classification/RBFNetwork.java#L254-L258 |
17,373 | haifengl/smile | math/src/main/java/smile/math/matrix/SVD.java | SVD.getS | public DenseMatrix getS() {
DenseMatrix S = Matrix.zeros(U.nrows(), V.nrows());
for (int i = 0; i < s.length; i++) {
S.set(i, i, s[i]);
}
return S;
} | java | public DenseMatrix getS() {
DenseMatrix S = Matrix.zeros(U.nrows(), V.nrows());
for (int i = 0; i < s.length; i++) {
S.set(i, i, s[i]);
}
return S;
} | [
"public",
"DenseMatrix",
"getS",
"(",
")",
"{",
"DenseMatrix",
"S",
"=",
"Matrix",
".",
"zeros",
"(",
"U",
".",
"nrows",
"(",
")",
",",
"V",
".",
"nrows",
"(",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"s",
".",
"length"... | Returns the diagonal matrix of singular values | [
"Returns",
"the",
"diagonal",
"matrix",
"of",
"singular",
"values"
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/matrix/SVD.java#L121-L129 |
17,374 | haifengl/smile | math/src/main/java/smile/math/matrix/SVD.java | SVD.rank | public int rank() {
if (!full) {
throw new IllegalStateException("This is not a FULL singular value decomposition.");
}
int r = 0;
for (int i = 0; i < s.length; i++) {
if (s[i] > tol) {
r++;
}
}
return r;
} | java | public int rank() {
if (!full) {
throw new IllegalStateException("This is not a FULL singular value decomposition.");
}
int r = 0;
for (int i = 0; i < s.length; i++) {
if (s[i] > tol) {
r++;
}
}
return r;
} | [
"public",
"int",
"rank",
"(",
")",
"{",
"if",
"(",
"!",
"full",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"This is not a FULL singular value decomposition.\"",
")",
";",
"}",
"int",
"r",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";... | Returns the effective numerical matrix rank. The number of nonnegligible
singular values. | [
"Returns",
"the",
"effective",
"numerical",
"matrix",
"rank",
".",
"The",
"number",
"of",
"nonnegligible",
"singular",
"values",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/matrix/SVD.java#L142-L154 |
17,375 | haifengl/smile | math/src/main/java/smile/math/matrix/SVD.java | SVD.nullity | public int nullity() {
if (!full) {
throw new IllegalStateException("This is not a FULL singular value decomposition.");
}
int r = 0;
for (int i = 0; i < s.length; i++) {
if (s[i] <= tol) {
r++;
}
}
return r;
} | java | public int nullity() {
if (!full) {
throw new IllegalStateException("This is not a FULL singular value decomposition.");
}
int r = 0;
for (int i = 0; i < s.length; i++) {
if (s[i] <= tol) {
r++;
}
}
return r;
} | [
"public",
"int",
"nullity",
"(",
")",
"{",
"if",
"(",
"!",
"full",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"This is not a FULL singular value decomposition.\"",
")",
";",
"}",
"int",
"r",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
... | Returns the dimension of null space. The number of negligible
singular values. | [
"Returns",
"the",
"dimension",
"of",
"null",
"space",
".",
"The",
"number",
"of",
"negligible",
"singular",
"values",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/matrix/SVD.java#L160-L172 |
17,376 | haifengl/smile | math/src/main/java/smile/math/matrix/SVD.java | SVD.range | public DenseMatrix range() {
if (!full) {
throw new IllegalStateException("This is not a FULL singular value decomposition.");
}
int nr = 0;
DenseMatrix rnge = Matrix.zeros(m, rank());
for (int j = 0; j < n; j++) {
if (s[j] > tol) {
for (i... | java | public DenseMatrix range() {
if (!full) {
throw new IllegalStateException("This is not a FULL singular value decomposition.");
}
int nr = 0;
DenseMatrix rnge = Matrix.zeros(m, rank());
for (int j = 0; j < n; j++) {
if (s[j] > tol) {
for (i... | [
"public",
"DenseMatrix",
"range",
"(",
")",
"{",
"if",
"(",
"!",
"full",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"This is not a FULL singular value decomposition.\"",
")",
";",
"}",
"int",
"nr",
"=",
"0",
";",
"DenseMatrix",
"rnge",
"=",
"Mat... | Returns a matrix of which columns give an orthonormal basis for the range space. | [
"Returns",
"a",
"matrix",
"of",
"which",
"columns",
"give",
"an",
"orthonormal",
"basis",
"for",
"the",
"range",
"space",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/matrix/SVD.java#L200-L216 |
17,377 | haifengl/smile | math/src/main/java/smile/math/matrix/SVD.java | SVD.nullspace | public DenseMatrix nullspace() {
if (!full) {
throw new IllegalStateException("This is not a FULL singular value decomposition.");
}
int nn = 0;
DenseMatrix nullsp = Matrix.zeros(n, nullity());
for (int j = 0; j < n; j++) {
if (s[j] <= tol) {
... | java | public DenseMatrix nullspace() {
if (!full) {
throw new IllegalStateException("This is not a FULL singular value decomposition.");
}
int nn = 0;
DenseMatrix nullsp = Matrix.zeros(n, nullity());
for (int j = 0; j < n; j++) {
if (s[j] <= tol) {
... | [
"public",
"DenseMatrix",
"nullspace",
"(",
")",
"{",
"if",
"(",
"!",
"full",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"This is not a FULL singular value decomposition.\"",
")",
";",
"}",
"int",
"nn",
"=",
"0",
";",
"DenseMatrix",
"nullsp",
"=",
... | Returns a matrix of which columns give an orthonormal basis for the null space. | [
"Returns",
"a",
"matrix",
"of",
"which",
"columns",
"give",
"an",
"orthonormal",
"basis",
"for",
"the",
"null",
"space",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/matrix/SVD.java#L221-L237 |
17,378 | haifengl/smile | math/src/main/java/smile/math/IntArrayList.java | IntArrayList.ensureCapacity | public void ensureCapacity(int capacity) {
if (capacity > data.length) {
int newCap = Math.max(data.length << 1, capacity);
int[] tmp = new int[newCap];
System.arraycopy(data, 0, tmp, 0, data.length);
data = tmp;
}
} | java | public void ensureCapacity(int capacity) {
if (capacity > data.length) {
int newCap = Math.max(data.length << 1, capacity);
int[] tmp = new int[newCap];
System.arraycopy(data, 0, tmp, 0, data.length);
data = tmp;
}
} | [
"public",
"void",
"ensureCapacity",
"(",
"int",
"capacity",
")",
"{",
"if",
"(",
"capacity",
">",
"data",
".",
"length",
")",
"{",
"int",
"newCap",
"=",
"Math",
".",
"max",
"(",
"data",
".",
"length",
"<<",
"1",
",",
"capacity",
")",
";",
"int",
"[... | Increases the capacity, if necessary, to ensure that it can hold
at least the number of values specified by the minimum capacity
argument.
@param capacity the desired minimum capacity. | [
"Increases",
"the",
"capacity",
"if",
"necessary",
"to",
"ensure",
"that",
"it",
"can",
"hold",
"at",
"least",
"the",
"number",
"of",
"values",
"specified",
"by",
"the",
"minimum",
"capacity",
"argument",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/IntArrayList.java#L74-L81 |
17,379 | haifengl/smile | math/src/main/java/smile/math/IntArrayList.java | IntArrayList.set | public IntArrayList set(int index, int val) {
if (index < 0 || index >= size) {
throw new IndexOutOfBoundsException(String.valueOf(index));
}
data[index] = val;
return this;
} | java | public IntArrayList set(int index, int val) {
if (index < 0 || index >= size) {
throw new IndexOutOfBoundsException(String.valueOf(index));
}
data[index] = val;
return this;
} | [
"public",
"IntArrayList",
"set",
"(",
"int",
"index",
",",
"int",
"val",
")",
"{",
"if",
"(",
"index",
"<",
"0",
"||",
"index",
">=",
"size",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"String",
".",
"valueOf",
"(",
"index",
")",
")",
... | Replaces the value at the specified position in this list with the
specified value.
@param index index of the value to replace
@param val value to be stored at the specified position
@throws IndexOutOfBoundsException if the index is out of range (index < 0 || index ≥ size()) | [
"Replaces",
"the",
"value",
"at",
"the",
"specified",
"position",
"in",
"this",
"list",
"with",
"the",
"specified",
"value",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/IntArrayList.java#L150-L156 |
17,380 | haifengl/smile | math/src/main/java/smile/math/IntArrayList.java | IntArrayList.remove | public int remove(int index) {
if (index < 0 || index >= size) {
throw new IndexOutOfBoundsException(String.valueOf(index));
}
int old = get(index);
if (index == 0) {
// data at the front
System.arraycopy(data, 1, data, 0, size - 1);
... | java | public int remove(int index) {
if (index < 0 || index >= size) {
throw new IndexOutOfBoundsException(String.valueOf(index));
}
int old = get(index);
if (index == 0) {
// data at the front
System.arraycopy(data, 1, data, 0, size - 1);
... | [
"public",
"int",
"remove",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"index",
"<",
"0",
"||",
"index",
">=",
"size",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"String",
".",
"valueOf",
"(",
"index",
")",
")",
";",
"}",
"int",
"old",... | Removes the value at specified index from the list.
@param index index of the element to remove.
@return the value previously stored at specified index
@throws IndexOutOfBoundsException if the index is out of range (index < 0 || index ≥ size()) | [
"Removes",
"the",
"value",
"at",
"specified",
"index",
"from",
"the",
"list",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/IntArrayList.java#L173-L193 |
17,381 | haifengl/smile | interpolation/src/main/java/smile/interpolation/KrigingInterpolation.java | KrigingInterpolation.rdist | private double rdist(double[] x1, double[] x2) {
double d = 0.0;
for (int i = 0; i < x1.length; i++) {
double t = x1[i] - x2[i];
d += t * t;
}
return Math.sqrt(d);
} | java | private double rdist(double[] x1, double[] x2) {
double d = 0.0;
for (int i = 0; i < x1.length; i++) {
double t = x1[i] - x2[i];
d += t * t;
}
return Math.sqrt(d);
} | [
"private",
"double",
"rdist",
"(",
"double",
"[",
"]",
"x1",
",",
"double",
"[",
"]",
"x2",
")",
"{",
"double",
"d",
"=",
"0.0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"x1",
".",
"length",
";",
"i",
"++",
")",
"{",
"double",
... | Cartesian distance. | [
"Cartesian",
"distance",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/interpolation/src/main/java/smile/interpolation/KrigingInterpolation.java#L160-L167 |
17,382 | haifengl/smile | math/src/main/java/smile/math/Histogram.java | Histogram.histogram | public static double[][] histogram(int[] data, double[] breaks) {
int k = breaks.length - 1;
if (k <= 1) {
throw new IllegalArgumentException("Invalid number of bins: " + k);
}
double[][] freq = new double[3][k];
for (int i = 0; i < k; i++) {
freq... | java | public static double[][] histogram(int[] data, double[] breaks) {
int k = breaks.length - 1;
if (k <= 1) {
throw new IllegalArgumentException("Invalid number of bins: " + k);
}
double[][] freq = new double[3][k];
for (int i = 0; i < k; i++) {
freq... | [
"public",
"static",
"double",
"[",
"]",
"[",
"]",
"histogram",
"(",
"int",
"[",
"]",
"data",
",",
"double",
"[",
"]",
"breaks",
")",
"{",
"int",
"k",
"=",
"breaks",
".",
"length",
"-",
"1",
";",
"if",
"(",
"k",
"<=",
"1",
")",
"{",
"throw",
"... | Generate the histogram of n bins.
@param data the data points.
@param breaks an array of size k+1 giving the breakpoints between
histogram cells. Must be in ascending order.
@return a 3-by-n bins array of which first row is the lower bound of bins,
second row is the upper bound of bins, and the third row is the frequen... | [
"Generate",
"the",
"histogram",
"of",
"n",
"bins",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/Histogram.java#L131-L161 |
17,383 | haifengl/smile | math/src/main/java/smile/math/Histogram.java | Histogram.breaks | public static double[] breaks(double[] x, double h) {
return breaks(Math.min(x), Math.max(x), h);
} | java | public static double[] breaks(double[] x, double h) {
return breaks(Math.min(x), Math.max(x), h);
} | [
"public",
"static",
"double",
"[",
"]",
"breaks",
"(",
"double",
"[",
"]",
"x",
",",
"double",
"h",
")",
"{",
"return",
"breaks",
"(",
"Math",
".",
"min",
"(",
"x",
")",
",",
"Math",
".",
"max",
"(",
"x",
")",
",",
"h",
")",
";",
"}"
] | Returns the breakpoints between histogram cells for a dataset based on a
suggested bin width h.
@param x the data set.
@param h the bin width.
@return the breakpoints between histogram cells | [
"Returns",
"the",
"breakpoints",
"between",
"histogram",
"cells",
"for",
"a",
"dataset",
"based",
"on",
"a",
"suggested",
"bin",
"width",
"h",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/Histogram.java#L310-L312 |
17,384 | haifengl/smile | math/src/main/java/smile/math/Histogram.java | Histogram.breaks | public static double[] breaks(double min, double max, double h) {
if (h <= 0.0) {
throw new IllegalArgumentException("Invalid bin width: " + h);
}
if (min > max) {
throw new IllegalArgumentException("Invalid lower and upper bounds: " + min + " > " + max);
}
... | java | public static double[] breaks(double min, double max, double h) {
if (h <= 0.0) {
throw new IllegalArgumentException("Invalid bin width: " + h);
}
if (min > max) {
throw new IllegalArgumentException("Invalid lower and upper bounds: " + min + " > " + max);
}
... | [
"public",
"static",
"double",
"[",
"]",
"breaks",
"(",
"double",
"min",
",",
"double",
"max",
",",
"double",
"h",
")",
"{",
"if",
"(",
"h",
"<=",
"0.0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid bin width: \"",
"+",
"h",
")",
... | Returns the breakpoints between histogram cells for a given range based
on a suggested bin width h.
@param min the lower bound of bins.
@param max the upper bound of bins.
@param h the bin width.
@return the breakpoints between histogram cells | [
"Returns",
"the",
"breakpoints",
"between",
"histogram",
"cells",
"for",
"a",
"given",
"range",
"based",
"on",
"a",
"suggested",
"bin",
"width",
"h",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/Histogram.java#L322-L341 |
17,385 | haifengl/smile | math/src/main/java/smile/math/Histogram.java | Histogram.breaks | public static double[] breaks(double[] x, int k) {
return breaks(Math.min(x), Math.max(x), k);
} | java | public static double[] breaks(double[] x, int k) {
return breaks(Math.min(x), Math.max(x), k);
} | [
"public",
"static",
"double",
"[",
"]",
"breaks",
"(",
"double",
"[",
"]",
"x",
",",
"int",
"k",
")",
"{",
"return",
"breaks",
"(",
"Math",
".",
"min",
"(",
"x",
")",
",",
"Math",
".",
"max",
"(",
"x",
")",
",",
"k",
")",
";",
"}"
] | Returns the breakpoints between histogram cells for a dataset.
@param x the data set.
@param k the number of bins.
@return the breakpoints between histogram cells | [
"Returns",
"the",
"breakpoints",
"between",
"histogram",
"cells",
"for",
"a",
"dataset",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/Histogram.java#L349-L351 |
17,386 | haifengl/smile | math/src/main/java/smile/math/Histogram.java | Histogram.breaks | public static double[] breaks(double min, double max, int k) {
if (k <= 1) {
throw new IllegalArgumentException("Invalid number of bins: " + k);
}
if (min > max) {
throw new IllegalArgumentException("Invalid lower and upper bounds: " + min + " > " + max);
}
... | java | public static double[] breaks(double min, double max, int k) {
if (k <= 1) {
throw new IllegalArgumentException("Invalid number of bins: " + k);
}
if (min > max) {
throw new IllegalArgumentException("Invalid lower and upper bounds: " + min + " > " + max);
}
... | [
"public",
"static",
"double",
"[",
"]",
"breaks",
"(",
"double",
"min",
",",
"double",
"max",
",",
"int",
"k",
")",
"{",
"if",
"(",
"k",
"<=",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid number of bins: \"",
"+",
"k",
")",
... | Returns the breakpoints between histogram cells for a given range.
@param min the lower bound of bins.
@param max the upper bound of bins.
@param k the number of bins.
@return the breakpoints between histogram cells | [
"Returns",
"the",
"breakpoints",
"between",
"histogram",
"cells",
"for",
"a",
"given",
"range",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/Histogram.java#L360-L371 |
17,387 | haifengl/smile | math/src/main/java/smile/math/Histogram.java | Histogram.bins | public static int bins(double[] x, double h) {
if (h <= 0.0) {
throw new IllegalArgumentException("Invalid bin width: " + h);
}
double max = Math.max(x);
double min = Math.min(x);
return (int) Math.ceil((max-min) / h);
} | java | public static int bins(double[] x, double h) {
if (h <= 0.0) {
throw new IllegalArgumentException("Invalid bin width: " + h);
}
double max = Math.max(x);
double min = Math.min(x);
return (int) Math.ceil((max-min) / h);
} | [
"public",
"static",
"int",
"bins",
"(",
"double",
"[",
"]",
"x",
",",
"double",
"h",
")",
"{",
"if",
"(",
"h",
"<=",
"0.0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid bin width: \"",
"+",
"h",
")",
";",
"}",
"double",
"max",
... | Returns the number of bins for a data based on a suggested bin width h.
@param x the data set.
@param h the bin width.
@return the number of bins k = ceil((max - min) / h) | [
"Returns",
"the",
"number",
"of",
"bins",
"for",
"a",
"data",
"based",
"on",
"a",
"suggested",
"bin",
"width",
"h",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/Histogram.java#L379-L388 |
17,388 | haifengl/smile | core/src/main/java/smile/feature/GAFeatureSelection.java | GAFeatureSelection.learn | public BitString[] learn(int size, int generation, ClassifierTrainer<double[]> trainer, ClassificationMeasure measure, double[][] x, int[] y, int k) {
if (size <= 0) {
throw new IllegalArgumentException("Invalid population size: " + size);
}
if (k < 2) {
throw ne... | java | public BitString[] learn(int size, int generation, ClassifierTrainer<double[]> trainer, ClassificationMeasure measure, double[][] x, int[] y, int k) {
if (size <= 0) {
throw new IllegalArgumentException("Invalid population size: " + size);
}
if (k < 2) {
throw ne... | [
"public",
"BitString",
"[",
"]",
"learn",
"(",
"int",
"size",
",",
"int",
"generation",
",",
"ClassifierTrainer",
"<",
"double",
"[",
"]",
">",
"trainer",
",",
"ClassificationMeasure",
"measure",
",",
"double",
"[",
"]",
"[",
"]",
"x",
",",
"int",
"[",
... | Genetic algorithm based feature selection for classification.
@param size the population size of Genetic Algorithm.
@param generation the maximum number of iterations.
@param trainer classifier trainer.
@param measure classification measure as the chromosome fitness measure.
@param x training instances.
@param y traini... | [
"Genetic",
"algorithm",
"based",
"feature",
"selection",
"for",
"classification",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/feature/GAFeatureSelection.java#L107-L132 |
17,389 | haifengl/smile | data/src/main/java/smile/data/NominalAttribute.java | NominalAttribute.valueOf | @Override
public double valueOf(String s) throws ParseException {
Integer i = map.get(s);
if (i == null) {
if (open) {
i = values.size();
map.put(s, i);
values.add(s);
} else {
throw new ParseException("Invalid s... | java | @Override
public double valueOf(String s) throws ParseException {
Integer i = map.get(s);
if (i == null) {
if (open) {
i = values.size();
map.put(s, i);
values.add(s);
} else {
throw new ParseException("Invalid s... | [
"@",
"Override",
"public",
"double",
"valueOf",
"(",
"String",
"s",
")",
"throws",
"ParseException",
"{",
"Integer",
"i",
"=",
"map",
".",
"get",
"(",
"s",
")",
";",
"if",
"(",
"i",
"==",
"null",
")",
"{",
"if",
"(",
"open",
")",
"{",
"i",
"=",
... | Returns the ordinal value of a string value. | [
"Returns",
"the",
"ordinal",
"value",
"of",
"a",
"string",
"value",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/data/src/main/java/smile/data/NominalAttribute.java#L164-L178 |
17,390 | haifengl/smile | plot/src/main/java/smile/plot/Projection.java | Projection.initBaseCoordsProjection | private void initBaseCoordsProjection() {
baseScreenCoords = new int[canvas.base.baseCoords.length][2];
for (int i = 0; i < canvas.base.dimension + 1; i++) {
double[] ratio = baseCoordsScreenProjectionRatio(canvas.base.baseCoords[i]);
baseScreenCoords[i][0] = (int) (canvas.getWid... | java | private void initBaseCoordsProjection() {
baseScreenCoords = new int[canvas.base.baseCoords.length][2];
for (int i = 0; i < canvas.base.dimension + 1; i++) {
double[] ratio = baseCoordsScreenProjectionRatio(canvas.base.baseCoords[i]);
baseScreenCoords[i][0] = (int) (canvas.getWid... | [
"private",
"void",
"initBaseCoordsProjection",
"(",
")",
"{",
"baseScreenCoords",
"=",
"new",
"int",
"[",
"canvas",
".",
"base",
".",
"baseCoords",
".",
"length",
"]",
"[",
"2",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"canvas",
"."... | Initialize base coordinates on Java2D screen. | [
"Initialize",
"base",
"coordinates",
"on",
"Java2D",
"screen",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Projection.java#L55-L62 |
17,391 | haifengl/smile | plot/src/main/java/smile/plot/Projection.java | Projection.screenProjection | public int[] screenProjection(double... coord) {
double[] sc = new double[2];
sc[0] = baseScreenCoords[0][0];
sc[1] = baseScreenCoords[0][1];
for (int i = 0; i < canvas.base.dimension; i++) {
sc[0] += ((coord[i] - canvas.base.baseCoords[0][i]) / (canvas.base.baseCoords[i + 1... | java | public int[] screenProjection(double... coord) {
double[] sc = new double[2];
sc[0] = baseScreenCoords[0][0];
sc[1] = baseScreenCoords[0][1];
for (int i = 0; i < canvas.base.dimension; i++) {
sc[0] += ((coord[i] - canvas.base.baseCoords[0][i]) / (canvas.base.baseCoords[i + 1... | [
"public",
"int",
"[",
"]",
"screenProjection",
"(",
"double",
"...",
"coord",
")",
"{",
"double",
"[",
"]",
"sc",
"=",
"new",
"double",
"[",
"2",
"]",
";",
"sc",
"[",
"0",
"]",
"=",
"baseScreenCoords",
"[",
"0",
"]",
"[",
"0",
"]",
";",
"sc",
"... | Project logical coordinates to Java2D coordinates. | [
"Project",
"logical",
"coordinates",
"to",
"Java2D",
"coordinates",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Projection.java#L67-L78 |
17,392 | haifengl/smile | plot/src/main/java/smile/plot/Projection.java | Projection.screenProjectionBaseRatio | public int[] screenProjectionBaseRatio(double... coord) {
double[] sc = new double[2];
sc[0] = baseScreenCoords[0][0];
sc[1] = baseScreenCoords[0][1];
for (int i = 0; i < canvas.base.dimension; i++) {
sc[0] += coord[i] * (baseScreenCoords[i + 1][0] - baseScreenCoords[0][0]);... | java | public int[] screenProjectionBaseRatio(double... coord) {
double[] sc = new double[2];
sc[0] = baseScreenCoords[0][0];
sc[1] = baseScreenCoords[0][1];
for (int i = 0; i < canvas.base.dimension; i++) {
sc[0] += coord[i] * (baseScreenCoords[i + 1][0] - baseScreenCoords[0][0]);... | [
"public",
"int",
"[",
"]",
"screenProjectionBaseRatio",
"(",
"double",
"...",
"coord",
")",
"{",
"double",
"[",
"]",
"sc",
"=",
"new",
"double",
"[",
"2",
"]",
";",
"sc",
"[",
"0",
"]",
"=",
"baseScreenCoords",
"[",
"0",
"]",
"[",
"0",
"]",
";",
... | Project logical coordinates in base ratio to Java2D coordinates. | [
"Project",
"logical",
"coordinates",
"in",
"base",
"ratio",
"to",
"Java2D",
"coordinates",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Projection.java#L83-L94 |
17,393 | haifengl/smile | math/src/main/java/smile/stat/distribution/AbstractDistribution.java | AbstractDistribution.logLikelihood | @Override
public double logLikelihood(double[] x) {
double L = 0.0;
for (double xi : x)
L += logp(xi);
return L;
} | java | @Override
public double logLikelihood(double[] x) {
double L = 0.0;
for (double xi : x)
L += logp(xi);
return L;
} | [
"@",
"Override",
"public",
"double",
"logLikelihood",
"(",
"double",
"[",
"]",
"x",
")",
"{",
"double",
"L",
"=",
"0.0",
";",
"for",
"(",
"double",
"xi",
":",
"x",
")",
"L",
"+=",
"logp",
"(",
"xi",
")",
";",
"return",
"L",
";",
"}"
] | The likelihood given a sample set following the distribution. | [
"The",
"likelihood",
"given",
"a",
"sample",
"set",
"following",
"the",
"distribution",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/stat/distribution/AbstractDistribution.java#L125-L133 |
17,394 | haifengl/smile | core/src/main/java/smile/util/MulticoreExecutor.java | MulticoreExecutor.createThreadPool | private static void createThreadPool() {
if (nprocs == -1) {
int n = -1;
try {
String env = System.getProperty("smile.threads");
if (env != null) {
n = Integer.parseInt(env);
}
} catch (Exception ex) {
... | java | private static void createThreadPool() {
if (nprocs == -1) {
int n = -1;
try {
String env = System.getProperty("smile.threads");
if (env != null) {
n = Integer.parseInt(env);
}
} catch (Exception ex) {
... | [
"private",
"static",
"void",
"createThreadPool",
"(",
")",
"{",
"if",
"(",
"nprocs",
"==",
"-",
"1",
")",
"{",
"int",
"n",
"=",
"-",
"1",
";",
"try",
"{",
"String",
"env",
"=",
"System",
".",
"getProperty",
"(",
"\"smile.threads\"",
")",
";",
"if",
... | Creates the worker thread pool. | [
"Creates",
"the",
"worker",
"thread",
"pool",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/util/MulticoreExecutor.java#L52-L74 |
17,395 | haifengl/smile | core/src/main/java/smile/util/MulticoreExecutor.java | MulticoreExecutor.run | public static <T> List<T> run(Collection<? extends Callable<T>> tasks) throws Exception {
createThreadPool();
List<T> results = new ArrayList<>();
if (threads == null) {
for (Callable<T> task : tasks) {
results.add(task.call());
}
} else {
... | java | public static <T> List<T> run(Collection<? extends Callable<T>> tasks) throws Exception {
createThreadPool();
List<T> results = new ArrayList<>();
if (threads == null) {
for (Callable<T> task : tasks) {
results.add(task.call());
}
} else {
... | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"run",
"(",
"Collection",
"<",
"?",
"extends",
"Callable",
"<",
"T",
">",
">",
"tasks",
")",
"throws",
"Exception",
"{",
"createThreadPool",
"(",
")",
";",
"List",
"<",
"T",
">",
"results",
... | Executes the given tasks serially or parallel depending on the number
of cores of the system. Returns a list of result objects of each task.
The results of this method are undefined if the given collection is
modified while this operation is in progress.
@param tasks the collection of tasks.
@return a list of result ob... | [
"Executes",
"the",
"given",
"tasks",
"serially",
"or",
"parallel",
"depending",
"on",
"the",
"number",
"of",
"cores",
"of",
"the",
"system",
".",
"Returns",
"a",
"list",
"of",
"result",
"objects",
"of",
"each",
"task",
".",
"The",
"results",
"of",
"this",
... | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/util/MulticoreExecutor.java#L95-L118 |
17,396 | haifengl/smile | plot/src/main/java/smile/plot/Histogram.java | Histogram.plot | public static PlotCanvas plot(String id, double[] data) {
Histogram histogram = new Histogram(data);
histogram.setID(id);
double[] lowerBound = {Math.min(data), 0};
double[] upperBound = {Math.max(data), 0};
double[][] freq = histogram.getHistogram();
for (int i... | java | public static PlotCanvas plot(String id, double[] data) {
Histogram histogram = new Histogram(data);
histogram.setID(id);
double[] lowerBound = {Math.min(data), 0};
double[] upperBound = {Math.max(data), 0};
double[][] freq = histogram.getHistogram();
for (int i... | [
"public",
"static",
"PlotCanvas",
"plot",
"(",
"String",
"id",
",",
"double",
"[",
"]",
"data",
")",
"{",
"Histogram",
"histogram",
"=",
"new",
"Histogram",
"(",
"data",
")",
";",
"histogram",
".",
"setID",
"(",
"id",
")",
";",
"double",
"[",
"]",
"l... | Create a plot canvas with the histogram plot.
@param id the id of the plot.
@param data a sample set. | [
"Create",
"a",
"plot",
"canvas",
"with",
"the",
"histogram",
"plot",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Histogram.java#L335-L354 |
17,397 | haifengl/smile | core/src/main/java/smile/association/FPGrowth.java | FPGrowth.buildTotalSupportTree | TotalSupportTree buildTotalSupportTree() {
TotalSupportTree ttree = new TotalSupportTree(minSupport, T0.numFreqItems, T0.order);
learn(null, null, ttree);
return ttree;
} | java | TotalSupportTree buildTotalSupportTree() {
TotalSupportTree ttree = new TotalSupportTree(minSupport, T0.numFreqItems, T0.order);
learn(null, null, ttree);
return ttree;
} | [
"TotalSupportTree",
"buildTotalSupportTree",
"(",
")",
"{",
"TotalSupportTree",
"ttree",
"=",
"new",
"TotalSupportTree",
"(",
"minSupport",
",",
"T0",
".",
"numFreqItems",
",",
"T0",
".",
"order",
")",
";",
"learn",
"(",
"null",
",",
"null",
",",
"ttree",
")... | Mines the frequent item sets. The discovered frequent item sets
will be stored in a total support tree. | [
"Mines",
"the",
"frequent",
"item",
"sets",
".",
"The",
"discovered",
"frequent",
"item",
"sets",
"will",
"be",
"stored",
"in",
"a",
"total",
"support",
"tree",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/association/FPGrowth.java#L164-L168 |
17,398 | haifengl/smile | core/src/main/java/smile/association/FPGrowth.java | FPGrowth.learn | private long learn(PrintStream out, List<ItemSet> list, TotalSupportTree ttree) {
if (MulticoreExecutor.getThreadPoolSize() > 1) {
return grow(out, list, ttree, T0, null, null, null);
} else {
return grow(out, list, ttree, T0, null);
}
} | java | private long learn(PrintStream out, List<ItemSet> list, TotalSupportTree ttree) {
if (MulticoreExecutor.getThreadPoolSize() > 1) {
return grow(out, list, ttree, T0, null, null, null);
} else {
return grow(out, list, ttree, T0, null);
}
} | [
"private",
"long",
"learn",
"(",
"PrintStream",
"out",
",",
"List",
"<",
"ItemSet",
">",
"list",
",",
"TotalSupportTree",
"ttree",
")",
"{",
"if",
"(",
"MulticoreExecutor",
".",
"getThreadPoolSize",
"(",
")",
">",
"1",
")",
"{",
"return",
"grow",
"(",
"o... | Mines the frequent item sets. The discovered frequent item sets
will be printed out to the provided stream.
@param out a print stream for output of frequent item sets.
@return the number of discovered frequent item sets. | [
"Mines",
"the",
"frequent",
"item",
"sets",
".",
"The",
"discovered",
"frequent",
"item",
"sets",
"will",
"be",
"printed",
"out",
"to",
"the",
"provided",
"stream",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/association/FPGrowth.java#L176-L182 |
17,399 | haifengl/smile | core/src/main/java/smile/association/FPGrowth.java | FPGrowth.collect | private void collect(PrintStream out, List<ItemSet> list, TotalSupportTree ttree, int[] itemset, int support) {
if (list != null) {
synchronized (list) {
list.add(new ItemSet(itemset, support));
}
}
if (out != null) {
synchronized (out) {
... | java | private void collect(PrintStream out, List<ItemSet> list, TotalSupportTree ttree, int[] itemset, int support) {
if (list != null) {
synchronized (list) {
list.add(new ItemSet(itemset, support));
}
}
if (out != null) {
synchronized (out) {
... | [
"private",
"void",
"collect",
"(",
"PrintStream",
"out",
",",
"List",
"<",
"ItemSet",
">",
"list",
",",
"TotalSupportTree",
"ttree",
",",
"int",
"[",
"]",
"itemset",
",",
"int",
"support",
")",
"{",
"if",
"(",
"list",
"!=",
"null",
")",
"{",
"synchroni... | Adds an item set to the result. | [
"Adds",
"an",
"item",
"set",
"to",
"the",
"result",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/association/FPGrowth.java#L322-L341 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.