This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name := "algorithm-handler" | |
organization := "com.foo" | |
version := "1.0.0" | |
autoScalaLibrary := false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -e | |
CRAN_MIRROR=${CRAN_MIRROR:=http://cran.rstudio.com/} | |
# When installing from CRAN, use this mirror as a default | |
echo "options(repos=structure(c(CRAN=\"$CRAN_MIRROR\")))" > ~/.Rprofile | |
ROOTDIR=/opt/algorithm | |
# First install the latest CRAN packages system wide so it can populate the shared cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"data":[ | |
{ | |
"text":"The atomic nucleus is held together with the strong nuclear force. Nuclear power is a very economical fuel source for today's economies." | |
} | |
], | |
"namespace":"data://nlp/arxiv_model", | |
"mode":"predict", | |
"option":"very accurate", | |
"returnDocs":true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package AlgorithmHandler.algorithms; | |
import java.util.HashMap; | |
public class AdvancedAlgorithm { | |
public class AlgoInput { | |
String name; | |
Integer age; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Before | |
public void IntializePipe() throws IOException, InterruptedException { | |
Process p = Runtime.getRuntime().exec("mkfifo /tmp/pipe"); | |
p.waitFor(); | |
Thread.sleep(100); | |
System.out.println("fifo pipe made."); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading required package: methods | |
Installing package into ‘/opt/algorithm/dependencies’ | |
(as ‘lib’ is unspecified) | |
Warning: dependency ‘mvtnorm’ is not available | |
also installing the dependencies ‘glue’, ‘stringi’, ‘colorspace’, ‘utf8’, ‘TH.data’, ‘stringr’, ‘labeling’, ‘munsell’, ‘RColorBrewer’, ‘fansi’, ‘pillar’, ‘pkgconfig’, ‘libcoin’, ‘matrixStats’, ‘multcomp’, ‘truncnorm’, ‘gtable’, ‘lazyeval’, ‘reshape2’, ‘scales’, ‘tibble’, ‘viridisLite’, ‘withr’, ‘modeltools’, ‘strucchange’, ‘coin’, ‘zoo’, ‘sandwich’, ‘e1071’, ‘cmm’, ‘Rsolnp’, ‘numDeriv’, ‘ggplot2’, ‘party’, ‘plyr’, ‘proto’, ‘polspline’, ‘randomForest’, ‘classInt’, ‘mipfp’ | |
trying URL 'http://cran.rstudio.com/src/contrib/glue_1.3.1.tar.gz' | |
Content type 'application/x-gzip' length 122950 bytes (120 KB) | |
================================================== | |
downloaded 120 KB | |
trying URL 'http://cran.rstudio.com/src/contrib/stringi_1.4.3.tar.gz' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.org.example; | |
import java.util.HashMap; | |
/** | |
* Hello world! | |
* | |
*/ | |
class AlgorithmBasic | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AlgorithmHandler<INPUT, O, CONTEXT> { | |
private BiFunction<INPUT, CONTEXT, O> applyFunc; | |
private Supplier<CONTEXT> loadFunc; | |
private HashMap<String, Object> context; | |
private <T, J, L> BiFunction<T, J, L> applyHandler(FunctionWithException<T, J, L> fe) { | |
return (arg1, arg2) -> { | |
try { | |
return fe.apply(arg1, arg2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class InternalHandler<I1, I2, O> | |
{ | |
public delegate O ApplyMethod1(I1 input); | |
public delegate O ApplyMethod2(I1 input, I2 context); | |
public delegate I2 LoadMethod(); | |
private I2 _context = default; | |
private LoadMethod _loadMethod = () => { return default;}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package algorithmia.Algorithm | |
import com.algorithmia._ | |
import com.algorithmia.algo._ | |
import com.algorithmia.data._ | |
import com.algorithmia.algorithmHandler._ | |
import com.google.gson._ | |
object Algorithm{ |