Coder Social home page Coder Social logo

incanter / incanter Goto Github PK

View Code? Open in Web Editor NEW
2.2K 2.2K 292.0 41.57 MB

Clojure-based, R-like statistical computing and graphics environment for the JVM

Home Page: http://incanter.org

HTML 1.75% Clojure 96.14% Java 1.99% Shell 0.06% Batchfile 0.02% Dockerfile 0.03%

incanter's Introduction

Incanter

Incanter

Overview and motivation

Incanter is a Clojure-based, R-like statistical computing and graphics environment for the JVM. At the core of Incanter are the Parallel Colt numerics library, a multithreaded version of Colt, and the JFreeChart charting library, as well as several other Java and Clojure libraries.

The motivation for creating Incanter is to provide a JVM-based statistical computing and graphics platform with R-like semantics and interactive-programming environment. Running on the JVM provides access to the large number of existing Java libraries for data access, data processing, and presentation. Clojure’s seamless integration with Java makes leveraging these libraries much simpler than is possible in R, and Incanter’s R-like semantics makes statistical programming much simpler than is possible in pure Java.

Motivation for a Lisp-based R-like statistical environment can be found in the paper Back to the Future: Lisp as a Base for a Statistical Computing System by Ihaka and Lang (2008). Incanter is also inspired by the now dormant Lisp-Stat (see the special volume in the Journal of Statistical Software on Lisp-Stat: Past, Present, and Future from 2005).

Motivation for a JVM-based Lisp can be found at the Clojure website, and screencasts of several excellent Clojure talks by the language’s creator, Rich Hickey, can be found at Clojure TV.

Getting started with Clojure

For a great introduction to programming in Clojure, read Clojure – Functional Programming for the JVM. by R. Mark Volkmann. For an even more extensive introduction, get one of the books on Clojure Programming Clojure, 2ed by Stuart Halloway and Aaron Bedra, “The Joy of Clojure” by Michael Fogus and Chris Houser, “Clojure in Action” by Amit Rathore, “Practical Clojure” by Luke VanderHart and Stuart Sierra.

Other Clojure resources

Getting started with Incanter

Include in Clojure project

Include all incanter modules at once in your project.clj:

:dependencies [[org.clojure/clojure "1.9.0"]
               [incanter "1.9.3"]]

Or only the modules you need:

:dependencies [[org.clojure/clojure "1.9.0"]
               [incanter/incanter-core "1.9.3"]
               [incanter/incanter-charts "1.9.3"]]

Start repl:

lein repl

Use standalone app

Start by visiting the Incanter website for an overview, checkout the documentation page for a listing of HOW-TOs and examples, and then download either an Incanter executable or a pre-built version of the latest build of Incanter, which includes all the necessary dependencies, and unpack the file (if you would like to build it from source, read Building Incanter). You also might need to install libgfortran3 library that is required for jblas that is powering matrix operations (see jblas wiki for more details).

Start the Clojure REPL (aka the shell) by double-clicking on the downloaded executable or, if you downloaded the pre-built distribution, running one of the scripts in the Incanter directory: script/repl or script\repl.bat on Windows.

Usage

From the Clojure REPL, load the Incanter libraries:

