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,200 | haifengl/smile | math/src/main/java/smile/math/matrix/QR.java | QR.getR | public DenseMatrix getR() {
int n = qr.ncols();
DenseMatrix R = Matrix.zeros(n, n);
for (int i = 0; i < n; i++) {
R.set(i, i, tau[i]);
for (int j = i+1; j < n; j++) {
R.set(i, j, qr.get(i, j));
}
}
return R;
} | java | public DenseMatrix getR() {
int n = qr.ncols();
DenseMatrix R = Matrix.zeros(n, n);
for (int i = 0; i < n; i++) {
R.set(i, i, tau[i]);
for (int j = i+1; j < n; j++) {
R.set(i, j, qr.get(i, j));
}
}
return R;
} | [
"public",
"DenseMatrix",
"getR",
"(",
")",
"{",
"int",
"n",
"=",
"qr",
".",
"ncols",
"(",
")",
";",
"DenseMatrix",
"R",
"=",
"Matrix",
".",
"zeros",
"(",
"n",
",",
"n",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i... | Returns the upper triangular factor. | [
"Returns",
"the",
"upper",
"triangular",
"factor",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/matrix/QR.java#L88-L98 |
17,201 | haifengl/smile | math/src/main/java/smile/math/matrix/QR.java | QR.getQ | public DenseMatrix getQ() {
int m = qr.nrows();
int n = qr.ncols();
DenseMatrix Q = Matrix.zeros(m, n);
for (int k = n - 1; k >= 0; k--) {
Q.set(k, k, 1.0);
for (int j = k; j < n; j++) {
if (qr.get(k, k) != 0) {
double s = 0.0;
... | java | public DenseMatrix getQ() {
int m = qr.nrows();
int n = qr.ncols();
DenseMatrix Q = Matrix.zeros(m, n);
for (int k = n - 1; k >= 0; k--) {
Q.set(k, k, 1.0);
for (int j = k; j < n; j++) {
if (qr.get(k, k) != 0) {
double s = 0.0;
... | [
"public",
"DenseMatrix",
"getQ",
"(",
")",
"{",
"int",
"m",
"=",
"qr",
".",
"nrows",
"(",
")",
";",
"int",
"n",
"=",
"qr",
".",
"ncols",
"(",
")",
";",
"DenseMatrix",
"Q",
"=",
"Matrix",
".",
"zeros",
"(",
"m",
",",
"n",
")",
";",
"for",
"(",... | Returns the orthogonal factor. | [
"Returns",
"the",
"orthogonal",
"factor",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/matrix/QR.java#L103-L123 |
17,202 | haifengl/smile | data/src/main/java/smile/data/parser/SparseDatasetParser.java | SparseDatasetParser.parse | public SparseDataset parse(String name, InputStream stream) throws IOException, ParseException {
BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
try {
// process header
int nrow = 1;
String line = reader.readLine();
for (; nrow <... | java | public SparseDataset parse(String name, InputStream stream) throws IOException, ParseException {
BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
try {
// process header
int nrow = 1;
String line = reader.readLine();
for (; nrow <... | [
"public",
"SparseDataset",
"parse",
"(",
"String",
"name",
",",
"InputStream",
"stream",
")",
"throws",
"IOException",
",",
"ParseException",
"{",
"BufferedReader",
"reader",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"stream",
")",
")",
... | Parse a sparse dataset from an input stream.
@param name the name of dataset.
@param stream the input stream of data.
@throws java.io.IOException | [
"Parse",
"a",
"sparse",
"dataset",
"from",
"an",
"input",
"stream",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/data/src/main/java/smile/data/parser/SparseDatasetParser.java#L151-L189 |
17,203 | haifengl/smile | math/src/main/java/smile/sort/PriorityQueue.java | PriorityQueue.swap | private void swap(int i, int j) {
int t = pq[i];
pq[i] = pq[j];
pq[j] = t;
qp[pq[i]] = i;
qp[pq[j]] = j;
} | java | private void swap(int i, int j) {
int t = pq[i];
pq[i] = pq[j];
pq[j] = t;
qp[pq[i]] = i;
qp[pq[j]] = j;
} | [
"private",
"void",
"swap",
"(",
"int",
"i",
",",
"int",
"j",
")",
"{",
"int",
"t",
"=",
"pq",
"[",
"i",
"]",
";",
"pq",
"[",
"i",
"]",
"=",
"pq",
"[",
"j",
"]",
";",
"pq",
"[",
"j",
"]",
"=",
"t",
";",
"qp",
"[",
"pq",
"[",
"i",
"]",
... | Swap i and j items of pq and qp.
@param i item index
@param j item index | [
"Swap",
"i",
"and",
"j",
"items",
"of",
"pq",
"and",
"qp",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/sort/PriorityQueue.java#L63-L69 |
17,204 | haifengl/smile | math/src/main/java/smile/sort/PriorityQueue.java | PriorityQueue.swim | private void swim(int k) {
while (k > 1 && less(k, (k + d - 2) / d)) {
swap(k, (k + d - 2) / d);
k = (k + d - 2) / d;
}
} | java | private void swim(int k) {
while (k > 1 && less(k, (k + d - 2) / d)) {
swap(k, (k + d - 2) / d);
k = (k + d - 2) / d;
}
} | [
"private",
"void",
"swim",
"(",
"int",
"k",
")",
"{",
"while",
"(",
"k",
">",
"1",
"&&",
"less",
"(",
"k",
",",
"(",
"k",
"+",
"d",
"-",
"2",
")",
"/",
"d",
")",
")",
"{",
"swap",
"(",
"k",
",",
"(",
"k",
"+",
"d",
"-",
"2",
")",
"/",... | fix up. | [
"fix",
"up",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/sort/PriorityQueue.java#L74-L79 |
17,205 | haifengl/smile | math/src/main/java/smile/sort/PriorityQueue.java | PriorityQueue.sink | private void sink(int k, int N) {
int j;
while ((j = d * (k - 1) + 2) <= N) {
for (int i = j + 1; i < j + d && i <= N; i++) {
if (less(i, j)) {
j = i;
}
}
if (!(less(j, k))) {
break;
}
... | java | private void sink(int k, int N) {
int j;
while ((j = d * (k - 1) + 2) <= N) {
for (int i = j + 1; i < j + d && i <= N; i++) {
if (less(i, j)) {
j = i;
}
}
if (!(less(j, k))) {
break;
}
... | [
"private",
"void",
"sink",
"(",
"int",
"k",
",",
"int",
"N",
")",
"{",
"int",
"j",
";",
"while",
"(",
"(",
"j",
"=",
"d",
"*",
"(",
"k",
"-",
"1",
")",
"+",
"2",
")",
"<=",
"N",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"j",
"+",
"1",
";... | fix down. | [
"fix",
"down",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/sort/PriorityQueue.java#L84-L98 |
17,206 | haifengl/smile | math/src/main/java/smile/sort/PriorityQueue.java | PriorityQueue.insert | public void insert(int v) {
pq[++n] = v;
qp[v] = n;
swim(n);
} | java | public void insert(int v) {
pq[++n] = v;
qp[v] = n;
swim(n);
} | [
"public",
"void",
"insert",
"(",
"int",
"v",
")",
"{",
"pq",
"[",
"++",
"n",
"]",
"=",
"v",
";",
"qp",
"[",
"v",
"]",
"=",
"n",
";",
"swim",
"(",
"n",
")",
";",
"}"
] | Insert a new item into queue.
@param v the index of item. | [
"Insert",
"a",
"new",
"item",
"into",
"queue",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/sort/PriorityQueue.java#L132-L136 |
17,207 | haifengl/smile | math/src/main/java/smile/math/special/Erf.java | Erf.inverfc | public static double inverfc(double p) {
double x, err, t, pp;
if (p >= 2.0) {
return -100.;
}
if (p <= 0.0) {
return 100.;
}
pp = (p < 1.0) ? p : 2. - p;
t = Math.sqrt(-2. * Math.log(pp / 2.));
x = -0.70711 * ((2.30753 + t * 0.2706... | java | public static double inverfc(double p) {
double x, err, t, pp;
if (p >= 2.0) {
return -100.;
}
if (p <= 0.0) {
return 100.;
}
pp = (p < 1.0) ? p : 2. - p;
t = Math.sqrt(-2. * Math.log(pp / 2.));
x = -0.70711 * ((2.30753 + t * 0.2706... | [
"public",
"static",
"double",
"inverfc",
"(",
"double",
"p",
")",
"{",
"double",
"x",
",",
"err",
",",
"t",
",",
"pp",
";",
"if",
"(",
"p",
">=",
"2.0",
")",
"{",
"return",
"-",
"100.",
";",
"}",
"if",
"(",
"p",
"<=",
"0.0",
")",
"{",
"return... | The inverse complementary error function. | [
"The",
"inverse",
"complementary",
"error",
"function",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/special/Erf.java#L104-L120 |
17,208 | haifengl/smile | math/src/main/java/smile/math/special/Gamma.java | Gamma.digamma | public static double digamma(double x) {
final double C7[][] = {
{
1.3524999667726346383e4, 4.5285601699547289655e4,
4.5135168469736662555e4, 1.8529011818582610168e4,
3.3291525149406935532e3, 2.4068032474357201831e2,
5.15778920001390847... | java | public static double digamma(double x) {
final double C7[][] = {
{
1.3524999667726346383e4, 4.5285601699547289655e4,
4.5135168469736662555e4, 1.8529011818582610168e4,
3.3291525149406935532e3, 2.4068032474357201831e2,
5.15778920001390847... | [
"public",
"static",
"double",
"digamma",
"(",
"double",
"x",
")",
"{",
"final",
"double",
"C7",
"[",
"]",
"[",
"]",
"=",
"{",
"{",
"1.3524999667726346383e4",
",",
"4.5285601699547289655e4",
",",
"4.5135168469736662555e4",
",",
"1.8529011818582610168e4",
",",
"3.... | The digamma function is defined as the logarithmic derivative of the gamma function. | [
"The",
"digamma",
"function",
"is",
"defined",
"as",
"the",
"logarithmic",
"derivative",
"of",
"the",
"gamma",
"function",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/special/Gamma.java#L265-L320 |
17,209 | haifengl/smile | math/src/main/java/smile/math/special/Gamma.java | Gamma.inverseRegularizedIncompleteGamma | public static double inverseRegularizedIncompleteGamma(double a, double p) {
if (a <= 0.0) {
throw new IllegalArgumentException("a must be pos in invgammap");
}
final double EPS = 1.0E-8;
double x, err, t, u, pp;
double lna1 = 0.0;
double afac = 0.0;
... | java | public static double inverseRegularizedIncompleteGamma(double a, double p) {
if (a <= 0.0) {
throw new IllegalArgumentException("a must be pos in invgammap");
}
final double EPS = 1.0E-8;
double x, err, t, u, pp;
double lna1 = 0.0;
double afac = 0.0;
... | [
"public",
"static",
"double",
"inverseRegularizedIncompleteGamma",
"(",
"double",
"a",
",",
"double",
"p",
")",
"{",
"if",
"(",
"a",
"<=",
"0.0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"a must be pos in invgammap\"",
")",
";",
"}",
"final",... | The inverse of regularized incomplete gamma function. | [
"The",
"inverse",
"of",
"regularized",
"incomplete",
"gamma",
"function",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/special/Gamma.java#L325-L383 |
17,210 | haifengl/smile | core/src/main/java/smile/clustering/FastPair.java | FastPair.findNeighbor | private void findNeighbor(int p) {
// if no neighbors available, set flag for UpdatePoint to find
if (npoints == 1) {
neighbor[p] = p;
distance[p] = Float.MAX_VALUE;
return;
}
// find first point unequal to p itself
int first = 0;
if (... | java | private void findNeighbor(int p) {
// if no neighbors available, set flag for UpdatePoint to find
if (npoints == 1) {
neighbor[p] = p;
distance[p] = Float.MAX_VALUE;
return;
}
// find first point unequal to p itself
int first = 0;
if (... | [
"private",
"void",
"findNeighbor",
"(",
"int",
"p",
")",
"{",
"// if no neighbors available, set flag for UpdatePoint to find",
"if",
"(",
"npoints",
"==",
"1",
")",
"{",
"neighbor",
"[",
"p",
"]",
"=",
"p",
";",
"distance",
"[",
"p",
"]",
"=",
"Float",
".",... | Find nearest neighbor of a given point. | [
"Find",
"nearest",
"neighbor",
"of",
"a",
"given",
"point",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/clustering/FastPair.java#L102-L130 |
17,211 | haifengl/smile | core/src/main/java/smile/clustering/FastPair.java | FastPair.remove | public void remove(int p) {
npoints--;
int q = index[p];
index[points[q] = points[npoints]] = q;
for (int i = 0; i < npoints; i++) {
if (neighbor[points[i]] == p) {
findNeighbor(points[i]);
}
}
} | java | public void remove(int p) {
npoints--;
int q = index[p];
index[points[q] = points[npoints]] = q;
for (int i = 0; i < npoints; i++) {
if (neighbor[points[i]] == p) {
findNeighbor(points[i]);
}
}
} | [
"public",
"void",
"remove",
"(",
"int",
"p",
")",
"{",
"npoints",
"--",
";",
"int",
"q",
"=",
"index",
"[",
"p",
"]",
";",
"index",
"[",
"points",
"[",
"q",
"]",
"=",
"points",
"[",
"npoints",
"]",
"]",
"=",
"q",
";",
"for",
"(",
"int",
"i",
... | Remove a point and update neighbors of points for which it had been nearest | [
"Remove",
"a",
"point",
"and",
"update",
"neighbors",
"of",
"points",
"for",
"which",
"it",
"had",
"been",
"nearest"
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/clustering/FastPair.java#L143-L153 |
17,212 | haifengl/smile | core/src/main/java/smile/clustering/FastPair.java | FastPair.getNearestPair | public double getNearestPair(int[] pair) {
if (npoints < 2) {
throw new IllegalStateException("FastPair: not enough points to form pair");
}
double d = distance[points[0]];
int r = 0;
for (int i = 1; i < npoints; i++) {
if (distance[points[i]] < d) {
... | java | public double getNearestPair(int[] pair) {
if (npoints < 2) {
throw new IllegalStateException("FastPair: not enough points to form pair");
}
double d = distance[points[0]];
int r = 0;
for (int i = 1; i < npoints; i++) {
if (distance[points[i]] < d) {
... | [
"public",
"double",
"getNearestPair",
"(",
"int",
"[",
"]",
"pair",
")",
"{",
"if",
"(",
"npoints",
"<",
"2",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"FastPair: not enough points to form pair\"",
")",
";",
"}",
"double",
"d",
"=",
"distance",... | Find closest pair by scanning list of nearest neighbors | [
"Find",
"closest",
"pair",
"by",
"scanning",
"list",
"of",
"nearest",
"neighbors"
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/clustering/FastPair.java#L158-L182 |
17,213 | haifengl/smile | core/src/main/java/smile/clustering/FastPair.java | FastPair.updatePoint | public void updatePoint(int p) {
neighbor[p] = p; // flag for not yet found any
distance[p] = Float.MAX_VALUE;
for (int i = 0; i < npoints; i++) {
int q = points[i];
if (q != p) {
float d = linkage.d(p, q);
if (d < distance[p]) {
... | java | public void updatePoint(int p) {
neighbor[p] = p; // flag for not yet found any
distance[p] = Float.MAX_VALUE;
for (int i = 0; i < npoints; i++) {
int q = points[i];
if (q != p) {
float d = linkage.d(p, q);
if (d < distance[p]) {
... | [
"public",
"void",
"updatePoint",
"(",
"int",
"p",
")",
"{",
"neighbor",
"[",
"p",
"]",
"=",
"p",
";",
"// flag for not yet found any",
"distance",
"[",
"p",
"]",
"=",
"Float",
".",
"MAX_VALUE",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
... | All distances to point have changed, check if our structures are ok
Note that although we completely recompute the neighbors of p,
we don't explicitly call findNeighbor, since that would double
the number of distance computations made by this routine.
Also, like deletion, we don't change any other point's neighbor to p... | [
"All",
"distances",
"to",
"point",
"have",
"changed",
"check",
"if",
"our",
"structures",
"are",
"ok",
"Note",
"that",
"although",
"we",
"completely",
"recompute",
"the",
"neighbors",
"of",
"p",
"we",
"don",
"t",
"explicitly",
"call",
"findNeighbor",
"since",
... | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/clustering/FastPair.java#L191-L211 |
17,214 | haifengl/smile | core/src/main/java/smile/clustering/FastPair.java | FastPair.updateDistance | public void updateDistance(int p, int q) {
float d = linkage.d(p, q);
if (d < distance[p]) {
distance[p] = q;
neighbor[p] = q;
} else if (neighbor[p] == q && d > distance[p]) {
findNeighbor(p);
}
if (d < distance[q]) {
distance[q]... | java | public void updateDistance(int p, int q) {
float d = linkage.d(p, q);
if (d < distance[p]) {
distance[p] = q;
neighbor[p] = q;
} else if (neighbor[p] == q && d > distance[p]) {
findNeighbor(p);
}
if (d < distance[q]) {
distance[q]... | [
"public",
"void",
"updateDistance",
"(",
"int",
"p",
",",
"int",
"q",
")",
"{",
"float",
"d",
"=",
"linkage",
".",
"d",
"(",
"p",
",",
"q",
")",
";",
"if",
"(",
"d",
"<",
"distance",
"[",
"p",
"]",
")",
"{",
"distance",
"[",
"p",
"]",
"=",
... | Single distance has changed, check if our structures are ok. | [
"Single",
"distance",
"has",
"changed",
"check",
"if",
"our",
"structures",
"are",
"ok",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/clustering/FastPair.java#L216-L232 |
17,215 | haifengl/smile | core/src/main/java/smile/classification/LogisticRegression.java | LogisticRegression.softmax | private static void softmax(double[] prob) {
double max = Double.NEGATIVE_INFINITY;
for (int i = 0; i < prob.length; i++) {
if (prob[i] > max) {
max = prob[i];
}
}
double Z = 0.0;
for (int i = 0; i < prob.length; i++) {
double ... | java | private static void softmax(double[] prob) {
double max = Double.NEGATIVE_INFINITY;
for (int i = 0; i < prob.length; i++) {
if (prob[i] > max) {
max = prob[i];
}
}
double Z = 0.0;
for (int i = 0; i < prob.length; i++) {
double ... | [
"private",
"static",
"void",
"softmax",
"(",
"double",
"[",
"]",
"prob",
")",
"{",
"double",
"max",
"=",
"Double",
".",
"NEGATIVE_INFINITY",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"prob",
".",
"length",
";",
"i",
"++",
")",
"{",
"i... | Calculate softmax function without overflow. | [
"Calculate",
"softmax",
"function",
"without",
"overflow",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/classification/LogisticRegression.java#L932-L950 |
17,216 | haifengl/smile | plot/src/main/java/smile/plot/Contour.java | Contour.isIntersect | private boolean isIntersect(double z0, double z1, double zc) {
if ((z0 - zc) * (z1 - zc) < 0.0) {
return true;
}
return false;
} | java | private boolean isIntersect(double z0, double z1, double zc) {
if ((z0 - zc) * (z1 - zc) < 0.0) {
return true;
}
return false;
} | [
"private",
"boolean",
"isIntersect",
"(",
"double",
"z0",
",",
"double",
"z1",
",",
"double",
"zc",
")",
"{",
"if",
"(",
"(",
"z0",
"-",
"zc",
")",
"*",
"(",
"z1",
"-",
"zc",
")",
"<",
"0.0",
")",
"{",
"return",
"true",
";",
"}",
"return",
"fal... | Returns true if zc is between z0 and z1. | [
"Returns",
"true",
"if",
"zc",
"is",
"between",
"z0",
"and",
"z1",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Contour.java#L807-L813 |
17,217 | haifengl/smile | plot/src/main/java/smile/plot/Contour.java | Contour.segdir | private int segdir(double xend, double yend, int[] ij) {
if (YMATCH(yend, y[ij[1]])) {
if (ij[1] == 0) {
return 0;
}
ij[1] -= 1;
return 3;
}
if (XMATCH(xend, x[ij[0]])) {
if (ij[0] == 0) {
return 0;
... | java | private int segdir(double xend, double yend, int[] ij) {
if (YMATCH(yend, y[ij[1]])) {
if (ij[1] == 0) {
return 0;
}
ij[1] -= 1;
return 3;
}
if (XMATCH(xend, x[ij[0]])) {
if (ij[0] == 0) {
return 0;
... | [
"private",
"int",
"segdir",
"(",
"double",
"xend",
",",
"double",
"yend",
",",
"int",
"[",
"]",
"ij",
")",
"{",
"if",
"(",
"YMATCH",
"(",
"yend",
",",
"y",
"[",
"ij",
"[",
"1",
"]",
"]",
")",
")",
"{",
"if",
"(",
"ij",
"[",
"1",
"]",
"==",
... | Determine the entry direction to the next cell and update the cell
indices. | [
"Determine",
"the",
"entry",
"direction",
"to",
"the",
"next",
"cell",
"and",
"update",
"the",
"cell",
"indices",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Contour.java#L834-L868 |
17,218 | haifengl/smile | core/src/main/java/smile/association/FPTree.java | FPTree.freq | private static int[] freq(int[][] itemsets) {
int[] f = new int[Math.max(itemsets) + 1];
for (int[] itemset : itemsets) {
for (int i : itemset) {
f[i]++;
}
}
return f;
} | java | private static int[] freq(int[][] itemsets) {
int[] f = new int[Math.max(itemsets) + 1];
for (int[] itemset : itemsets) {
for (int i : itemset) {
f[i]++;
}
}
return f;
} | [
"private",
"static",
"int",
"[",
"]",
"freq",
"(",
"int",
"[",
"]",
"[",
"]",
"itemsets",
")",
"{",
"int",
"[",
"]",
"f",
"=",
"new",
"int",
"[",
"Math",
".",
"max",
"(",
"itemsets",
")",
"+",
"1",
"]",
";",
"for",
"(",
"int",
"[",
"]",
"it... | Returns the frequency of single items.
@param itemsets the transaction database.
@return the frequency of single items | [
"Returns",
"the",
"frequency",
"of",
"single",
"items",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/association/FPTree.java#L293-L301 |
17,219 | haifengl/smile | core/src/main/java/smile/association/FPTree.java | FPTree.add | public void add(int[] itemset) {
numTransactions++;
int m = 0;
int t = itemset.length;
int[] o = new int[t];
for (int i = 0; i < t; i++) {
int item = itemset[i];
o[i] = order[item];
if (itemSupport[item] >= minSupport) {
... | java | public void add(int[] itemset) {
numTransactions++;
int m = 0;
int t = itemset.length;
int[] o = new int[t];
for (int i = 0; i < t; i++) {
int item = itemset[i];
o[i] = order[item];
if (itemSupport[item] >= minSupport) {
... | [
"public",
"void",
"add",
"(",
"int",
"[",
"]",
"itemset",
")",
"{",
"numTransactions",
"++",
";",
"int",
"m",
"=",
"0",
";",
"int",
"t",
"=",
"itemset",
".",
"length",
";",
"int",
"[",
"]",
"o",
"=",
"new",
"int",
"[",
"t",
"]",
";",
"for",
"... | Add an item set into the FP-tree.
@param itemset an item set, which should NOT contain duplicated items.
Note that it is reordered after the call. | [
"Add",
"an",
"item",
"set",
"into",
"the",
"FP",
"-",
"tree",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/association/FPTree.java#L316-L349 |
17,220 | haifengl/smile | core/src/main/java/smile/association/FPTree.java | FPTree.add | public void add(int index, int end, int[] itemset, int support) {
root.add(index, end, itemset, support);
} | java | public void add(int index, int end, int[] itemset, int support) {
root.add(index, end, itemset, support);
} | [
"public",
"void",
"add",
"(",
"int",
"index",
",",
"int",
"end",
",",
"int",
"[",
"]",
"itemset",
",",
"int",
"support",
")",
"{",
"root",
".",
"add",
"(",
"index",
",",
"end",
",",
"itemset",
",",
"support",
")",
";",
"}"
] | Add an item set into the FP-tree. The items in the set is already in the
descending order of frequency.
@param index the current item index in the item set.
@param end the end index of item set to append into the database.
@param itemset an item set.
@param support the support/frequency of the item set. | [
"Add",
"an",
"item",
"set",
"into",
"the",
"FP",
"-",
"tree",
".",
"The",
"items",
"in",
"the",
"set",
"is",
"already",
"in",
"the",
"descending",
"order",
"of",
"frequency",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/association/FPTree.java#L359-L361 |
17,221 | haifengl/smile | math/src/main/java/smile/math/distance/HammingDistance.java | HammingDistance.d | @Override
public double d(T[] x, T[] y) {
if (x.length != y.length)
throw new IllegalArgumentException(String.format("Arrays have different length: x[%d], y[%d]", x.length, y.length));
int dist = 0;
for (int i = 0; i < x.length; i++) {
if (!x[i].equals(y[i]))
... | java | @Override
public double d(T[] x, T[] y) {
if (x.length != y.length)
throw new IllegalArgumentException(String.format("Arrays have different length: x[%d], y[%d]", x.length, y.length));
int dist = 0;
for (int i = 0; i < x.length; i++) {
if (!x[i].equals(y[i]))
... | [
"@",
"Override",
"public",
"double",
"d",
"(",
"T",
"[",
"]",
"x",
",",
"T",
"[",
"]",
"y",
")",
"{",
"if",
"(",
"x",
".",
"length",
"!=",
"y",
".",
"length",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"... | Returns Hamming distance between the two arrays. | [
"Returns",
"Hamming",
"distance",
"between",
"the",
"two",
"arrays",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/distance/HammingDistance.java#L48-L60 |
17,222 | haifengl/smile | math/src/main/java/smile/math/distance/HammingDistance.java | HammingDistance.d | public static int d(int x, int y) {
int dist = 0;
int val = x ^ y;
// Count the number of set bits (Knuth's algorithm)
while (val != 0) {
++dist;
val &= val - 1;
}
return dist;
} | java | public static int d(int x, int y) {
int dist = 0;
int val = x ^ y;
// Count the number of set bits (Knuth's algorithm)
while (val != 0) {
++dist;
val &= val - 1;
}
return dist;
} | [
"public",
"static",
"int",
"d",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"int",
"dist",
"=",
"0",
";",
"int",
"val",
"=",
"x",
"^",
"y",
";",
"// Count the number of set bits (Knuth's algorithm)",
"while",
"(",
"val",
"!=",
"0",
")",
"{",
"++",
"d... | Returns Hamming distance between the two integers. | [
"Returns",
"Hamming",
"distance",
"between",
"the",
"two",
"integers",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/distance/HammingDistance.java#L79-L90 |
17,223 | haifengl/smile | math/src/main/java/smile/math/distance/HammingDistance.java | HammingDistance.d | public static int d(BitSet x, BitSet y) {
if (x.size() != y.size())
throw new IllegalArgumentException(String.format("BitSets have different length: x[%d], y[%d]", x.size(), y.size()));
int dist = 0;
for (int i = 0; i < x.size(); i++) {
if (x.get(i) != y.get(i))
... | java | public static int d(BitSet x, BitSet y) {
if (x.size() != y.size())
throw new IllegalArgumentException(String.format("BitSets have different length: x[%d], y[%d]", x.size(), y.size()));
int dist = 0;
for (int i = 0; i < x.size(); i++) {
if (x.get(i) != y.get(i))
... | [
"public",
"static",
"int",
"d",
"(",
"BitSet",
"x",
",",
"BitSet",
"y",
")",
"{",
"if",
"(",
"x",
".",
"size",
"(",
")",
"!=",
"y",
".",
"size",
"(",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"BitSet... | Returns Hamming distance between the two BitSets. | [
"Returns",
"Hamming",
"distance",
"between",
"the",
"two",
"BitSets",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/distance/HammingDistance.java#L159-L170 |
17,224 | haifengl/smile | plot/src/main/java/smile/plot/Base.java | Base.initBaseCoord | void initBaseCoord() {
baseCoords = new double[dimension + 1][];
for (int i = 0; i < baseCoords.length; i++) {
baseCoords[i] = lowerBound.clone();
if (i > 0) {
baseCoords[i][i - 1] = upperBound[i - 1];
}
}
} | java | void initBaseCoord() {
baseCoords = new double[dimension + 1][];
for (int i = 0; i < baseCoords.length; i++) {
baseCoords[i] = lowerBound.clone();
if (i > 0) {
baseCoords[i][i - 1] = upperBound[i - 1];
}
}
} | [
"void",
"initBaseCoord",
"(",
")",
"{",
"baseCoords",
"=",
"new",
"double",
"[",
"dimension",
"+",
"1",
"]",
"[",
"",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"baseCoords",
".",
"length",
";",
"i",
"++",
")",
"{",
"baseCoords",
... | Reset coord. | [
"Reset",
"coord",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Base.java#L139-L147 |
17,225 | haifengl/smile | plot/src/main/java/smile/plot/Base.java | Base.setPrecisionUnit | void setPrecisionUnit(int i) {
if (upperBound[i] > lowerBound[i]) {
double digits = Math.log10(Math.abs(upperBound[i] - lowerBound[i]));
double residual = digits - Math.floor(digits);
if (residual < 0.2) {
// If the range is less than 15 units, we reduce one l... | java | void setPrecisionUnit(int i) {
if (upperBound[i] > lowerBound[i]) {
double digits = Math.log10(Math.abs(upperBound[i] - lowerBound[i]));
double residual = digits - Math.floor(digits);
if (residual < 0.2) {
// If the range is less than 15 units, we reduce one l... | [
"void",
"setPrecisionUnit",
"(",
"int",
"i",
")",
"{",
"if",
"(",
"upperBound",
"[",
"i",
"]",
">",
"lowerBound",
"[",
"i",
"]",
")",
"{",
"double",
"digits",
"=",
"Math",
".",
"log10",
"(",
"Math",
".",
"abs",
"(",
"upperBound",
"[",
"i",
"]",
"... | Set the precision unit for axis i. | [
"Set",
"the",
"precision",
"unit",
"for",
"axis",
"i",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Base.java#L159-L179 |
17,226 | haifengl/smile | plot/src/main/java/smile/plot/Base.java | Base.extendBound | public void extendBound(int i) {
if (i < 0 || i >= dimension) {
throw new IllegalArgumentException("Invalid bound index: " + i);
}
extendBound[i] = true;
lowerBound[i] = precisionUnit[i] * (Math.floor(originalLowerBound[i] / precisionUnit[i]));
upperBound[i] = precis... | java | public void extendBound(int i) {
if (i < 0 || i >= dimension) {
throw new IllegalArgumentException("Invalid bound index: " + i);
}
extendBound[i] = true;
lowerBound[i] = precisionUnit[i] * (Math.floor(originalLowerBound[i] / precisionUnit[i]));
upperBound[i] = precis... | [
"public",
"void",
"extendBound",
"(",
"int",
"i",
")",
"{",
"if",
"(",
"i",
"<",
"0",
"||",
"i",
">=",
"dimension",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid bound index: \"",
"+",
"i",
")",
";",
"}",
"extendBound",
"[",
"i",
... | Round the bounds for axis i. | [
"Round",
"the",
"bounds",
"for",
"axis",
"i",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Base.java#L184-L192 |
17,227 | haifengl/smile | plot/src/main/java/smile/plot/Base.java | Base.extendLowerBound | public void extendLowerBound(double[] bound) {
if (bound.length != dimension) {
throw new IllegalArgumentException(BOUND_SIZE_DON_T_MATCH_THE_DIMENSION);
}
boolean extend = false;
for (int i = 0; i < bound.length; i++) {
if (bound[i] < originalLowerBound[i]) {
... | java | public void extendLowerBound(double[] bound) {
if (bound.length != dimension) {
throw new IllegalArgumentException(BOUND_SIZE_DON_T_MATCH_THE_DIMENSION);
}
boolean extend = false;
for (int i = 0; i < bound.length; i++) {
if (bound[i] < originalLowerBound[i]) {
... | [
"public",
"void",
"extendLowerBound",
"(",
"double",
"[",
"]",
"bound",
")",
"{",
"if",
"(",
"bound",
".",
"length",
"!=",
"dimension",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"BOUND_SIZE_DON_T_MATCH_THE_DIMENSION",
")",
";",
"}",
"boolean",
... | Extend lower bounds. | [
"Extend",
"lower",
"bounds",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Base.java#L232-L248 |
17,228 | haifengl/smile | plot/src/main/java/smile/plot/Base.java | Base.extendUpperBound | public void extendUpperBound(double[] bound) {
if (bound.length != dimension) {
throw new IllegalArgumentException(BOUND_SIZE_DON_T_MATCH_THE_DIMENSION);
}
boolean extend = false;
for (int i = 0; i < bound.length; i++) {
if (bound[i] > originalUpperBound[i]) {
... | java | public void extendUpperBound(double[] bound) {
if (bound.length != dimension) {
throw new IllegalArgumentException(BOUND_SIZE_DON_T_MATCH_THE_DIMENSION);
}
boolean extend = false;
for (int i = 0; i < bound.length; i++) {
if (bound[i] > originalUpperBound[i]) {
... | [
"public",
"void",
"extendUpperBound",
"(",
"double",
"[",
"]",
"bound",
")",
"{",
"if",
"(",
"bound",
".",
"length",
"!=",
"dimension",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"BOUND_SIZE_DON_T_MATCH_THE_DIMENSION",
")",
";",
"}",
"boolean",
... | Extend upper bounds. | [
"Extend",
"upper",
"bounds",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Base.java#L253-L269 |
17,229 | haifengl/smile | core/src/main/java/smile/clustering/CLARANS.java | CLARANS.getRandomNeighbor | private double getRandomNeighbor(T[] data, T[] medoids, int[] y, double[] d) {
int n = data.length;
int index = Math.randomInt(k);
T medoid = null;
boolean dup;
do {
dup = false;
medoid = data[Math.randomInt(n)];
for (int i = 0; i < k; i++) {
... | java | private double getRandomNeighbor(T[] data, T[] medoids, int[] y, double[] d) {
int n = data.length;
int index = Math.randomInt(k);
T medoid = null;
boolean dup;
do {
dup = false;
medoid = data[Math.randomInt(n)];
for (int i = 0; i < k; i++) {
... | [
"private",
"double",
"getRandomNeighbor",
"(",
"T",
"[",
"]",
"data",
",",
"T",
"[",
"]",
"medoids",
",",
"int",
"[",
"]",
"y",
",",
"double",
"[",
"]",
"d",
")",
"{",
"int",
"n",
"=",
"data",
".",
"length",
";",
"int",
"index",
"=",
"Math",
".... | Generate a random neighbor which differs in only one medoid with current clusters. | [
"Generate",
"a",
"random",
"neighbor",
"which",
"differs",
"in",
"only",
"one",
"medoid",
"with",
"current",
"clusters",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/clustering/CLARANS.java#L230-L270 |
17,230 | haifengl/smile | plot/src/main/java/smile/plot/BoxPlot.java | BoxPlot.init | private void init() {
quantiles = new double[data.length][8];
for (int i = 0; i < data.length; i++) {
int n = data[i].length;
Arrays.sort(data[i]);
quantiles[i][1] = data[i][n / 4];
quantiles[i][2] = data[i][n / 2];
quantiles[i][3] = data[i][3 ... | java | private void init() {
quantiles = new double[data.length][8];
for (int i = 0; i < data.length; i++) {
int n = data[i].length;
Arrays.sort(data[i]);
quantiles[i][1] = data[i][n / 4];
quantiles[i][2] = data[i][n / 2];
quantiles[i][3] = data[i][3 ... | [
"private",
"void",
"init",
"(",
")",
"{",
"quantiles",
"=",
"new",
"double",
"[",
"data",
".",
"length",
"]",
"[",
"8",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"data",
".",
"length",
";",
"i",
"++",
")",
"{",
"int",
"n",
... | Calculate quantiles. | [
"Calculate",
"quantiles",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/BoxPlot.java#L109-L123 |
17,231 | haifengl/smile | plot/src/main/java/smile/plot/BoxPlot.java | BoxPlot.plot | public static PlotCanvas plot(double[] data) {
double[] lowerBound = {0, Math.min(data)};
double[] upperBound = {1, Math.max(data)};
PlotCanvas canvas = new PlotCanvas(lowerBound, upperBound);
canvas.add(new BoxPlot(data));
canvas.getAxis(0).setGridVisible(false);
canva... | java | public static PlotCanvas plot(double[] data) {
double[] lowerBound = {0, Math.min(data)};
double[] upperBound = {1, Math.max(data)};
PlotCanvas canvas = new PlotCanvas(lowerBound, upperBound);
canvas.add(new BoxPlot(data));
canvas.getAxis(0).setGridVisible(false);
canva... | [
"public",
"static",
"PlotCanvas",
"plot",
"(",
"double",
"[",
"]",
"data",
")",
"{",
"double",
"[",
"]",
"lowerBound",
"=",
"{",
"0",
",",
"Math",
".",
"min",
"(",
"data",
")",
"}",
";",
"double",
"[",
"]",
"upperBound",
"=",
"{",
"1",
",",
"Math... | Create a plot canvas with the box plot of given data.
@param data a sample set. | [
"Create",
"a",
"plot",
"canvas",
"with",
"the",
"box",
"plot",
"of",
"given",
"data",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/BoxPlot.java#L205-L216 |
17,232 | haifengl/smile | plot/src/main/java/smile/plot/BoxPlot.java | BoxPlot.plot | public static PlotCanvas plot(double[][] data, String[] labels) {
if (data.length != labels.length) {
throw new IllegalArgumentException("Data size and label size don't match.");
}
double[] lowerBound = {0, Math.min(data)};
double[] upperBound = {data.length, Math.max(data)}... | java | public static PlotCanvas plot(double[][] data, String[] labels) {
if (data.length != labels.length) {
throw new IllegalArgumentException("Data size and label size don't match.");
}
double[] lowerBound = {0, Math.min(data)};
double[] upperBound = {data.length, Math.max(data)}... | [
"public",
"static",
"PlotCanvas",
"plot",
"(",
"double",
"[",
"]",
"[",
"]",
"data",
",",
"String",
"[",
"]",
"labels",
")",
"{",
"if",
"(",
"data",
".",
"length",
"!=",
"labels",
".",
"length",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"("... | Create a plot canvas with multiple box plots of given data.
@param data a data matrix of which each row will create a box plot.
@param labels the labels for each box plot. | [
"Create",
"a",
"plot",
"canvas",
"with",
"multiple",
"box",
"plots",
"of",
"given",
"data",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/BoxPlot.java#L240-L264 |
17,233 | haifengl/smile | core/src/main/java/smile/feature/MaxAbsScaler.java | MaxAbsScaler.transform | @Override
public double[] transform(double[] x) {
if (x.length != scale.length) {
throw new IllegalArgumentException(String.format("Invalid vector size %d, expected %d", x.length, scale.length));
}
double[] y = copy ? new double[x.length] : x;
for (int i = 0; i < x.lengt... | java | @Override
public double[] transform(double[] x) {
if (x.length != scale.length) {
throw new IllegalArgumentException(String.format("Invalid vector size %d, expected %d", x.length, scale.length));
}
double[] y = copy ? new double[x.length] : x;
for (int i = 0; i < x.lengt... | [
"@",
"Override",
"public",
"double",
"[",
"]",
"transform",
"(",
"double",
"[",
"]",
"x",
")",
"{",
"if",
"(",
"x",
".",
"length",
"!=",
"scale",
".",
"length",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
... | Scales each feature by its maximum absolute value.
@param x a vector to be scaled. The vector will be modified on output.
@return the input vector. | [
"Scales",
"each",
"feature",
"by",
"its",
"maximum",
"absolute",
"value",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/feature/MaxAbsScaler.java#L79-L91 |
17,234 | haifengl/smile | core/src/main/java/smile/classification/DecisionTree.java | DecisionTree.impurity | private double impurity(int[] count, int n) {
double impurity = 0.0;
switch (rule) {
case GINI:
impurity = 1.0;
for (int i = 0; i < count.length; i++) {
if (count[i] > 0) {
double p = (double) count[i] / n;
... | java | private double impurity(int[] count, int n) {
double impurity = 0.0;
switch (rule) {
case GINI:
impurity = 1.0;
for (int i = 0; i < count.length; i++) {
if (count[i] > 0) {
double p = (double) count[i] / n;
... | [
"private",
"double",
"impurity",
"(",
"int",
"[",
"]",
"count",
",",
"int",
"n",
")",
"{",
"double",
"impurity",
"=",
"0.0",
";",
"switch",
"(",
"rule",
")",
"{",
"case",
"GINI",
":",
"impurity",
"=",
"1.0",
";",
"for",
"(",
"int",
"i",
"=",
"0",... | Returns the impurity of a node.
@param count the sample count in each class.
@param n the number of samples in the node.
@return the impurity of a node | [
"Returns",
"the",
"impurity",
"of",
"a",
"node",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/classification/DecisionTree.java#L742-L776 |
17,235 | haifengl/smile | core/src/main/java/smile/gap/GeneticAlgorithm.java | GeneticAlgorithm.setTournament | public GeneticAlgorithm<T> setTournament(int size, double p) {
if (size < 1) {
throw new IllegalArgumentException("Invalid tournament size: " + size);
}
if (p < 0.5 || p > 1.0) {
throw new IllegalArgumentException("Invalid best-player-wins probability: " + p);
... | java | public GeneticAlgorithm<T> setTournament(int size, double p) {
if (size < 1) {
throw new IllegalArgumentException("Invalid tournament size: " + size);
}
if (p < 0.5 || p > 1.0) {
throw new IllegalArgumentException("Invalid best-player-wins probability: " + p);
... | [
"public",
"GeneticAlgorithm",
"<",
"T",
">",
"setTournament",
"(",
"int",
"size",
",",
"double",
"p",
")",
"{",
"if",
"(",
"size",
"<",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid tournament size: \"",
"+",
"size",
")",
";",
... | Set the tournament size and the best-player-wins probability in
tournament selection.
@param size the size of tournament pool.
@param p the best-player-wins probability. | [
"Set",
"the",
"tournament",
"size",
"and",
"the",
"best",
"-",
"player",
"-",
"wins",
"probability",
"in",
"tournament",
"selection",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/gap/GeneticAlgorithm.java#L288-L300 |
17,236 | haifengl/smile | core/src/main/java/smile/gap/GeneticAlgorithm.java | GeneticAlgorithm.evolve | public T evolve(int generation, double threshold) {
if (generation <= 0) {
throw new IllegalArgumentException("Invalid number of generations to go: " + generation);
}
// Calculate the fitness of each chromosome.
try {
MulticoreExecutor.run(tasks);
... | java | public T evolve(int generation, double threshold) {
if (generation <= 0) {
throw new IllegalArgumentException("Invalid number of generations to go: " + generation);
}
// Calculate the fitness of each chromosome.
try {
MulticoreExecutor.run(tasks);
... | [
"public",
"T",
"evolve",
"(",
"int",
"generation",
",",
"double",
"threshold",
")",
"{",
"if",
"(",
"generation",
"<=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid number of generations to go: \"",
"+",
"generation",
")",
";",
"}",... | Performs genetic algorithm until the given number of generations is reached
or the best fitness is larger than the given threshold.
@param generation the maximum number of iterations.
@param threshold the fitness threshold. The algorithm stops when a
solution is found that satisfies minimum criteria.
@return the best ... | [
"Performs",
"genetic",
"algorithm",
"until",
"the",
"given",
"number",
"of",
"generations",
"is",
"reached",
"or",
"the",
"best",
"fitness",
"is",
"larger",
"than",
"the",
"given",
"threshold",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/gap/GeneticAlgorithm.java#L356-L422 |
17,237 | haifengl/smile | core/src/main/java/smile/gap/GeneticAlgorithm.java | GeneticAlgorithm.select | @SuppressWarnings("unchecked")
private T select(T[] population) {
double worst = population[0].fitness();
double[] fitness = new double[size];
switch (selection) {
case ROULETTE_WHEEL:
if (worst > 0.0) {
worst = 0.0;
}
... | java | @SuppressWarnings("unchecked")
private T select(T[] population) {
double worst = population[0].fitness();
double[] fitness = new double[size];
switch (selection) {
case ROULETTE_WHEEL:
if (worst > 0.0) {
worst = 0.0;
}
... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"T",
"select",
"(",
"T",
"[",
"]",
"population",
")",
"{",
"double",
"worst",
"=",
"population",
"[",
"0",
"]",
".",
"fitness",
"(",
")",
";",
"double",
"[",
"]",
"fitness",
"=",
"new",
"... | Select a chromosome with replacement from the population based on their
fitness. Note that the population should be in ascending order in terms
of fitness. | [
"Select",
"a",
"chromosome",
"with",
"replacement",
"from",
"the",
"population",
"based",
"on",
"their",
"fitness",
".",
"Note",
"that",
"the",
"population",
"should",
"be",
"in",
"ascending",
"order",
"in",
"terms",
"of",
"fitness",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/gap/GeneticAlgorithm.java#L429-L486 |
17,238 | haifengl/smile | core/src/main/java/smile/sequence/HMM.java | HMM.logp | public double logp(int[] o, int[] s) {
if (o.length != s.length) {
throw new IllegalArgumentException("The observation sequence and state sequence are not the same length.");
}
int n = s.length;
double p = log(pi[s[0]]) + log(b[s[0]][o[0]]);
for (int i = 1; i < n; i+... | java | public double logp(int[] o, int[] s) {
if (o.length != s.length) {
throw new IllegalArgumentException("The observation sequence and state sequence are not the same length.");
}
int n = s.length;
double p = log(pi[s[0]]) + log(b[s[0]][o[0]]);
for (int i = 1; i < n; i+... | [
"public",
"double",
"logp",
"(",
"int",
"[",
"]",
"o",
",",
"int",
"[",
"]",
"s",
")",
"{",
"if",
"(",
"o",
".",
"length",
"!=",
"s",
".",
"length",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The observation sequence and state sequence a... | Returns the log joint probability of an observation sequence along a
state sequence given this HMM.
@param o an observation sequence.
@param s a state sequence.
@return the log joint probability P(o, s | H) given the model H. | [
"Returns",
"the",
"log",
"joint",
"probability",
"of",
"an",
"observation",
"sequence",
"along",
"a",
"state",
"sequence",
"given",
"this",
"HMM",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/sequence/HMM.java#L246-L258 |
17,239 | haifengl/smile | core/src/main/java/smile/sequence/HMM.java | HMM.logp | public double logp(int[] o) {
double[][] alpha = new double[o.length][numStates];
double[] scaling = new double[o.length];
forward(o, alpha, scaling);
double p = 0.0;
for (int t = 0; t < o.length; t++) {
p += java.lang.Math.log(scaling[t]);
}
return... | java | public double logp(int[] o) {
double[][] alpha = new double[o.length][numStates];
double[] scaling = new double[o.length];
forward(o, alpha, scaling);
double p = 0.0;
for (int t = 0; t < o.length; t++) {
p += java.lang.Math.log(scaling[t]);
}
return... | [
"public",
"double",
"logp",
"(",
"int",
"[",
"]",
"o",
")",
"{",
"double",
"[",
"]",
"[",
"]",
"alpha",
"=",
"new",
"double",
"[",
"o",
".",
"length",
"]",
"[",
"numStates",
"]",
";",
"double",
"[",
"]",
"scaling",
"=",
"new",
"double",
"[",
"o... | Returns the logarithm probability of an observation sequence given this
HMM. A scaling procedure is used in order to avoid underflows when
computing the probability of long sequences.
@param o an observation sequence.
@return the log probability of this sequence. | [
"Returns",
"the",
"logarithm",
"probability",
"of",
"an",
"observation",
"sequence",
"given",
"this",
"HMM",
".",
"A",
"scaling",
"procedure",
"is",
"used",
"in",
"order",
"to",
"avoid",
"underflows",
"when",
"computing",
"the",
"probability",
"of",
"long",
"s... | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/sequence/HMM.java#L278-L290 |
17,240 | haifengl/smile | core/src/main/java/smile/sequence/HMM.java | HMM.forward | private void forward(int[] o, double[][] alpha, double[] scaling) {
for (int k = 0; k < numStates; k++) {
alpha[0][k] = pi[k] * b[k][o[0]];
}
scale(scaling, alpha, 0);
for (int t = 1; t < o.length; t++) {
for (int k = 0; k < numStates; k++) {
doub... | java | private void forward(int[] o, double[][] alpha, double[] scaling) {
for (int k = 0; k < numStates; k++) {
alpha[0][k] = pi[k] * b[k][o[0]];
}
scale(scaling, alpha, 0);
for (int t = 1; t < o.length; t++) {
for (int k = 0; k < numStates; k++) {
doub... | [
"private",
"void",
"forward",
"(",
"int",
"[",
"]",
"o",
",",
"double",
"[",
"]",
"[",
"]",
"alpha",
",",
"double",
"[",
"]",
"scaling",
")",
"{",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"numStates",
";",
"k",
"++",
")",
"{",
"alpha"... | Scaled forward procedure without underflow.
@param o an observation sequence.
@param alpha on output, alpha(i, j) holds the scaled total probability of
ending up in state i at time j.
@param scaling on output, it holds scaling factors. | [
"Scaled",
"forward",
"procedure",
"without",
"underflow",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/sequence/HMM.java#L317-L335 |
17,241 | haifengl/smile | core/src/main/java/smile/sequence/HMM.java | HMM.backward | private void backward(int[] o, double[][] beta, double[] scaling) {
int n = o.length - 1;
for (int i = 0; i < numStates; i++) {
beta[n][i] = 1.0 / scaling[n];
}
for (int t = n; t-- > 0;) {
for (int i = 0; i < numStates; i++) {
double sum = 0.;
... | java | private void backward(int[] o, double[][] beta, double[] scaling) {
int n = o.length - 1;
for (int i = 0; i < numStates; i++) {
beta[n][i] = 1.0 / scaling[n];
}
for (int t = n; t-- > 0;) {
for (int i = 0; i < numStates; i++) {
double sum = 0.;
... | [
"private",
"void",
"backward",
"(",
"int",
"[",
"]",
"o",
",",
"double",
"[",
"]",
"[",
"]",
"beta",
",",
"double",
"[",
"]",
"scaling",
")",
"{",
"int",
"n",
"=",
"o",
".",
"length",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i... | Scaled backward procedure without underflow.
@param o an observation sequence.
@param beta on output, beta(i, j) holds the scaled total probability of
starting up in state i at time j.
@param scaling on input, it should hold scaling factors computed by
forward procedure. | [
"Scaled",
"backward",
"procedure",
"without",
"underflow",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/sequence/HMM.java#L346-L363 |
17,242 | haifengl/smile | core/src/main/java/smile/taxonomy/Concept.java | Concept.addKeyword | public void addKeyword(String keyword) {
if (taxonomy.concepts.containsKey(keyword)) {
throw new IllegalArgumentException(String.format("Concept %s already exists.", keyword));
}
taxonomy.concepts.put(keyword, this);
if (synset == null) {
synset = new TreeSet<>(... | java | public void addKeyword(String keyword) {
if (taxonomy.concepts.containsKey(keyword)) {
throw new IllegalArgumentException(String.format("Concept %s already exists.", keyword));
}
taxonomy.concepts.put(keyword, this);
if (synset == null) {
synset = new TreeSet<>(... | [
"public",
"void",
"addKeyword",
"(",
"String",
"keyword",
")",
"{",
"if",
"(",
"taxonomy",
".",
"concepts",
".",
"containsKey",
"(",
"keyword",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"Concept %s already ... | Add a keyword to the concept synset. | [
"Add",
"a",
"keyword",
"to",
"the",
"concept",
"synset",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/taxonomy/Concept.java#L195-L207 |
17,243 | haifengl/smile | core/src/main/java/smile/taxonomy/Concept.java | Concept.addKeywords | public void addKeywords(String[] keywords) {
for (String keyword : keywords) {
if (taxonomy.concepts.containsKey(keyword)) {
throw new IllegalArgumentException(String.format("Concept %s already exists.", keyword));
}
}
for (String keyword : keywords) {
... | java | public void addKeywords(String[] keywords) {
for (String keyword : keywords) {
if (taxonomy.concepts.containsKey(keyword)) {
throw new IllegalArgumentException(String.format("Concept %s already exists.", keyword));
}
}
for (String keyword : keywords) {
... | [
"public",
"void",
"addKeywords",
"(",
"String",
"[",
"]",
"keywords",
")",
"{",
"for",
"(",
"String",
"keyword",
":",
"keywords",
")",
"{",
"if",
"(",
"taxonomy",
".",
"concepts",
".",
"containsKey",
"(",
"keyword",
")",
")",
"{",
"throw",
"new",
"Ille... | Add a list of synomym to the concept synset. | [
"Add",
"a",
"list",
"of",
"synomym",
"to",
"the",
"concept",
"synset",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/taxonomy/Concept.java#L212-L230 |
17,244 | haifengl/smile | core/src/main/java/smile/taxonomy/Concept.java | Concept.removeKeyword | public void removeKeyword(String keyword) {
if (!taxonomy.concepts.containsKey(keyword)) {
throw new IllegalArgumentException(String.format("Concept %s does not exist.", keyword));
}
taxonomy.concepts.remove(keyword);
if (synset != null) {
synset.remove(keyword);... | java | public void removeKeyword(String keyword) {
if (!taxonomy.concepts.containsKey(keyword)) {
throw new IllegalArgumentException(String.format("Concept %s does not exist.", keyword));
}
taxonomy.concepts.remove(keyword);
if (synset != null) {
synset.remove(keyword);... | [
"public",
"void",
"removeKeyword",
"(",
"String",
"keyword",
")",
"{",
"if",
"(",
"!",
"taxonomy",
".",
"concepts",
".",
"containsKey",
"(",
"keyword",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"Concept %... | Remove a keyword from the concept synset. | [
"Remove",
"a",
"keyword",
"from",
"the",
"concept",
"synset",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/taxonomy/Concept.java#L256-L265 |
17,245 | haifengl/smile | core/src/main/java/smile/taxonomy/Concept.java | Concept.addChild | public void addChild(Concept concept) {
if (taxonomy != concept.taxonomy) {
throw new IllegalArgumentException("Concepts are not from the same taxonomy.");
}
if (children == null) {
children = new ArrayList<>();
}
children.add(concept);
c... | java | public void addChild(Concept concept) {
if (taxonomy != concept.taxonomy) {
throw new IllegalArgumentException("Concepts are not from the same taxonomy.");
}
if (children == null) {
children = new ArrayList<>();
}
children.add(concept);
c... | [
"public",
"void",
"addChild",
"(",
"Concept",
"concept",
")",
"{",
"if",
"(",
"taxonomy",
"!=",
"concept",
".",
"taxonomy",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Concepts are not from the same taxonomy.\"",
")",
";",
"}",
"if",
"(",
"chil... | Add a child to this node | [
"Add",
"a",
"child",
"to",
"this",
"node"
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/taxonomy/Concept.java#L287-L298 |
17,246 | haifengl/smile | core/src/main/java/smile/taxonomy/Concept.java | Concept.removeChild | public boolean removeChild(Concept concept) {
if (concept.parent != this) {
throw new IllegalArgumentException("Concept to remove is not a child");
}
for (int i = 0; i < children.size(); i++) {
if (children.get(i) == concept) {
children.remove(i);
... | java | public boolean removeChild(Concept concept) {
if (concept.parent != this) {
throw new IllegalArgumentException("Concept to remove is not a child");
}
for (int i = 0; i < children.size(); i++) {
if (children.get(i) == concept) {
children.remove(i);
... | [
"public",
"boolean",
"removeChild",
"(",
"Concept",
"concept",
")",
"{",
"if",
"(",
"concept",
".",
"parent",
"!=",
"this",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Concept to remove is not a child\"",
")",
";",
"}",
"for",
"(",
"int",
"i"... | Remove a child to this node | [
"Remove",
"a",
"child",
"to",
"this",
"node"
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/taxonomy/Concept.java#L303-L317 |
17,247 | haifengl/smile | core/src/main/java/smile/taxonomy/Concept.java | Concept.isAncestorOf | public boolean isAncestorOf(Concept concept) {
Concept p = concept.parent;
while (p != null) {
if (p == this) {
return true;
} else {
p = p.parent;
}
}
return false;
} | java | public boolean isAncestorOf(Concept concept) {
Concept p = concept.parent;
while (p != null) {
if (p == this) {
return true;
} else {
p = p.parent;
}
}
return false;
} | [
"public",
"boolean",
"isAncestorOf",
"(",
"Concept",
"concept",
")",
"{",
"Concept",
"p",
"=",
"concept",
".",
"parent",
";",
"while",
"(",
"p",
"!=",
"null",
")",
"{",
"if",
"(",
"p",
"==",
"this",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{"... | Returns true if this concept is an ancestor of the given concept. | [
"Returns",
"true",
"if",
"this",
"concept",
"is",
"an",
"ancestor",
"of",
"the",
"given",
"concept",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/taxonomy/Concept.java#L322-L334 |
17,248 | haifengl/smile | core/src/main/java/smile/taxonomy/Concept.java | Concept.getPathFromRoot | public List<Concept> getPathFromRoot() {
LinkedList<Concept> path = new LinkedList<>();
Concept node = this;
while (node != null) {
path.addFirst(node);
node = node.parent;
}
return path;
} | java | public List<Concept> getPathFromRoot() {
LinkedList<Concept> path = new LinkedList<>();
Concept node = this;
while (node != null) {
path.addFirst(node);
node = node.parent;
}
return path;
} | [
"public",
"List",
"<",
"Concept",
">",
"getPathFromRoot",
"(",
")",
"{",
"LinkedList",
"<",
"Concept",
">",
"path",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"Concept",
"node",
"=",
"this",
";",
"while",
"(",
"node",
"!=",
"null",
")",
"{",
"pat... | Returns the path from root to the given node. | [
"Returns",
"the",
"path",
"from",
"root",
"to",
"the",
"given",
"node",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/taxonomy/Concept.java#L339-L349 |
17,249 | haifengl/smile | core/src/main/java/smile/taxonomy/Concept.java | Concept.getPathToRoot | public List<Concept> getPathToRoot() {
LinkedList<Concept> path = new LinkedList<>();
Concept node = this;
while (node != null) {
path.add(node);
node = node.parent;
}
return path;
} | java | public List<Concept> getPathToRoot() {
LinkedList<Concept> path = new LinkedList<>();
Concept node = this;
while (node != null) {
path.add(node);
node = node.parent;
}
return path;
} | [
"public",
"List",
"<",
"Concept",
">",
"getPathToRoot",
"(",
")",
"{",
"LinkedList",
"<",
"Concept",
">",
"path",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"Concept",
"node",
"=",
"this",
";",
"while",
"(",
"node",
"!=",
"null",
")",
"{",
"path"... | Returns the path from the given node to the root. | [
"Returns",
"the",
"path",
"from",
"the",
"given",
"node",
"to",
"the",
"root",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/taxonomy/Concept.java#L354-L364 |
17,250 | haifengl/smile | core/src/main/java/smile/sequence/CRF.java | CRF.featureset | public double[] featureset(double[] features, int label) {
double[] fs = new double[features.length + 1];
System.arraycopy(features, 0, fs, 0, features.length);
fs[features.length] = label;
return fs;
} | java | public double[] featureset(double[] features, int label) {
double[] fs = new double[features.length + 1];
System.arraycopy(features, 0, fs, 0, features.length);
fs[features.length] = label;
return fs;
} | [
"public",
"double",
"[",
"]",
"featureset",
"(",
"double",
"[",
"]",
"features",
",",
"int",
"label",
")",
"{",
"double",
"[",
"]",
"fs",
"=",
"new",
"double",
"[",
"features",
".",
"length",
"+",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"fe... | Returns a feature set with the class label of previous position.
@param features the indices of the nonzero features.
@param label the class label of previous position as a feature. | [
"Returns",
"a",
"feature",
"set",
"with",
"the",
"class",
"label",
"of",
"previous",
"position",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/sequence/CRF.java#L88-L93 |
17,251 | haifengl/smile | core/src/main/java/smile/sequence/CRF.java | CRF.predictForwardBackward | private int[] predictForwardBackward(int[][] x) {
int n = x.length; // length of sequence
TrellisNode[][] trellis = getTrellis(x);
double[] scaling = new double[n];
forward(trellis, scaling);
backward(trellis);
int[] label = new int[n];
double[] p = new double[n... | java | private int[] predictForwardBackward(int[][] x) {
int n = x.length; // length of sequence
TrellisNode[][] trellis = getTrellis(x);
double[] scaling = new double[n];
forward(trellis, scaling);
backward(trellis);
int[] label = new int[n];
double[] p = new double[n... | [
"private",
"int",
"[",
"]",
"predictForwardBackward",
"(",
"int",
"[",
"]",
"[",
"]",
"x",
")",
"{",
"int",
"n",
"=",
"x",
".",
"length",
";",
"// length of sequence",
"TrellisNode",
"[",
"]",
"[",
"]",
"trellis",
"=",
"getTrellis",
"(",
"x",
")",
";... | Returns the most likely label sequence given the feature sequence by the
forward-backward algorithm.
@param x a sequence of sparse features taking values in [0, p) about each
position of original sequence, where p is the number of features.
@return the most likely label sequence. | [
"Returns",
"the",
"most",
"likely",
"label",
"sequence",
"given",
"the",
"feature",
"sequence",
"by",
"the",
"forward",
"-",
"backward",
"algorithm",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/sequence/CRF.java#L386-L413 |
17,252 | haifengl/smile | core/src/main/java/smile/sequence/CRF.java | CRF.predictViterbi | private int[] predictViterbi(int[][] x) {
int n = x.length;
double[][] trellis = new double[n][numClasses];
int[][] psy = new int[n][numClasses];
int p = x[0].length; // dimension
// forward
double[] t0 = trellis[0];
int[] p0 = psy[0];
int[] features = ... | java | private int[] predictViterbi(int[][] x) {
int n = x.length;
double[][] trellis = new double[n][numClasses];
int[][] psy = new int[n][numClasses];
int p = x[0].length; // dimension
// forward
double[] t0 = trellis[0];
int[] p0 = psy[0];
int[] features = ... | [
"private",
"int",
"[",
"]",
"predictViterbi",
"(",
"int",
"[",
"]",
"[",
"]",
"x",
")",
"{",
"int",
"n",
"=",
"x",
".",
"length",
";",
"double",
"[",
"]",
"[",
"]",
"trellis",
"=",
"new",
"double",
"[",
"n",
"]",
"[",
"numClasses",
"]",
";",
... | Returns the most likely label sequence given the feature sequence by the
Viterbi algorithm.
@param x a sequence of sparse features taking values in [0, p) about each
position of original sequence, where p is the number of features.
@return the most likely label sequence. | [
"Returns",
"the",
"most",
"likely",
"label",
"sequence",
"given",
"the",
"feature",
"sequence",
"by",
"the",
"Viterbi",
"algorithm",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/sequence/CRF.java#L423-L476 |
17,253 | haifengl/smile | core/src/main/java/smile/sequence/CRF.java | CRF.backward | private void backward(TrellisNode[][] trellis) {
int n = trellis.length - 1;
TrellisNode[] tn = trellis[n];
for (int i = 0; i < numClasses; i++) {
tn[i].beta = 1.0;
}
for (int t = n; t-- > 0;) {
TrellisNode[] tt = trellis[t];
TrellisNode[] tt1... | java | private void backward(TrellisNode[][] trellis) {
int n = trellis.length - 1;
TrellisNode[] tn = trellis[n];
for (int i = 0; i < numClasses; i++) {
tn[i].beta = 1.0;
}
for (int t = n; t-- > 0;) {
TrellisNode[] tt = trellis[t];
TrellisNode[] tt1... | [
"private",
"void",
"backward",
"(",
"TrellisNode",
"[",
"]",
"[",
"]",
"trellis",
")",
"{",
"int",
"n",
"=",
"trellis",
".",
"length",
"-",
"1",
";",
"TrellisNode",
"[",
"]",
"tn",
"=",
"trellis",
"[",
"n",
"]",
";",
"for",
"(",
"int",
"i",
"=",
... | Performs backward procedure on the trellis. | [
"Performs",
"backward",
"procedure",
"on",
"the",
"trellis",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/sequence/CRF.java#L860-L887 |
17,254 | haifengl/smile | core/src/main/java/smile/sequence/CRF.java | CRF.setTargets | private void setTargets(TrellisNode[][] trellis, double[] scaling, int[] label) {
TrellisNode[] t0 = trellis[0];
// Finding the normalizer for our first 'column' in the matrix
double normalizer = 0.0;
for (int i = 0; i < numClasses; i++) {
normalizer += t0[i].expScores[0] * ... | java | private void setTargets(TrellisNode[][] trellis, double[] scaling, int[] label) {
TrellisNode[] t0 = trellis[0];
// Finding the normalizer for our first 'column' in the matrix
double normalizer = 0.0;
for (int i = 0; i < numClasses; i++) {
normalizer += t0[i].expScores[0] * ... | [
"private",
"void",
"setTargets",
"(",
"TrellisNode",
"[",
"]",
"[",
"]",
"trellis",
",",
"double",
"[",
"]",
"scaling",
",",
"int",
"[",
"]",
"label",
")",
"{",
"TrellisNode",
"[",
"]",
"t0",
"=",
"trellis",
"[",
"0",
"]",
";",
"// Finding the normaliz... | Set training targets based on results of forward-backward | [
"Set",
"training",
"targets",
"based",
"on",
"results",
"of",
"forward",
"-",
"backward"
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/sequence/CRF.java#L954-L991 |
17,255 | haifengl/smile | core/src/main/java/smile/clustering/HierarchicalClustering.java | HierarchicalClustering.partition | public int[] partition(int k) {
int n = merge.length + 1;
int[] membership = new int[n];
IntHeapSelect heap = new IntHeapSelect(k);
for (int i = 2; i <= k; i++) {
heap.add(merge[n - i][0]);
heap.add(merge[n - i][1]);
}
for (int i = 0; i < k; i++)... | java | public int[] partition(int k) {
int n = merge.length + 1;
int[] membership = new int[n];
IntHeapSelect heap = new IntHeapSelect(k);
for (int i = 2; i <= k; i++) {
heap.add(merge[n - i][0]);
heap.add(merge[n - i][1]);
}
for (int i = 0; i < k; i++)... | [
"public",
"int",
"[",
"]",
"partition",
"(",
"int",
"k",
")",
"{",
"int",
"n",
"=",
"merge",
".",
"length",
"+",
"1",
";",
"int",
"[",
"]",
"membership",
"=",
"new",
"int",
"[",
"n",
"]",
";",
"IntHeapSelect",
"heap",
"=",
"new",
"IntHeapSelect",
... | Cuts a tree into several groups by specifying the desired number.
@param k the number of clusters.
@return the cluster label of each sample. | [
"Cuts",
"a",
"tree",
"into",
"several",
"groups",
"by",
"specifying",
"the",
"desired",
"number",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/clustering/HierarchicalClustering.java#L136-L151 |
17,256 | haifengl/smile | core/src/main/java/smile/clustering/HierarchicalClustering.java | HierarchicalClustering.partition | public int[] partition(double h) {
for (int i = 0; i < height.length - 1; i++) {
if (height[i] > height[i + 1]) {
throw new IllegalStateException("Non-monotonic cluster tree -- the linkage is probably not appropriate!");
}
}
int n = merge.length + 1;
... | java | public int[] partition(double h) {
for (int i = 0; i < height.length - 1; i++) {
if (height[i] > height[i + 1]) {
throw new IllegalStateException("Non-monotonic cluster tree -- the linkage is probably not appropriate!");
}
}
int n = merge.length + 1;
... | [
"public",
"int",
"[",
"]",
"partition",
"(",
"double",
"h",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"height",
".",
"length",
"-",
"1",
";",
"i",
"++",
")",
"{",
"if",
"(",
"height",
"[",
"i",
"]",
">",
"height",
"[",
"i",... | Cuts a tree into several groups by specifying the cut height.
@param h the cut height.
@return the cluster label of each sample. | [
"Cuts",
"a",
"tree",
"into",
"several",
"groups",
"by",
"specifying",
"the",
"cut",
"height",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/clustering/HierarchicalClustering.java#L158-L178 |
17,257 | haifengl/smile | core/src/main/java/smile/clustering/HierarchicalClustering.java | HierarchicalClustering.bfs | private void bfs(int[] membership, int cluster, int id) {
int n = merge.length + 1;
Queue<Integer> queue = new LinkedList<>();
queue.offer(cluster);
for (Integer i = queue.poll(); i != null; i = queue.poll()) {
if (i < n) {
membership[i] = id;
... | java | private void bfs(int[] membership, int cluster, int id) {
int n = merge.length + 1;
Queue<Integer> queue = new LinkedList<>();
queue.offer(cluster);
for (Integer i = queue.poll(); i != null; i = queue.poll()) {
if (i < n) {
membership[i] = id;
... | [
"private",
"void",
"bfs",
"(",
"int",
"[",
"]",
"membership",
",",
"int",
"cluster",
",",
"int",
"id",
")",
"{",
"int",
"n",
"=",
"merge",
".",
"length",
"+",
"1",
";",
"Queue",
"<",
"Integer",
">",
"queue",
"=",
"new",
"LinkedList",
"<>",
"(",
"... | BFS the merge tree and identify cluster membership.
@param membership the cluster membership array.
@param cluster the last merge point of cluster.
@param id the cluster ID. | [
"BFS",
"the",
"merge",
"tree",
"and",
"identify",
"cluster",
"membership",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/clustering/HierarchicalClustering.java#L186-L215 |
17,258 | haifengl/smile | nlp/src/main/java/smile/nlp/stemmer/PorterStemmer.java | PorterStemmer.vowelinstem | private final boolean vowelinstem() {
int i;
for (i = 0; i <= j; i++) {
if (!isConsonant(i)) {
return true;
}
}
return false;
} | java | private final boolean vowelinstem() {
int i;
for (i = 0; i <= j; i++) {
if (!isConsonant(i)) {
return true;
}
}
return false;
} | [
"private",
"final",
"boolean",
"vowelinstem",
"(",
")",
"{",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<=",
"j",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"isConsonant",
"(",
"i",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
... | Returns true if 0,...j contains a vowel | [
"Returns",
"true",
"if",
"0",
"...",
"j",
"contains",
"a",
"vowel"
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/nlp/src/main/java/smile/nlp/stemmer/PorterStemmer.java#L154-L162 |
17,259 | haifengl/smile | nlp/src/main/java/smile/nlp/stemmer/PorterStemmer.java | PorterStemmer.stripPluralParticiple | public String stripPluralParticiple(String word) {
b = word.toCharArray();
k = word.length() - 1;
if (k > 1 && !word.equalsIgnoreCase("is") && !word.equalsIgnoreCase("was") && !word.equalsIgnoreCase("has") && !word.equalsIgnoreCase("his") && !word.equalsIgnoreCase("this")) {
step1(t... | java | public String stripPluralParticiple(String word) {
b = word.toCharArray();
k = word.length() - 1;
if (k > 1 && !word.equalsIgnoreCase("is") && !word.equalsIgnoreCase("was") && !word.equalsIgnoreCase("has") && !word.equalsIgnoreCase("his") && !word.equalsIgnoreCase("this")) {
step1(t... | [
"public",
"String",
"stripPluralParticiple",
"(",
"String",
"word",
")",
"{",
"b",
"=",
"word",
".",
"toCharArray",
"(",
")",
";",
"k",
"=",
"word",
".",
"length",
"(",
")",
"-",
"1",
";",
"if",
"(",
"k",
">",
"1",
"&&",
"!",
"word",
".",
"equals... | Remove plurals and participles. | [
"Remove",
"plurals",
"and",
"participles",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/nlp/src/main/java/smile/nlp/stemmer/PorterStemmer.java#L605-L615 |
17,260 | haifengl/smile | core/src/main/java/smile/classification/NeuralNetwork.java | NeuralNetwork.natural | private static ActivationFunction natural(ErrorFunction error, int k) {
if (error == ErrorFunction.CROSS_ENTROPY) {
if (k == 1) {
return ActivationFunction.LOGISTIC_SIGMOID;
} else {
return ActivationFunction.SOFTMAX;
}
} else {
... | java | private static ActivationFunction natural(ErrorFunction error, int k) {
if (error == ErrorFunction.CROSS_ENTROPY) {
if (k == 1) {
return ActivationFunction.LOGISTIC_SIGMOID;
} else {
return ActivationFunction.SOFTMAX;
}
} else {
... | [
"private",
"static",
"ActivationFunction",
"natural",
"(",
"ErrorFunction",
"error",
",",
"int",
"k",
")",
"{",
"if",
"(",
"error",
"==",
"ErrorFunction",
".",
"CROSS_ENTROPY",
")",
"{",
"if",
"(",
"k",
"==",
"1",
")",
"{",
"return",
"ActivationFunction",
... | Returns the activation function of output layer based on natural pairing.
@param error the error function.
@param k the number of output nodes.
@return the activation function of output layer based on natural pairing | [
"Returns",
"the",
"activation",
"function",
"of",
"output",
"layer",
"based",
"on",
"natural",
"pairing",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/classification/NeuralNetwork.java#L400-L411 |
17,261 | haifengl/smile | core/src/main/java/smile/classification/NeuralNetwork.java | NeuralNetwork.setInput | private void setInput(double[] x) {
if (x.length != inputLayer.units) {
throw new IllegalArgumentException(String.format("Invalid input vector size: %d, expected: %d", x.length, inputLayer.units));
}
System.arraycopy(x, 0, inputLayer.output, 0, inputLayer.units);
} | java | private void setInput(double[] x) {
if (x.length != inputLayer.units) {
throw new IllegalArgumentException(String.format("Invalid input vector size: %d, expected: %d", x.length, inputLayer.units));
}
System.arraycopy(x, 0, inputLayer.output, 0, inputLayer.units);
} | [
"private",
"void",
"setInput",
"(",
"double",
"[",
"]",
"x",
")",
"{",
"if",
"(",
"x",
".",
"length",
"!=",
"inputLayer",
".",
"units",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"Invalid input vector size: %d,... | Sets the input vector into the input layer.
@param x the input vector. | [
"Sets",
"the",
"input",
"vector",
"into",
"the",
"input",
"layer",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/classification/NeuralNetwork.java#L597-L602 |
17,262 | haifengl/smile | core/src/main/java/smile/classification/NeuralNetwork.java | NeuralNetwork.getOutput | private void getOutput(double[] y) {
if (y.length != outputLayer.units) {
throw new IllegalArgumentException(String.format("Invalid output vector size: %d, expected: %d", y.length, outputLayer.units));
}
System.arraycopy(outputLayer.output, 0, y, 0, outputLayer.units);
} | java | private void getOutput(double[] y) {
if (y.length != outputLayer.units) {
throw new IllegalArgumentException(String.format("Invalid output vector size: %d, expected: %d", y.length, outputLayer.units));
}
System.arraycopy(outputLayer.output, 0, y, 0, outputLayer.units);
} | [
"private",
"void",
"getOutput",
"(",
"double",
"[",
"]",
"y",
")",
"{",
"if",
"(",
"y",
".",
"length",
"!=",
"outputLayer",
".",
"units",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"Invalid output vector size: ... | Returns the output vector into the given array.
@param y the output vector. | [
"Returns",
"the",
"output",
"vector",
"into",
"the",
"given",
"array",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/classification/NeuralNetwork.java#L608-L613 |
17,263 | haifengl/smile | core/src/main/java/smile/classification/NeuralNetwork.java | NeuralNetwork.softmax | private void softmax() {
double max = Double.NEGATIVE_INFINITY;
for (int i = 0; i < outputLayer.units; i++) {
if (outputLayer.output[i] > max) {
max = outputLayer.output[i];
}
}
double sum = 0.0;
for (int i = 0; i < outputLayer.units; i++)... | java | private void softmax() {
double max = Double.NEGATIVE_INFINITY;
for (int i = 0; i < outputLayer.units; i++) {
if (outputLayer.output[i] > max) {
max = outputLayer.output[i];
}
}
double sum = 0.0;
for (int i = 0; i < outputLayer.units; i++)... | [
"private",
"void",
"softmax",
"(",
")",
"{",
"double",
"max",
"=",
"Double",
".",
"NEGATIVE_INFINITY",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"outputLayer",
".",
"units",
";",
"i",
"++",
")",
"{",
"if",
"(",
"outputLayer",
".",
"outp... | Calculate softmax activation function in output layer without overflow. | [
"Calculate",
"softmax",
"activation",
"function",
"in",
"output",
"layer",
"without",
"overflow",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/classification/NeuralNetwork.java#L646-L664 |
17,264 | haifengl/smile | core/src/main/java/smile/classification/NeuralNetwork.java | NeuralNetwork.propagate | private void propagate() {
for (int l = 0; l < net.length - 1; l++) {
propagate(net[l], net[l + 1]);
}
} | java | private void propagate() {
for (int l = 0; l < net.length - 1; l++) {
propagate(net[l], net[l + 1]);
}
} | [
"private",
"void",
"propagate",
"(",
")",
"{",
"for",
"(",
"int",
"l",
"=",
"0",
";",
"l",
"<",
"net",
".",
"length",
"-",
"1",
";",
"l",
"++",
")",
"{",
"propagate",
"(",
"net",
"[",
"l",
"]",
",",
"net",
"[",
"l",
"+",
"1",
"]",
")",
";... | Propagates the signals through the neural network. | [
"Propagates",
"the",
"signals",
"through",
"the",
"neural",
"network",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/classification/NeuralNetwork.java#L669-L673 |
17,265 | haifengl/smile | core/src/main/java/smile/classification/NeuralNetwork.java | NeuralNetwork.backpropagate | private void backpropagate() {
for (int l = net.length; --l > 0;) {
backpropagate(net[l], net[l - 1]);
}
} | java | private void backpropagate() {
for (int l = net.length; --l > 0;) {
backpropagate(net[l], net[l - 1]);
}
} | [
"private",
"void",
"backpropagate",
"(",
")",
"{",
"for",
"(",
"int",
"l",
"=",
"net",
".",
"length",
";",
"--",
"l",
">",
"0",
";",
")",
"{",
"backpropagate",
"(",
"net",
"[",
"l",
"]",
",",
"net",
"[",
"l",
"-",
"1",
"]",
")",
";",
"}",
"... | Propagates the errors back through the network. | [
"Propagates",
"the",
"errors",
"back",
"through",
"the",
"network",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/classification/NeuralNetwork.java#L752-L756 |
17,266 | haifengl/smile | core/src/main/java/smile/classification/NeuralNetwork.java | NeuralNetwork.adjustWeights | private void adjustWeights() {
for (int l = 1; l < net.length; l++) {
for (int i = 0; i < net[l].units; i++) {
for (int j = 0; j <= net[l - 1].units; j++) {
double out = net[l - 1].output[j];
double err = net[l].error[i];
do... | java | private void adjustWeights() {
for (int l = 1; l < net.length; l++) {
for (int i = 0; i < net[l].units; i++) {
for (int j = 0; j <= net[l - 1].units; j++) {
double out = net[l - 1].output[j];
double err = net[l].error[i];
do... | [
"private",
"void",
"adjustWeights",
"(",
")",
"{",
"for",
"(",
"int",
"l",
"=",
"1",
";",
"l",
"<",
"net",
".",
"length",
";",
"l",
"++",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"net",
"[",
"l",
"]",
".",
"units",
";",
... | Adjust network weights by back-propagation algorithm. | [
"Adjust",
"network",
"weights",
"by",
"back",
"-",
"propagation",
"algorithm",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/classification/NeuralNetwork.java#L761-L776 |
17,267 | haifengl/smile | core/src/main/java/smile/classification/NeuralNetwork.java | NeuralNetwork.predict | @Override
public int predict(double[] x, double[] y) {
setInput(x);
propagate();
getOutput(y);
if (outputLayer.units == 1) {
if (outputLayer.output[0] > 0.5) {
return 0;
} else {
return 1;
}
}
doubl... | java | @Override
public int predict(double[] x, double[] y) {
setInput(x);
propagate();
getOutput(y);
if (outputLayer.units == 1) {
if (outputLayer.output[0] > 0.5) {
return 0;
} else {
return 1;
}
}
doubl... | [
"@",
"Override",
"public",
"int",
"predict",
"(",
"double",
"[",
"]",
"x",
",",
"double",
"[",
"]",
"y",
")",
"{",
"setInput",
"(",
"x",
")",
";",
"propagate",
"(",
")",
";",
"getOutput",
"(",
"y",
")",
";",
"if",
"(",
"outputLayer",
".",
"units"... | Predict the target value of a given instance. Note that this method is NOT
multi-thread safe.
@param x the instance.
@param y the array to store network output on output. For softmax
activation function, these are estimated posteriori probabilities.
@return the predicted class label. | [
"Predict",
"the",
"target",
"value",
"of",
"a",
"given",
"instance",
".",
"Note",
"that",
"this",
"method",
"is",
"NOT",
"multi",
"-",
"thread",
"safe",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/classification/NeuralNetwork.java#L786-L809 |
17,268 | haifengl/smile | core/src/main/java/smile/classification/NeuralNetwork.java | NeuralNetwork.learn | public double learn(double[] x, double[] y, double weight) {
setInput(x);
propagate();
double err = weight * computeOutputError(y);
if (weight != 1.0) {
for (int i = 0; i < outputLayer.units; i++) {
outputLayer.error[i] *= weight;
}
}
... | java | public double learn(double[] x, double[] y, double weight) {
setInput(x);
propagate();
double err = weight * computeOutputError(y);
if (weight != 1.0) {
for (int i = 0; i < outputLayer.units; i++) {
outputLayer.error[i] *= weight;
}
}
... | [
"public",
"double",
"learn",
"(",
"double",
"[",
"]",
"x",
",",
"double",
"[",
"]",
"y",
",",
"double",
"weight",
")",
"{",
"setInput",
"(",
"x",
")",
";",
"propagate",
"(",
")",
";",
"double",
"err",
"=",
"weight",
"*",
"computeOutputError",
"(",
... | Update the neural network with given instance and associated target value.
Note that this method is NOT multi-thread safe.
@param x the training instance.
@param y the target value.
@param weight a positive weight value associated with the training instance.
@return the weighted training error before back-propagation. | [
"Update",
"the",
"neural",
"network",
"with",
"given",
"instance",
"and",
"associated",
"target",
"value",
".",
"Note",
"that",
"this",
"method",
"is",
"NOT",
"multi",
"-",
"thread",
"safe",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/classification/NeuralNetwork.java#L849-L864 |
17,269 | haifengl/smile | core/src/main/java/smile/classification/NeuralNetwork.java | NeuralNetwork.learn | public void learn(double[] x, int y, double weight) {
if (weight < 0.0) {
throw new IllegalArgumentException("Invalid weight: " + weight);
}
if (weight == 0.0) {
logger.info("Ignore the training instance with zero weight.");
return;
}
... | java | public void learn(double[] x, int y, double weight) {
if (weight < 0.0) {
throw new IllegalArgumentException("Invalid weight: " + weight);
}
if (weight == 0.0) {
logger.info("Ignore the training instance with zero weight.");
return;
}
... | [
"public",
"void",
"learn",
"(",
"double",
"[",
"]",
"x",
",",
"int",
"y",
",",
"double",
"weight",
")",
"{",
"if",
"(",
"weight",
"<",
"0.0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid weight: \"",
"+",
"weight",
")",
";",
"}... | Online update the neural network with a new training instance.
Note that this method is NOT multi-thread safe.
@param x training instance.
@param y training label.
@param weight a positive weight value associated with the training instance. | [
"Online",
"update",
"the",
"neural",
"network",
"with",
"a",
"new",
"training",
"instance",
".",
"Note",
"that",
"this",
"method",
"is",
"NOT",
"multi",
"-",
"thread",
"safe",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/classification/NeuralNetwork.java#L879-L922 |
17,270 | haifengl/smile | core/src/main/java/smile/classification/NeuralNetwork.java | NeuralNetwork.learn | public void learn(double[][] x, int[] y) {
int n = x.length;
int[] index = Math.permutate(n);
for (int i = 0; i < n; i++) {
learn(x[index[i]], y[index[i]]);
}
} | java | public void learn(double[][] x, int[] y) {
int n = x.length;
int[] index = Math.permutate(n);
for (int i = 0; i < n; i++) {
learn(x[index[i]], y[index[i]]);
}
} | [
"public",
"void",
"learn",
"(",
"double",
"[",
"]",
"[",
"]",
"x",
",",
"int",
"[",
"]",
"y",
")",
"{",
"int",
"n",
"=",
"x",
".",
"length",
";",
"int",
"[",
"]",
"index",
"=",
"Math",
".",
"permutate",
"(",
"n",
")",
";",
"for",
"(",
"int"... | Trains the neural network with the given dataset for one epoch by
stochastic gradient descent.
@param x training instances.
@param y training labels in [0, k), where k is the number of classes. | [
"Trains",
"the",
"neural",
"network",
"with",
"the",
"given",
"dataset",
"for",
"one",
"epoch",
"by",
"stochastic",
"gradient",
"descent",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/classification/NeuralNetwork.java#L931-L937 |
17,271 | haifengl/smile | plot/src/main/java/smile/plot/Grid.java | Grid.plot | public static PlotCanvas plot(String id, double[][][] data) {
double[] lowerBound = {data[0][0][0], data[0][0][1]};
double[] upperBound = {data[0][0][0], data[0][0][1]};
for (int i = 0; i < data.length; i++) {
for (int j = 0; j < data[i].length; j++) {
if (data[i][j][... | java | public static PlotCanvas plot(String id, double[][][] data) {
double[] lowerBound = {data[0][0][0], data[0][0][1]};
double[] upperBound = {data[0][0][0], data[0][0][1]};
for (int i = 0; i < data.length; i++) {
for (int j = 0; j < data[i].length; j++) {
if (data[i][j][... | [
"public",
"static",
"PlotCanvas",
"plot",
"(",
"String",
"id",
",",
"double",
"[",
"]",
"[",
"]",
"[",
"]",
"data",
")",
"{",
"double",
"[",
"]",
"lowerBound",
"=",
"{",
"data",
"[",
"0",
"]",
"[",
"0",
"]",
"[",
"0",
"]",
",",
"data",
"[",
"... | Create a 2D grid plot canvas.
@param id the id of the plot.
@param data an m x n x 2 array which are coordinates of m x n grid. | [
"Create",
"a",
"2D",
"grid",
"plot",
"canvas",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Grid.java#L113-L140 |
17,272 | haifengl/smile | demo/src/main/java/smile/demo/projection/LDADemo.java | LDADemo.learn | public JComponent learn() {
double[][] data = dataset[datasetIndex].toArray(new double[dataset[datasetIndex].size()][]);
String[] names = dataset[datasetIndex].toArray(new String[dataset[datasetIndex].size()]);
if (names[0] == null) {
names = null;
}
int[] l... | java | public JComponent learn() {
double[][] data = dataset[datasetIndex].toArray(new double[dataset[datasetIndex].size()][]);
String[] names = dataset[datasetIndex].toArray(new String[dataset[datasetIndex].size()]);
if (names[0] == null) {
names = null;
}
int[] l... | [
"public",
"JComponent",
"learn",
"(",
")",
"{",
"double",
"[",
"]",
"[",
"]",
"data",
"=",
"dataset",
"[",
"datasetIndex",
"]",
".",
"toArray",
"(",
"new",
"double",
"[",
"dataset",
"[",
"datasetIndex",
"]",
".",
"size",
"(",
")",
"]",
"[",
"",
"]"... | Execute the projection algorithm and return a swing JComponent representing
the clusters. | [
"Execute",
"the",
"projection",
"algorithm",
"and",
"return",
"a",
"swing",
"JComponent",
"representing",
"the",
"clusters",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/demo/src/main/java/smile/demo/projection/LDADemo.java#L90-L124 |
17,273 | haifengl/smile | math/src/main/java/smile/math/matrix/EVD.java | EVD.getD | public DenseMatrix getD() {
int n = V.nrows();
DenseMatrix D = Matrix.zeros(n, n);
for (int i = 0; i < n; i++) {
D.set(i, i, d[i]);
if (e != null) {
if (e[i] > 0) {
D.set(i, i + 1, e[i]);
} else if (e[i] < 0) {
... | java | public DenseMatrix getD() {
int n = V.nrows();
DenseMatrix D = Matrix.zeros(n, n);
for (int i = 0; i < n; i++) {
D.set(i, i, d[i]);
if (e != null) {
if (e[i] > 0) {
D.set(i, i + 1, e[i]);
} else if (e[i] < 0) {
... | [
"public",
"DenseMatrix",
"getD",
"(",
")",
"{",
"int",
"n",
"=",
"V",
".",
"nrows",
"(",
")",
";",
"DenseMatrix",
"D",
"=",
"Matrix",
".",
"zeros",
"(",
"n",
",",
"n",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i"... | Returns the block diagonal eigenvalue matrix whose diagonal are the real
part of eigenvalues, lower subdiagonal are positive imaginary parts, and
upper subdiagonal are negative imaginary parts. | [
"Returns",
"the",
"block",
"diagonal",
"eigenvalue",
"matrix",
"whose",
"diagonal",
"are",
"the",
"real",
"part",
"of",
"eigenvalues",
"lower",
"subdiagonal",
"are",
"positive",
"imaginary",
"parts",
"and",
"upper",
"subdiagonal",
"are",
"negative",
"imaginary",
"... | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/matrix/EVD.java#L153-L167 |
17,274 | haifengl/smile | plot/src/main/java/smile/plot/Palette.java | Palette.terrain | public static Color[] terrain(int n, float alpha) {
int k = n / 2;
float[] H = {4 / 12f, 2 / 12f, 0 / 12f};
float[] S = {1f, 1f, 0f};
float[] V = {0.65f, 0.9f, 0.95f};
Color[] palette = new Color[n];
float h = H[0];
float hw = (H[1] - H[0]) / (k - 1);
f... | java | public static Color[] terrain(int n, float alpha) {
int k = n / 2;
float[] H = {4 / 12f, 2 / 12f, 0 / 12f};
float[] S = {1f, 1f, 0f};
float[] V = {0.65f, 0.9f, 0.95f};
Color[] palette = new Color[n];
float h = H[0];
float hw = (H[1] - H[0]) / (k - 1);
f... | [
"public",
"static",
"Color",
"[",
"]",
"terrain",
"(",
"int",
"n",
",",
"float",
"alpha",
")",
"{",
"int",
"k",
"=",
"n",
"/",
"2",
";",
"float",
"[",
"]",
"H",
"=",
"{",
"4",
"/",
"12f",
",",
"2",
"/",
"12f",
",",
"0",
"/",
"12f",
"}",
"... | Generate terrain color palette.
@param n the number of colors in the palette.
@param alpha the parameter in [0,1] for transparency. | [
"Generate",
"terrain",
"color",
"palette",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Palette.java#L129-L174 |
17,275 | haifengl/smile | plot/src/main/java/smile/plot/Palette.java | Palette.topo | public static Color[] topo(int n, float alpha) {
int j = n / 3;
int k = n / 3;
int i = n - j - k;
Color[] palette = new Color[n];
float h = 43 / 60.0f;
float hw = (31 / 60.0f - h) / (i - 1);
int l = 0;
for (; l < i; l++) {
palette[l] = hsv(h,... | java | public static Color[] topo(int n, float alpha) {
int j = n / 3;
int k = n / 3;
int i = n - j - k;
Color[] palette = new Color[n];
float h = 43 / 60.0f;
float hw = (31 / 60.0f - h) / (i - 1);
int l = 0;
for (; l < i; l++) {
palette[l] = hsv(h,... | [
"public",
"static",
"Color",
"[",
"]",
"topo",
"(",
"int",
"n",
",",
"float",
"alpha",
")",
"{",
"int",
"j",
"=",
"n",
"/",
"3",
";",
"int",
"k",
"=",
"n",
"/",
"3",
";",
"int",
"i",
"=",
"n",
"-",
"j",
"-",
"k",
";",
"Color",
"[",
"]",
... | Generate topo color palette.
@param n the number of colors in the palette.
@param alpha the parameter in [0,1] for transparency. | [
"Generate",
"topo",
"color",
"palette",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Palette.java#L189-L222 |
17,276 | haifengl/smile | plot/src/main/java/smile/plot/Palette.java | Palette.jet | public static Color[] jet(int n, float alpha) {
int m = (int) Math.ceil(n / 4);
float[] u = new float[3 * m];
for (int i = 0; i < u.length; i++) {
if (i == 0) {
u[i] = 0.0f;
} else if (i <= m) {
u[i] = i / (float) m;
} else if ... | java | public static Color[] jet(int n, float alpha) {
int m = (int) Math.ceil(n / 4);
float[] u = new float[3 * m];
for (int i = 0; i < u.length; i++) {
if (i == 0) {
u[i] = 0.0f;
} else if (i <= m) {
u[i] = i / (float) m;
} else if ... | [
"public",
"static",
"Color",
"[",
"]",
"jet",
"(",
"int",
"n",
",",
"float",
"alpha",
")",
"{",
"int",
"m",
"=",
"(",
"int",
")",
"Math",
".",
"ceil",
"(",
"n",
"/",
"4",
")",
";",
"float",
"[",
"]",
"u",
"=",
"new",
"float",
"[",
"3",
"*",... | Generate jet color palette.
@param n the number of colors in the palette.
@param alpha the parameter in [0,1] for transparency. | [
"Generate",
"jet",
"color",
"palette",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Palette.java#L237-L277 |
17,277 | haifengl/smile | plot/src/main/java/smile/plot/Palette.java | Palette.redgreen | public static Color[] redgreen(int n, float alpha) {
Color[] palette = new Color[n];
for (int i = 0; i < n; i++) {
palette[i] = new Color((float) Math.sqrt((i + 1.0f) / n), (float) Math.sqrt(1 - (i + 1.0f) / n), 0.0f, alpha);
}
return palette;
} | java | public static Color[] redgreen(int n, float alpha) {
Color[] palette = new Color[n];
for (int i = 0; i < n; i++) {
palette[i] = new Color((float) Math.sqrt((i + 1.0f) / n), (float) Math.sqrt(1 - (i + 1.0f) / n), 0.0f, alpha);
}
return palette;
} | [
"public",
"static",
"Color",
"[",
"]",
"redgreen",
"(",
"int",
"n",
",",
"float",
"alpha",
")",
"{",
"Color",
"[",
"]",
"palette",
"=",
"new",
"Color",
"[",
"n",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
... | Generate red-green color palette.
@param n the number of colors in the palette.
@param alpha the parameter in [0,1] for transparency. | [
"Generate",
"red",
"-",
"green",
"color",
"palette",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Palette.java#L292-L299 |
17,278 | haifengl/smile | plot/src/main/java/smile/plot/Palette.java | Palette.redblue | public static Color[] redblue(int n, float alpha) {
Color[] palette = new Color[n];
for (int i = 0; i < n; i++) {
palette[i] = new Color((float) Math.sqrt((i + 1.0f) / n), 0.0f, (float) Math.sqrt(1 - (i + 1.0f) / n), alpha);
}
return palette;
} | java | public static Color[] redblue(int n, float alpha) {
Color[] palette = new Color[n];
for (int i = 0; i < n; i++) {
palette[i] = new Color((float) Math.sqrt((i + 1.0f) / n), 0.0f, (float) Math.sqrt(1 - (i + 1.0f) / n), alpha);
}
return palette;
} | [
"public",
"static",
"Color",
"[",
"]",
"redblue",
"(",
"int",
"n",
",",
"float",
"alpha",
")",
"{",
"Color",
"[",
"]",
"palette",
"=",
"new",
"Color",
"[",
"n",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
... | Generate red-blue color palette.
@param n the number of colors in the palette.
@param alpha the parameter in [0,1] for transparency. | [
"Generate",
"red",
"-",
"blue",
"color",
"palette",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Palette.java#L314-L321 |
17,279 | haifengl/smile | plot/src/main/java/smile/plot/Palette.java | Palette.heat | public static Color[] heat(int n, float alpha) {
int j = n / 4;
int k = n - j;
float h = 1.0f / 6;
Color[] c = rainbow(k, 0, h, alpha);
Color[] palette = new Color[n];
System.arraycopy(c, 0, palette, 0, k);
float s = 1 - 1.0f / (2 * j);
float end = 1.0f... | java | public static Color[] heat(int n, float alpha) {
int j = n / 4;
int k = n - j;
float h = 1.0f / 6;
Color[] c = rainbow(k, 0, h, alpha);
Color[] palette = new Color[n];
System.arraycopy(c, 0, palette, 0, k);
float s = 1 - 1.0f / (2 * j);
float end = 1.0f... | [
"public",
"static",
"Color",
"[",
"]",
"heat",
"(",
"int",
"n",
",",
"float",
"alpha",
")",
"{",
"int",
"j",
"=",
"n",
"/",
"4",
";",
"int",
"k",
"=",
"n",
"-",
"j",
";",
"float",
"h",
"=",
"1.0f",
"/",
"6",
";",
"Color",
"[",
"]",
"c",
"... | Generate heat color palette.
@param n the number of colors in the palette.
@param alpha the parameter in [0,1] for transparency. | [
"Generate",
"heat",
"color",
"palette",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Palette.java#L336-L356 |
17,280 | haifengl/smile | plot/src/main/java/smile/plot/Palette.java | Palette.hsv | private static Color hsv(float h, float s, float v, float alpha) {
float r = 0;
float g = 0;
float b = 0;
if (s == 0) {
// this color in on the black white center line <=> h = UNDEFINED
// Achromatic color, there is no hue
r = v;
g = v;
... | java | private static Color hsv(float h, float s, float v, float alpha) {
float r = 0;
float g = 0;
float b = 0;
if (s == 0) {
// this color in on the black white center line <=> h = UNDEFINED
// Achromatic color, there is no hue
r = v;
g = v;
... | [
"private",
"static",
"Color",
"hsv",
"(",
"float",
"h",
",",
"float",
"s",
",",
"float",
"v",
",",
"float",
"alpha",
")",
"{",
"float",
"r",
"=",
"0",
";",
"float",
"g",
"=",
"0",
";",
"float",
"b",
"=",
"0",
";",
"if",
"(",
"s",
"==",
"0",
... | Generate a color based on HSV model. | [
"Generate",
"a",
"color",
"based",
"on",
"HSV",
"model",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Palette.java#L410-L476 |
17,281 | haifengl/smile | nlp/src/main/java/smile/nlp/pos/HMMPOSTagger.java | HMMPOSTagger.getDefault | public static HMMPOSTagger getDefault() {
if (DEFAULT_TAGGER == null) {
try {
ObjectInputStream ois = new ObjectInputStream(HMMPOSTagger.class.getResourceAsStream("/smile/nlp/pos/hmmpostagger.model"));
DEFAULT_TAGGER = (HMMPOSTagger) ois.readObject();
... | java | public static HMMPOSTagger getDefault() {
if (DEFAULT_TAGGER == null) {
try {
ObjectInputStream ois = new ObjectInputStream(HMMPOSTagger.class.getResourceAsStream("/smile/nlp/pos/hmmpostagger.model"));
DEFAULT_TAGGER = (HMMPOSTagger) ois.readObject();
... | [
"public",
"static",
"HMMPOSTagger",
"getDefault",
"(",
")",
"{",
"if",
"(",
"DEFAULT_TAGGER",
"==",
"null",
")",
"{",
"try",
"{",
"ObjectInputStream",
"ois",
"=",
"new",
"ObjectInputStream",
"(",
"HMMPOSTagger",
".",
"class",
".",
"getResourceAsStream",
"(",
"... | Returns the default English POS tagger.
@return the default English POS tagger | [
"Returns",
"the",
"default",
"English",
"POS",
"tagger",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/nlp/src/main/java/smile/nlp/pos/HMMPOSTagger.java#L117-L128 |
17,282 | haifengl/smile | nlp/src/main/java/smile/nlp/pos/HMMPOSTagger.java | HMMPOSTagger.translate | private static int[] translate(PennTreebankPOS[] tags) {
int[] seq = new int[tags.length];
for (int i = 0; i < tags.length; i++) {
seq[i] = tags[i].ordinal();
}
return seq;
} | java | private static int[] translate(PennTreebankPOS[] tags) {
int[] seq = new int[tags.length];
for (int i = 0; i < tags.length; i++) {
seq[i] = tags[i].ordinal();
}
return seq;
} | [
"private",
"static",
"int",
"[",
"]",
"translate",
"(",
"PennTreebankPOS",
"[",
"]",
"tags",
")",
"{",
"int",
"[",
"]",
"seq",
"=",
"new",
"int",
"[",
"tags",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"tags",
"."... | Translate a POS tag sequence to internal representation. | [
"Translate",
"a",
"POS",
"tag",
"sequence",
"to",
"internal",
"representation",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/nlp/src/main/java/smile/nlp/pos/HMMPOSTagger.java#L262-L270 |
17,283 | haifengl/smile | nlp/src/main/java/smile/nlp/pos/HMMPOSTagger.java | HMMPOSTagger.load | public static void load(String dir, List<String[]> sentences, List<PennTreebankPOS[]> labels) {
List<File> files = new ArrayList<>();
walkin(new File(dir), files);
for (File file : files) {
try {
FileInputStream stream = new FileInputStream(file);
Buf... | java | public static void load(String dir, List<String[]> sentences, List<PennTreebankPOS[]> labels) {
List<File> files = new ArrayList<>();
walkin(new File(dir), files);
for (File file : files) {
try {
FileInputStream stream = new FileInputStream(file);
Buf... | [
"public",
"static",
"void",
"load",
"(",
"String",
"dir",
",",
"List",
"<",
"String",
"[",
"]",
">",
"sentences",
",",
"List",
"<",
"PennTreebankPOS",
"[",
"]",
">",
"labels",
")",
"{",
"List",
"<",
"File",
">",
"files",
"=",
"new",
"ArrayList",
"<>"... | Load training data from a corpora.
@param dir a file object defining the top directory | [
"Load",
"training",
"data",
"from",
"a",
"corpora",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/nlp/src/main/java/smile/nlp/pos/HMMPOSTagger.java#L344-L393 |
17,284 | haifengl/smile | nlp/src/main/java/smile/nlp/pos/HMMPOSTagger.java | HMMPOSTagger.walkin | public static void walkin(File dir, List<File> files) {
String pattern = ".POS";
File[] listFile = dir.listFiles();
if (listFile != null) {
for (File file : listFile) {
if (file.isDirectory()) {
walkin(file, files);
... | java | public static void walkin(File dir, List<File> files) {
String pattern = ".POS";
File[] listFile = dir.listFiles();
if (listFile != null) {
for (File file : listFile) {
if (file.isDirectory()) {
walkin(file, files);
... | [
"public",
"static",
"void",
"walkin",
"(",
"File",
"dir",
",",
"List",
"<",
"File",
">",
"files",
")",
"{",
"String",
"pattern",
"=",
"\".POS\"",
";",
"File",
"[",
"]",
"listFile",
"=",
"dir",
".",
"listFiles",
"(",
")",
";",
"if",
"(",
"listFile",
... | Recursive function to descend into the directory tree and find all the files
that end with ".POS"
@param dir a file object defining the top directory | [
"Recursive",
"function",
"to",
"descend",
"into",
"the",
"directory",
"tree",
"and",
"find",
"all",
"the",
"files",
"that",
"end",
"with",
".",
"POS"
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/nlp/src/main/java/smile/nlp/pos/HMMPOSTagger.java#L400-L414 |
17,285 | haifengl/smile | nlp/src/main/java/smile/nlp/pos/HMMPOSTagger.java | HMMPOSTagger.main | public static void main(String[] argvs) {
List<String[]> sentences = new ArrayList<>();
List<PennTreebankPOS[]> labels = new ArrayList<>();
load("D:\\sourceforge\\corpora\\PennTreebank\\PennTreebank2\\TAGGED\\POS\\WSJ", sentences, labels);
load("D:\\sourceforge\\corpora\... | java | public static void main(String[] argvs) {
List<String[]> sentences = new ArrayList<>();
List<PennTreebankPOS[]> labels = new ArrayList<>();
load("D:\\sourceforge\\corpora\\PennTreebank\\PennTreebank2\\TAGGED\\POS\\WSJ", sentences, labels);
load("D:\\sourceforge\\corpora\... | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"argvs",
")",
"{",
"List",
"<",
"String",
"[",
"]",
">",
"sentences",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"List",
"<",
"PennTreebankPOS",
"[",
"]",
">",
"labels",
"=",
"new",
"A... | Train the default model on WSJ and BROWN datasets. | [
"Train",
"the",
"default",
"model",
"on",
"WSJ",
"and",
"BROWN",
"datasets",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/nlp/src/main/java/smile/nlp/pos/HMMPOSTagger.java#L419-L440 |
17,286 | haifengl/smile | math/src/main/java/smile/sort/QuickSort.java | QuickSort.sort | public static <T extends Comparable<? super T>> int[] sort(T[] arr) {
int[] order = new int[arr.length];
for (int i = 0; i < order.length; i++) {
order[i] = i;
}
sort(arr, order);
return order;
} | java | public static <T extends Comparable<? super T>> int[] sort(T[] arr) {
int[] order = new int[arr.length];
for (int i = 0; i < order.length; i++) {
order[i] = i;
}
sort(arr, order);
return order;
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"int",
"[",
"]",
"sort",
"(",
"T",
"[",
"]",
"arr",
")",
"{",
"int",
"[",
"]",
"order",
"=",
"new",
"int",
"[",
"arr",
".",
"length",
"]",
";",
"for",
"(... | Sorts the specified array into ascending order.
@return the original index of elements after sorting in range [0, n). | [
"Sorts",
"the",
"specified",
"array",
"into",
"ascending",
"order",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/sort/QuickSort.java#L886-L893 |
17,287 | haifengl/smile | math/src/main/java/smile/sort/QuickSort.java | QuickSort.sort | public static <T extends Comparable<? super T>> void sort(T[] arr, int[] brr) {
sort(arr, brr, arr.length);
} | java | public static <T extends Comparable<? super T>> void sort(T[] arr, int[] brr) {
sort(arr, brr, arr.length);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"void",
"sort",
"(",
"T",
"[",
"]",
"arr",
",",
"int",
"[",
"]",
"brr",
")",
"{",
"sort",
"(",
"arr",
",",
"brr",
",",
"arr",
".",
"length",
")",
";",
"}... | Besides sorting the array arr, the array brr will be also
rearranged as the same order of arr. | [
"Besides",
"sorting",
"the",
"array",
"arr",
"the",
"array",
"brr",
"will",
"be",
"also",
"rearranged",
"as",
"the",
"same",
"order",
"of",
"arr",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/sort/QuickSort.java#L899-L901 |
17,288 | haifengl/smile | data/src/main/java/smile/data/SparseDataset.java | SparseDataset.set | public void set(int i, int y) {
if (response == null) {
throw new IllegalArgumentException("The dataset has no response values.");
}
if (response.getType() != Attribute.Type.NOMINAL) {
throw new IllegalArgumentException("The response variable is not n... | java | public void set(int i, int y) {
if (response == null) {
throw new IllegalArgumentException("The dataset has no response values.");
}
if (response.getType() != Attribute.Type.NOMINAL) {
throw new IllegalArgumentException("The response variable is not n... | [
"public",
"void",
"set",
"(",
"int",
"i",
",",
"int",
"y",
")",
"{",
"if",
"(",
"response",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The dataset has no response values.\"",
")",
";",
"}",
"if",
"(",
"response",
".",
"getT... | Set the class label of a datum. If the index
exceeds the current matrix size, the matrix will resize itself.
@param i the row index of entry.
@param y the class label or real-valued response of the datum. | [
"Set",
"the",
"class",
"label",
"of",
"a",
"datum",
".",
"If",
"the",
"index",
"exceeds",
"the",
"current",
"matrix",
"size",
"the",
"matrix",
"will",
"resize",
"itself",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/data/src/main/java/smile/data/SparseDataset.java#L190-L211 |
17,289 | haifengl/smile | data/src/main/java/smile/data/SparseDataset.java | SparseDataset.set | public void set(int i, double y, double weight) {
if (i < 0) {
throw new IllegalArgumentException("Invalid index: i = " + i);
}
int nrows = size();
if (i >= nrows) {
for (int k = nrows; k <= i; k++) {
data.add(new Datum<>(new SparseArray()));
... | java | public void set(int i, double y, double weight) {
if (i < 0) {
throw new IllegalArgumentException("Invalid index: i = " + i);
}
int nrows = size();
if (i >= nrows) {
for (int k = nrows; k <= i; k++) {
data.add(new Datum<>(new SparseArray()));
... | [
"public",
"void",
"set",
"(",
"int",
"i",
",",
"double",
"y",
",",
"double",
"weight",
")",
"{",
"if",
"(",
"i",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid index: i = \"",
"+",
"i",
")",
";",
"}",
"int",
"nrows",
... | Set the class label of real-valued response of a datum. If the index
exceeds the current matrix size, the matrix will resize itself.
@param i the row index of entry.
@param y the class label or real-valued response of the datum.
@param weight the optional weight of the datum. | [
"Set",
"the",
"class",
"label",
"of",
"real",
"-",
"valued",
"response",
"of",
"a",
"datum",
".",
"If",
"the",
"index",
"exceeds",
"the",
"current",
"matrix",
"size",
"the",
"matrix",
"will",
"resize",
"itself",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/data/src/main/java/smile/data/SparseDataset.java#L249-L264 |
17,290 | haifengl/smile | data/src/main/java/smile/data/SparseDataset.java | SparseDataset.set | public void set(int i, int j, double x) {
if (i < 0 || j < 0) {
throw new IllegalArgumentException("Invalid index: i = " + i + " j = " + j);
}
int nrows = size();
if (i >= nrows) {
for (int k = nrows; k <= i; k++) {
data.add(new Datum<>(new Sparse... | java | public void set(int i, int j, double x) {
if (i < 0 || j < 0) {
throw new IllegalArgumentException("Invalid index: i = " + i + " j = " + j);
}
int nrows = size();
if (i >= nrows) {
for (int k = nrows; k <= i; k++) {
data.add(new Datum<>(new Sparse... | [
"public",
"void",
"set",
"(",
"int",
"i",
",",
"int",
"j",
",",
"double",
"x",
")",
"{",
"if",
"(",
"i",
"<",
"0",
"||",
"j",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid index: i = \"",
"+",
"i",
"+",
"\" j = \"",
... | Set a nonzero entry into the matrix. If the index exceeds the current
matrix size, the matrix will resize itself.
@param i the row index of entry.
@param j the column index of entry.
@param x the value of entry. | [
"Set",
"a",
"nonzero",
"entry",
"into",
"the",
"matrix",
".",
"If",
"the",
"index",
"exceeds",
"the",
"current",
"matrix",
"size",
"the",
"matrix",
"will",
"resize",
"itself",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/data/src/main/java/smile/data/SparseDataset.java#L273-L298 |
17,291 | haifengl/smile | data/src/main/java/smile/data/SparseDataset.java | SparseDataset.remove | public Datum<SparseArray> remove(int i) {
Datum<SparseArray> datum = data.remove(i);
n -= datum.x.size();
for (SparseArray.Entry item : datum.x) {
colSize[item.i]--;
}
return datum;
} | java | public Datum<SparseArray> remove(int i) {
Datum<SparseArray> datum = data.remove(i);
n -= datum.x.size();
for (SparseArray.Entry item : datum.x) {
colSize[item.i]--;
}
return datum;
} | [
"public",
"Datum",
"<",
"SparseArray",
">",
"remove",
"(",
"int",
"i",
")",
"{",
"Datum",
"<",
"SparseArray",
">",
"datum",
"=",
"data",
".",
"remove",
"(",
"i",
")",
";",
"n",
"-=",
"datum",
".",
"x",
".",
"size",
"(",
")",
";",
"for",
"(",
"S... | Removes the element at the specified position in this dataset.
@param i the index of the element to be removed.
@return the element previously at the specified position. | [
"Removes",
"the",
"element",
"at",
"the",
"specified",
"position",
"in",
"this",
"dataset",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/data/src/main/java/smile/data/SparseDataset.java#L332-L341 |
17,292 | haifengl/smile | data/src/main/java/smile/data/SparseDataset.java | SparseDataset.unitize | public void unitize() {
for (Datum<SparseArray> row : this) {
double sum = 0.0;
for (SparseArray.Entry e : row.x) {
sum += Math.sqr(e.x);
}
sum = Math.sqrt(sum);
for (SparseArray.Entry e : row.x) {
e.x /= sum;
... | java | public void unitize() {
for (Datum<SparseArray> row : this) {
double sum = 0.0;
for (SparseArray.Entry e : row.x) {
sum += Math.sqr(e.x);
}
sum = Math.sqrt(sum);
for (SparseArray.Entry e : row.x) {
e.x /= sum;
... | [
"public",
"void",
"unitize",
"(",
")",
"{",
"for",
"(",
"Datum",
"<",
"SparseArray",
">",
"row",
":",
"this",
")",
"{",
"double",
"sum",
"=",
"0.0",
";",
"for",
"(",
"SparseArray",
".",
"Entry",
"e",
":",
"row",
".",
"x",
")",
"{",
"sum",
"+=",
... | Unitize each row so that L2 norm of x = 1. | [
"Unitize",
"each",
"row",
"so",
"that",
"L2",
"norm",
"of",
"x",
"=",
"1",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/data/src/main/java/smile/data/SparseDataset.java#L346-L360 |
17,293 | haifengl/smile | data/src/main/java/smile/data/SparseDataset.java | SparseDataset.unitize1 | public void unitize1() {
for (Datum<SparseArray> row : this) {
double sum = 0.0;
for (SparseArray.Entry e : row.x) {
sum += Math.abs(e.x);
}
for (SparseArray.Entry e : row.x) {
e.x /= sum;
}
}
} | java | public void unitize1() {
for (Datum<SparseArray> row : this) {
double sum = 0.0;
for (SparseArray.Entry e : row.x) {
sum += Math.abs(e.x);
}
for (SparseArray.Entry e : row.x) {
e.x /= sum;
}
}
} | [
"public",
"void",
"unitize1",
"(",
")",
"{",
"for",
"(",
"Datum",
"<",
"SparseArray",
">",
"row",
":",
"this",
")",
"{",
"double",
"sum",
"=",
"0.0",
";",
"for",
"(",
"SparseArray",
".",
"Entry",
"e",
":",
"row",
".",
"x",
")",
"{",
"sum",
"+=",
... | Unitize each row so that L1 norm of x is 1. | [
"Unitize",
"each",
"row",
"so",
"that",
"L1",
"norm",
"of",
"x",
"is",
"1",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/data/src/main/java/smile/data/SparseDataset.java#L365-L377 |
17,294 | haifengl/smile | data/src/main/java/smile/data/SparseDataset.java | SparseDataset.iterator | @Override
public Iterator<Datum<SparseArray>> iterator() {
return new Iterator<Datum<SparseArray>>() {
/**
* Current position.
*/
int i = 0;
@Override
public boolean hasNext() {
return i < data.size();
}
... | java | @Override
public Iterator<Datum<SparseArray>> iterator() {
return new Iterator<Datum<SparseArray>>() {
/**
* Current position.
*/
int i = 0;
@Override
public boolean hasNext() {
return i < data.size();
}
... | [
"@",
"Override",
"public",
"Iterator",
"<",
"Datum",
"<",
"SparseArray",
">",
">",
"iterator",
"(",
")",
"{",
"return",
"new",
"Iterator",
"<",
"Datum",
"<",
"SparseArray",
">",
">",
"(",
")",
"{",
"/**\n * Current position.\n */",
"int",... | Returns an iterator over the elements in this dataset in proper sequence.
@return an iterator over the elements in this dataset in proper sequence | [
"Returns",
"an",
"iterator",
"over",
"the",
"elements",
"in",
"this",
"dataset",
"in",
"proper",
"sequence",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/data/src/main/java/smile/data/SparseDataset.java#L411-L435 |
17,295 | haifengl/smile | data/src/main/java/smile/data/SparseDataset.java | SparseDataset.toArray | public double[][] toArray() {
int m = data.size();
double[][] a = new double[m][ncols()];
for (int i = 0; i < m; i++) {
for (SparseArray.Entry item : get(i).x) {
a[i][item.i] = item.x;
}
}
return a;
} | java | public double[][] toArray() {
int m = data.size();
double[][] a = new double[m][ncols()];
for (int i = 0; i < m; i++) {
for (SparseArray.Entry item : get(i).x) {
a[i][item.i] = item.x;
}
}
return a;
} | [
"public",
"double",
"[",
"]",
"[",
"]",
"toArray",
"(",
")",
"{",
"int",
"m",
"=",
"data",
".",
"size",
"(",
")",
";",
"double",
"[",
"]",
"[",
"]",
"a",
"=",
"new",
"double",
"[",
"m",
"]",
"[",
"ncols",
"(",
")",
"]",
";",
"for",
"(",
"... | Returns a dense two-dimensional array containing the whole matrix in
this dataset in proper sequence.
@return a dense two-dimensional array containing the whole matrix in
this dataset in proper sequence. | [
"Returns",
"a",
"dense",
"two",
"-",
"dimensional",
"array",
"containing",
"the",
"whole",
"matrix",
"in",
"this",
"dataset",
"in",
"proper",
"sequence",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/data/src/main/java/smile/data/SparseDataset.java#L444-L455 |
17,296 | haifengl/smile | core/src/main/java/smile/neighbor/MPLSH.java | MPLSH.put | public void put(double[] key, E value) {
int index = keys.size();
keys.add(key);
data.add(value);
for (Hash h : hash) {
h.add(index, key, value);
}
} | java | public void put(double[] key, E value) {
int index = keys.size();
keys.add(key);
data.add(value);
for (Hash h : hash) {
h.add(index, key, value);
}
} | [
"public",
"void",
"put",
"(",
"double",
"[",
"]",
"key",
",",
"E",
"value",
")",
"{",
"int",
"index",
"=",
"keys",
".",
"size",
"(",
")",
";",
"keys",
".",
"add",
"(",
"key",
")",
";",
"data",
".",
"add",
"(",
"value",
")",
";",
"for",
"(",
... | Insert an item into the hash table. | [
"Insert",
"an",
"item",
"into",
"the",
"hash",
"table",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/neighbor/MPLSH.java#L833-L840 |
17,297 | haifengl/smile | core/src/main/java/smile/neighbor/MPLSH.java | MPLSH.nearest | public Neighbor<double[], E> nearest(double[] q, double recall, int T) {
if (recall > 1 || recall < 0) {
throw new IllegalArgumentException("Invalid recall: " + recall);
}
double alpha = 1 - Math.pow(1 - recall, 1.0 / hash.size());
IntArrayList candidates = new IntArrayList... | java | public Neighbor<double[], E> nearest(double[] q, double recall, int T) {
if (recall > 1 || recall < 0) {
throw new IllegalArgumentException("Invalid recall: " + recall);
}
double alpha = 1 - Math.pow(1 - recall, 1.0 / hash.size());
IntArrayList candidates = new IntArrayList... | [
"public",
"Neighbor",
"<",
"double",
"[",
"]",
",",
"E",
">",
"nearest",
"(",
"double",
"[",
"]",
"q",
",",
"double",
"recall",
",",
"int",
"T",
")",
"{",
"if",
"(",
"recall",
">",
"1",
"||",
"recall",
"<",
"0",
")",
"{",
"throw",
"new",
"Illeg... | Returns the approximate nearest neighbor. A posteriori multiple probe
model has to be trained already.
@param q the query object.
@param recall the expected recall rate.
@param T the maximum number of probes. | [
"Returns",
"the",
"approximate",
"nearest",
"neighbor",
".",
"A",
"posteriori",
"multiple",
"probe",
"model",
"has",
"to",
"be",
"trained",
"already",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/neighbor/MPLSH.java#L900-L949 |
17,298 | haifengl/smile | math/src/main/java/smile/sort/HeapSelect.java | HeapSelect.sort | public void sort() {
if (!sorted) {
sort(heap, Math.min(k,n));
sorted = true;
}
} | java | public void sort() {
if (!sorted) {
sort(heap, Math.min(k,n));
sorted = true;
}
} | [
"public",
"void",
"sort",
"(",
")",
"{",
"if",
"(",
"!",
"sorted",
")",
"{",
"sort",
"(",
"heap",
",",
"Math",
".",
"min",
"(",
"k",
",",
"n",
")",
")",
";",
"sorted",
"=",
"true",
";",
"}",
"}"
] | Sort the smallest values. | [
"Sort",
"the",
"smallest",
"values",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/sort/HeapSelect.java#L122-L127 |
17,299 | haifengl/smile | plot/src/main/java/smile/swing/Printer.java | Printer.print | public void print(Printable painter) {
printer.setPrintable(painter);
if (printer.printDialog(printAttributes)) {
try {
printer.print(printAttributes);
} catch (PrinterException ex) {
logger.error("Failed to print", ex);
JOptionPane... | java | public void print(Printable painter) {
printer.setPrintable(painter);
if (printer.printDialog(printAttributes)) {
try {
printer.print(printAttributes);
} catch (PrinterException ex) {
logger.error("Failed to print", ex);
JOptionPane... | [
"public",
"void",
"print",
"(",
"Printable",
"painter",
")",
"{",
"printer",
".",
"setPrintable",
"(",
"painter",
")",
";",
"if",
"(",
"printer",
".",
"printDialog",
"(",
"printAttributes",
")",
")",
"{",
"try",
"{",
"printer",
".",
"print",
"(",
"printA... | Prints a document that implements Printable interface.
@param painter the Printable that renders each page of the document. | [
"Prints",
"a",
"document",
"that",
"implements",
"Printable",
"interface",
"."
] | e27e43e90fbaacce3f99d30120cf9dd6a764c33d | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/swing/Printer.java#L74-L84 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.