Skip to content

Instantly share code, notes, and snippets.

{:fit-ctx {:metamorph/mode :fit, :metamorph/data Group: 3 [120 5]:
| :sepal_length | :sepal_width | :petal_length | :petal_width | :species |
|--------------:|-------------:|--------------:|-------------:|---------:|
| 4.5 | 2.3 | 1.3 | 0.3 | 1.0 |
| 5.8 | 2.7 | 3.9 | 1.2 | 0.0 |
| 6.3 | 2.7 | 4.9 | 1.8 | 2.0 |
| 7.1 | 3.0 | 5.9 | 2.1 | 2.0 |
| 6.3 | 3.4 | 5.6 | 2.4 | 2.0 |
| 6.4 | 3.2 | 4.5 | 1.5 | 0.0 |
FROM rocker/r-ver:4.1.1
RUN apt-get update && apt-get -y install openjdk-11-jdk curl rlwrap libssl-dev build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libreadline-dev libffi-dev
RUN curl -O https://download.clojure.org/install/linux-install-1.10.3.967.sh && chmod +x linux-install-1.10.3.967.sh && ./linux-install-1.10.3.967.sh
SHELL ["/bin/bash", "-c"]
RUN echo $'{ \n\
:mvn/repos {"clojars" {:url "https://repo.clojars.org/"} \n\
"central" {:url "https://repo1.maven.org/maven2/"} \n\
"bedatadriven" {:url "https://nexus.bedatadriven.com/content/groups/public/"}} \n\
\n\
:paths ["src" "resources"] \n\
(ns behrica.corr-matrix
(:require [fastmath.stats :as stats]
[aerial.hanami.common :as hc]
[aerial.hanami.templates :as ht]
[aerial.hanami.core :as hmi]))
(defn round
[n scale rm]
(.setScale ^java.math.BigDecimal (bigdec n)
(int scale)
;; calculation function
(defn calc-correlations-matrix [data cols-to-use]
(doall
(for [col-1 cols-to-use col-2 cols-to-use]
{:col-1 col-1
:col-2 col-2
:corr
(Float/valueOf
(str
"""Python bindings to start a Clojure repl from a python process. Relies on
libpython-clj being in a deps.edn pathway as clojure is called from the command
line to build the classpath. Expects javabridge to be installed and functional.
Javabridge will dynamically find the java library that corresponds with calling 'java'
from the command line and load it. We then initialize Clojure and provide pathways
to require namespaces, find symbols, and call functions.
There are two import initialization methods - init_clojure and init_clojure_repl - these
take care of starting up everything in the correct order.
(ns sciloj.evaluate
(:require [tech.v3.dataset.modelling :as ds-mod]
[tech.v3.datatype.functional :as dfn]
[tech.v3.datatype.argops :as argops]
[tech.v3.dataset :as ds]
[tech.v3.datatype.errors :as errors]
[tech.v3.dataset.column-filters :as cf]
[tech.v3.ml.loss :as loss]
[clojure.tools.logging :as log]
[tech.v3.ml :as ml]
(ns sciloj.titanic
(:require [scicloj.metamorph.core :as morph]
[tablecloth.pipeline :as tc-mm]
[tablecloth.api :as tc]
[tech.v3.dataset.metamorph :as ds-mm]
[tech.v3.dataset :as ds]
[tech.v3.dataset.modelling :as ds-mod]
[tech.v3.ml.metamorph :as ml-mm]
[tech.v3.ml :as ml]
(ns try-transform.transformers
(:require [tablecloth.api :as tc]
[tech.v3.dataset :as ds]
[tech.v3.dataset.math :as ds-math]
[tech.v3.dataset.modelling :as ds-mod]
[tech.v3.ml :as ml]))
;;; adapt exiting function to be transform compliant
(defn drop-rows [pipeline-context rows-selector]
(assoc pipeline-context
@behrica
behrica / bow.clj
Last active December 17, 2020 22:29
(ns sciloj.smile-nlp-example
(:require [clojure.string :as str]
[pppmap.core :as ppp]
[tablecloth.api :as tc]
[tablecloth.api.split :as split])
(:import smile.classification.Maxent
smile.nlp.normalizer.SimpleNormalizer
smile.nlp.stemmer.PorterStemmer
[smile.nlp.tokenizer SimpleSentenceSplitter SimpleTokenizer]
[smile.validation Accuracy ConfusionMatrix]))
@behrica
behrica / maps.org
Last active August 15, 2021 09:51
Proof of concept for htmlwidget integration in org mode
renderDeps <- function(widget,dir=".",libdir="lib") {
  rendered <- htmltools::renderTags(widget)

  deps <- lapply(rendered1$dependencies, function(dep) {
    dep <- htmltools::copyDependencyToDir(dep, libdir, FALSE)
    dep <- htmltools::makeDependencyRelative(dep, dir, FALSE)