Re: Clojure with Tensorflow, Torch etc (call for participation, brainstorming etc)

2016-05-30 Thread Mikera
I've been working with a number of collaborators on a deep learning library 
for Clojure. 

Some key features:
- An abstract API for key machine learning functionality
- Ability to declare graphs / stacks of operations (somewhat analogous to 
tensorflow)
- Support for multiple underlying implementations (ClojureScript, JVM, CPU, 
GPU)
- Integration with core.matrix for N-dimensional data processing

We intend to release as open source. We haven't released yet because we 
want to get the API right first but it is looking very promising.

On Tuesday, 31 May 2016 02:34:41 UTC+8, kovasb wrote:
>
> Anyone seriously working on deep learning with Clojure?
>
> I'm working with Torch at the day job, and have done work integrating 
> Tensorflow into Clojure, so I'm fairly familiar with the challenges of what 
> needs to be done. A bit too much to bite off on my own in my spare time. 
>
> So is anyone out there familiar enough with these tools to have a sensible 
> conversation of what could be done in Clojure?
>
> The main question on my mind is: what level of abstraction would be useful?
>
> All the existing tools have several layers of abstraction. In Tensorflow, 
> at the bottom theres the DAG of operations, and above that a high-level 
> library of python constructs to build the DAG (and now of course libraries 
> going higher still). In Torch, its more complicated: there's the excellent 
> tensor library at the bottom; the NN modules that are widely used; and 
> various non-orthogonal libraries and modules stack on top of those. 
>
> One could try to integrate at the bottom layer, and then re-invent the 
> layers above that in Clojure. Or one could try to integrate at the higher 
> layers, which is more complicated, but gives more leverage from the 
> existing ecosystem. 
>
> Any thoughts?
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: clojure.spec generation question

2016-05-30 Thread Gary Fredericks
At a glance, this is probably the normal increasing-size behavior of 
test.check, and the bias should only be present for the first few samples. 
E.g., if you do a (take 1000 (gen/sample ...)), it should be more uniform.

Whether it's a real problem depends on how you're running your tests. I 
haven't yet looked into whether clojure.spec provides some default way of 
running test.check properties, so I'm not sure about that. But as long as 
you're running "enough" tests, e.g. >100, it should be fine.

