repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
datumbox/datumbox-framework | datumbox-framework-applications/src/main/java/com/datumbox/framework/applications/nlp/TextClassifier.java | TextClassifier.predict | public Record predict(String text) {
TrainingParameters trainingParameters = (TrainingParameters) knowledgeBase.getTrainingParameters();
Dataframe testDataset = new Dataframe(knowledgeBase.getConfiguration());
testDataset.add(
new Record(
new AssociativeArray... | java | public Record predict(String text) {
TrainingParameters trainingParameters = (TrainingParameters) knowledgeBase.getTrainingParameters();
Dataframe testDataset = new Dataframe(knowledgeBase.getConfiguration());
testDataset.add(
new Record(
new AssociativeArray... | [
"public",
"Record",
"predict",
"(",
"String",
"text",
")",
"{",
"TrainingParameters",
"trainingParameters",
"=",
"(",
"TrainingParameters",
")",
"knowledgeBase",
".",
"getTrainingParameters",
"(",
")",
";",
"Dataframe",
"testDataset",
"=",
"new",
"Dataframe",
"(",
... | It generates a prediction for a particular string. It returns a Record
object which contains the observation data, the predicted class and
probabilities.
@param text
@return | [
"It",
"generates",
"a",
"prediction",
"for",
"a",
"particular",
"string",
".",
"It",
"returns",
"a",
"Record",
"object",
"which",
"contains",
"the",
"observation",
"data",
"the",
"predicted",
"class",
"and",
"probabilities",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-applications/src/main/java/com/datumbox/framework/applications/nlp/TextClassifier.java#L173-L193 | train |
datumbox/datumbox-framework | datumbox-framework-applications/src/main/java/com/datumbox/framework/applications/nlp/TextClassifier.java | TextClassifier.validate | public ClassificationMetrics validate(Dataframe testDataset) {
logger.info("validate()");
predict(testDataset);
ClassificationMetrics vm = new ClassificationMetrics(testDataset);
return vm;
} | java | public ClassificationMetrics validate(Dataframe testDataset) {
logger.info("validate()");
predict(testDataset);
ClassificationMetrics vm = new ClassificationMetrics(testDataset);
return vm;
} | [
"public",
"ClassificationMetrics",
"validate",
"(",
"Dataframe",
"testDataset",
")",
"{",
"logger",
".",
"info",
"(",
"\"validate()\"",
")",
";",
"predict",
"(",
"testDataset",
")",
";",
"ClassificationMetrics",
"vm",
"=",
"new",
"ClassificationMetrics",
"(",
"tes... | It validates the modeler using the provided dataset and it returns the ClassificationMetrics. The testDataset should contain the real target variables.
@param testDataset
@return | [
"It",
"validates",
"the",
"modeler",
"using",
"the",
"provided",
"dataset",
"and",
"it",
"returns",
"the",
"ClassificationMetrics",
".",
"The",
"testDataset",
"should",
"contain",
"the",
"real",
"target",
"variables",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-applications/src/main/java/com/datumbox/framework/applications/nlp/TextClassifier.java#L201-L209 | train |
datumbox/datumbox-framework | datumbox-framework-applications/src/main/java/com/datumbox/framework/applications/nlp/TextClassifier.java | TextClassifier.validate | public ClassificationMetrics validate(Map<Object, URI> datasets) {
TrainingParameters trainingParameters = (TrainingParameters) knowledgeBase.getTrainingParameters();
//build the testDataset
Dataframe testDataset = Dataframe.Builder.parseTextFiles(
datasets,
Abst... | java | public ClassificationMetrics validate(Map<Object, URI> datasets) {
TrainingParameters trainingParameters = (TrainingParameters) knowledgeBase.getTrainingParameters();
//build the testDataset
Dataframe testDataset = Dataframe.Builder.parseTextFiles(
datasets,
Abst... | [
"public",
"ClassificationMetrics",
"validate",
"(",
"Map",
"<",
"Object",
",",
"URI",
">",
"datasets",
")",
"{",
"TrainingParameters",
"trainingParameters",
"=",
"(",
"TrainingParameters",
")",
"knowledgeBase",
".",
"getTrainingParameters",
"(",
")",
";",
"//build t... | It validates the modeler using the provided dataset files. The data
map should have as index the names of each class and as values the URIs
of the training files. The data files should contain one example
per row.
@param datasets
@return | [
"It",
"validates",
"the",
"modeler",
"using",
"the",
"provided",
"dataset",
"files",
".",
"The",
"data",
"map",
"should",
"have",
"as",
"index",
"the",
"names",
"of",
"each",
"class",
"and",
"as",
"values",
"the",
"URIs",
"of",
"the",
"training",
"files",
... | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-applications/src/main/java/com/datumbox/framework/applications/nlp/TextClassifier.java#L220-L235 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/common/abstracts/AbstractTrainer.java | AbstractTrainer.createKnowledgeBaseName | protected final String createKnowledgeBaseName(String storageName, String separator) {
return storageName + separator + getClass().getSimpleName();
} | java | protected final String createKnowledgeBaseName(String storageName, String separator) {
return storageName + separator + getClass().getSimpleName();
} | [
"protected",
"final",
"String",
"createKnowledgeBaseName",
"(",
"String",
"storageName",
",",
"String",
"separator",
")",
"{",
"return",
"storageName",
"+",
"separator",
"+",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
";",
"}"
] | Generates a name for the KnowledgeBase.
@param storageName
@param separator
@return | [
"Generates",
"a",
"name",
"for",
"the",
"KnowledgeBase",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/common/abstracts/AbstractTrainer.java#L175-L177 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/mathematics/discrete/Combinatorics.java | Combinatorics.combinations | public static <T> Set<Set<T>> combinations(Set<T> elements, int subsetSize) {
return combinationsStream(elements, subsetSize).collect(Collectors.toSet());
} | java | public static <T> Set<Set<T>> combinations(Set<T> elements, int subsetSize) {
return combinationsStream(elements, subsetSize).collect(Collectors.toSet());
} | [
"public",
"static",
"<",
"T",
">",
"Set",
"<",
"Set",
"<",
"T",
">",
">",
"combinations",
"(",
"Set",
"<",
"T",
">",
"elements",
",",
"int",
"subsetSize",
")",
"{",
"return",
"combinationsStream",
"(",
"elements",
",",
"subsetSize",
")",
".",
"collect"... | Returns all the possible combinations of the set.
@param elements
@param subsetSize
@param <T>
@return | [
"Returns",
"all",
"the",
"possible",
"combinations",
"of",
"the",
"set",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/mathematics/discrete/Combinatorics.java#L69-L71 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/mathematics/discrete/Combinatorics.java | Combinatorics.combinationsStream | public static <T> Stream<Set<T>> combinationsStream(Set<T> elements, int subsetSize) {
if (subsetSize == 0) {
return Stream.of(new HashSet<>());
}
else if (subsetSize <= elements.size()) {
Set<T> remainingElements = elements;
Iterator<T> it = remainingElement... | java | public static <T> Stream<Set<T>> combinationsStream(Set<T> elements, int subsetSize) {
if (subsetSize == 0) {
return Stream.of(new HashSet<>());
}
else if (subsetSize <= elements.size()) {
Set<T> remainingElements = elements;
Iterator<T> it = remainingElement... | [
"public",
"static",
"<",
"T",
">",
"Stream",
"<",
"Set",
"<",
"T",
">",
">",
"combinationsStream",
"(",
"Set",
"<",
"T",
">",
"elements",
",",
"int",
"subsetSize",
")",
"{",
"if",
"(",
"subsetSize",
"==",
"0",
")",
"{",
"return",
"Stream",
".",
"of... | Returns all the possible combinations of the set in a stream.
Heavily Modified code:
http://codereview.stackexchange.com/questions/26854/recursive-method-to-return-a-set-of-all-combinations
@param elements
@param subsetSize
@param <T>
@return | [
"Returns",
"all",
"the",
"possible",
"combinations",
"of",
"the",
"set",
"in",
"a",
"stream",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/mathematics/discrete/Combinatorics.java#L84-L107 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/mathematics/discrete/Combinatorics.java | Combinatorics.combinationsIterator | public static <T> Iterator<T[]> combinationsIterator(final T[] elements, final int subsetSize) {
return new Iterator<T[]>() {
/**
* The index on the combination array.
*/
private int r = 0;
/**
* The index on the elements array.
... | java | public static <T> Iterator<T[]> combinationsIterator(final T[] elements, final int subsetSize) {
return new Iterator<T[]>() {
/**
* The index on the combination array.
*/
private int r = 0;
/**
* The index on the elements array.
... | [
"public",
"static",
"<",
"T",
">",
"Iterator",
"<",
"T",
"[",
"]",
">",
"combinationsIterator",
"(",
"final",
"T",
"[",
"]",
"elements",
",",
"final",
"int",
"subsetSize",
")",
"{",
"return",
"new",
"Iterator",
"<",
"T",
"[",
"]",
">",
"(",
")",
"{... | Fast and memory efficient way to return an iterator with all the possible combinations of an array.
Heavily Modified code:
http://hmkcode.com/calculate-find-all-possible-combinations-of-an-array-using-java/
@param elements
@param subsetSize
@param <T>
@return | [
"Fast",
"and",
"memory",
"efficient",
"way",
"to",
"return",
"an",
"iterator",
"with",
"all",
"the",
"possible",
"combinations",
"of",
"an",
"array",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/mathematics/discrete/Combinatorics.java#L120-L203 | train |
datumbox/datumbox-framework | datumbox-framework-common/src/main/java/com/datumbox/framework/common/concurrency/StreamMethods.java | StreamMethods.stream | public static <T> Stream<T> stream(Spliterator<T> spliterator, boolean parallel) {
return StreamSupport.<T>stream(spliterator, parallel);
} | java | public static <T> Stream<T> stream(Spliterator<T> spliterator, boolean parallel) {
return StreamSupport.<T>stream(spliterator, parallel);
} | [
"public",
"static",
"<",
"T",
">",
"Stream",
"<",
"T",
">",
"stream",
"(",
"Spliterator",
"<",
"T",
">",
"spliterator",
",",
"boolean",
"parallel",
")",
"{",
"return",
"StreamSupport",
".",
"<",
"T",
">",
"stream",
"(",
"spliterator",
",",
"parallel",
... | Converts an spliterator to a stream.
@param <T>
@param spliterator
@param parallel
@return | [
"Converts",
"an",
"spliterator",
"to",
"a",
"stream",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-common/src/main/java/com/datumbox/framework/common/concurrency/StreamMethods.java#L40-L42 | train |
datumbox/datumbox-framework | datumbox-framework-common/src/main/java/com/datumbox/framework/common/concurrency/StreamMethods.java | StreamMethods.stream | public static <T> Stream<T> stream(Stream<T> stream, boolean parallel) {
if(parallel) {
return stream.parallel();
}
else {
return stream.sequential();
}
} | java | public static <T> Stream<T> stream(Stream<T> stream, boolean parallel) {
if(parallel) {
return stream.parallel();
}
else {
return stream.sequential();
}
} | [
"public",
"static",
"<",
"T",
">",
"Stream",
"<",
"T",
">",
"stream",
"(",
"Stream",
"<",
"T",
">",
"stream",
",",
"boolean",
"parallel",
")",
"{",
"if",
"(",
"parallel",
")",
"{",
"return",
"stream",
".",
"parallel",
"(",
")",
";",
"}",
"else",
... | Converts an Stream to parallel or sequential .
@param <T>
@param stream
@param parallel
@return | [
"Converts",
"an",
"Stream",
"to",
"parallel",
"or",
"sequential",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-common/src/main/java/com/datumbox/framework/common/concurrency/StreamMethods.java#L64-L71 | train |
datumbox/datumbox-framework | datumbox-framework-common/src/main/java/com/datumbox/framework/common/utilities/ReflectionMethods.java | ReflectionMethods.findMethod | public static Method findMethod(Object obj, String methodName, Object... params) {
Class<?>[] classArray = new Class<?>[params.length];
for (int i = 0; i < params.length; i++) {
classArray[i] = params[i].getClass();
}
try {
//look on all the public, protected, def... | java | public static Method findMethod(Object obj, String methodName, Object... params) {
Class<?>[] classArray = new Class<?>[params.length];
for (int i = 0; i < params.length; i++) {
classArray[i] = params[i].getClass();
}
try {
//look on all the public, protected, def... | [
"public",
"static",
"Method",
"findMethod",
"(",
"Object",
"obj",
",",
"String",
"methodName",
",",
"Object",
"...",
"params",
")",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"classArray",
"=",
"new",
"Class",
"<",
"?",
">",
"[",
"params",
".",
"length",
... | Finds the public, protected, default or private method of the object with the provided name and parameters.
@param obj
@param methodName
@param params
@return | [
"Finds",
"the",
"public",
"protected",
"default",
"or",
"private",
"method",
"of",
"the",
"object",
"with",
"the",
"provided",
"name",
"and",
"parameters",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-common/src/main/java/com/datumbox/framework/common/utilities/ReflectionMethods.java#L56-L93 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/extractors/NgramsExtractor.java | NgramsExtractor.extract | @Override
public Map<String, Double> extract(final String text) {
Map<Integer, String> ID2word = new HashMap<>(); //ID=>Kwd
Map<Integer, Double> ID2occurrences = new HashMap<>(); //ID=>counts/scores
Map<Integer, Integer> position2ID = new LinkedHashMap<>(); //word position=>ID maintain the o... | java | @Override
public Map<String, Double> extract(final String text) {
Map<Integer, String> ID2word = new HashMap<>(); //ID=>Kwd
Map<Integer, Double> ID2occurrences = new HashMap<>(); //ID=>counts/scores
Map<Integer, Integer> position2ID = new LinkedHashMap<>(); //word position=>ID maintain the o... | [
"@",
"Override",
"public",
"Map",
"<",
"String",
",",
"Double",
">",
"extract",
"(",
"final",
"String",
"text",
")",
"{",
"Map",
"<",
"Integer",
",",
"String",
">",
"ID2word",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"//ID=>Kwd",
"Map",
"<",
"Inte... | This method gets as input a string and returns as output a map with the
extracted keywords along with the number of their scores in the text. Their
scores are a combination of occurrences and proximity metrics.
@param text
@return | [
"This",
"method",
"gets",
"as",
"input",
"a",
"string",
"and",
"returns",
"as",
"output",
"a",
"map",
"with",
"the",
"extracted",
"keywords",
"along",
"with",
"the",
"number",
"of",
"their",
"scores",
"in",
"the",
"text",
".",
"Their",
"scores",
"are",
"... | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/extractors/NgramsExtractor.java#L164-L215 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java | SimpleRandomSampling.weightedSampling | public static FlatDataCollection weightedSampling(AssociativeArray weightedTable, int n, boolean withReplacement) {
FlatDataList sampledIds = new FlatDataList();
double sumOfFrequencies = Descriptives.sum(weightedTable.toFlatDataCollection());
int populationN = weightedTable.size();
... | java | public static FlatDataCollection weightedSampling(AssociativeArray weightedTable, int n, boolean withReplacement) {
FlatDataList sampledIds = new FlatDataList();
double sumOfFrequencies = Descriptives.sum(weightedTable.toFlatDataCollection());
int populationN = weightedTable.size();
... | [
"public",
"static",
"FlatDataCollection",
"weightedSampling",
"(",
"AssociativeArray",
"weightedTable",
",",
"int",
"n",
",",
"boolean",
"withReplacement",
")",
"{",
"FlatDataList",
"sampledIds",
"=",
"new",
"FlatDataList",
"(",
")",
";",
"double",
"sumOfFrequencies",... | Samples n ids based on their a Table which contains weights, probabilities
or frequencies.
@param weightedTable
@param n
@param withReplacement
@return | [
"Samples",
"n",
"ids",
"based",
"on",
"their",
"a",
"Table",
"which",
"contains",
"weights",
"probabilities",
"or",
"frequencies",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java#L44-L74 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java | SimpleRandomSampling.xbarVariance | public static double xbarVariance(double variance, int sampleN, int populationN) {
if(populationN<=0 || sampleN<=0 || sampleN>populationN) {
throw new IllegalArgumentException("All the parameters must be positive and sampleN smaller than populationN.");
}
double xbarVariance... | java | public static double xbarVariance(double variance, int sampleN, int populationN) {
if(populationN<=0 || sampleN<=0 || sampleN>populationN) {
throw new IllegalArgumentException("All the parameters must be positive and sampleN smaller than populationN.");
}
double xbarVariance... | [
"public",
"static",
"double",
"xbarVariance",
"(",
"double",
"variance",
",",
"int",
"sampleN",
",",
"int",
"populationN",
")",
"{",
"if",
"(",
"populationN",
"<=",
"0",
"||",
"sampleN",
"<=",
"0",
"||",
"sampleN",
">",
"populationN",
")",
"{",
"throw",
... | Calculates Variance for Xbar for a finite population size
@param variance
@param sampleN
@param populationN
@return | [
"Calculates",
"Variance",
"for",
"Xbar",
"for",
"a",
"finite",
"population",
"size"
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java#L161-L169 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java | SimpleRandomSampling.xbarStd | public static double xbarStd(double std, int sampleN) {
return Math.sqrt(xbarVariance(std*std, sampleN, Integer.MAX_VALUE));
} | java | public static double xbarStd(double std, int sampleN) {
return Math.sqrt(xbarVariance(std*std, sampleN, Integer.MAX_VALUE));
} | [
"public",
"static",
"double",
"xbarStd",
"(",
"double",
"std",
",",
"int",
"sampleN",
")",
"{",
"return",
"Math",
".",
"sqrt",
"(",
"xbarVariance",
"(",
"std",
"*",
"std",
",",
"sampleN",
",",
"Integer",
".",
"MAX_VALUE",
")",
")",
";",
"}"
] | Calculates Standard Deviation for Xbar for infinite population size
@param std
@param sampleN
@return | [
"Calculates",
"Standard",
"Deviation",
"for",
"Xbar",
"for",
"infinite",
"population",
"size"
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java#L178-L180 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java | SimpleRandomSampling.xbarStd | public static double xbarStd(double std, int sampleN, int populationN) {
return Math.sqrt(xbarVariance(std*std, sampleN, populationN));
} | java | public static double xbarStd(double std, int sampleN, int populationN) {
return Math.sqrt(xbarVariance(std*std, sampleN, populationN));
} | [
"public",
"static",
"double",
"xbarStd",
"(",
"double",
"std",
",",
"int",
"sampleN",
",",
"int",
"populationN",
")",
"{",
"return",
"Math",
".",
"sqrt",
"(",
"xbarVariance",
"(",
"std",
"*",
"std",
",",
"sampleN",
",",
"populationN",
")",
")",
";",
"}... | Calculates Standard Deviation for Xbar for finite population size
@param std
@param sampleN
@param populationN
@return | [
"Calculates",
"Standard",
"Deviation",
"for",
"Xbar",
"for",
"finite",
"population",
"size"
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java#L190-L192 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java | SimpleRandomSampling.pbarVariance | public static double pbarVariance(double pbar, int sampleN, int populationN) {
if(populationN<=0 || sampleN<=0 || sampleN>populationN) {
throw new IllegalArgumentException("All the parameters must be positive and sampleN smaller than populationN.");
}
double f = (double)sampleN/popul... | java | public static double pbarVariance(double pbar, int sampleN, int populationN) {
if(populationN<=0 || sampleN<=0 || sampleN>populationN) {
throw new IllegalArgumentException("All the parameters must be positive and sampleN smaller than populationN.");
}
double f = (double)sampleN/popul... | [
"public",
"static",
"double",
"pbarVariance",
"(",
"double",
"pbar",
",",
"int",
"sampleN",
",",
"int",
"populationN",
")",
"{",
"if",
"(",
"populationN",
"<=",
"0",
"||",
"sampleN",
"<=",
"0",
"||",
"sampleN",
">",
"populationN",
")",
"{",
"throw",
"new... | Calculates Variance for Pbar for a finite population size
@param pbar
@param sampleN
@param populationN
@return | [
"Calculates",
"Variance",
"for",
"Pbar",
"for",
"a",
"finite",
"population",
"size"
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java#L213-L221 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java | SimpleRandomSampling.pbarStd | public static double pbarStd(double pbar, int sampleN) {
return Math.sqrt(pbarVariance(pbar, sampleN, Integer.MAX_VALUE));
} | java | public static double pbarStd(double pbar, int sampleN) {
return Math.sqrt(pbarVariance(pbar, sampleN, Integer.MAX_VALUE));
} | [
"public",
"static",
"double",
"pbarStd",
"(",
"double",
"pbar",
",",
"int",
"sampleN",
")",
"{",
"return",
"Math",
".",
"sqrt",
"(",
"pbarVariance",
"(",
"pbar",
",",
"sampleN",
",",
"Integer",
".",
"MAX_VALUE",
")",
")",
";",
"}"
] | Calculates Standard Deviation for Pbar for infinite population size
@param pbar
@param sampleN
@return | [
"Calculates",
"Standard",
"Deviation",
"for",
"Pbar",
"for",
"infinite",
"population",
"size"
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java#L230-L232 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java | SimpleRandomSampling.pbarStd | public static double pbarStd(double pbar, int sampleN, int populationN) {
return Math.sqrt(pbarVariance(pbar, sampleN, populationN));
} | java | public static double pbarStd(double pbar, int sampleN, int populationN) {
return Math.sqrt(pbarVariance(pbar, sampleN, populationN));
} | [
"public",
"static",
"double",
"pbarStd",
"(",
"double",
"pbar",
",",
"int",
"sampleN",
",",
"int",
"populationN",
")",
"{",
"return",
"Math",
".",
"sqrt",
"(",
"pbarVariance",
"(",
"pbar",
",",
"sampleN",
",",
"populationN",
")",
")",
";",
"}"
] | Calculates Standard Deviation for Pbar for finite population size
@param pbar
@param sampleN
@param populationN
@return | [
"Calculates",
"Standard",
"Deviation",
"for",
"Pbar",
"for",
"finite",
"population",
"size"
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java#L242-L244 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java | SimpleRandomSampling.minimumSampleSizeForMaximumXbarStd | public static int minimumSampleSizeForMaximumXbarStd(double maximumXbarStd, double populationStd, int populationN) {
if(populationN<=0) {
throw new IllegalArgumentException("The populationN parameter must be positive.");
}
double minimumSampleN = 1.0/(Math.pow(maximumXbarStd... | java | public static int minimumSampleSizeForMaximumXbarStd(double maximumXbarStd, double populationStd, int populationN) {
if(populationN<=0) {
throw new IllegalArgumentException("The populationN parameter must be positive.");
}
double minimumSampleN = 1.0/(Math.pow(maximumXbarStd... | [
"public",
"static",
"int",
"minimumSampleSizeForMaximumXbarStd",
"(",
"double",
"maximumXbarStd",
",",
"double",
"populationStd",
",",
"int",
"populationN",
")",
"{",
"if",
"(",
"populationN",
"<=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"... | Returns the minimum required sample size when we set a specific maximum Xbar STD Error for finite population size.
@param maximumXbarStd
@param populationStd
@param populationN
@return | [
"Returns",
"the",
"minimum",
"required",
"sample",
"size",
"when",
"we",
"set",
"a",
"specific",
"maximum",
"Xbar",
"STD",
"Error",
"for",
"finite",
"population",
"size",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java#L265-L273 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java | SimpleRandomSampling.minimumSampleSizeForGivenDandMaximumRisk | public static int minimumSampleSizeForGivenDandMaximumRisk(double d, double aLevel, double populationStd) {
return minimumSampleSizeForGivenDandMaximumRisk(d, aLevel, populationStd, Integer.MAX_VALUE);
} | java | public static int minimumSampleSizeForGivenDandMaximumRisk(double d, double aLevel, double populationStd) {
return minimumSampleSizeForGivenDandMaximumRisk(d, aLevel, populationStd, Integer.MAX_VALUE);
} | [
"public",
"static",
"int",
"minimumSampleSizeForGivenDandMaximumRisk",
"(",
"double",
"d",
",",
"double",
"aLevel",
",",
"double",
"populationStd",
")",
"{",
"return",
"minimumSampleSizeForGivenDandMaximumRisk",
"(",
"d",
",",
"aLevel",
",",
"populationStd",
",",
"Int... | Returns the minimum required sample size when we set a predifined limit d and a maximum probability Risk a for infinite population size
@param d
@param aLevel
@param populationStd
@return | [
"Returns",
"the",
"minimum",
"required",
"sample",
"size",
"when",
"we",
"set",
"a",
"predifined",
"limit",
"d",
"and",
"a",
"maximum",
"probability",
"Risk",
"a",
"for",
"infinite",
"population",
"size"
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java#L283-L285 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java | SimpleRandomSampling.minimumSampleSizeForGivenDandMaximumRisk | public static int minimumSampleSizeForGivenDandMaximumRisk(double d, double aLevel, double populationStd, int populationN) {
if(populationN<=0 || aLevel<=0 || d<=0) {
throw new IllegalArgumentException("All the parameters must be positive.");
}
double a = 1.0 - aLevel/2.0;
... | java | public static int minimumSampleSizeForGivenDandMaximumRisk(double d, double aLevel, double populationStd, int populationN) {
if(populationN<=0 || aLevel<=0 || d<=0) {
throw new IllegalArgumentException("All the parameters must be positive.");
}
double a = 1.0 - aLevel/2.0;
... | [
"public",
"static",
"int",
"minimumSampleSizeForGivenDandMaximumRisk",
"(",
"double",
"d",
",",
"double",
"aLevel",
",",
"double",
"populationStd",
",",
"int",
"populationN",
")",
"{",
"if",
"(",
"populationN",
"<=",
"0",
"||",
"aLevel",
"<=",
"0",
"||",
"d",
... | Returns the minimum required sample size when we set a predefined limit d and a maximum probability Risk a for finite population size
@param d
@param aLevel
@param populationStd
@param populationN
@return | [
"Returns",
"the",
"minimum",
"required",
"sample",
"size",
"when",
"we",
"set",
"a",
"predefined",
"limit",
"d",
"and",
"a",
"maximum",
"probability",
"Risk",
"a",
"for",
"finite",
"population",
"size"
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java#L296-L314 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/analyzers/TextSimilarity.java | TextSimilarity.shinglerSimilarity | public static double shinglerSimilarity(String text1, String text2, int w) {
preprocessDocument(text1);
preprocessDocument(text2);
NgramsExtractor.Parameters parameters = new NgramsExtractor.Parameters();
parameters.setMaxCombinations(w);
parameters.setMaxDistanceBetweenKwds(0);... | java | public static double shinglerSimilarity(String text1, String text2, int w) {
preprocessDocument(text1);
preprocessDocument(text2);
NgramsExtractor.Parameters parameters = new NgramsExtractor.Parameters();
parameters.setMaxCombinations(w);
parameters.setMaxDistanceBetweenKwds(0);... | [
"public",
"static",
"double",
"shinglerSimilarity",
"(",
"String",
"text1",
",",
"String",
"text2",
",",
"int",
"w",
")",
"{",
"preprocessDocument",
"(",
"text1",
")",
";",
"preprocessDocument",
"(",
"text2",
")",
";",
"NgramsExtractor",
".",
"Parameters",
"pa... | Estimates the w-shingler similarity between two texts. The w is the number
of word sequences that are used for the estimation.
References:
http://phpir.com/shingling-near-duplicate-detection
http://www.std.org/~msm/common/clustering.html
@param text1
@param text2
@param w
@return | [
"Estimates",
"the",
"w",
"-",
"shingler",
"similarity",
"between",
"two",
"texts",
".",
"The",
"w",
"is",
"the",
"number",
"of",
"word",
"sequences",
"that",
"are",
"used",
"for",
"the",
"estimation",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/analyzers/TextSimilarity.java#L74-L116 | train |
datumbox/datumbox-framework | datumbox-framework-common/src/main/java/com/datumbox/framework/common/storage/abstracts/BigMapHolder.java | BigMapHolder.bigMapInitializer | private void bigMapInitializer(StorageEngine storageEngine) {
//get all the fields from all the inherited classes
for(Field field : ReflectionMethods.getAllFields(new LinkedList<>(), this.getClass())){
//if the field is annotated with BigMap
if (field.isAnnotationPresent(BigMap.c... | java | private void bigMapInitializer(StorageEngine storageEngine) {
//get all the fields from all the inherited classes
for(Field field : ReflectionMethods.getAllFields(new LinkedList<>(), this.getClass())){
//if the field is annotated with BigMap
if (field.isAnnotationPresent(BigMap.c... | [
"private",
"void",
"bigMapInitializer",
"(",
"StorageEngine",
"storageEngine",
")",
"{",
"//get all the fields from all the inherited classes",
"for",
"(",
"Field",
"field",
":",
"ReflectionMethods",
".",
"getAllFields",
"(",
"new",
"LinkedList",
"<>",
"(",
")",
",",
... | Initializes all the fields of the class which are marked with the BigMap
annotation automatically.
@param storageEngine | [
"Initializes",
"all",
"the",
"fields",
"of",
"the",
"class",
"which",
"are",
"marked",
"with",
"the",
"BigMap",
"annotation",
"automatically",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-common/src/main/java/com/datumbox/framework/common/storage/abstracts/BigMapHolder.java#L49-L57 | train |
datumbox/datumbox-framework | datumbox-framework-common/src/main/java/com/datumbox/framework/common/storage/abstracts/BigMapHolder.java | BigMapHolder.initializeBigMapField | private void initializeBigMapField(StorageEngine storageEngine, Field field) {
field.setAccessible(true);
try {
BigMap a = field.getAnnotation(BigMap.class);
field.set(this, storageEngine.getBigMap(field.getName(), a.keyClass(), a.valueClass(), a.mapType(), a.storageHint(), a.co... | java | private void initializeBigMapField(StorageEngine storageEngine, Field field) {
field.setAccessible(true);
try {
BigMap a = field.getAnnotation(BigMap.class);
field.set(this, storageEngine.getBigMap(field.getName(), a.keyClass(), a.valueClass(), a.mapType(), a.storageHint(), a.co... | [
"private",
"void",
"initializeBigMapField",
"(",
"StorageEngine",
"storageEngine",
",",
"Field",
"field",
")",
"{",
"field",
".",
"setAccessible",
"(",
"true",
")",
";",
"try",
"{",
"BigMap",
"a",
"=",
"field",
".",
"getAnnotation",
"(",
"BigMap",
".",
"clas... | Initializes a field which is marked as BigMap.
@param storageEngine
@param field | [
"Initializes",
"a",
"field",
"which",
"is",
"marked",
"as",
"BigMap",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-common/src/main/java/com/datumbox/framework/common/storage/abstracts/BigMapHolder.java#L65-L75 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/common/dataobjects/TrainableBundle.java | TrainableBundle.put | public Trainable put(String key, Trainable value) {
return bundle.put(key, value);
} | java | public Trainable put(String key, Trainable value) {
return bundle.put(key, value);
} | [
"public",
"Trainable",
"put",
"(",
"String",
"key",
",",
"Trainable",
"value",
")",
"{",
"return",
"bundle",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}"
] | Puts the trainable in the bundle using a specific key and returns the previous entry or null.
@param key
@param value
@return | [
"Puts",
"the",
"trainable",
"in",
"the",
"bundle",
"using",
"a",
"specific",
"key",
"and",
"returns",
"the",
"previous",
"entry",
"or",
"null",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/common/dataobjects/TrainableBundle.java#L88-L90 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/common/dataobjects/TrainableBundle.java | TrainableBundle.setParallelized | public void setParallelized(boolean parallelized) {
for(Trainable t : bundle.values()) {
if (t !=null && t instanceof Parallelizable) {
((Parallelizable)t).setParallelized(parallelized);
}
}
} | java | public void setParallelized(boolean parallelized) {
for(Trainable t : bundle.values()) {
if (t !=null && t instanceof Parallelizable) {
((Parallelizable)t).setParallelized(parallelized);
}
}
} | [
"public",
"void",
"setParallelized",
"(",
"boolean",
"parallelized",
")",
"{",
"for",
"(",
"Trainable",
"t",
":",
"bundle",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"t",
"!=",
"null",
"&&",
"t",
"instanceof",
"Parallelizable",
")",
"{",
"(",
"(",
... | Updates the parallelized flag of all wrapped algorithms.
@param parallelized | [
"Updates",
"the",
"parallelized",
"flag",
"of",
"all",
"wrapped",
"algorithms",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/common/dataobjects/TrainableBundle.java#L97-L103 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/MLBuilder.java | MLBuilder.create | public static <T extends Trainable, TP extends Parameterizable> T create(TP trainingParameters, Configuration configuration) {
try {
Class<T> aClass = (Class<T>) trainingParameters.getClass().getEnclosingClass();
Constructor<T> constructor = aClass.getDeclaredConstructor(trainingParamete... | java | public static <T extends Trainable, TP extends Parameterizable> T create(TP trainingParameters, Configuration configuration) {
try {
Class<T> aClass = (Class<T>) trainingParameters.getClass().getEnclosingClass();
Constructor<T> constructor = aClass.getDeclaredConstructor(trainingParamete... | [
"public",
"static",
"<",
"T",
"extends",
"Trainable",
",",
"TP",
"extends",
"Parameterizable",
">",
"T",
"create",
"(",
"TP",
"trainingParameters",
",",
"Configuration",
"configuration",
")",
"{",
"try",
"{",
"Class",
"<",
"T",
">",
"aClass",
"=",
"(",
"Cl... | Creates a new algorithm based on the provided training parameters.
@param <T>
@param configuration
@return | [
"Creates",
"a",
"new",
"algorithm",
"based",
"on",
"the",
"provided",
"training",
"parameters",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/MLBuilder.java#L39-L49 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/MLBuilder.java | MLBuilder.load | public static <T extends Trainable> T load(Class<T> aClass, String storageName, Configuration configuration) {
try {
Constructor<T> constructor = aClass.getDeclaredConstructor(String.class, Configuration.class);
constructor.setAccessible(true);
return constructor.newInstance(... | java | public static <T extends Trainable> T load(Class<T> aClass, String storageName, Configuration configuration) {
try {
Constructor<T> constructor = aClass.getDeclaredConstructor(String.class, Configuration.class);
constructor.setAccessible(true);
return constructor.newInstance(... | [
"public",
"static",
"<",
"T",
"extends",
"Trainable",
">",
"T",
"load",
"(",
"Class",
"<",
"T",
">",
"aClass",
",",
"String",
"storageName",
",",
"Configuration",
"configuration",
")",
"{",
"try",
"{",
"Constructor",
"<",
"T",
">",
"constructor",
"=",
"a... | Loads an algorithm from the storage.
@param <T>
@param aClass
@param storageName
@param configuration
@return | [
"Loads",
"an",
"algorithm",
"from",
"the",
"storage",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/MLBuilder.java#L60-L69 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/mathematics/discrete/Arithmetics.java | Arithmetics.combination | public static double combination(int n, int k) {
if(n<k) {
throw new IllegalArgumentException("The n can't be smaller than k.");
}
double combinations=1.0;
double lowerBound = n-k;
for(int i=n;i>lowerBound;i--) {
combinations *= i/(i-lowerBound);
}... | java | public static double combination(int n, int k) {
if(n<k) {
throw new IllegalArgumentException("The n can't be smaller than k.");
}
double combinations=1.0;
double lowerBound = n-k;
for(int i=n;i>lowerBound;i--) {
combinations *= i/(i-lowerBound);
}... | [
"public",
"static",
"double",
"combination",
"(",
"int",
"n",
",",
"int",
"k",
")",
"{",
"if",
"(",
"n",
"<",
"k",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The n can't be smaller than k.\"",
")",
";",
"}",
"double",
"combinations",
"=",
... | It estimates the number of k-combinations of n objects.
@param n
@param k
@return | [
"It",
"estimates",
"the",
"number",
"of",
"k",
"-",
"combinations",
"of",
"n",
"objects",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/mathematics/discrete/Arithmetics.java#L48-L58 | train |
datumbox/datumbox-framework | datumbox-framework-storage/datumbox-framework-storage-mapdb/src/main/java/com/datumbox/framework/storage/mapdb/MapDBEngine.java | MapDBEngine.getStorageTypeFromName | private StorageType getStorageTypeFromName(String name) {
for(Map.Entry<StorageType, DB> entry : storageRegistry.entrySet()) {
DB storage = entry.getValue();
if(isOpenStorage(storage) && storage.exists(name)) {
return entry.getKey();
}
}
... | java | private StorageType getStorageTypeFromName(String name) {
for(Map.Entry<StorageType, DB> entry : storageRegistry.entrySet()) {
DB storage = entry.getValue();
if(isOpenStorage(storage) && storage.exists(name)) {
return entry.getKey();
}
}
... | [
"private",
"StorageType",
"getStorageTypeFromName",
"(",
"String",
"name",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"StorageType",
",",
"DB",
">",
"entry",
":",
"storageRegistry",
".",
"entrySet",
"(",
")",
")",
"{",
"DB",
"storage",
"=",
"entry",
... | Returns the StorageType using the name of the map. It assumes that names
are unique across all StorageType. If not found null is returned.
@param name
@return | [
"Returns",
"the",
"StorageType",
"using",
"the",
"name",
"of",
"the",
"map",
".",
"It",
"assumes",
"that",
"names",
"are",
"unique",
"across",
"all",
"StorageType",
".",
"If",
"not",
"found",
"null",
"is",
"returned",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-storage/datumbox-framework-storage-mapdb/src/main/java/com/datumbox/framework/storage/mapdb/MapDBEngine.java#L406-L415 | train |
datumbox/datumbox-framework | datumbox-framework-storage/datumbox-framework-storage-mapdb/src/main/java/com/datumbox/framework/storage/mapdb/MapDBEngine.java | MapDBEngine.closeStorageRegistry | private void closeStorageRegistry() {
for(DB storage : storageRegistry.values()) {
if(isOpenStorage(storage)) {
storage.close();
}
}
storageRegistry.clear();
} | java | private void closeStorageRegistry() {
for(DB storage : storageRegistry.values()) {
if(isOpenStorage(storage)) {
storage.close();
}
}
storageRegistry.clear();
} | [
"private",
"void",
"closeStorageRegistry",
"(",
")",
"{",
"for",
"(",
"DB",
"storage",
":",
"storageRegistry",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"isOpenStorage",
"(",
"storage",
")",
")",
"{",
"storage",
".",
"close",
"(",
")",
";",
"}",
... | It closes all the storageengines in the registry. | [
"It",
"closes",
"all",
"the",
"storageengines",
"in",
"the",
"registry",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-storage/datumbox-framework-storage-mapdb/src/main/java/com/datumbox/framework/storage/mapdb/MapDBEngine.java#L420-L427 | train |
datumbox/datumbox-framework | datumbox-framework-storage/datumbox-framework-storage-mapdb/src/main/java/com/datumbox/framework/storage/mapdb/MapDBEngine.java | MapDBEngine.blockedStorageClose | private boolean blockedStorageClose(StorageType storageType) {
DB storage = storageRegistry.get(storageType);
if(isOpenStorage(storage)) {
storage.commit();
//find the underlying engine
Engine e = storage.getEngine();
while (EngineWrapper.class.isAssignab... | java | private boolean blockedStorageClose(StorageType storageType) {
DB storage = storageRegistry.get(storageType);
if(isOpenStorage(storage)) {
storage.commit();
//find the underlying engine
Engine e = storage.getEngine();
while (EngineWrapper.class.isAssignab... | [
"private",
"boolean",
"blockedStorageClose",
"(",
"StorageType",
"storageType",
")",
"{",
"DB",
"storage",
"=",
"storageRegistry",
".",
"get",
"(",
"storageType",
")",
";",
"if",
"(",
"isOpenStorage",
"(",
"storage",
")",
")",
"{",
"storage",
".",
"commit",
... | Closes the provided storage and waits until all changes are written to disk. It should be used when
we move the storage to a different location. Returns true if the storage needed to be closed and
false if it was not necessary.
@param storageType
@return | [
"Closes",
"the",
"provided",
"storage",
"and",
"waits",
"until",
"all",
"changes",
"are",
"written",
"to",
"disk",
".",
"It",
"should",
"be",
"used",
"when",
"we",
"move",
"the",
"storage",
"to",
"a",
"different",
"location",
".",
"Returns",
"true",
"if",
... | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-storage/datumbox-framework-storage-mapdb/src/main/java/com/datumbox/framework/storage/mapdb/MapDBEngine.java#L437-L464 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/tokenizers/WhitespaceTokenizer.java | WhitespaceTokenizer.tokenize | @Override
public List<String> tokenize(String text) {
List<String> tokens = new ArrayList<>(Arrays.asList(text.split("[\\p{Z}\\p{C}]+")));
return tokens;
} | java | @Override
public List<String> tokenize(String text) {
List<String> tokens = new ArrayList<>(Arrays.asList(text.split("[\\p{Z}\\p{C}]+")));
return tokens;
} | [
"@",
"Override",
"public",
"List",
"<",
"String",
">",
"tokenize",
"(",
"String",
"text",
")",
"{",
"List",
"<",
"String",
">",
"tokens",
"=",
"new",
"ArrayList",
"<>",
"(",
"Arrays",
".",
"asList",
"(",
"text",
".",
"split",
"(",
"\"[\\\\p{Z}\\\\p{C}]+\... | Separates the tokens of a string by splitting it on white space.
@param text
@return | [
"Separates",
"the",
"tokens",
"of",
"a",
"string",
"by",
"splitting",
"it",
"on",
"white",
"space",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/tokenizers/WhitespaceTokenizer.java#L36-L40 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/decisiontheory/DecisionCriteria.java | DecisionCriteria.maxMin | public static Map.Entry<Object, Object> maxMin(DataTable2D payoffMatrix) {
if(payoffMatrix.isValid()==false) {
throw new IllegalArgumentException("The payoff matrix does not have a rectangular format.");
}
AssociativeArray minPayoffs = new AssociativeArray();
for(Map... | java | public static Map.Entry<Object, Object> maxMin(DataTable2D payoffMatrix) {
if(payoffMatrix.isValid()==false) {
throw new IllegalArgumentException("The payoff matrix does not have a rectangular format.");
}
AssociativeArray minPayoffs = new AssociativeArray();
for(Map... | [
"public",
"static",
"Map",
".",
"Entry",
"<",
"Object",
",",
"Object",
">",
"maxMin",
"(",
"DataTable2D",
"payoffMatrix",
")",
"{",
"if",
"(",
"payoffMatrix",
".",
"isValid",
"(",
")",
"==",
"false",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(... | Returns the best option and the payoff under maxMin strategy
@param payoffMatrix
@return | [
"Returns",
"the",
"best",
"option",
"and",
"the",
"payoff",
"under",
"maxMin",
"strategy"
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/decisiontheory/DecisionCriteria.java#L40-L62 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/decisiontheory/DecisionCriteria.java | DecisionCriteria.maxMax | public static Map.Entry<Object, Object> maxMax(DataTable2D payoffMatrix) {
if(payoffMatrix.isValid()==false) {
throw new IllegalArgumentException("The payoff matrix does not have a rectangular format.");
}
Double maxMaxPayoff = Double.NEGATIVE_INFINITY;
Object maxMax... | java | public static Map.Entry<Object, Object> maxMax(DataTable2D payoffMatrix) {
if(payoffMatrix.isValid()==false) {
throw new IllegalArgumentException("The payoff matrix does not have a rectangular format.");
}
Double maxMaxPayoff = Double.NEGATIVE_INFINITY;
Object maxMax... | [
"public",
"static",
"Map",
".",
"Entry",
"<",
"Object",
",",
"Object",
">",
"maxMax",
"(",
"DataTable2D",
"payoffMatrix",
")",
"{",
"if",
"(",
"payoffMatrix",
".",
"isValid",
"(",
")",
"==",
"false",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(... | Returns the best option and the payoff under maxMax strategy
@param payoffMatrix
@return | [
"Returns",
"the",
"best",
"option",
"and",
"the",
"payoff",
"under",
"maxMax",
"strategy"
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/decisiontheory/DecisionCriteria.java#L70-L93 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/decisiontheory/DecisionCriteria.java | DecisionCriteria.savage | public static Map.Entry<Object, Object> savage(DataTable2D payoffMatrix) {
if(payoffMatrix.isValid()==false) {
throw new IllegalArgumentException("The payoff matrix does not have a rectangular format.");
}
//Deep clone the payoffMatrix to avoid modifying its original values
... | java | public static Map.Entry<Object, Object> savage(DataTable2D payoffMatrix) {
if(payoffMatrix.isValid()==false) {
throw new IllegalArgumentException("The payoff matrix does not have a rectangular format.");
}
//Deep clone the payoffMatrix to avoid modifying its original values
... | [
"public",
"static",
"Map",
".",
"Entry",
"<",
"Object",
",",
"Object",
">",
"savage",
"(",
"DataTable2D",
"payoffMatrix",
")",
"{",
"if",
"(",
"payoffMatrix",
".",
"isValid",
"(",
")",
"==",
"false",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(... | Returns the best option and the payoff under savage strategy
@param payoffMatrix
@return | [
"Returns",
"the",
"best",
"option",
"and",
"the",
"payoff",
"under",
"savage",
"strategy"
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/decisiontheory/DecisionCriteria.java#L101-L124 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/decisiontheory/DecisionCriteria.java | DecisionCriteria.laplace | public static Map.Entry<Object, Object> laplace(DataTable2D payoffMatrix) {
if(payoffMatrix.isValid()==false) {
throw new IllegalArgumentException("The payoff matrix does not have a rectangular format.");
}
//http://orms.pef.czu.cz/text/game-theory/DecisionTheory.html
... | java | public static Map.Entry<Object, Object> laplace(DataTable2D payoffMatrix) {
if(payoffMatrix.isValid()==false) {
throw new IllegalArgumentException("The payoff matrix does not have a rectangular format.");
}
//http://orms.pef.czu.cz/text/game-theory/DecisionTheory.html
... | [
"public",
"static",
"Map",
".",
"Entry",
"<",
"Object",
",",
"Object",
">",
"laplace",
"(",
"DataTable2D",
"payoffMatrix",
")",
"{",
"if",
"(",
"payoffMatrix",
".",
"isValid",
"(",
")",
"==",
"false",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"... | Returns the best option and the payoff under laplace strategy
@param payoffMatrix
@return | [
"Returns",
"the",
"best",
"option",
"and",
"the",
"payoff",
"under",
"laplace",
"strategy"
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/decisiontheory/DecisionCriteria.java#L132-L158 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/decisiontheory/DecisionCriteria.java | DecisionCriteria.hurwiczAlpha | public static Map.Entry<Object, Object> hurwiczAlpha(DataTable2D payoffMatrix, double alpha) {
if(payoffMatrix.isValid()==false) {
throw new IllegalArgumentException("The payoff matrix does not have a rectangular format.");
}
AssociativeArray minPayoffs = new AssociativeArra... | java | public static Map.Entry<Object, Object> hurwiczAlpha(DataTable2D payoffMatrix, double alpha) {
if(payoffMatrix.isValid()==false) {
throw new IllegalArgumentException("The payoff matrix does not have a rectangular format.");
}
AssociativeArray minPayoffs = new AssociativeArra... | [
"public",
"static",
"Map",
".",
"Entry",
"<",
"Object",
",",
"Object",
">",
"hurwiczAlpha",
"(",
"DataTable2D",
"payoffMatrix",
",",
"double",
"alpha",
")",
"{",
"if",
"(",
"payoffMatrix",
".",
"isValid",
"(",
")",
"==",
"false",
")",
"{",
"throw",
"new"... | Returns the best option and the payoff under hurwiczAlpha strategy
@param payoffMatrix
@param alpha
@return | [
"Returns",
"the",
"best",
"option",
"and",
"the",
"payoff",
"under",
"hurwiczAlpha",
"strategy"
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/decisiontheory/DecisionCriteria.java#L167-L202 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/decisiontheory/DecisionCriteria.java | DecisionCriteria.maximumLikelihood | public static Map.Entry<Object, Object> maximumLikelihood(DataTable2D payoffMatrix, AssociativeArray eventProbabilities) {
if(payoffMatrix.isValid()==false) {
throw new IllegalArgumentException("The payoff matrix does not have a rectangular format.");
}
Map.Entry<Object, Obj... | java | public static Map.Entry<Object, Object> maximumLikelihood(DataTable2D payoffMatrix, AssociativeArray eventProbabilities) {
if(payoffMatrix.isValid()==false) {
throw new IllegalArgumentException("The payoff matrix does not have a rectangular format.");
}
Map.Entry<Object, Obj... | [
"public",
"static",
"Map",
".",
"Entry",
"<",
"Object",
",",
"Object",
">",
"maximumLikelihood",
"(",
"DataTable2D",
"payoffMatrix",
",",
"AssociativeArray",
"eventProbabilities",
")",
"{",
"if",
"(",
"payoffMatrix",
".",
"isValid",
"(",
")",
"==",
"false",
")... | Returns the best option and the payoff under maximumLikelihood strategy
@param payoffMatrix
@param eventProbabilities
@return | [
"Returns",
"the",
"best",
"option",
"and",
"the",
"payoff",
"under",
"maximumLikelihood",
"strategy"
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/decisiontheory/DecisionCriteria.java#L211-L222 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/decisiontheory/DecisionCriteria.java | DecisionCriteria.bayes | public static Map.Entry<Object, Object> bayes(DataTable2D payoffMatrix, AssociativeArray eventProbabilities) {
if(payoffMatrix.isValid()==false) {
throw new IllegalArgumentException("The payoff matrix does not have a rectangular format.");
}
AssociativeArray expectedPayoffs ... | java | public static Map.Entry<Object, Object> bayes(DataTable2D payoffMatrix, AssociativeArray eventProbabilities) {
if(payoffMatrix.isValid()==false) {
throw new IllegalArgumentException("The payoff matrix does not have a rectangular format.");
}
AssociativeArray expectedPayoffs ... | [
"public",
"static",
"Map",
".",
"Entry",
"<",
"Object",
",",
"Object",
">",
"bayes",
"(",
"DataTable2D",
"payoffMatrix",
",",
"AssociativeArray",
"eventProbabilities",
")",
"{",
"if",
"(",
"payoffMatrix",
".",
"isValid",
"(",
")",
"==",
"false",
")",
"{",
... | Returns the best option and the payoff under bayes strategy
@param payoffMatrix
@param eventProbabilities
@return | [
"Returns",
"the",
"best",
"option",
"and",
"the",
"payoff",
"under",
"bayes",
"strategy"
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/decisiontheory/DecisionCriteria.java#L231-L255 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/descriptivestatistics/Bivariate.java | Bivariate.bivariateMatrix | private static DataTable2D bivariateMatrix(Dataframe dataSet, BivariateType type) {
DataTable2D bivariateMatrix = new DataTable2D();
//extract values of first variable
Map<Object, TypeInference.DataType> columnTypes = dataSet.getXDataTypes();
Object[] allVariables = columnTypes.... | java | private static DataTable2D bivariateMatrix(Dataframe dataSet, BivariateType type) {
DataTable2D bivariateMatrix = new DataTable2D();
//extract values of first variable
Map<Object, TypeInference.DataType> columnTypes = dataSet.getXDataTypes();
Object[] allVariables = columnTypes.... | [
"private",
"static",
"DataTable2D",
"bivariateMatrix",
"(",
"Dataframe",
"dataSet",
",",
"BivariateType",
"type",
")",
"{",
"DataTable2D",
"bivariateMatrix",
"=",
"new",
"DataTable2D",
"(",
")",
";",
"//extract values of first variable",
"Map",
"<",
"Object",
",",
"... | Calculates BivariateMatrix for a given statistic
@param dataSet
@param type
@return | [
"Calculates",
"BivariateMatrix",
"for",
"a",
"given",
"statistic"
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/descriptivestatistics/Bivariate.java#L47-L121 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/mathematics/regularization/ElasticNetRegularizer.java | ElasticNetRegularizer.updateWeights | public static <K> void updateWeights(double l1, double l2, double learningRate, Map<K, Double> weights, Map<K, Double> newWeights) {
L2Regularizer.updateWeights(l2, learningRate, weights, newWeights);
L1Regularizer.updateWeights(l1, learningRate, weights, newWeights);
} | java | public static <K> void updateWeights(double l1, double l2, double learningRate, Map<K, Double> weights, Map<K, Double> newWeights) {
L2Regularizer.updateWeights(l2, learningRate, weights, newWeights);
L1Regularizer.updateWeights(l1, learningRate, weights, newWeights);
} | [
"public",
"static",
"<",
"K",
">",
"void",
"updateWeights",
"(",
"double",
"l1",
",",
"double",
"l2",
",",
"double",
"learningRate",
",",
"Map",
"<",
"K",
",",
"Double",
">",
"weights",
",",
"Map",
"<",
"K",
",",
"Double",
">",
"newWeights",
")",
"{"... | Updates the weights by applying the ElasticNet regularization.
@param l1
@param l2
@param learningRate
@param weights
@param newWeights
@param <K> | [
"Updates",
"the",
"weights",
"by",
"applying",
"the",
"ElasticNet",
"regularization",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/mathematics/regularization/ElasticNetRegularizer.java#L40-L43 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/mathematics/regularization/ElasticNetRegularizer.java | ElasticNetRegularizer.estimatePenalty | public static <K> double estimatePenalty(double l1, double l2, Map<K, Double> weights) {
double penalty = 0.0;
penalty += L2Regularizer.estimatePenalty(l2, weights);
penalty += L1Regularizer.estimatePenalty(l1, weights);
return penalty;
} | java | public static <K> double estimatePenalty(double l1, double l2, Map<K, Double> weights) {
double penalty = 0.0;
penalty += L2Regularizer.estimatePenalty(l2, weights);
penalty += L1Regularizer.estimatePenalty(l1, weights);
return penalty;
} | [
"public",
"static",
"<",
"K",
">",
"double",
"estimatePenalty",
"(",
"double",
"l1",
",",
"double",
"l2",
",",
"Map",
"<",
"K",
",",
"Double",
">",
"weights",
")",
"{",
"double",
"penalty",
"=",
"0.0",
";",
"penalty",
"+=",
"L2Regularizer",
".",
"estim... | Estimates the penalty by adding the ElasticNet regularization.
@param l1
@param l2
@param weights
@param <K>
@return | [
"Estimates",
"the",
"penalty",
"by",
"adding",
"the",
"ElasticNet",
"regularization",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/mathematics/regularization/ElasticNetRegularizer.java#L54-L59 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java | PHPMethods.substr_count | public static int substr_count(final String string, final String substring) {
if(substring.length()==1) {
return substr_count(string, substring.charAt(0));
}
int count = 0;
int idx = 0;
while ((idx = string.indexOf(substring, idx)) != -1) {
++idx;... | java | public static int substr_count(final String string, final String substring) {
if(substring.length()==1) {
return substr_count(string, substring.charAt(0));
}
int count = 0;
int idx = 0;
while ((idx = string.indexOf(substring, idx)) != -1) {
++idx;... | [
"public",
"static",
"int",
"substr_count",
"(",
"final",
"String",
"string",
",",
"final",
"String",
"substring",
")",
"{",
"if",
"(",
"substring",
".",
"length",
"(",
")",
"==",
"1",
")",
"{",
"return",
"substr_count",
"(",
"string",
",",
"substring",
"... | Count the number of substring occurrences.
@param string
@param substring
@return | [
"Count",
"the",
"number",
"of",
"substring",
"occurrences",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java#L62-L76 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java | PHPMethods.substr_count | public static int substr_count(final String string, final char character) {
int count = 0;
int n = string.length();
for(int i=0;i<n;i++) {
if(string.charAt(i)==character) {
++count;
}
}
return count;
} | java | public static int substr_count(final String string, final char character) {
int count = 0;
int n = string.length();
for(int i=0;i<n;i++) {
if(string.charAt(i)==character) {
++count;
}
}
return count;
} | [
"public",
"static",
"int",
"substr_count",
"(",
"final",
"String",
"string",
",",
"final",
"char",
"character",
")",
"{",
"int",
"count",
"=",
"0",
";",
"int",
"n",
"=",
"string",
".",
"length",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",... | Count the number of times a character appears in the string.
@param string
@param character
@return | [
"Count",
"the",
"number",
"of",
"times",
"a",
"character",
"appears",
"in",
"the",
"string",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java#L85-L95 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java | PHPMethods.preg_replace | public static String preg_replace(String regex, String replacement, String subject) {
Pattern p = Pattern.compile(regex);
return preg_replace(p, replacement, subject);
} | java | public static String preg_replace(String regex, String replacement, String subject) {
Pattern p = Pattern.compile(regex);
return preg_replace(p, replacement, subject);
} | [
"public",
"static",
"String",
"preg_replace",
"(",
"String",
"regex",
",",
"String",
"replacement",
",",
"String",
"subject",
")",
"{",
"Pattern",
"p",
"=",
"Pattern",
".",
"compile",
"(",
"regex",
")",
";",
"return",
"preg_replace",
"(",
"p",
",",
"replac... | Matches a string with a regex and replaces the matched components with
a provided string.
@param regex
@param replacement
@param subject
@return | [
"Matches",
"a",
"string",
"with",
"a",
"regex",
"and",
"replaces",
"the",
"matched",
"components",
"with",
"a",
"provided",
"string",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java#L106-L109 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java | PHPMethods.preg_replace | public static String preg_replace(Pattern pattern, String replacement, String subject) {
Matcher m = pattern.matcher(subject);
StringBuffer sb = new StringBuffer(subject.length());
while(m.find()){
m.appendReplacement(sb, replacement);
}
m.appendTail(sb);
ret... | java | public static String preg_replace(Pattern pattern, String replacement, String subject) {
Matcher m = pattern.matcher(subject);
StringBuffer sb = new StringBuffer(subject.length());
while(m.find()){
m.appendReplacement(sb, replacement);
}
m.appendTail(sb);
ret... | [
"public",
"static",
"String",
"preg_replace",
"(",
"Pattern",
"pattern",
",",
"String",
"replacement",
",",
"String",
"subject",
")",
"{",
"Matcher",
"m",
"=",
"pattern",
".",
"matcher",
"(",
"subject",
")",
";",
"StringBuffer",
"sb",
"=",
"new",
"StringBuff... | Matches a string with a pattern and replaces the matched components with
a provided string.
@param pattern
@param replacement
@param subject
@return | [
"Matches",
"a",
"string",
"with",
"a",
"pattern",
"and",
"replaces",
"the",
"matched",
"components",
"with",
"a",
"provided",
"string",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java#L120-L128 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java | PHPMethods.preg_match | public static int preg_match(String regex, String subject) {
Pattern p = Pattern.compile(regex);
return preg_match(p, subject);
} | java | public static int preg_match(String regex, String subject) {
Pattern p = Pattern.compile(regex);
return preg_match(p, subject);
} | [
"public",
"static",
"int",
"preg_match",
"(",
"String",
"regex",
",",
"String",
"subject",
")",
"{",
"Pattern",
"p",
"=",
"Pattern",
".",
"compile",
"(",
"regex",
")",
";",
"return",
"preg_match",
"(",
"p",
",",
"subject",
")",
";",
"}"
] | Matches a string with a regex.
@param regex
@param subject
@return | [
"Matches",
"a",
"string",
"with",
"a",
"regex",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java#L137-L140 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java | PHPMethods.preg_match | public static int preg_match(Pattern pattern, String subject) {
int matches=0;
Matcher m = pattern.matcher(subject);
while(m.find()){
++matches;
}
return matches;
} | java | public static int preg_match(Pattern pattern, String subject) {
int matches=0;
Matcher m = pattern.matcher(subject);
while(m.find()){
++matches;
}
return matches;
} | [
"public",
"static",
"int",
"preg_match",
"(",
"Pattern",
"pattern",
",",
"String",
"subject",
")",
"{",
"int",
"matches",
"=",
"0",
";",
"Matcher",
"m",
"=",
"pattern",
".",
"matcher",
"(",
"subject",
")",
";",
"while",
"(",
"m",
".",
"find",
"(",
")... | Matches a string with a pattern.
@param pattern
@param subject
@return | [
"Matches",
"a",
"string",
"with",
"a",
"pattern",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java#L149-L156 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java | PHPMethods.round | public static double round(double d, int i) {
double multiplier = Math.pow(10, i);
return Math.round(d*multiplier)/multiplier;
} | java | public static double round(double d, int i) {
double multiplier = Math.pow(10, i);
return Math.round(d*multiplier)/multiplier;
} | [
"public",
"static",
"double",
"round",
"(",
"double",
"d",
",",
"int",
"i",
")",
"{",
"double",
"multiplier",
"=",
"Math",
".",
"pow",
"(",
"10",
",",
"i",
")",
";",
"return",
"Math",
".",
"round",
"(",
"d",
"*",
"multiplier",
")",
"/",
"multiplier... | Rounds a number to a specified precision.
@param d
@param i
@return | [
"Rounds",
"a",
"number",
"to",
"a",
"specified",
"precision",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java#L165-L168 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java | PHPMethods.log | public static double log(double d, double base) {
if(base==1.0 || base<=0.0) {
throw new IllegalArgumentException("Invalid base for logarithm.");
}
return Math.log(d)/Math.log(base);
} | java | public static double log(double d, double base) {
if(base==1.0 || base<=0.0) {
throw new IllegalArgumentException("Invalid base for logarithm.");
}
return Math.log(d)/Math.log(base);
} | [
"public",
"static",
"double",
"log",
"(",
"double",
"d",
",",
"double",
"base",
")",
"{",
"if",
"(",
"base",
"==",
"1.0",
"||",
"base",
"<=",
"0.0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid base for logarithm.\"",
")",
";",
"}"... | Returns the logarithm of a number at an arbitrary base.
@param d
@param base
@return | [
"Returns",
"the",
"logarithm",
"of",
"a",
"number",
"at",
"an",
"arbitrary",
"base",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java#L177-L182 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java | PHPMethods.array_flip | public static <K,V> Map<V,K> array_flip(Map<K,V> map) {
Map<V,K> flipped = new HashMap<>();
for(Map.Entry<K,V> entry : map.entrySet()) {
flipped.put(entry.getValue(), entry.getKey());
}
return flipped;
} | java | public static <K,V> Map<V,K> array_flip(Map<K,V> map) {
Map<V,K> flipped = new HashMap<>();
for(Map.Entry<K,V> entry : map.entrySet()) {
flipped.put(entry.getValue(), entry.getKey());
}
return flipped;
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Map",
"<",
"V",
",",
"K",
">",
"array_flip",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
")",
"{",
"Map",
"<",
"V",
",",
"K",
">",
"flipped",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
... | It flips the key and values of a map.
@param <K>
@param <V>
@param map
@return | [
"It",
"flips",
"the",
"key",
"and",
"values",
"of",
"a",
"map",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java#L224-L230 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java | PHPMethods.shuffle | public static <T> void shuffle(T[] array, Random rnd) {
//Implementing Fisher-Yates shuffle
T tmp;
for (int i = array.length - 1; i > 0; --i) {
int index = rnd.nextInt(i + 1);
tmp = array[index];
array[index] = array[i];
array[i] = tmp... | java | public static <T> void shuffle(T[] array, Random rnd) {
//Implementing Fisher-Yates shuffle
T tmp;
for (int i = array.length - 1; i > 0; --i) {
int index = rnd.nextInt(i + 1);
tmp = array[index];
array[index] = array[i];
array[i] = tmp... | [
"public",
"static",
"<",
"T",
">",
"void",
"shuffle",
"(",
"T",
"[",
"]",
"array",
",",
"Random",
"rnd",
")",
"{",
"//Implementing Fisher-Yates shuffle",
"T",
"tmp",
";",
"for",
"(",
"int",
"i",
"=",
"array",
".",
"length",
"-",
"1",
";",
"i",
">",
... | Shuffles the values of any array in place using the provided random generator.
@param <T>
@param array
@param rnd | [
"Shuffles",
"the",
"values",
"of",
"any",
"array",
"in",
"place",
"using",
"the",
"provided",
"random",
"generator",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java#L249-L259 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java | PHPMethods.asort | public static <T extends Comparable<T>> Integer[] asort(T[] array) {
return _asort(array, false);
} | java | public static <T extends Comparable<T>> Integer[] asort(T[] array) {
return _asort(array, false);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"Integer",
"[",
"]",
"asort",
"(",
"T",
"[",
"]",
"array",
")",
"{",
"return",
"_asort",
"(",
"array",
",",
"false",
")",
";",
"}"
] | Sorts an array in ascending order and returns an array with indexes of
the original order.
@param <T>
@param array
@return | [
"Sorts",
"an",
"array",
"in",
"ascending",
"order",
"and",
"returns",
"an",
"array",
"with",
"indexes",
"of",
"the",
"original",
"order",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java#L269-L271 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java | PHPMethods.arsort | public static <T extends Comparable<T>> Integer[] arsort(T[] array) {
return _asort(array, true);
} | java | public static <T extends Comparable<T>> Integer[] arsort(T[] array) {
return _asort(array, true);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"Integer",
"[",
"]",
"arsort",
"(",
"T",
"[",
"]",
"array",
")",
"{",
"return",
"_asort",
"(",
"array",
",",
"true",
")",
";",
"}"
] | Sorts an array in descending order and returns an array with indexes of
the original order.
@param <T>
@param array
@return | [
"Sorts",
"an",
"array",
"in",
"descending",
"order",
"and",
"returns",
"an",
"array",
"with",
"indexes",
"of",
"the",
"original",
"order",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java#L281-L283 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java | PHPMethods.arrangeByIndex | public static <T> void arrangeByIndex(T[] array, Integer[] indexes) {
if(array.length != indexes.length) {
throw new IllegalArgumentException("The length of the two arrays must match.");
}
//sort the array based on the indexes
for(int i=0;i<array.length;i++) {
... | java | public static <T> void arrangeByIndex(T[] array, Integer[] indexes) {
if(array.length != indexes.length) {
throw new IllegalArgumentException("The length of the two arrays must match.");
}
//sort the array based on the indexes
for(int i=0;i<array.length;i++) {
... | [
"public",
"static",
"<",
"T",
">",
"void",
"arrangeByIndex",
"(",
"T",
"[",
"]",
"array",
",",
"Integer",
"[",
"]",
"indexes",
")",
"{",
"if",
"(",
"array",
".",
"length",
"!=",
"indexes",
".",
"length",
")",
"{",
"throw",
"new",
"IllegalArgumentExcept... | Rearranges the array based on the order of the provided indexes.
@param <T>
@param array
@param indexes | [
"Rearranges",
"the",
"array",
"based",
"on",
"the",
"order",
"of",
"the",
"provided",
"indexes",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java#L310-L324 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java | PHPMethods.array_clone | public static double[] array_clone(double[] a) {
if(a == null) {
return a;
}
return Arrays.copyOf(a, a.length);
} | java | public static double[] array_clone(double[] a) {
if(a == null) {
return a;
}
return Arrays.copyOf(a, a.length);
} | [
"public",
"static",
"double",
"[",
"]",
"array_clone",
"(",
"double",
"[",
"]",
"a",
")",
"{",
"if",
"(",
"a",
"==",
"null",
")",
"{",
"return",
"a",
";",
"}",
"return",
"Arrays",
".",
"copyOf",
"(",
"a",
",",
"a",
".",
"length",
")",
";",
"}"
... | Copies the elements of double array.
@param a
@return | [
"Copies",
"the",
"elements",
"of",
"double",
"array",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java#L332-L337 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java | PHPMethods.array_clone | public static double[][] array_clone(double[][] a) {
if(a == null) {
return a;
}
double[][] copy = new double[a.length][];
for(int i=0;i<a.length;i++) {
copy[i] = Arrays.copyOf(a[i], a[i].length);
}
return copy;
} | java | public static double[][] array_clone(double[][] a) {
if(a == null) {
return a;
}
double[][] copy = new double[a.length][];
for(int i=0;i<a.length;i++) {
copy[i] = Arrays.copyOf(a[i], a[i].length);
}
return copy;
} | [
"public",
"static",
"double",
"[",
"]",
"[",
"]",
"array_clone",
"(",
"double",
"[",
"]",
"[",
"]",
"a",
")",
"{",
"if",
"(",
"a",
"==",
"null",
")",
"{",
"return",
"a",
";",
"}",
"double",
"[",
"]",
"[",
"]",
"copy",
"=",
"new",
"double",
"[... | Copies the elements of double 2D array.
@param a
@return | [
"Copies",
"the",
"elements",
"of",
"double",
"2D",
"array",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java#L345-L354 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/ensemblelearning/FixedCombinationRules.java | FixedCombinationRules.sum | public static AssociativeArray sum(DataTable2D classifierClassProbabilityMatrix) {
AssociativeArray combinedClassProbabilities = new AssociativeArray();
for(Map.Entry<Object, AssociativeArray> entry : classifierClassProbabilityMatrix.entrySet()) {
//Object classifier = entry.getKey... | java | public static AssociativeArray sum(DataTable2D classifierClassProbabilityMatrix) {
AssociativeArray combinedClassProbabilities = new AssociativeArray();
for(Map.Entry<Object, AssociativeArray> entry : classifierClassProbabilityMatrix.entrySet()) {
//Object classifier = entry.getKey... | [
"public",
"static",
"AssociativeArray",
"sum",
"(",
"DataTable2D",
"classifierClassProbabilityMatrix",
")",
"{",
"AssociativeArray",
"combinedClassProbabilities",
"=",
"new",
"AssociativeArray",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Object",
",",
"As... | Combines the responses of the classifiers by using estimating the sum
of the probabilities of their responses.
@param classifierClassProbabilityMatrix
@return | [
"Combines",
"the",
"responses",
"of",
"the",
"classifiers",
"by",
"using",
"estimating",
"the",
"sum",
"of",
"the",
"probabilities",
"of",
"their",
"responses",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/ensemblelearning/FixedCombinationRules.java#L46-L66 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/ensemblelearning/FixedCombinationRules.java | FixedCombinationRules.median | public static AssociativeArray median(DataTable2D classifierClassProbabilityMatrix) {
AssociativeArray combinedClassProbabilities = new AssociativeArray();
//extract all the classes first
for(Map.Entry<Object, AssociativeArray> entry : classifierClassProbabilityMatrix.entrySet()) {
... | java | public static AssociativeArray median(DataTable2D classifierClassProbabilityMatrix) {
AssociativeArray combinedClassProbabilities = new AssociativeArray();
//extract all the classes first
for(Map.Entry<Object, AssociativeArray> entry : classifierClassProbabilityMatrix.entrySet()) {
... | [
"public",
"static",
"AssociativeArray",
"median",
"(",
"DataTable2D",
"classifierClassProbabilityMatrix",
")",
"{",
"AssociativeArray",
"combinedClassProbabilities",
"=",
"new",
"AssociativeArray",
"(",
")",
";",
"//extract all the classes first",
"for",
"(",
"Map",
".",
... | Combines the responses of the classifiers by using estimating the median
of the probabilities of their responses.
@param classifierClassProbabilityMatrix
@return | [
"Combines",
"the",
"responses",
"of",
"the",
"classifiers",
"by",
"using",
"estimating",
"the",
"median",
"of",
"the",
"probabilities",
"of",
"their",
"responses",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/ensemblelearning/FixedCombinationRules.java#L137-L167 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/ensemblelearning/FixedCombinationRules.java | FixedCombinationRules.majorityVote | public static AssociativeArray majorityVote(DataTable2D classifierClassProbabilityMatrix) {
AssociativeArray combinedClassProbabilities = new AssociativeArray();
//extract all the classes first
for(Map.Entry<Object, AssociativeArray> entry : classifierClassProbabilityMatrix.entrySet())... | java | public static AssociativeArray majorityVote(DataTable2D classifierClassProbabilityMatrix) {
AssociativeArray combinedClassProbabilities = new AssociativeArray();
//extract all the classes first
for(Map.Entry<Object, AssociativeArray> entry : classifierClassProbabilityMatrix.entrySet())... | [
"public",
"static",
"AssociativeArray",
"majorityVote",
"(",
"DataTable2D",
"classifierClassProbabilityMatrix",
")",
"{",
"AssociativeArray",
"combinedClassProbabilities",
"=",
"new",
"AssociativeArray",
"(",
")",
";",
"//extract all the classes first",
"for",
"(",
"Map",
"... | Combines the responses of the classifiers by summing the votes of each
winner class.
@param classifierClassProbabilityMatrix
@return | [
"Combines",
"the",
"responses",
"of",
"the",
"classifiers",
"by",
"summing",
"the",
"votes",
"of",
"each",
"winner",
"class",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/ensemblelearning/FixedCombinationRules.java#L261-L292 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/topicmodeling/LatentDirichletAllocation.java | LatentDirichletAllocation.getWordProbabilitiesPerTopic | public AssociativeArray2D getWordProbabilitiesPerTopic() {
AssociativeArray2D ptw = new AssociativeArray2D();
ModelParameters modelParameters = knowledgeBase.getModelParameters();
TrainingParameters trainingParameters = knowledgeBase.getTrainingParameters();
//initializ... | java | public AssociativeArray2D getWordProbabilitiesPerTopic() {
AssociativeArray2D ptw = new AssociativeArray2D();
ModelParameters modelParameters = knowledgeBase.getModelParameters();
TrainingParameters trainingParameters = knowledgeBase.getTrainingParameters();
//initializ... | [
"public",
"AssociativeArray2D",
"getWordProbabilitiesPerTopic",
"(",
")",
"{",
"AssociativeArray2D",
"ptw",
"=",
"new",
"AssociativeArray2D",
"(",
")",
";",
"ModelParameters",
"modelParameters",
"=",
"knowledgeBase",
".",
"getModelParameters",
"(",
")",
";",
"TrainingPa... | Returns the distribution of the words in each topic.
@return | [
"Returns",
"the",
"distribution",
"of",
"the",
"words",
"in",
"each",
"topic",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/topicmodeling/LatentDirichletAllocation.java#L355-L390 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/topicmodeling/LatentDirichletAllocation.java | LatentDirichletAllocation.increase | private <K> void increase(Map<K, Integer> map, K key) {
map.put(key, map.getOrDefault(key, 0)+1);
} | java | private <K> void increase(Map<K, Integer> map, K key) {
map.put(key, map.getOrDefault(key, 0)+1);
} | [
"private",
"<",
"K",
">",
"void",
"increase",
"(",
"Map",
"<",
"K",
",",
"Integer",
">",
"map",
",",
"K",
"key",
")",
"{",
"map",
".",
"put",
"(",
"key",
",",
"map",
".",
"getOrDefault",
"(",
"key",
",",
"0",
")",
"+",
"1",
")",
";",
"}"
] | Utility method that increases the map value by 1.
@param <K>
@param map
@param key | [
"Utility",
"method",
"that",
"increases",
"the",
"map",
"value",
"by",
"1",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/topicmodeling/LatentDirichletAllocation.java#L542-L544 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/topicmodeling/LatentDirichletAllocation.java | LatentDirichletAllocation.decrease | private <K> void decrease(Map<K, Integer> map, K key) {
map.put(key, map.getOrDefault(key, 0)-1);
} | java | private <K> void decrease(Map<K, Integer> map, K key) {
map.put(key, map.getOrDefault(key, 0)-1);
} | [
"private",
"<",
"K",
">",
"void",
"decrease",
"(",
"Map",
"<",
"K",
",",
"Integer",
">",
"map",
",",
"K",
"key",
")",
"{",
"map",
".",
"put",
"(",
"key",
",",
"map",
".",
"getOrDefault",
"(",
"key",
",",
"0",
")",
"-",
"1",
")",
";",
"}"
] | Utility method that decreases the map value by 1.
@param <K>
@param map
@param key | [
"Utility",
"method",
"that",
"decreases",
"the",
"map",
"value",
"by",
"1",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/topicmodeling/LatentDirichletAllocation.java#L552-L554 | train |
datumbox/datumbox-framework | datumbox-framework-common/src/main/java/com/datumbox/framework/common/storage/abstracts/AbstractStorageEngine.java | AbstractStorageEngine.preSerializer | protected <T extends Serializable> Map<String, Object> preSerializer(T serializableObject) {
Map<String, Object> objReferences = new HashMap<>();
for(Field field : ReflectionMethods.getAllFields(new LinkedList<>(), serializableObject.getClass())) {
if (field.isAnnotationPresent(BigMap.class... | java | protected <T extends Serializable> Map<String, Object> preSerializer(T serializableObject) {
Map<String, Object> objReferences = new HashMap<>();
for(Field field : ReflectionMethods.getAllFields(new LinkedList<>(), serializableObject.getClass())) {
if (field.isAnnotationPresent(BigMap.class... | [
"protected",
"<",
"T",
"extends",
"Serializable",
">",
"Map",
"<",
"String",
",",
"Object",
">",
"preSerializer",
"(",
"T",
"serializableObject",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"objReferences",
"=",
"new",
"HashMap",
"<>",
"(",
")",
... | This method is called before serializing the objects. It extracts all the not-serializable BigMap references
of the provided object and stores them in a Map. Then it replaces all the references of the provided object
with nulls to avoid their serialization. The main idea is that we temporarily remove from the object an... | [
"This",
"method",
"is",
"called",
"before",
"serializing",
"the",
"objects",
".",
"It",
"extracts",
"all",
"the",
"not",
"-",
"serializable",
"BigMap",
"references",
"of",
"the",
"provided",
"object",
"and",
"stores",
"them",
"in",
"a",
"Map",
".",
"Then",
... | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-common/src/main/java/com/datumbox/framework/common/storage/abstracts/AbstractStorageEngine.java#L121-L144 | train |
datumbox/datumbox-framework | datumbox-framework-common/src/main/java/com/datumbox/framework/common/storage/abstracts/AbstractStorageEngine.java | AbstractStorageEngine.postSerializer | protected <T extends Serializable> void postSerializer(T serializableObject, Map<String, Object> objReferences) {
for(Field field : ReflectionMethods.getAllFields(new LinkedList<>(), serializableObject.getClass())) {
String fieldName = field.getName();
Object ref = objReferences.remove(... | java | protected <T extends Serializable> void postSerializer(T serializableObject, Map<String, Object> objReferences) {
for(Field field : ReflectionMethods.getAllFields(new LinkedList<>(), serializableObject.getClass())) {
String fieldName = field.getName();
Object ref = objReferences.remove(... | [
"protected",
"<",
"T",
"extends",
"Serializable",
">",
"void",
"postSerializer",
"(",
"T",
"serializableObject",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"objReferences",
")",
"{",
"for",
"(",
"Field",
"field",
":",
"ReflectionMethods",
".",
"getAllField... | This method is called after the object serialization. It moves all the not-serializable BigMap references from
the Map back to the provided object. The main idea is that once the serialization is completed, we are allowed to
restore back all the references which were removed by the preSerializer.
@param serializableOb... | [
"This",
"method",
"is",
"called",
"after",
"the",
"object",
"serialization",
".",
"It",
"moves",
"all",
"the",
"not",
"-",
"serializable",
"BigMap",
"references",
"from",
"the",
"Map",
"back",
"to",
"the",
"provided",
"object",
".",
"The",
"main",
"idea",
... | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-common/src/main/java/com/datumbox/framework/common/storage/abstracts/AbstractStorageEngine.java#L192-L209 | train |
datumbox/datumbox-framework | datumbox-framework-common/src/main/java/com/datumbox/framework/common/storage/abstracts/AbstractStorageEngine.java | AbstractStorageEngine.postDeserializer | protected <T extends Serializable> void postDeserializer(T serializableObject) {
Method method = null;
for(Field field : ReflectionMethods.getAllFields(new LinkedList<>(), serializableObject.getClass())) {
if (field.isAnnotationPresent(BigMap.class)) { //look only for BigMaps
... | java | protected <T extends Serializable> void postDeserializer(T serializableObject) {
Method method = null;
for(Field field : ReflectionMethods.getAllFields(new LinkedList<>(), serializableObject.getClass())) {
if (field.isAnnotationPresent(BigMap.class)) { //look only for BigMaps
... | [
"protected",
"<",
"T",
"extends",
"Serializable",
">",
"void",
"postDeserializer",
"(",
"T",
"serializableObject",
")",
"{",
"Method",
"method",
"=",
"null",
";",
"for",
"(",
"Field",
"field",
":",
"ReflectionMethods",
".",
"getAllFields",
"(",
"new",
"LinkedL... | This method is called after the object deserialization. It initializes all BigMaps of the serializable object which
have a null value. The main idea is that once an object is deserialized it will contain nulls in all the BigMap fields
which were not serialized. For all of those fields we call their initialization metho... | [
"This",
"method",
"is",
"called",
"after",
"the",
"object",
"deserialization",
".",
"It",
"initializes",
"all",
"BigMaps",
"of",
"the",
"serializable",
"object",
"which",
"have",
"a",
"null",
"value",
".",
"The",
"main",
"idea",
"is",
"that",
"once",
"an",
... | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-common/src/main/java/com/datumbox/framework/common/storage/abstracts/AbstractStorageEngine.java#L219-L241 | train |
datumbox/datumbox-framework | datumbox-framework-common/src/main/java/com/datumbox/framework/development/FeatureContext.java | FeatureContext.isActive | public static boolean isActive(Enum obj) {
Enum value = ACTIVE_SWITCHES.get((Class)obj.getClass());
return value != null && value == obj;
} | java | public static boolean isActive(Enum obj) {
Enum value = ACTIVE_SWITCHES.get((Class)obj.getClass());
return value != null && value == obj;
} | [
"public",
"static",
"boolean",
"isActive",
"(",
"Enum",
"obj",
")",
"{",
"Enum",
"value",
"=",
"ACTIVE_SWITCHES",
".",
"get",
"(",
"(",
"Class",
")",
"obj",
".",
"getClass",
"(",
")",
")",
";",
"return",
"value",
"!=",
"null",
"&&",
"value",
"==",
"o... | Validates whether the feature is active.
@param obj
@return | [
"Validates",
"whether",
"the",
"feature",
"is",
"active",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-common/src/main/java/com/datumbox/framework/development/FeatureContext.java#L50-L53 | train |
datumbox/datumbox-framework | datumbox-framework-common/src/main/java/com/datumbox/framework/common/dataobjects/DataTable2D.java | DataTable2D.isValid | public boolean isValid() {
int totalNumberOfColumns = 0;
Set<Object> columns = new HashSet<>();
for(Map.Entry<Object, AssociativeArray> entry : internalData.entrySet()) {
AssociativeArray row = entry.getValue();
if(columns.isEmpty()) {
//this is executed o... | java | public boolean isValid() {
int totalNumberOfColumns = 0;
Set<Object> columns = new HashSet<>();
for(Map.Entry<Object, AssociativeArray> entry : internalData.entrySet()) {
AssociativeArray row = entry.getValue();
if(columns.isEmpty()) {
//this is executed o... | [
"public",
"boolean",
"isValid",
"(",
")",
"{",
"int",
"totalNumberOfColumns",
"=",
"0",
";",
"Set",
"<",
"Object",
">",
"columns",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Object",
",",
"AssociativeArray",
">",... | Returns if the DataTable2D is valid. This data structure is considered
valid it all the DataTable cells are set and as a result the DataTable
has a rectangular format.
@return | [
"Returns",
"if",
"the",
"DataTable2D",
"is",
"valid",
".",
"This",
"data",
"structure",
"is",
"considered",
"valid",
"it",
"all",
"the",
"DataTable",
"cells",
"are",
"set",
"and",
"as",
"a",
"result",
"the",
"DataTable",
"has",
"a",
"rectangular",
"format",
... | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-common/src/main/java/com/datumbox/framework/common/dataobjects/DataTable2D.java#L56-L82 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/common/abstracts/modelers/AbstractClassifier.java | AbstractClassifier.getSelectedClassFromClassScores | protected Object getSelectedClassFromClassScores(AssociativeArray predictionScores) {
Map.Entry<Object, Object> maxEntry = MapMethods.selectMaxKeyValue(predictionScores);
return maxEntry.getKey();
} | java | protected Object getSelectedClassFromClassScores(AssociativeArray predictionScores) {
Map.Entry<Object, Object> maxEntry = MapMethods.selectMaxKeyValue(predictionScores);
return maxEntry.getKey();
} | [
"protected",
"Object",
"getSelectedClassFromClassScores",
"(",
"AssociativeArray",
"predictionScores",
")",
"{",
"Map",
".",
"Entry",
"<",
"Object",
",",
"Object",
">",
"maxEntry",
"=",
"MapMethods",
".",
"selectMaxKeyValue",
"(",
"predictionScores",
")",
";",
"retu... | Estimates the selected class from the prediction scores.
@param predictionScores
@return | [
"Estimates",
"the",
"selected",
"class",
"from",
"the",
"prediction",
"scores",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/common/abstracts/modelers/AbstractClassifier.java#L102-L106 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SystematicSampling.java | SystematicSampling.randomSampling | public static FlatDataCollection randomSampling(FlatDataList idList, int n, boolean randomizeRecords) {
FlatDataList sampledIds = new FlatDataList();
int populationN = idList.size();
Object[] keys = idList.toArray();
if(randomizeRecords) {
PHPMethods.<Object... | java | public static FlatDataCollection randomSampling(FlatDataList idList, int n, boolean randomizeRecords) {
FlatDataList sampledIds = new FlatDataList();
int populationN = idList.size();
Object[] keys = idList.toArray();
if(randomizeRecords) {
PHPMethods.<Object... | [
"public",
"static",
"FlatDataCollection",
"randomSampling",
"(",
"FlatDataList",
"idList",
",",
"int",
"n",
",",
"boolean",
"randomizeRecords",
")",
"{",
"FlatDataList",
"sampledIds",
"=",
"new",
"FlatDataList",
"(",
")",
";",
"int",
"populationN",
"=",
"idList",
... | Samples n ids by using Systematic Sampling
@param idList
@param n
@param randomizeRecords
@return | [
"Samples",
"n",
"ids",
"by",
"using",
"Systematic",
"Sampling"
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SystematicSampling.java#L39-L62 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/common/abstracts/algorithms/AbstractDPMM.java | AbstractDPMM.getFromClusterMap | private CL getFromClusterMap(int clusterId, Map<Integer, CL> clusterMap) {
CL c = clusterMap.get(clusterId);
if(c.getFeatureIds() == null) {
c.setFeatureIds(knowledgeBase.getModelParameters().getFeatureIds()); //fetch the featureIds from model parameters object
}
return c;
... | java | private CL getFromClusterMap(int clusterId, Map<Integer, CL> clusterMap) {
CL c = clusterMap.get(clusterId);
if(c.getFeatureIds() == null) {
c.setFeatureIds(knowledgeBase.getModelParameters().getFeatureIds()); //fetch the featureIds from model parameters object
}
return c;
... | [
"private",
"CL",
"getFromClusterMap",
"(",
"int",
"clusterId",
",",
"Map",
"<",
"Integer",
",",
"CL",
">",
"clusterMap",
")",
"{",
"CL",
"c",
"=",
"clusterMap",
".",
"get",
"(",
"clusterId",
")",
";",
"if",
"(",
"c",
".",
"getFeatureIds",
"(",
")",
"... | Always use this method to get the cluster from the clusterMap because it
ensures that the featureIds are set.
The featureIds can be unset if we use a data structure which stores
stuff in file. Since the featureIds field of cluster is transient, the
information gets lost. This function ensures that it sets it back.
@pa... | [
"Always",
"use",
"this",
"method",
"to",
"get",
"the",
"cluster",
"from",
"the",
"clusterMap",
"because",
"it",
"ensures",
"that",
"the",
"featureIds",
"are",
"set",
".",
"The",
"featureIds",
"can",
"be",
"unset",
"if",
"we",
"use",
"a",
"data",
"structure... | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/common/abstracts/algorithms/AbstractDPMM.java#L373-L379 | train |
datumbox/datumbox-framework | datumbox-framework-common/src/main/java/com/datumbox/framework/common/storage/abstracts/AbstractFileStorageEngine.java | AbstractFileStorageEngine.getDirectory | protected String getDirectory() {
//get the default filepath of the permanet storage file
String directory = storageConfiguration.getDirectory();
if(directory == null || directory.isEmpty()) {
directory = System.getProperty("java.io.tmpdir"); //write them to the tmp directory
... | java | protected String getDirectory() {
//get the default filepath of the permanet storage file
String directory = storageConfiguration.getDirectory();
if(directory == null || directory.isEmpty()) {
directory = System.getProperty("java.io.tmpdir"); //write them to the tmp directory
... | [
"protected",
"String",
"getDirectory",
"(",
")",
"{",
"//get the default filepath of the permanet storage file",
"String",
"directory",
"=",
"storageConfiguration",
".",
"getDirectory",
"(",
")",
";",
"if",
"(",
"directory",
"==",
"null",
"||",
"directory",
".",
"isEm... | Returns the location of the directory from the configuration or the temporary directory if not defined.
@return | [
"Returns",
"the",
"location",
"of",
"the",
"directory",
"from",
"the",
"configuration",
"or",
"the",
"temporary",
"directory",
"if",
"not",
"defined",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-common/src/main/java/com/datumbox/framework/common/storage/abstracts/AbstractFileStorageEngine.java#L47-L56 | train |
datumbox/datumbox-framework | datumbox-framework-common/src/main/java/com/datumbox/framework/common/storage/abstracts/AbstractFileStorageEngine.java | AbstractFileStorageEngine.getRootPath | protected Path getRootPath(String storageName) {
return Paths.get(getDirectory() + File.separator + storageName);
} | java | protected Path getRootPath(String storageName) {
return Paths.get(getDirectory() + File.separator + storageName);
} | [
"protected",
"Path",
"getRootPath",
"(",
"String",
"storageName",
")",
"{",
"return",
"Paths",
".",
"get",
"(",
"getDirectory",
"(",
")",
"+",
"File",
".",
"separator",
"+",
"storageName",
")",
";",
"}"
] | Returns the root path of the storage.
@param storageName
@return | [
"Returns",
"the",
"root",
"path",
"of",
"the",
"storage",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-common/src/main/java/com/datumbox/framework/common/storage/abstracts/AbstractFileStorageEngine.java#L64-L66 | train |
datumbox/datumbox-framework | datumbox-framework-common/src/main/java/com/datumbox/framework/common/storage/abstracts/AbstractFileStorageEngine.java | AbstractFileStorageEngine.deleteIfExistsRecursively | protected boolean deleteIfExistsRecursively(Path path) throws IOException {
try {
return Files.deleteIfExists(path);
}
catch (DirectoryNotEmptyException ex) {
//do recursive delete
Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
@Overr... | java | protected boolean deleteIfExistsRecursively(Path path) throws IOException {
try {
return Files.deleteIfExists(path);
}
catch (DirectoryNotEmptyException ex) {
//do recursive delete
Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
@Overr... | [
"protected",
"boolean",
"deleteIfExistsRecursively",
"(",
"Path",
"path",
")",
"throws",
"IOException",
"{",
"try",
"{",
"return",
"Files",
".",
"deleteIfExists",
"(",
"path",
")",
";",
"}",
"catch",
"(",
"DirectoryNotEmptyException",
"ex",
")",
"{",
"//do recur... | Deletes the file or directory recursively if it exists.
@param path
@return
@throws IOException | [
"Deletes",
"the",
"file",
"or",
"directory",
"recursively",
"if",
"it",
"exists",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-common/src/main/java/com/datumbox/framework/common/storage/abstracts/AbstractFileStorageEngine.java#L75-L96 | train |
datumbox/datumbox-framework | datumbox-framework-common/src/main/java/com/datumbox/framework/common/storage/abstracts/AbstractFileStorageEngine.java | AbstractFileStorageEngine.deleteDirectory | protected boolean deleteDirectory(Path path, boolean cleanParent) throws IOException {
boolean pathExists = deleteIfExistsRecursively(path);
if(pathExists && cleanParent) {
cleanEmptyParentDirectory(path.getParent());
return true;
}
return false;
} | java | protected boolean deleteDirectory(Path path, boolean cleanParent) throws IOException {
boolean pathExists = deleteIfExistsRecursively(path);
if(pathExists && cleanParent) {
cleanEmptyParentDirectory(path.getParent());
return true;
}
return false;
} | [
"protected",
"boolean",
"deleteDirectory",
"(",
"Path",
"path",
",",
"boolean",
"cleanParent",
")",
"throws",
"IOException",
"{",
"boolean",
"pathExists",
"=",
"deleteIfExistsRecursively",
"(",
"path",
")",
";",
"if",
"(",
"pathExists",
"&&",
"cleanParent",
")",
... | Deletes a directory and optionally removes the parent directory if it becomes empty.
@param path
@param cleanParent
@return
@throws IOException | [
"Deletes",
"a",
"directory",
"and",
"optionally",
"removes",
"the",
"parent",
"directory",
"if",
"it",
"becomes",
"empty",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-common/src/main/java/com/datumbox/framework/common/storage/abstracts/AbstractFileStorageEngine.java#L106-L113 | train |
datumbox/datumbox-framework | datumbox-framework-common/src/main/java/com/datumbox/framework/common/storage/abstracts/AbstractFileStorageEngine.java | AbstractFileStorageEngine.cleanEmptyParentDirectory | private void cleanEmptyParentDirectory(Path path) throws IOException {
Path normPath = path.normalize();
if(normPath.equals(Paths.get(getDirectory()).normalize()) || normPath.equals(Paths.get(System.getProperty("java.io.tmpdir")).normalize())) { //stop if we reach the output or temporary directory
... | java | private void cleanEmptyParentDirectory(Path path) throws IOException {
Path normPath = path.normalize();
if(normPath.equals(Paths.get(getDirectory()).normalize()) || normPath.equals(Paths.get(System.getProperty("java.io.tmpdir")).normalize())) { //stop if we reach the output or temporary directory
... | [
"private",
"void",
"cleanEmptyParentDirectory",
"(",
"Path",
"path",
")",
"throws",
"IOException",
"{",
"Path",
"normPath",
"=",
"path",
".",
"normalize",
"(",
")",
";",
"if",
"(",
"normPath",
".",
"equals",
"(",
"Paths",
".",
"get",
"(",
"getDirectory",
"... | Removes recursively all empty parent directories up to and excluding the storage directory.
@param path
@throws IOException | [
"Removes",
"recursively",
"all",
"empty",
"parent",
"directories",
"up",
"to",
"and",
"excluding",
"the",
"storage",
"directory",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-common/src/main/java/com/datumbox/framework/common/storage/abstracts/AbstractFileStorageEngine.java#L121-L133 | train |
datumbox/datumbox-framework | datumbox-framework-common/src/main/java/com/datumbox/framework/common/storage/abstracts/AbstractFileStorageEngine.java | AbstractFileStorageEngine.moveDirectory | protected boolean moveDirectory(Path src, Path target) throws IOException {
if(Files.exists(src)) {
createDirectoryIfNotExists(target.getParent());
deleteDirectory(target, false);
Files.move(src, target);
cleanEmptyParentDirectory(src.getParent());
ret... | java | protected boolean moveDirectory(Path src, Path target) throws IOException {
if(Files.exists(src)) {
createDirectoryIfNotExists(target.getParent());
deleteDirectory(target, false);
Files.move(src, target);
cleanEmptyParentDirectory(src.getParent());
ret... | [
"protected",
"boolean",
"moveDirectory",
"(",
"Path",
"src",
",",
"Path",
"target",
")",
"throws",
"IOException",
"{",
"if",
"(",
"Files",
".",
"exists",
"(",
"src",
")",
")",
"{",
"createDirectoryIfNotExists",
"(",
"target",
".",
"getParent",
"(",
")",
")... | Moves a directory in the target location.
@param src
@param target
@return
@throws IOException | [
"Moves",
"a",
"directory",
"in",
"the",
"target",
"location",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-common/src/main/java/com/datumbox/framework/common/storage/abstracts/AbstractFileStorageEngine.java#L143-L154 | train |
datumbox/datumbox-framework | datumbox-framework-common/src/main/java/com/datumbox/framework/common/storage/abstracts/AbstractFileStorageEngine.java | AbstractFileStorageEngine.createDirectoryIfNotExists | protected boolean createDirectoryIfNotExists(Path path) throws IOException {
if(!Files.exists(path)) {
Files.createDirectories(path);
return true;
}
else {
return false;
}
} | java | protected boolean createDirectoryIfNotExists(Path path) throws IOException {
if(!Files.exists(path)) {
Files.createDirectories(path);
return true;
}
else {
return false;
}
} | [
"protected",
"boolean",
"createDirectoryIfNotExists",
"(",
"Path",
"path",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"Files",
".",
"exists",
"(",
"path",
")",
")",
"{",
"Files",
".",
"createDirectories",
"(",
"path",
")",
";",
"return",
"true",
";... | Creates the directory in the target location if it does not exist.
@param path
@return
@throws IOException | [
"Creates",
"the",
"directory",
"in",
"the",
"target",
"location",
"if",
"it",
"does",
"not",
"exist",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-common/src/main/java/com/datumbox/framework/common/storage/abstracts/AbstractFileStorageEngine.java#L163-L171 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/timeseries/Smoothing.java | Smoothing.simpleMovingAverage | public static double simpleMovingAverage(FlatDataList flatDataList, int N) {
double SMA=0;
int counter=0;
for(int i=flatDataList.size()-1;i>=0;--i) {
double Yti = flatDataList.getDouble(i);
if(counter>=N) {
break;
}
SMA+=Yti; //pos... | java | public static double simpleMovingAverage(FlatDataList flatDataList, int N) {
double SMA=0;
int counter=0;
for(int i=flatDataList.size()-1;i>=0;--i) {
double Yti = flatDataList.getDouble(i);
if(counter>=N) {
break;
}
SMA+=Yti; //pos... | [
"public",
"static",
"double",
"simpleMovingAverage",
"(",
"FlatDataList",
"flatDataList",
",",
"int",
"N",
")",
"{",
"double",
"SMA",
"=",
"0",
";",
"int",
"counter",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"flatDataList",
".",
"size",
"(",
")",
"-... | Simple Moving Average
@param flatDataList
@param N
@return | [
"Simple",
"Moving",
"Average"
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/timeseries/Smoothing.java#L34-L50 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/timeseries/Smoothing.java | Smoothing.weightedMovingAverage | public static double weightedMovingAverage(FlatDataList flatDataList, int N) {
double WMA=0;
double denominator=0.0;
int counter=0;
for(int i=flatDataList.size()-1;i>=0;--i) {
double Yti = flatDataList.getDouble(i);
if(counter>=N) {
b... | java | public static double weightedMovingAverage(FlatDataList flatDataList, int N) {
double WMA=0;
double denominator=0.0;
int counter=0;
for(int i=flatDataList.size()-1;i>=0;--i) {
double Yti = flatDataList.getDouble(i);
if(counter>=N) {
b... | [
"public",
"static",
"double",
"weightedMovingAverage",
"(",
"FlatDataList",
"flatDataList",
",",
"int",
"N",
")",
"{",
"double",
"WMA",
"=",
"0",
";",
"double",
"denominator",
"=",
"0.0",
";",
"int",
"counter",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",... | Weighted Moving Average
@param flatDataList
@param N
@return | [
"Weighted",
"Moving",
"Average"
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/timeseries/Smoothing.java#L74-L96 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/timeseries/Smoothing.java | Smoothing.simpleExponentialSmoothing | public static double simpleExponentialSmoothing(FlatDataList flatDataList, double a) {
double EMA=0;
int count=0;
for(int i=flatDataList.size()-1;i>=0;--i) {
double Yti = flatDataList.getDouble(i);
EMA+=a*Math.pow(1-a,count)*Yti;
++count;
}
r... | java | public static double simpleExponentialSmoothing(FlatDataList flatDataList, double a) {
double EMA=0;
int count=0;
for(int i=flatDataList.size()-1;i>=0;--i) {
double Yti = flatDataList.getDouble(i);
EMA+=a*Math.pow(1-a,count)*Yti;
++count;
}
r... | [
"public",
"static",
"double",
"simpleExponentialSmoothing",
"(",
"FlatDataList",
"flatDataList",
",",
"double",
"a",
")",
"{",
"double",
"EMA",
"=",
"0",
";",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"flatDataList",
".",
"size",
"(",
"... | Simple Explonential Smoothing
@param flatDataList
@param a
@return | [
"Simple",
"Explonential",
"Smoothing"
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/timeseries/Smoothing.java#L105-L116 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/SelectKth.java | SelectKth.largest | public static Double largest(Iterator<Double> elements, int k) {
Iterator<Double> oppositeElements = new Iterator<Double>() {
/** {@inheritDoc} */
@Override
public boolean hasNext() {
return elements.hasNext();
}
/** {@inhe... | java | public static Double largest(Iterator<Double> elements, int k) {
Iterator<Double> oppositeElements = new Iterator<Double>() {
/** {@inheritDoc} */
@Override
public boolean hasNext() {
return elements.hasNext();
}
/** {@inhe... | [
"public",
"static",
"Double",
"largest",
"(",
"Iterator",
"<",
"Double",
">",
"elements",
",",
"int",
"k",
")",
"{",
"Iterator",
"<",
"Double",
">",
"oppositeElements",
"=",
"new",
"Iterator",
"<",
"Double",
">",
"(",
")",
"{",
"/** {@inheritDoc} */",
"@",... | Selects the kth largest element from an iterable object.
@param elements
@param k
@return | [
"Selects",
"the",
"kth",
"largest",
"element",
"from",
"an",
"iterable",
"object",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/SelectKth.java#L35-L50 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/ClusterSampling.java | ClusterSampling.nBar | public static double nBar(TransposeDataList clusterIdList) {
int populationM = clusterIdList.size();
double nBar = 0.0;
for(Map.Entry<Object, FlatDataList> entry : clusterIdList.entrySet()) {
nBar += (double)entry.getValue().size()/populationM;
}
return nBar... | java | public static double nBar(TransposeDataList clusterIdList) {
int populationM = clusterIdList.size();
double nBar = 0.0;
for(Map.Entry<Object, FlatDataList> entry : clusterIdList.entrySet()) {
nBar += (double)entry.getValue().size()/populationM;
}
return nBar... | [
"public",
"static",
"double",
"nBar",
"(",
"TransposeDataList",
"clusterIdList",
")",
"{",
"int",
"populationM",
"=",
"clusterIdList",
".",
"size",
"(",
")",
";",
"double",
"nBar",
"=",
"0.0",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Object",
",",
"Fl... | Returns the mean cluster size.
@param clusterIdList
@return | [
"Returns",
"the",
"mean",
"cluster",
"size",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/ClusterSampling.java#L41-L50 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/ClusterSampling.java | ClusterSampling.randomSampling | public static TransposeDataCollection randomSampling(TransposeDataList clusterIdList, int sampleM) {
TransposeDataCollection sampledIds = new TransposeDataCollection();
Object[] selectedClusters = clusterIdList.keySet().toArray();
PHPMethods.<Object>shuffle(selectedClusters);
... | java | public static TransposeDataCollection randomSampling(TransposeDataList clusterIdList, int sampleM) {
TransposeDataCollection sampledIds = new TransposeDataCollection();
Object[] selectedClusters = clusterIdList.keySet().toArray();
PHPMethods.<Object>shuffle(selectedClusters);
... | [
"public",
"static",
"TransposeDataCollection",
"randomSampling",
"(",
"TransposeDataList",
"clusterIdList",
",",
"int",
"sampleM",
")",
"{",
"TransposeDataCollection",
"sampledIds",
"=",
"new",
"TransposeDataCollection",
"(",
")",
";",
"Object",
"[",
"]",
"selectedClust... | Samples m clusters by using Cluster Sampling
@param clusterIdList
@param sampleM
@return | [
"Samples",
"m",
"clusters",
"by",
"using",
"Cluster",
"Sampling"
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/ClusterSampling.java#L59-L72 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/StringCleaner.java | StringCleaner.tokenizeSmileys | public static String tokenizeSmileys(String text) {
for(Map.Entry<String, String> smiley : SMILEYS_MAPPING.entrySet()) {
text = text.replaceAll(smiley.getKey(), smiley.getValue());
}
return text;
} | java | public static String tokenizeSmileys(String text) {
for(Map.Entry<String, String> smiley : SMILEYS_MAPPING.entrySet()) {
text = text.replaceAll(smiley.getKey(), smiley.getValue());
}
return text;
} | [
"public",
"static",
"String",
"tokenizeSmileys",
"(",
"String",
"text",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"smiley",
":",
"SMILEYS_MAPPING",
".",
"entrySet",
"(",
")",
")",
"{",
"text",
"=",
"text",
".",
"repl... | Replaces all the SMILEYS_MAPPING within the text with their tokens.
@param text
@return | [
"Replaces",
"all",
"the",
"SMILEYS_MAPPING",
"within",
"the",
"text",
"with",
"their",
"tokens",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/StringCleaner.java#L78-L83 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/StringCleaner.java | StringCleaner.unifyTerminators | public static String unifyTerminators(String text) {
text = text.replaceAll("[\",:;()\\-]+", " "); // Replace commas, hyphens, quotes etc (count them as spaces)
text = text.replaceAll("[\\.!?]", "."); // Unify terminators
text = text.replaceAll("\\.[\\. ]+", "."); // Check for duplicated termina... | java | public static String unifyTerminators(String text) {
text = text.replaceAll("[\",:;()\\-]+", " "); // Replace commas, hyphens, quotes etc (count them as spaces)
text = text.replaceAll("[\\.!?]", "."); // Unify terminators
text = text.replaceAll("\\.[\\. ]+", "."); // Check for duplicated termina... | [
"public",
"static",
"String",
"unifyTerminators",
"(",
"String",
"text",
")",
"{",
"text",
"=",
"text",
".",
"replaceAll",
"(",
"\"[\\\",:;()\\\\-]+\"",
",",
"\" \"",
")",
";",
"// Replace commas, hyphens, quotes etc (count them as spaces)",
"text",
"=",
"text",
".",
... | Replaces all terminators with space or dots. The final string will contain only
alphanumerics and dots.
@param text
@return | [
"Replaces",
"all",
"terminators",
"with",
"space",
"or",
"dots",
".",
"The",
"final",
"string",
"will",
"contain",
"only",
"alphanumerics",
"and",
"dots",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/StringCleaner.java#L115-L121 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/StringCleaner.java | StringCleaner.removeAccents | public static String removeAccents(String text) {
text = Normalizer.normalize(text, Normalizer.Form.NFD);
text = text.replaceAll("[\\p{InCombiningDiacriticalMarks}]", "");
return text;
} | java | public static String removeAccents(String text) {
text = Normalizer.normalize(text, Normalizer.Form.NFD);
text = text.replaceAll("[\\p{InCombiningDiacriticalMarks}]", "");
return text;
} | [
"public",
"static",
"String",
"removeAccents",
"(",
"String",
"text",
")",
"{",
"text",
"=",
"Normalizer",
".",
"normalize",
"(",
"text",
",",
"Normalizer",
".",
"Form",
".",
"NFD",
")",
";",
"text",
"=",
"text",
".",
"replaceAll",
"(",
"\"[\\\\p{InCombini... | Removes all accepts from the text.
@param text
@return | [
"Removes",
"all",
"accepts",
"from",
"the",
"text",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/StringCleaner.java#L129-L133 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/StringCleaner.java | StringCleaner.clear | public static String clear(String text) {
text = StringCleaner.tokenizeURLs(text);
text = StringCleaner.tokenizeSmileys(text);
text = StringCleaner.removeAccents(text);
text = StringCleaner.removeSymbols(text);
text = StringCleaner.removeExtraSpaces(text);
return... | java | public static String clear(String text) {
text = StringCleaner.tokenizeURLs(text);
text = StringCleaner.tokenizeSmileys(text);
text = StringCleaner.removeAccents(text);
text = StringCleaner.removeSymbols(text);
text = StringCleaner.removeExtraSpaces(text);
return... | [
"public",
"static",
"String",
"clear",
"(",
"String",
"text",
")",
"{",
"text",
"=",
"StringCleaner",
".",
"tokenizeURLs",
"(",
"text",
")",
";",
"text",
"=",
"StringCleaner",
".",
"tokenizeSmileys",
"(",
"text",
")",
";",
"text",
"=",
"StringCleaner",
"."... | Convenience method which tokenizes the URLs and the SMILEYS_MAPPING, removes accents
and symbols and eliminates the extra spaces from the provided text.
@param text
@return | [
"Convenience",
"method",
"which",
"tokenizes",
"the",
"URLs",
"and",
"the",
"SMILEYS_MAPPING",
"removes",
"accents",
"and",
"symbols",
"and",
"eliminates",
"the",
"extra",
"spaces",
"from",
"the",
"provided",
"text",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/StringCleaner.java#L142-L150 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/nonparametrics/independentsamples/Chisquare.java | Chisquare.getScoreValue | public static double getScoreValue(DataTable2D dataTable) {
AssociativeArray result = getScore(dataTable);
double score = result.getDouble("score");
return score;
} | java | public static double getScoreValue(DataTable2D dataTable) {
AssociativeArray result = getScore(dataTable);
double score = result.getDouble("score");
return score;
} | [
"public",
"static",
"double",
"getScoreValue",
"(",
"DataTable2D",
"dataTable",
")",
"{",
"AssociativeArray",
"result",
"=",
"getScore",
"(",
"dataTable",
")",
";",
"double",
"score",
"=",
"result",
".",
"getDouble",
"(",
"\"score\"",
")",
";",
"return",
"scor... | Convenience method to get the score of Chisquare.
@param dataTable
@return | [
"Convenience",
"method",
"to",
"get",
"the",
"score",
"of",
"Chisquare",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/nonparametrics/independentsamples/Chisquare.java#L140-L146 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/mathematics/linearprogramming/LPSolver.java | LPSolver.solve | public static LPResult solve(double[] linearObjectiveFunction, List<LPSolver.LPConstraint> linearConstraintsList, boolean nonNegative, boolean maximize) {
int m = linearConstraintsList.size();
List<LinearConstraint> constraints = new ArrayList<>(m);
for(LPSolver.LPConstraint constraint : linear... | java | public static LPResult solve(double[] linearObjectiveFunction, List<LPSolver.LPConstraint> linearConstraintsList, boolean nonNegative, boolean maximize) {
int m = linearConstraintsList.size();
List<LinearConstraint> constraints = new ArrayList<>(m);
for(LPSolver.LPConstraint constraint : linear... | [
"public",
"static",
"LPResult",
"solve",
"(",
"double",
"[",
"]",
"linearObjectiveFunction",
",",
"List",
"<",
"LPSolver",
".",
"LPConstraint",
">",
"linearConstraintsList",
",",
"boolean",
"nonNegative",
",",
"boolean",
"maximize",
")",
"{",
"int",
"m",
"=",
... | Solves the LP problem and returns the result.
@param linearObjectiveFunction
@param linearConstraintsList
@param nonNegative
@param maximize
@return | [
"Solves",
"the",
"LP",
"problem",
"and",
"returns",
"the",
"result",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/mathematics/linearprogramming/LPSolver.java#L163-L200 | train |
datumbox/datumbox-framework | datumbox-framework-common/src/main/java/com/datumbox/framework/common/dataobjects/AssociativeArray2D.java | AssociativeArray2D.get2d | public final Object get2d(Object key1, Object key2) {
AssociativeArray tmp = internalData.get(key1);
if(tmp == null) {
return null;
}
return tmp.internalData.get(key2);
} | java | public final Object get2d(Object key1, Object key2) {
AssociativeArray tmp = internalData.get(key1);
if(tmp == null) {
return null;
}
return tmp.internalData.get(key2);
} | [
"public",
"final",
"Object",
"get2d",
"(",
"Object",
"key1",
",",
"Object",
"key2",
")",
"{",
"AssociativeArray",
"tmp",
"=",
"internalData",
".",
"get",
"(",
"key1",
")",
";",
"if",
"(",
"tmp",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"re... | Convenience function to get the value by using both keys.
@param key1
@param key2
@return | [
"Convenience",
"function",
"to",
"get",
"the",
"value",
"by",
"using",
"both",
"keys",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-common/src/main/java/com/datumbox/framework/common/dataobjects/AssociativeArray2D.java#L127-L134 | train |
datumbox/datumbox-framework | datumbox-framework-common/src/main/java/com/datumbox/framework/common/dataobjects/AssociativeArray2D.java | AssociativeArray2D.put2d | public final Object put2d(Object key1, Object key2, Object value) {
AssociativeArray tmp = internalData.get(key1);
if(tmp == null) {
internalData.put(key1, new AssociativeArray());
}
return internalData.get(key1).internalData.put(key2, value);
} | java | public final Object put2d(Object key1, Object key2, Object value) {
AssociativeArray tmp = internalData.get(key1);
if(tmp == null) {
internalData.put(key1, new AssociativeArray());
}
return internalData.get(key1).internalData.put(key2, value);
} | [
"public",
"final",
"Object",
"put2d",
"(",
"Object",
"key1",
",",
"Object",
"key2",
",",
"Object",
"value",
")",
"{",
"AssociativeArray",
"tmp",
"=",
"internalData",
".",
"get",
"(",
"key1",
")",
";",
"if",
"(",
"tmp",
"==",
"null",
")",
"{",
"internal... | Convenience function used to put a value in a particular key positions.
@param key1
@param key2
@param value
@return | [
"Convenience",
"function",
"used",
"to",
"put",
"a",
"value",
"in",
"a",
"particular",
"key",
"positions",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-common/src/main/java/com/datumbox/framework/common/dataobjects/AssociativeArray2D.java#L144-L151 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/parsers/URLParser.java | URLParser.joinURL | public static String joinURL(Map<URLParts, String> urlParts) {
try {
URI uri = new URI(urlParts.get(URLParts.PROTOCOL), urlParts.get(URLParts.AUTHORITY), urlParts.get(URLParts.PATH), urlParts.get(URLParts.QUERY), urlParts.get(URLParts.REF));
return uri.toString();
}
catc... | java | public static String joinURL(Map<URLParts, String> urlParts) {
try {
URI uri = new URI(urlParts.get(URLParts.PROTOCOL), urlParts.get(URLParts.AUTHORITY), urlParts.get(URLParts.PATH), urlParts.get(URLParts.QUERY), urlParts.get(URLParts.REF));
return uri.toString();
}
catc... | [
"public",
"static",
"String",
"joinURL",
"(",
"Map",
"<",
"URLParts",
",",
"String",
">",
"urlParts",
")",
"{",
"try",
"{",
"URI",
"uri",
"=",
"new",
"URI",
"(",
"urlParts",
".",
"get",
"(",
"URLParts",
".",
"PROTOCOL",
")",
",",
"urlParts",
".",
"ge... | This method can be used to build a URL from its parts.
@param urlParts
@return | [
"This",
"method",
"can",
"be",
"used",
"to",
"build",
"a",
"URL",
"from",
"its",
"parts",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/parsers/URLParser.java#L205-L213 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/parsers/URLParser.java | URLParser.splitDomain | public static Map<DomainParts, String> splitDomain(String domain) {
Map<DomainParts, String> domainParts = null;
String[] dottedParts = domain.trim().toLowerCase(Locale.ENGLISH).split("\\.");
if(dottedParts.length==2) {
domainParts = new HashMap<>();
dom... | java | public static Map<DomainParts, String> splitDomain(String domain) {
Map<DomainParts, String> domainParts = null;
String[] dottedParts = domain.trim().toLowerCase(Locale.ENGLISH).split("\\.");
if(dottedParts.length==2) {
domainParts = new HashMap<>();
dom... | [
"public",
"static",
"Map",
"<",
"DomainParts",
",",
"String",
">",
"splitDomain",
"(",
"String",
"domain",
")",
"{",
"Map",
"<",
"DomainParts",
",",
"String",
">",
"domainParts",
"=",
"null",
";",
"String",
"[",
"]",
"dottedParts",
"=",
"domain",
".",
"t... | Splits a domain name to parts and returns them in a map.
@param domain
@return | [
"Splits",
"a",
"domain",
"name",
"to",
"parts",
"and",
"returns",
"them",
"in",
"a",
"map",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/parsers/URLParser.java#L221-L263 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/analyzers/ReadabilityStatistics.java | ReadabilityStatistics.fleschKincaidReadingEase | public static double fleschKincaidReadingEase(String strText) {
strText = cleanText(strText);
return PHPMethods.round((206.835 - (1.015 * averageWordsPerSentence(strText)) - (84.6 * averageSyllablesPerWord(strText))), 1);
} | java | public static double fleschKincaidReadingEase(String strText) {
strText = cleanText(strText);
return PHPMethods.round((206.835 - (1.015 * averageWordsPerSentence(strText)) - (84.6 * averageSyllablesPerWord(strText))), 1);
} | [
"public",
"static",
"double",
"fleschKincaidReadingEase",
"(",
"String",
"strText",
")",
"{",
"strText",
"=",
"cleanText",
"(",
"strText",
")",
";",
"return",
"PHPMethods",
".",
"round",
"(",
"(",
"206.835",
"-",
"(",
"1.015",
"*",
"averageWordsPerSentence",
"... | Returns the Flesch-Kincaid Reading Ease of text entered rounded to one digit.
@param strText Text to be checked
@return | [
"Returns",
"the",
"Flesch",
"-",
"Kincaid",
"Reading",
"Ease",
"of",
"text",
"entered",
"rounded",
"to",
"one",
"digit",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/analyzers/ReadabilityStatistics.java#L57-L60 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/analyzers/ReadabilityStatistics.java | ReadabilityStatistics.fleschKincaidGradeLevel | public static double fleschKincaidGradeLevel(String strText) {
strText = cleanText(strText);
return PHPMethods.round(((0.39 * averageWordsPerSentence(strText)) + (11.8 * averageSyllablesPerWord(strText)) - 15.59), 1);
} | java | public static double fleschKincaidGradeLevel(String strText) {
strText = cleanText(strText);
return PHPMethods.round(((0.39 * averageWordsPerSentence(strText)) + (11.8 * averageSyllablesPerWord(strText)) - 15.59), 1);
} | [
"public",
"static",
"double",
"fleschKincaidGradeLevel",
"(",
"String",
"strText",
")",
"{",
"strText",
"=",
"cleanText",
"(",
"strText",
")",
";",
"return",
"PHPMethods",
".",
"round",
"(",
"(",
"(",
"0.39",
"*",
"averageWordsPerSentence",
"(",
"strText",
")"... | Returns the Flesch-Kincaid Grade level of text entered rounded to one digit.
@param strText Text to be checked
@return | [
"Returns",
"the",
"Flesch",
"-",
"Kincaid",
"Grade",
"level",
"of",
"text",
"entered",
"rounded",
"to",
"one",
"digit",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/analyzers/ReadabilityStatistics.java#L68-L71 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/analyzers/ReadabilityStatistics.java | ReadabilityStatistics.gunningFogScore | public static double gunningFogScore(String strText) {
strText = cleanText(strText);
return PHPMethods.round(((averageWordsPerSentence(strText) + percentageWordsWithThreeSyllables(strText)) * 0.4), 1);
} | java | public static double gunningFogScore(String strText) {
strText = cleanText(strText);
return PHPMethods.round(((averageWordsPerSentence(strText) + percentageWordsWithThreeSyllables(strText)) * 0.4), 1);
} | [
"public",
"static",
"double",
"gunningFogScore",
"(",
"String",
"strText",
")",
"{",
"strText",
"=",
"cleanText",
"(",
"strText",
")",
";",
"return",
"PHPMethods",
".",
"round",
"(",
"(",
"(",
"averageWordsPerSentence",
"(",
"strText",
")",
"+",
"percentageWor... | Returns the Gunning-Fog score of text entered rounded to one digit.
@param strText Text to be checked
@return | [
"Returns",
"the",
"Gunning",
"-",
"Fog",
"score",
"of",
"text",
"entered",
"rounded",
"to",
"one",
"digit",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/analyzers/ReadabilityStatistics.java#L79-L82 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/analyzers/ReadabilityStatistics.java | ReadabilityStatistics.colemanLiauIndex | public static double colemanLiauIndex(String strText) {
strText = cleanText(strText);
int intWordCount = wordCount(strText);
return PHPMethods.round( ( (5.89 * (letterCount(strText) / (double)intWordCount)) - (0.3 * (sentenceCount(strText) / (double)intWordCount)) - 15.8 ), 1);
} | java | public static double colemanLiauIndex(String strText) {
strText = cleanText(strText);
int intWordCount = wordCount(strText);
return PHPMethods.round( ( (5.89 * (letterCount(strText) / (double)intWordCount)) - (0.3 * (sentenceCount(strText) / (double)intWordCount)) - 15.8 ), 1);
} | [
"public",
"static",
"double",
"colemanLiauIndex",
"(",
"String",
"strText",
")",
"{",
"strText",
"=",
"cleanText",
"(",
"strText",
")",
";",
"int",
"intWordCount",
"=",
"wordCount",
"(",
"strText",
")",
";",
"return",
"PHPMethods",
".",
"round",
"(",
"(",
... | Returns the Coleman-Liau Index of text entered rounded to one digit.
@param strText Text to be checked
@return | [
"Returns",
"the",
"Coleman",
"-",
"Liau",
"Index",
"of",
"text",
"entered",
"rounded",
"to",
"one",
"digit",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/analyzers/ReadabilityStatistics.java#L90-L94 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/analyzers/ReadabilityStatistics.java | ReadabilityStatistics.smogIndex | public static double smogIndex(String strText) {
strText = cleanText(strText);
return PHPMethods.round(1.043 * Math.sqrt((wordsWithThreeSyllables(strText) * (30.0 / sentenceCount(strText))) + 3.1291), 1);
} | java | public static double smogIndex(String strText) {
strText = cleanText(strText);
return PHPMethods.round(1.043 * Math.sqrt((wordsWithThreeSyllables(strText) * (30.0 / sentenceCount(strText))) + 3.1291), 1);
} | [
"public",
"static",
"double",
"smogIndex",
"(",
"String",
"strText",
")",
"{",
"strText",
"=",
"cleanText",
"(",
"strText",
")",
";",
"return",
"PHPMethods",
".",
"round",
"(",
"1.043",
"*",
"Math",
".",
"sqrt",
"(",
"(",
"wordsWithThreeSyllables",
"(",
"s... | Returns the SMOG Index of text entered rounded to one digit.
@param strText Text to be checked
@return | [
"Returns",
"the",
"SMOG",
"Index",
"of",
"text",
"entered",
"rounded",
"to",
"one",
"digit",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/analyzers/ReadabilityStatistics.java#L102-L105 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.