user=> (use '(incanter core stats charts io))

Try an example: sample 1,000 values from a standard-normal distribution and view a histogram:

user=> (view (histogram (sample-normal 1000)))

Try another simple example, a plot of the sine function over the range -10 to 10:

user=> (def my-plot (function-plot sin -10 10))
user=> (view my-plot)

You can save plots into a png file:

user=> (save my-plot "plot.png")

Incanter can save charts into pdf or svg files. Check incanter.pdf/save-pdf and incanter.svg/save-svg functions.

Let’s play with some data now. We’ll look at London weather for 2012:

; function that returns dataset containing weather in London for given month in 2012
(defn weather-for-month [month]
  (-> (format "https://www.wunderground.com/history/airport/EGLL/2012/%d/10/MonthlyHistory.html?format=1" month)
      (read-dataset :header true)))

; get weather data for each month in 2012 and build single dataset
(def data (->> (range 1 13) (map weather-for-month) (apply conj-rows)))

; view dataset in a table and view histogram of mean temperature
(view data)
; wunderground.com formats temperature depending on locale/location/whatever 
; so you might need to use "Mean TemperatureF" otherwise you'll get NullPointerException.
(view (histogram "Mean TemperatureC" :nbins 100 :data data))

; function that given month "2012-9-20" extracts month and returns 9
(defn month [date] (Integer/parseInt (second (.split date "-"))))

; dataset that contains 2 columns: month and mean temperature for that month
; don't forget to change to "Mean TemperatureF" if you did so few steps back.
(def grouped-by-month
  (->> (map (fn [date temp] {:month (month date) :temp temp})
            ($ "GMT" data) ($ "Mean TemperatureC" data))
       to-dataset
       ($rollup :mean :temp :month)
       ($order :month :asc)))

; view line chart that shows that August was the warmest month
(view (line-chart :month :temp :data grouped-by-month))

The online documentation for most Incanter functions contain usage examples. The documentation can be viewed using Clojure’s doc function. For example, to view the documentation and usage examples for the linear-model function, call (doc linear-model) from the Clojure shell. Use (find-doc "search term") to search the online documentation from the Clojure shell. The API documentation can also be found at http://incanter.github.io/incanter/.

The Clojure Data Analysis Cookbook (published by Packt Publishing) contains several chapters dedicated to Incanter, including work with datasets, charting, etc. You can read the sample chapter that describes Incanter’s datasets.

There is dedicated mailing list for discussions about Incater. It’s hosted on Google Groups.

More Incanter examples

Documentation

The following documentation covers the Incanter and Clojure APIs and the APIs of the underlying java libraries.

Incanter documentation

Related API documentation

Building Incanter

To build and test Incanter, you will need to have Leiningen and git installed:

1. Clone the repository with git: git clone git://github.com/incanter/incanter.git

2. Install Leiningen (version 2.x)
a. Download the lein script: wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
(use lein.bat on Windows)
b. Place it on your path and chmod it to be executable: chmod +x lein
c. Run: lein self-install

3. Execute lein sub install (or lein modules install) staying in the incanter directory – this will download all necessary dependencies, compile & install all Incanter’s modules into local Maven repository.

4. Start a REPL: lein repl (it also starts nRepl server), or start a Swank server: lein ritz 4005

Other tasks:

  • If you want to run the tests for each of Incanter’s modules, use lein sub test
  • Each of Incanter’s modules are independent Leiningen projects. Just cd into modules/incanter-* and use Leiningen to build each one as a stand-alone library.
  • lein sub install (or lein modules install) uses Leiningen to build all the modules and install them in your local ~/.m2 repository.

Incanter dependencies

incanter's People

Contributors

alexott avatar cburroughs avatar dasmoth avatar davidjameshumphreys avatar ejackson avatar farrellm avatar finbarrtimbers avatar gerrrr avatar jacksullivan avatar jakemcc avatar kittylyst avatar leungwk avatar liebke avatar lionandoil avatar markmfredrickson avatar mawiraike avatar mikera avatar morrifeldman avatar mseebach avatar mtnygard avatar nbeloglazov avatar nblumoe avatar no-man-is-an-island avatar otfrom avatar piokuc avatar quantisan avatar shark8me avatar silvamo avatar syhw avatar yuzeh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

incanter's Issues

PolarChart / PolarPlot?

Is it currently possible to create polar charts with incanter?

I couldn't find any functions in incanter.charts or google so I'm about to create my own JFreeChart wrapper function. Thought I might as well give a shout incase I'm missing something? :)

Linear Model Sample Error?

incanter.main=>    (use '(incanter core stats datasets charts))
nil
incanter.main=>     (def iris (to-matrix (get-dataset :iris) :dummies true))
#'incanter.main/iris
incanter.main=>     (def y (sel iris :cols 0))
#'incanter.main/y
incanter.main=>     (def x (sel iris :cols (range 1 6)))
#'incanter.main/x
incanter.main=>     (def iris-lm (linear-model y x)) ; with intercept term
ClassCastException clojure.lang.LazySeq cannot be cast to java.lang.Number  clojure.lang.Numbers.lt (Numbers.java:219)

This is copied from (doc linear-model)

Cosine similarity denominator incorrect

There is a typo in the denominator of the cosine similarity. It reads ||a|| * ||a|| but should read ||a||*||b||. I'm guessing this also affects tanimoto-coefficient.

Strange JFree Charts error...

Just pulled incanter down today, and its complaining about a function call to applyCurrentTheme in the charts namespace. Error is being called at incanter/charts.clj:2447

Ambiguous doc string for add-lines

Documentation to add-lines macro states that it works on line plots which could someone misinterpret as a line-chart, whereas the multimethod add-lines* is defined for xy-plots instead.
Just a minor issue though.

decomp-qr commented out?

I just need to use decomp-qr when it hits me that decomp-qr is not defined. Then I went through the source tree and found that decomp-qr is commented out. I'm wondering when it would be back again.

Incanter 1.4.0 Bar Chart returns illegal argument exception

Version 1.3.0 works. This example breaks with the following exception returned using 1.4.0:

(use '(incanter core stats charts datasets))

(with-data (get-dataset :co2)
(view (bar-chart :Type :uptake
:title "CO2 Uptake"
:group-by :Treatment
:x-label "Grass Types" :y-label "Uptake"
:legend true)))

java.lang.IllegalArgumentException: No matching method found: addValue for class org.jfree.data.category.DefaultCategoryDataset

Can't load incanter 1.2.3-SNAPSHOT using Clojure 1.1.0

This came up on the IRC channel today:

OSX 10.6.3
lein 1.2.0-RC1

Steps to repro:

  1. Create a new lien project using http://pastebin.com/QYLnBF50
  2. lein clean && lein deps
  3. lein repl
  4. user=> (use '(incanter core stats))
    java.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol (core.clj:2)
  5. modify project.clj to use Clojure beta1: http://pastebin.com/BXVeHWWV
  6. lein clean && lein deps && lein repl
  7. user=> (use '(incanter core stats))
  8. it works!

Please contact me if more info is needed.

Incanter 1.2.4 references old 1.2.3 modules

I just tried to upgrade to incanter 1.2.4 and noticed that it keeps the modules in version 1.2.3.
A look into the project.clj of the incanter 1.2.4 jar reveals that the dependencies have not change in there.

On OSX applet window is missing 22 pixels in height

The following program (adapted from Shiffman's processing code) doesn't work correctly because the drawable height of the created window is 178 pixels instead of 200 as coded. It does work correctly when the height parameters are changed to 222. It looks suspiciously like the missing 22 pixels are hiding under the window title bar since it is about the same size.

Using the prebuilt zip.

Java version "1.6.0_20" on OS X 10.6.3. Running using script/swank and Emacs.

(ns multiprob
(:use [incanter.core]
    [incanter.processing]))
(let [
  p1 (ref 0.05)
  p2 (ref (+ @p1 0.8))
  r (ref nil)
  sktch (sketch
         (setup []
                (doto this
                  (size 200 200)
                  smooth
                  (framerate 30)
                  (background 63 63 63)
                  (color-mode RGB 255 255 255)
                                        ))
         (draw []
               (dosync
                (ref-set r (rand)))

               (doto this
               (fill 0.0 1.0)
               (rect 0 0 (width this) (height this))
               (fill (if (< @r @p1)
                        255
                        (if (< @r @p2)
                          150
                          0)))

                 (stroke 200)
                 (rect (rem (* 10 (frame-count this)) (width this))
                       (rem (* 10 (quot (* 10 (frame-count this)) (width this))) (height this))
                       10 10)
                 (println (width this) (height this))
                 )))
  ]
  (view sktch :size [200 200]))

As a side note, I had an earlier version using the original clj-processing lib working without this problem.

Redundant macro expansions

Hi! First off, thanks so much for Incanter!

The chart macros don't take care to avoid multiple expansions of the arguments, which makes them unsafe if called with expressions that have side effects, and inefficient if called with expressions that require significant computation. For example, the 'values' parameter to bar-chart is expanded three times. (I believe this is a common gotcha in writing macros.)

I spotted this because the on-hover labels on the charts showed the raw expressions, not the values, so that's another undesirable side effect.

IMHO, the best solution may be to convert these macros to regular functions -- it's not at all clear to me why they must be macros.

Here's an example: http://gist.github.com/259024

scatter-plot of 300k points is very slow

Making a scatter-plot of 300k doubles is extremely slow compared to R or Excel with the same data. Perhaps JFreeChart isn't being used optimally?

A single CPU core is utilized 100% during this time. Also after the plot is generated, re-referencing it is quick enough.

sel incorrectly handles :all option for Matrix rows

given:

(def A (matrix (range 1 7) 2))

(sel A :all 1)

returns the entire matrix, rather than just the second column. This is because the dispatch function for sel (a multimethod) simply checks whether the second argument is a keyword. This method:

(defmethod sel [incanter.Matrix false]

has the code which handles :all passed as the rows parameter; however that code will never be reached, because such calls will be sent to the method for [incanter.Matrix true].

(This can be worked around by using true instead of :all to select all rows).

Running Incanter repl script from anywhere you want

I like to be able to run the Incanter repl from wherever I like. To achieve this, I modified the repl shell script a little. Here's the diff if you think it'd be useful.

Thanks for making Incanter.

-Ed

diff --git a/script/repl b/script/repl
index dace2e0..d554c18 100755
--- a/script/repl
+++ b/script/repl
@@ -1,8 +1,11 @@
#!/bin/sh
-CLASSPATH=src:test:config:data:.

-for f in lib/.jar; do
+BASEDIR=dirname $0
+
+CLASSPATH=$BASDIR/../src:$BASDIR/../test:$BASDIR/../config:$BASDIR/../data:$BASDIR/..
+
+for f in $BASEDIR/../lib/
.jar; do
CLASSPATH="$CLASSPATH":$f
done

-java -Xmx1G -cp "$CLASSPATH" jline.ConsoleRunner clojure.main -i script/run.clj -r
+java -Xmx1G -cp "$CLASSPATH" jline.ConsoleRunner clojure.main -i $BASEDIR/run.clj -r

combine-with mistakenly calls .rows and .columns

incanter.internal has a macro called combine-with which is used to implement some of the arithmetic functions (like plus). It is basically a big cond block. One of the conditions (starting on line 115) is:

  (and (number? ~A) (coll? ~B) (coll? (first ~B)))
    (let [~mA (make-matrix ~A (.rows ~B) (.columns ~B))
          ~mB (make-matrix ~B)]
      (.assign ~mA ~mB ~df))

Clearly the calls to .rows and .columns are mistakes; presumably, what was intended was something like:

    (let [~mA (make-matrix ~A (count ~B) (count (first ~B)))

t-test p-value calculation

In incanter.stats/t-test, there seems to be an issue with the one-sided-p calculation.

The lower-tail? argument should be passed as ":lower-tail? lower-tail?" instead of ":lower-tail lower-tail?"

I have a small patch.

factorial broken on (factorial 0)

According to Wikipedia, factorial(0) is special-cased to be 0. incanter.core/factorial has an incorrect pre-condition, it checks for (pos? k) rather than (not (neg? k)), throwing an exception on (factorial 0).

I've tested that (cern.jet.math.tdouble.DoubleArithmetic/factorial 0) handles it correctly, so only the precondition needs to be modified.

Unintuitive functions: to-map, to-dataset

(def ds (to-dataset (partition 3 (range 9)))) (= (to-map ds) (to-map ds)) ;; true (= ds (to-dataset (to-map ds))) ;; false, dataset becomes somehow transposed

PS: I do not mean that = does not work but that the data is really different, i.e., col-0 is (0 3 6) first and after mapping forth and back it is (8 7 6)

group-on does not work

(use '(incanter core datasets))
(def plant-growth (to-matrix (get-dataset :plant-growth)))
(group-on plant-growth 1)

clojure.lang.ArityException: Wrong number of args (2) passed to: core$group-on$filter-fn--1130$fn
at clojure.lang.AFn.throwArity (AFn.java:437)
clojure.lang.AFn.invoke (AFn.java:43)
incanter.core$eval721$fn__723.doInvoke (core.clj:295)
clojure.lang.RestFn.invoke (RestFn.java:439)
clojure.lang.MultiFn.invoke (MultiFn.java:172)
incanter.core$group_on$fn__1149.invoke (core.clj:1121)
clojure.core$map$fn__3811.invoke (core.clj:2432)
clojure.lang.LazySeq.sval (LazySeq.java:42)
clojure.lang.LazySeq.seq (LazySeq.java:60)
clojure.lang.RT.seq (RT.java:466)
clojure.core$seq.invoke (core.clj:133)
clojure.core$print_sequential.invoke (core_print.clj:46)
clojure.core/fn (core_print.clj:140)
clojure.lang.MultiFn.invoke (MultiFn.java:167)
clojure.core$pr_on.invoke (core.clj:3264)
clojure.core$pr.invoke (core.clj:3276)
clojure.lang.AFn.applyToHelper (AFn.java:161)
clojure.lang.RestFn.applyTo (RestFn.java:132)
clojure.core$apply.invoke (core.clj:600)
clojure.core$prn.doInvoke (core.clj:3309)
clojure.lang.RestFn.invoke (RestFn.java:408)

Common matrix interface?

Hello,

Would there be interest in the Incanter project in working towards a common interface for vector / matrix maths in Clojure?

The potential idea is to create an API / abstraction for matrix maths that is fairly generic and will support multiple possible matrix maths implementations (e.g. pure Java vs. JBLAS vs. Colt vs. some other custom format used by an external program).

This would free projects like Incanter from having to fix on a specific matrix implementation, and allow generic matrix functionality to be developed on a common base that is useful across the Clojure landscape.

I believe Clojure protocols are fast enough that performance would not be a concern.

See this thread in the Clatrix project: tel/clatrix#7

Obviously, Incanter would be a big and important consumer of such an API / abstraction so wanted to test for interest in the Incanter project before deciding if this is a project worth committing effort to.

set-stroke only affects the first line when :group-by'ing a line chart

When using set-stroke to try to increase the thickness of lines of a line-chart that's plotting data grouped into groups, only the first group seems to be affected. For example:

(doto (line-chart :parallel :min
                  :group-by :config
                  :legend true
                  :data (...))
  (set-stroke :width 3)
  (view
    :width 800
    :height 600))

Screenshot

call to filter needs namespace

In incanter.core, in (defmethod sel [incanter.Matrix true], line 295 has the call (filter filter mat). filter here has been bound to the optional function provided by the :filter keyword; the call to the core filter function needs to have the clojure.core namespace specified (as was correctly done in
(defmethod sel [::dataset true]

Problem importing from CSV

Hi Liebke,

When I use the "read-dataset" function to import data from CSV, I get the following error. The value "akshay" is not at the end of the vector. Instead it is put in front of what should be a bunch of nil values.

CSV:
1303938000,fraglimit,,,,akshay

Dataset (imported by "read-dataset"):
[1303938000 "fraglimit" "akshay" nil nil nil]

Are nil values allowed in the CSV?

Wrong operator precedence with +, -, *, and /

Incanter's infix feature suggest a surprising ordering of simple arithmetic expressions. Usually, + and - are given an equal precedence value, as well as * and / are given an equal one and higher than + and -.

The current setup makes simple expressions result in unexpected values, such as:

($= 10 - 1 + 10) ;=> -1, expected 19
($= 1 / 2 * 3) ;=> 1/6, expected 3/2

The fix is to correct lines 2625–2628 in modules/incanter-core/src/incanter/core.clj to read:

(defop '- 60 'incanter.core/minus)
(defop '+ 60 'incanter.core/plus)
(defop '/ 80 'incanter.core/div)
(defop '* 80 'incanter.core/mult)

with-rotation crashes with wrong number of arguments to push-matrix

using with-rotation from incanter.processing it doesnt work because the required sketch arguments for push-matrix rotate and pop-matrix aren't present in the macro or passed in from without.
I'm using the latest build (downloaded yesterday) on Solaris 10 java 1.6r17 (ithink)

Sorry for the duplicate but I accidentally closed it and could find the reopen button

Box plot group-by throws IllegalArgumentException when a group has one element

(box-plot :col-0 :data (to-dataset [[1 2 3] [4 5 6]]) :group-by :col-2)

throws exception

java.lang.IllegalArgumentException: No matching method found: add for class org.jfree.data.statistics.DefaultBoxAndWhiskerCategoryDataset
 at clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:80)
    clojure.lang.Reflector.invokeInstanceMethod (Reflector.java:28)
    incanter.charts$box_plot_STAR_.doInvoke (charts.clj:2305)
    clojure.lang.RestFn.applyTo (RestFn.java:139)
    clojure.core$apply.invoke (core.clj:601)
    incanter.charts_tests/fn (charts_tests.clj:117)
    clojure.test$test_var$fn__6926.invoke (test.clj:701)
    clojure.test$test_var.invoke (test.clj:701)
    clojure.test$test_all_vars$fn__6930$fn__6937.invoke (test.clj:717)
    clojure.test$default_fixture.invoke (test.clj:671)
    clojure.test$test_all_vars$fn__6930.invoke (test.clj:717)
    clojure.test$default_fixture.invoke (test.clj:671)
    clojure.test$test_all_vars.invoke (test.clj:713)
    clojure.test$test_ns.invoke (test.clj:736)
    clojure.core$map$fn__4087.invoke (core.clj:2434)
    clojure.lang.LazySeq.sval (LazySeq.java:42)
    clojure.lang.LazySeq.seq (LazySeq.java:60)
    clojure.lang.Cons.next (Cons.java:39)
    clojure.lang.RT.boundedLength (RT.java:1633)
    clojure.lang.RestFn.applyTo (RestFn.java:130)
    clojure.core$apply.invoke (core.clj:603)
    clojure.test$run_tests.doInvoke (test.clj:751)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invoke (core.clj:601)
    user$eval5066$fn__5069.invoke (NO_SOURCE_FILE:1)
    user$eval5066.invoke (NO_SOURCE_FILE:1)
    clojure.lang.Compiler.eval (Compiler.java:6511)
    clojure.lang.Compiler.eval (Compiler.java:6501)
    clojure.lang.Compiler.eval (Compiler.java:6501)
    clojure.lang.Compiler.eval (Compiler.java:6477)
    clojure.core$eval.invoke (core.clj:2797)
    clojure.main$eval_opt.invoke (main.clj:297)
    clojure.main$initialize.invoke (main.clj:316)
    clojure.main$null_opt.invoke (main.clj:349)
    clojure.main$main.doInvoke (main.clj:427)
    clojure.lang.RestFn.invoke (RestFn.java:421)
    clojure.lang.Var.invoke (Var.java:419)
    clojure.lang.AFn.applyToHelper (AFn.java:163)
    clojure.lang.Var.applyTo (Var.java:532)
    clojure.main.main (main.java:37)

It appears that this happens when there is only one element in a box plot group AND there is more than one element in the dataset in total.

The following

(box-plot :col-0 :data (to-dataset [[1 2 3] [4 5 3]]) :group-by :col-2)

doesn't throw an exception.

mongo-java-driver dependency not being pulled

When running lein deps with [incanter "1.3.0-SNAPSHOT"] as a dependency, I get this error:

Retrieving org/mongodb/mongo-java-driver/2.6.5/mongo-java-driver-2.6.5.pom (1k)
    from http://repo1.maven.org/maven2/
Could not transfer artifact org.mongodb:mongo-java-driver:pom:2.6.5 from/to central (http://repo1.maven.org/maven2): Checksum validation failed, no checksums available from the repository
Could not find artifact org.mongodb:mongo-java-driver:pom:2.6.5 in clojars (https://clojars.org/repo/) 

I fixed it for now by excluding incanter/incanter-mongodb like this : [incanter "1.3.0-SNAPSHOT" :exclusions [incanter/incanter-mongodb]]

But I hope incanter-mongodb's mongodb driver dependency can be updated!

Incanter produces a blank window over ssh -X or -Y

So far, every graph I've attempted to display over a forwarded X connection presents a blank, grey window. The same graphs display correctly when logged in to the console directly.

I don't know if this is an issue with Incanter, or one of its dependencies, but if possible, it'd be nice to have it fixed.

Thanks

Rob Browning

Options doesn't work for xy-plot

The graph from the xy-plot example is rendered without the title and axis labels:

(def x2 (range 0 20 0.1))
(def gamma-plot (xy-plot x2 (pdf-gamma x2 :shape 1 :rate 2)
                           :legend true
                           :title "Gamma PDF"
                           :y-label "Density"))
(view gamma-plot)

xy-plot

function xy-plot no longer sets labels

I noticed that (xy-plot [0 1] [2 4] :x-label "hello") no longer sets the x axis label nor does :y-label set the y axis label. (set-x-label chart label) still works.

swank-clojure a runtime dependency?

Noticed this line:
[swank-clojure "1.3.0-SNAPSHOT"]

in the dependencies for incanter, is this an actual runtime dependency, or can it be moved to dev-dependencies?

jline-0.9.94.jar missing from incanter/lib

Launching script/repl leads to:
Exception in thread "main" java.lang.NoClassDefFoundError: jline/ConsoleRunner
Caused by: java.lang.ClassNotFoundException: jline.ConsoleRunner
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

Copying jline-0.9.94.jar from lib/dev to lib fixes this issue.
Is this a problem with the dependencies?

Changing a matrix's dimensions

Hi,
I have two vectors x and y, and create a matrix using the Kronecker product of them. What I would like back is a matrix with dimension length(x) and length(y). I think I just get back a one dimensional matrix. Is it possible to resize this matrix or the have the kronecker function return a specific dimension size?

Also is there an Incanter function to return the dimensions of a given matrix?

scatter-plot fails when given a dataset with only one row

When I was using Incanter to draw scatter plots I ended up running into a case in which the data provided only had one row, because the data was provided by a user. A simple test case that shows the problem:

(scatter-plot :col-0 :col-1 :data (to-dataset [[1 2 3]]))
java.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer (NO_SOURCE_FILE:0)

I tried to figure out what was going wrong and it seems that basically when ($ :col some-dataset) is called it usually returns a sequence, but in the case in which there is only one row it instead returns a single item. However, the scatter-plot call doesn't anticipate this. It does something like:

_x (if (coll? x) (to-list x)  (if (coll? x) (to-list x) ($ x data))

I got things working in this case by replacing that section with

   _x (if (coll? x) (to-list x) 
     (if-let [x-list (sel data :cols x)]
       (if (seq? x-list) x-list (list x-list))))

The equivalent expression was also needed in y.

I haven't checked to see if this same problem is in other charts.

inconsistent behaviour $join?

Noticed that $joining two datasets returns different columns depending on the order of datasets defined. Let's say I have datasets a and b. First 3 rows of a (take 3 (:rows a))

{:qual 0.68, :pos "714038", :chrom "1", :chrom-pos "1_714038"}
{:qual 9.43, :pos "742584", :chrom "1", :chrom-pos "1_742584"}
{:qual 13.06, :pos "798494", :chrom "1", :chrom-pos "1_798494"}

First 3 rows of b:

{:is-present "yes", :id-golden "1_742584"}
{:is-present "yes", :id-golden "1_831535"}
{:is-present "yes", :id-golden "1_835153"}

The chrom-pos column in a matches the id-golden column in b. When I do

(col-names ($join [:chrom-pos :id-golden] a b))

I get the following columns: [:id-golden :is-present :qual :pos :chrom]. However, when I turn this around, I miss the is-present column

(col-names ($join [:id-golden :chrom-pos] b a)) ; => [:chrom-pos :chrom :pos :qual]

There are records that are in a but not in b, but also the other way around. I suppose that the second version of $join should also include the :found column?

jan.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.