On Monday, May 30, 2016 at 4:05:52 PM UTC-5, Jeroen van Dijk wrote:
>
> I'm trying to generate logical predicates in order to test a function that 
> should return the predicate in DNF. The generation seems to be biased 
> towards one of the predicates. What am I doing wrong?
>
> (require '[clojure.spec :as s])
> (require '[clojure.spec.gen :as gen])
>
> (s/def ::atom string?)
>
> (s/def ::predicate (s/or
> ::not-predicate
> ::and-predicate
> ::or-predicate
> ::atom))
>
> (s/def ::and-predicate (s/cat :pred #{:and} :args (s/+ ::predicate)))
> (s/def ::or-predicate  (s/cat :pred #{:or} :args (s/+ ::predicate)))
> (s/def ::not-predicate (s/tuple :pred #{:not} ::predicate))
>
> (prn (take 5 (gen/sample (s/gen ::predicate
> ;;=> 
> ((:and (:and "")) "" "X" "G" (:and "yd" (:and "c" "" (:and "F" (:and "" 
> "8" "Hb" "U0d")) "C") (:and (:and "1" "e" (:and "ME01" "w" "Y4" "" "P4") 
> "J4m4" "8") "Q7c" "") (:and (:and (:and "" "dG"))) "gw5"))
>
>
> No :or's or :not's here. If I change the order of s/or above the bias 
> changes. What's a better approach?
>
> Thanks,
> Jeroen
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: ANN: ClojureScript 1.8.51

2016-05-30 Thread Peter West
Running the Quick Start, I get the "No 'xpc' param provided to child 
iframe."  error from, I think, start-evaluator in 
cljs.clojure.browser.repl.cljs when I try to get the repl running.  This is 
in both Safari and Chrome.  Any idea what I'm doing wrong?

On Monday, 25 April 2016 21:39:57 UTC+10, David Nolen wrote:
>
> ClojureScript, the Clojure compiler that emits JavaScript source code.
>
> README and source code: https://github.com/clojure/clojurescript
>
> Leiningen dependency information:
>
> [org.clojure/clojurescript "1.8.51"]
>
> This release updates the Closure Compiler and tools.reader dependencies, 
> fixes a race condition with :parallel-build, improves JS module 
> integration, and includes a number of enhancements and fixes around 
> optional self hosting. A big thanks to everyone who contributed!
>
> As always feedback welcome.
>
> ## 1.8.51
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: spec - s/gen validation error

2016-05-30 Thread 'Sven Richter' via Clojure
So I tried some more and figured out that its the ::autoinc key that causes 
this:
(s/def ::column (s/keys :req-un [::name ::type]
:opt-un [::null ::max-length
 ::required ::pk
 ::autoinc   
  this one
 ::unique ::default
 ::refs ::fk-name]))

When I comment that key, no error occurs, if I uncomment it, spec 
validation errors repeatedly.

The only connection I see is that I remove exactly this k/v pair from the 
map in my specced function:

(s/fdef remove-autoinc-columns :args (s/cat :cols (s/spec ::schem/columns))
:ret ::schem/columns)
(defn remove-autoinc-columns [cols]
  (remove #(= true (:autoinc %)) cols))

But still, as it is an optional key I dont see why it should cause errors?

Thanks,
Sven

Am Montag, 30. Mai 2016 07:38:19 UTC+2 schrieb Sven Richter:
>
> Hi,
>
> So I looked at generating specs for tests and I hit an error I just dont 
> understand / neither can fix it. This is my code:
>
> (s/def ::column-types #{:int :varchar :boolean :text :time :date
> :char :binary :smallint :bigint :decimal
> :float :double :real :timestamp})
>
> (s/def ::name (s/and string? #(not= "" %)))
> (s/def ::boolean (s/or :t true? :f false?))
>
> (s/def ::type ::column-types)
> (s/def ::null ::boolean)
> (s/def ::max-length (s/and integer? #(< 0 %)))
> (s/def ::required ::boolean)
> (s/def ::pk ::boolean)
> (s/def ::autoinc ::boolean)
> (s/def ::unique ::boolean)
> (s/def ::default (s/or :string string? :boolean ::boolean))
> (s/def ::refs ::none-empty-string)
> (s/def ::fk-name ::none-empty-string)
> ​
> (s/def ::column (s/keys :req-un [::name ::type]
> :opt-un [::null ::max-length ::required ::pk 
> ::autoinc ::unique ::default
>  ::refs ::fk-name]))
> (s/def ::columns (s/cat :column (s/+ ::column)))
> ​
> ;function
> (s/fdef remove-autoinc-columns :args (s/cat :cols (s/spec columns))
> :ret ::schem/columns)
> (defn remove-autoinc-columns [cols]
>   (vec (remove #(= true (:autoinc %)) cols)))
>   
>   
> 
> ; generative test
> (defspec remove-autoinc-column 100
>  (prop/for-all [columns (s/gen ::schem/columns)]
>(= (h/remove-autoinc-columns  columns
>
> ; will fail with something along the lines of:
> ERROR in (remove-autoinc-column) (core.clj:4617)
> Uncaught exception, not in assertion.
> expected: nil
>   actual: clojure.lang.ExceptionInfo: Call to 
> #'de.sveri.clospcrud.helper/remove-autoinc-columns did not conform to spec:
> val: () fails spec: :de.sveri.clospcrud.spec.clospcrud/columns at: [:ret 
> :column] predicate: :de.sveri.clospcrud.spec.clospcrud/column,  
> Insufficient input
> :clojure.spec/args  (({:name "QpJ50qrS1m24V", :type :varchar, :unique 
> true, :required false, :autoinc true, :null true, :pk true, :max-length 14, 
> :fk-name "Tp9tG8hwUXK0"}))
>
> I cannot see where the error is coming from, I generate data according to 
> a spec which I pass to a function that takes this spec exactly.
>
> Any ideas?
>
> Thanks,
> Sven
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


clojure.spec generation question

2016-05-30 Thread Jeroen van Dijk
I'm trying to generate logical predicates in order to test a function that
should return the predicate in DNF. The generation seems to be biased
towards one of the predicates. What am I doing wrong?

(require '[clojure.spec :as s])
(require '[clojure.spec.gen :as gen])

(s/def ::atom string?)

(s/def ::predicate (s/or
::not-predicate
::and-predicate
::or-predicate
::atom))

(s/def ::and-predicate (s/cat :pred #{:and} :args (s/+ ::predicate)))
(s/def ::or-predicate  (s/cat :pred #{:or} :args (s/+ ::predicate)))
(s/def ::not-predicate (s/tuple :pred #{:not} ::predicate))

(prn (take 5 (gen/sample (s/gen ::predicate
;;=>
((:and (:and "")) "" "X" "G" (:and "yd" (:and "c" "" (:and "F" (:and "" "8"
"Hb" "U0d")) "C") (:and (:and "1" "e" (:and "ME01" "w" "Y4" "" "P4") "J4m4"
"8") "Q7c" "") (:and (:and (:and "" "dG"))) "gw5"))


No :or's or :not's here. If I change the order of s/or above the bias
changes. What's a better approach?

Thanks,
Jeroen

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Clojure with Tensorflow, Torch etc (call for participation, brainstorming etc)

2016-05-30 Thread kovas boguta
Anyone seriously working on deep learning with Clojure?

I'm working with Torch at the day job, and have done work integrating
Tensorflow into Clojure, so I'm fairly familiar with the challenges of what
needs to be done. A bit too much to bite off on my own in my spare time.

So is anyone out there familiar enough with these tools to have a sensible
conversation of what could be done in Clojure?

The main question on my mind is: what level of abstraction would be useful?

All the existing tools have several layers of abstraction. In Tensorflow,
at the bottom theres the DAG of operations, and above that a high-level
library of python constructs to build the DAG (and now of course libraries
going higher still). In Torch, its more complicated: there's the excellent
tensor library at the bottom; the NN modules that are widely used; and
various non-orthogonal libraries and modules stack on top of those.

One could try to integrate at the bottom layer, and then re-invent the
layers above that in Clojure. Or one could try to integrate at the higher
layers, which is more complicated, but gives more leverage from the
existing ecosystem.

Any thoughts?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to compile with optimizations none when using web workers

2016-05-30 Thread Thomas Heller
Not sure I understand what you mean. What do you mean by "main module"? 
cljs has a notion of a base module, while shadow-build does not.

Typically your ns structure and the requires are enough to establish 
relationships between them so shadow-build can figure out what needs to be 
where. If that is not possible for some reason you need to list them all 
yes.

/thomas

On Monday, May 30, 2016 at 1:04:08 PM UTC+2, Asher Coren wrote:
>
> Thomas,
> I as well think modules is the right approach when using web workers.
>
> What can I do if my app code is build from many namespaces? How do I tell 
> the main module to use all of them? Do I have to list them ALL?
>
>
> On Friday, February 19, 2016 at 5:54:59 PM UTC+2, William la Forge wrote:
>>
>> Compiling with optimizations none is no doubt quite handy, especially in 
>> conjunction with source maps, as a traceback will take you to the line of 
>> code causing the problems, and with the same variable names used in your 
>> original clojurescript code. But this is not currently possible for .jc 
>> files used by web workers as the unoptimized .js file contains a reference 
>> to js/window--and window does not exist in a web worker.
>>
>>
>> You should still be able to use optimizations none with your main 
>> javascript code, but you will need to compile your main code and your web 
>> worker code separately so that you can use different optimizations as 
>> appropriate. And you can do this so long as your not using shared workers. 
>> The question then is, how to compile the .js files separately.
>>
>> The duracell  demo 
>> uses a web worker AND is itself compiled with optimizations none. There are 
>> two things done to accomplish this:
>>
>>1. Duracell itself has no web worker code. Though it uses a library, 
>>durable-cells , which 
>>includes a web worker.
>>2. In the duracell build.boot 
>> file, 
>>the dev task uses pandeiro/boot-http 
>> rather than the simpler 
>>tailrecursion/boot-jetty . 
>>The advantage to using boot-http is that it supports the loading of 
>> static 
>>files from library jar files. In this case, that means the main code in 
>>aaworker can create a web worker using durable-cell's dcells.js file.
>>
>> So how does the durable-cells library create the dcells.js file? Again, 
>> there are two things done to accomplish this:
>>
>>1. In the durable-cells build.boot 
>> file, 
>>the dev task includes (cljs :optimizations :simple). This invokes the 
>>compiler with an appropriate level of optimizations.
>>2. But we still need to define the .js file. This is done in the 
>>dcells.cljs.edn 
>>
>> 
>>  file. 
>>See Multiple Builds 
>> for 
>>more information on cljs.edn files.
>>
>> From 
>> https://github.com/aatree/aaworker/wiki/Compiling-with-Optimizations-None
>>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to compile with optimizations none when using web workers

2016-05-30 Thread Asher Coren
Thomas,
I as well think modules is the right approach when using web workers.

What can I do if my app code is build from many namespaces? How do I tell 
the main module to use all of them? Do I have to list them ALL?


On Friday, February 19, 2016 at 5:54:59 PM UTC+2, William la Forge wrote:
>
> Compiling with optimizations none is no doubt quite handy, especially in 
> conjunction with source maps, as a traceback will take you to the line of 
> code causing the problems, and with the same variable names used in your 
> original clojurescript code. But this is not currently possible for .jc 
> files used by web workers as the unoptimized .js file contains a reference 
> to js/window--and window does not exist in a web worker.
>
>
> You should still be able to use optimizations none with your main 
> javascript code, but you will need to compile your main code and your web 
> worker code separately so that you can use different optimizations as 
> appropriate. And you can do this so long as your not using shared workers. 
> The question then is, how to compile the .js files separately.
>
> The duracell  demo 
> uses a web worker AND is itself compiled with optimizations none. There are 
> two things done to accomplish this:
>
>1. Duracell itself has no web worker code. Though it uses a library, 
>durable-cells , which 
>includes a web worker.
>2. In the duracell build.boot 
> file, 
>the dev task uses pandeiro/boot-http 
> rather than the simpler 
>tailrecursion/boot-jetty . 
>The advantage to using boot-http is that it supports the loading of static 
>files from library jar files. In this case, that means the main code in 
>aaworker can create a web worker using durable-cell's dcells.js file.
>
> So how does the durable-cells library create the dcells.js file? Again, 
> there are two things done to accomplish this:
>
>1. In the durable-cells build.boot 
> file, 
>the dev task includes (cljs :optimizations :simple). This invokes the 
>compiler with an appropriate level of optimizations.
>2. But we still need to define the .js file. This is done in the 
>dcells.cljs.edn 
>
> 
>  file. 
>See Multiple Builds 
> for 
>more information on cljs.edn files.
>
> From 
> https://github.com/aatree/aaworker/wiki/Compiling-with-Optimizations-None
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.