Re: [julia-users] function perlRegexReplace

2014-08-13 Thread Steven Siew
#Version 4
#More optimization done

function perlRegexReplace(str::ASCIIString,regex::Regex,rep::ASCIIString)
  local m,result,inter
  result = replace(str,regex,rep)
  inter = eachmatch(regex,str)
  for (m in inter)
for k = 1:length(m.captures)
  result = replace(result,char(k),m.captures[k],1)
end
  end
  result
end

originalstring="Mary had a little lamb, her skin is as white as snow"

resultstring = perlRegexReplace(originalstring,r"\b([\w]*e) ([\w]*)","not 
\1 black \2")

println("ORIGINAL: ",originalstring)
println("RESULTST: ",resultstring)




On Wednesday, August 13, 2014 8:19:08 PM UTC+10, Kevin Squire wrote:
>
> I implemented something related to this a long time ago (
> https://github.com/JuliaLang/julia/pull/1448).  At the time, Stefan 
> agreed that something like it was needed, but didn't like my 
> implementation.  Still hasn't happened (other things have had greater 
> priority), but I think it would be worthwhile.
>
> Kevin
>
>
> On Wed, Aug 13, 2014 at 12:07 AM, Jameson Nash  > wrote:
>
>> right, in other words, it implements backreference substitutions
>>
>>
>> On Wed, Aug 13, 2014 at 3:01 AM, Steven Siew > > wrote:
>>
>>> replace(*string*, *pat*, *r*[, *n*])
>>>
>>> Search for the given pattern pat, and replace each occurrence with r. 
>>> If n is provided, replace at most n occurrences. As with search, the 
>>> second argument may be a single character, a vector or a set of characters, 
>>> a string, or a regular expression. If r is a function, each occurrence 
>>> is replaced with r(s) where s is the matched substring.
>>>
>>>
>>>_
>>>_   _ _(_)_ |  A fresh approach to technical computing
>>>   (_) | (_) (_)|  Documentation: http://docs.julialang.org
>>>_ _   _| |_  __ _   |  Type "help()" to list help topics
>>>   | | | | | | |/ _` |  |
>>>   | | |_| | | | (_| |  |  Version 0.2.0 (2013-11-16 23:44 UTC)
>>>  _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org release
>>> |__/   |  i686-w64-mingw32
>>>
>>> julia> originalstring="Mary had a little lamb, her skin is as white as 
>>> snow"
>>>
>>> "Mary had a little lamb, her skin is as white as snow"
>>>
>>> julia> replace(originalstring,r"\b([\w]*e) ([\w]*)","not \1 black \2")
>>> "Mary had a not \x01 black \x02, her skin is as not \x01 black \x02 snow"
>>>
>>>
>>>
>>>
>>> On Wednesday, August 13, 2014 4:05:23 PM UTC+10, John Myles White wrote:
>>>
 Suspect I'm missing something. How is this different from the existing 
 function replace? 

  -- John 

 On Aug 12, 2014, at 11:03 PM, Steven Siew  wrote: 

 > Using regex like in the programming language Perl to perform 
 replacements. 
 > 
 > 
 > function 
 > perlRegexReplace(str::ASCIIString,regex::Regex,rep::ASCIIString) 

 >   local m,len,result,inter 
 >   m = match(regex,str) 
 >   len=length(m.captures) 
 >   result = replace(str,regex,rep) 
 >   if len > 0 
 > inter = eachmatch(regex,str) 
 > for (m in inter) 
 >   for k = 1:len 
 > # Comment out the next line when using function for 
 production 
 > println("Replacing \\",k," with ",m.captures[k]) 
 > result = replace(result,char(k),m.captures[k],1) 
 >   end 
 > end 
 >   end 
 >   result 
 > end 
 > 
 > originalstring="Mary had a little lamb, her skin is as white as snow" 
 > 
 > resultstring = perlRegexReplace(originalstring,r"\b([\w]*e) 
 ([\w]*)","not \1 black \2") 
 > 
 > println("ORIGINAL: ",originalstring) 
 > println("RESULTST: ",resultstring) 
 > 
 > 
 > == 
 > 
 > 
 > C:\oracle\julia\scripts> ..\julia.bat perlRegexReplace3.jl 
 > Replacing \1 with little 
 > Replacing \2 with lamb 
 > Replacing \1 with white 
 > Replacing \2 with as 
 > ORIGINAL: Mary had a little lamb, her skin is as white as snow 
 > RESULTST: Mary had a not little black lamb, her skin is as not white 
 black as snow 


>>
>

Re: [julia-users] Re: Package Popularity Ranking

2014-08-13 Thread Michael Smith
Thanks for all your replies.

Yes, the number of downloads might be misleading, yet it would be
interesting to be able to compare downloads to github stars and github
clones.

M


On 08/14/2014 10:07 AM, John Myles White wrote:
> This was a really nice read, even you can tell the author’s spent time
> with social scientists based on their assertion that a correlation of
> 0.3 is low.
> 
>  — John
> 
> On Aug 13, 2014, at 6:41 PM, Samuel Jenkins  > wrote:
> 
>> Since this is on the topic of package popularity, this blog post on
>> the metrics of gem (package) popularity in Ruby by Loren Segal may be
>> of interest (arguably a roughly similar problem):
>> http://gnuu.org/2011/10/19/gem-downloads-and-usage/
>>
>> On Wednesday, August 13, 2014 11:03:31 PM UTC+10, Michael Smith wrote:
>>
>> Is there some sort of way to rank the popularity of Julia packages?
>> Haven't found anything like that (and apologies if I have missed
>> anything).
>>
>> The reason I'm asking is that, although I am aware that relying
>> purely
>> on rankings has several disadvantages, I still do believe that
>> there are
>> some strong advantages in having a rough idea about what the really
>> important (or widely-used) packages are.
>>
>> This is particularly important considering the fact that the
>> number of
>> Julia packages is increasing, and for newbies it will be difficult to
>> find their way around.
>>
>> Thanks,
>>
>> M
> 


Re: [julia-users] Create matrix from a comprehension with row/col-returning function?

2014-08-13 Thread David Gonzales
how about:

reduce(hcat,[f() for j=1:5])

it is less clear, but calls f() the right amount of times. the downside may 
be the repeated calls to hcat

On Thursday, August 14, 2014 4:52:07 AM UTC+3, Jacob Quinn wrote:
>
> Ah, I see. Yeah, at least I'm not aware of how to do that with a 
> comprehension. You can unroll what a comprehension does and do it like:
>
> z = zeros(3,2)
> for i = 1:3
> z[i,:] = f()
> end
>
>
> It seems like it would be convenient to support syntax like:
>
> [f()... for i = 1:3]
>
> but you might need a way to specify the dimensions of the resulting matrix 
> as well.
>
>
> On Wed, Aug 13, 2014 at 9:40 PM, Brendan O'Connor  > wrote:
>
>> But that calls `f()` on every loop of your comprehension, so it's 
>>> probably best to do something like:
>>>
>>> g = f()
>>>
>>> In  [13]: [g[i] for i=1:2, j=1:3]
>>>
>>> Out [13]: 2x3 Array{Any,2}:
>>>  3.0  3.0  3.0
>>>  5.0  5.0  5.0
>>>
>>
>> Ah ... I should have said, actually, I don't want a constant value.  I 
>> wanted f() called 3 times, and its output arranged into a 3x2 matrix.
>>
>> [f()[i] for i=1:2, j=1:3]  is clever, but it calls f() 6 times.
>>
>> Brendan
>>
>
>

[julia-users] Re: Clipping Algorithm

2014-08-13 Thread Andreas Lobinger
function inpoly(px,py,edges)
i = 0
for k=1:size(edges)[1]
 p1x = edges[k,1]
 p1y = edges[k,2]
 p2x = edges[k,3]
 p2y = edges[k,4]
 
 if (p1y < py) & (p2y < py) 
  continue
 end

 if (p1y >= py) & (p2y >= py) 
  continue
 end

 d = p2y - p1y
 s = (py-p1y)*(p2x-p1x)
 
 if d != 0
  sx = (s / d)+p1x
  if sx >= px
   i = i +1
  end
 end
end

return mod(i,2)
end

tests a single point (px,py) against a closed polygon in edges = [x1 y1 x2 
y2; x2 y2 x3 y3; x3 y3 x1 y1], the first point repeated as last point.



Re: [julia-users] Gibbs sampling 10x slower than c++

2014-08-13 Thread John Myles White
Here are some things you might try:

(1) Don’t use a global const. Pass N as an argument to all functions.

(2) Use in-place multiplication via functions like A_mul_B! in lines like 
`@inbounds a = dot(W[:,n], state)`. In Julia 0.3, W[:,n] creates a copy of that 
column of W on every iteration.

(3) Don’t make full copies of state in lines like `@inbounds samples[:,i] = 
copy(state)`. Do explicit elementwise copying, which is much cheaper.

 — John

On Aug 13, 2014, at 9:14 PM, Andrew Wrigley  wrote:

> 



Re: [julia-users] Gadfly, draw, and font embedding.

2014-08-13 Thread Lee Streeter
It looks like pgf is a suitable solution. Thanks for that.

I might bug the Gadfly repo on this matter as well. 


On Thursday, August 14, 2014 3:28:43 PM UTC+12, Keno Fischer wrote:
>
> I believe Gadfly has a pgf backend which might help with this. For 
> svg, I don't think it can so why don't you happen an issue on the 
> Gadfly repository? 
>
>
>

Re: [julia-users] Behavior of size()

2014-08-13 Thread Miles Lubin
Perhaps the motivation for this behavior is that you can use 2d indexing on 
a 1d vector:

julia> x = [1,2,3];

julia> x[1,1]
1

julia> x[1,2]
ERROR: BoundsError()

Whether it makes sense to allow this is another question.

On Wednesday, August 13, 2014 8:59:03 PM UTC-6, Isaiah wrote:
>
> size(x,n) apparently works to arbitrary n. I don't think this is 
> intentional, because the C implementation includes a dimension check (this 
> call goes through codegen even at the REPL).
>
>
> On Wed, Aug 13, 2014 at 4:54 PM, Dominique Orban  > wrote:
>
>> I'm wondering if the following behavior is intentional and what the 
>> rationale is:
>>
>> julia> x = rand(5);
>>
>> julia> size(x)
>> (5,)
>>
>> julia> n = size(x,1)
>> 5
>>
>> julia> m = size(x,2)
>> 1
>>
>> julia> (n, m) = size(x)
>> ERROR: BoundsError()
>>
>> I would expect either both size(x,2) and (n,m) = size(x) to work and be 
>> consistent, or both to return the same error...
>>
>>
>

Re: [julia-users] Gadfly, draw, and font embedding.

2014-08-13 Thread Keno Fischer
I believe Gadfly has a pgf backend which might help with this. For
svg, I don't think it can so why don't you happen an issue on the
Gadfly repository?

On Wed, Aug 13, 2014 at 11:22 PM, Lee Streeter  wrote:
> When using Gadfly to produce graphs, is there a way to embed fonts rather
> than have them rasterized? This is the second time I've had this problem in
> a project that uses Cairo.
>
> Font embedding is a bottom line feature in producing graphs for academic
> publication. Please help, I don't want to go back to matlab. (I know that
> matlab doesn't embed fonts, but it doesn't rasterize them either and I can
> embed the fonts after the fact).
>
>


Re: [julia-users] Re: [PSA]: curve_fit from Optim.jl is moving to LsqFit.jl

2014-08-13 Thread Robert Feldt
So as not to confuse others I just wanted to clarify that curve_fit does 
not care what you supply as x as long as what is returned from calling your 
model is a vector of same length as what you supply as y. Example:

using LsqFit

mvmodel(x, p) = begin
  n = abs(x[1,:]) .^ p[2]
  d = abs(x[2,:]) .^ p[3]
  (p[1] .* (n ./ d))[:]
end

N = 25
M = 100
X = randn(M, N)
Params = [1.0, 2.0, 2.0]
errors = 0.01*randn(N)
Y = mvmodel(X, Params) .+ errors

# curve_fit does not care about what is in X as long as what is returned
# when calling model(X, p) is vector of float of same size as Y.
fit = curve_fit(mvmodel, X, Y, rand(3))

julia> Params .- fit.param
3-element Array{Float64,1}:
  1.91519e-5
 -3.94951e-7
 -5.9904e-6



[julia-users] Gadfly, draw, and font embedding.

2014-08-13 Thread Lee Streeter
When using Gadfly to produce graphs, is there a way to embed fonts rather 
than have them rasterized? This is the second time I've had this problem in 
a project that uses Cairo.

Font embedding is a bottom line feature in producing graphs for academic 
publication. Please help, I don't want to go back to matlab. (I know that 
matlab doesn't embed fonts, but it doesn't rasterize them either and I can 
embed the fonts after the fact).




Re: [julia-users] Behavior of size()

2014-08-13 Thread Isaiah Norton
size(x,n) apparently works to arbitrary n. I don't think this is
intentional, because the C implementation includes a dimension check (this
call goes through codegen even at the REPL).


On Wed, Aug 13, 2014 at 4:54 PM, Dominique Orban 
wrote:

> I'm wondering if the following behavior is intentional and what the
> rationale is:
>
> julia> x = rand(5);
>
> julia> size(x)
> (5,)
>
> julia> n = size(x,1)
> 5
>
> julia> m = size(x,2)
> 1
>
> julia> (n, m) = size(x)
> ERROR: BoundsError()
>
> I would expect either both size(x,2) and (n,m) = size(x) to work and be
> consistent, or both to return the same error...
>
>


Re: [julia-users] Re: Package Popularity Ranking

2014-08-13 Thread John Myles White
This was a really nice read, even you can tell the author’s spent time with 
social scientists based on their assertion that a correlation of 0.3 is low.

 — John

On Aug 13, 2014, at 6:41 PM, Samuel Jenkins  wrote:

> Since this is on the topic of package popularity, this blog post on the 
> metrics of gem (package) popularity in Ruby by Loren Segal may be of interest 
> (arguably a roughly similar problem):
> http://gnuu.org/2011/10/19/gem-downloads-and-usage/
> 
> On Wednesday, August 13, 2014 11:03:31 PM UTC+10, Michael Smith wrote:
> Is there some sort of way to rank the popularity of Julia packages? 
> Haven't found anything like that (and apologies if I have missed anything). 
> 
> The reason I'm asking is that, although I am aware that relying purely 
> on rankings has several disadvantages, I still do believe that there are 
> some strong advantages in having a rough idea about what the really 
> important (or widely-used) packages are. 
> 
> This is particularly important considering the fact that the number of 
> Julia packages is increasing, and for newbies it will be difficult to 
> find their way around. 
> 
> Thanks, 
> 
> M 



Re: [julia-users] Create matrix from a comprehension with row/col-returning function?

2014-08-13 Thread Jacob Quinn
Ah, I see. Yeah, at least I'm not aware of how to do that with a
comprehension. You can unroll what a comprehension does and do it like:

z = zeros(3,2)
for i = 1:3
z[i,:] = f()
end


It seems like it would be convenient to support syntax like:

[f()... for i = 1:3]

but you might need a way to specify the dimensions of the resulting matrix
as well.


On Wed, Aug 13, 2014 at 9:40 PM, Brendan O'Connor 
wrote:

> But that calls `f()` on every loop of your comprehension, so it's probably
>> best to do something like:
>>
>> g = f()
>>
>> In  [13]: [g[i] for i=1:2, j=1:3]
>>
>> Out [13]: 2x3 Array{Any,2}:
>>  3.0  3.0  3.0
>>  5.0  5.0  5.0
>>
>
> Ah ... I should have said, actually, I don't want a constant value.  I
> wanted f() called 3 times, and its output arranged into a 3x2 matrix.
>
> [f()[i] for i=1:2, j=1:3]  is clever, but it calls f() 6 times.
>
> Brendan
>


[julia-users] Re: Package Popularity Ranking

2014-08-13 Thread Samuel Jenkins
Since this is on the topic of package popularity, this blog post on the 
metrics of gem (package) popularity in Ruby by Loren Segal may be of 
interest (arguably a roughly similar problem):
http://gnuu.org/2011/10/19/gem-downloads-and-usage/

On Wednesday, August 13, 2014 11:03:31 PM UTC+10, Michael Smith wrote:
>
> Is there some sort of way to rank the popularity of Julia packages? 
> Haven't found anything like that (and apologies if I have missed 
> anything). 
>
> The reason I'm asking is that, although I am aware that relying purely 
> on rankings has several disadvantages, I still do believe that there are 
> some strong advantages in having a rough idea about what the really 
> important (or widely-used) packages are. 
>
> This is particularly important considering the fact that the number of 
> Julia packages is increasing, and for newbies it will be difficult to 
> find their way around. 
>
> Thanks, 
>
> M 
>


Re: [julia-users] Create matrix from a comprehension with row/col-returning function?

2014-08-13 Thread Brendan O'Connor
>
> But that calls `f()` on every loop of your comprehension, so it's probably
> best to do something like:
>
> g = f()
>
> In  [13]: [g[i] for i=1:2, j=1:3]
>
> Out [13]: 2x3 Array{Any,2}:
>  3.0  3.0  3.0
>  5.0  5.0  5.0
>

Ah ... I should have said, actually, I don't want a constant value.  I
wanted f() called 3 times, and its output arranged into a 3x2 matrix.

[f()[i] for i=1:2, j=1:3]  is clever, but it calls f() 6 times.

Brendan


Re: [julia-users] Create matrix from a comprehension with row/col-returning function?

2014-08-13 Thread Jacob Quinn
It is possible to create matrices from comprehensions directly:

In  [4]: [i+j for i=0:1, j=1:2]

Out [4]: 2x2 Array{Int64,2}:
 1  2
 2  3

Otherwise, in your case:

In  [10]: [f()[i] for i=1:2, j = 1:3]

Out [10]: 2x3 Array{Float64,2}:
 3.0  3.0  3.0
 5.0  5.0  5.0

But that calls `f()` on every loop of your comprehension, so it's probably
best to do something like:

g = f()

In  [13]: [g[i] for i=1:2, j=1:3]

Out [13]: 2x3 Array{Any,2}:
 3.0  3.0  3.0
 5.0  5.0  5.0


On Wed, Aug 13, 2014 at 9:17 PM, Brendan O'Connor 
wrote:

> Hi, I'd like to create a matrix with an array comprehension.
>  Specifically, I have a function that returns a 2-length array, like
>
> function f()
> [3.0, 5.0]
> end
>
> And I'd like an Nx2 (or 2xN) matrix from its output.  Unfortunately, an
> obvious way of calling it results in:
>
> [f() for i=1:3]
>
> 3-element Array{Array{Float64,1},1}:
>  [3.0,5.0]
>  [3.0,5.0]
>  [3.0,5.0]
>
> Is there a general way to convert Array{Array{float, 1}, 1} into an
> Array{float, 2} ?  reshape() and convert() both don't seem to do it.  I
> guess hcat() (or vcat()) could do it if it was called with each element in
> the original array as one of its arguments.
>
> I read through the docs page but didn't see anything obvious:
> http://docs.julialang.org/en/release-0.3/manual/arrays/
>
> This is also no better:
>
> [f()' for i=1:3]
>
> 3-element Array{Array{Float64,2},1}:
>  1x2 Array{Float64,2}:
>  3.0  5.0
>  1x2 Array{Float64,2}:
>  3.0  5.0
>  1x2 Array{Float64,2}:
>  3.0  5.0
>
>


[julia-users] Create matrix from a comprehension with row/col-returning function?

2014-08-13 Thread Brendan O'Connor
Hi, I'd like to create a matrix with an array comprehension.  Specifically, 
I have a function that returns a 2-length array, like

function f()
[3.0, 5.0]
end

And I'd like an Nx2 (or 2xN) matrix from its output.  Unfortunately, an 
obvious way of calling it results in:

[f() for i=1:3]

3-element Array{Array{Float64,1},1}:
 [3.0,5.0]
 [3.0,5.0]
 [3.0,5.0]

Is there a general way to convert Array{Array{float, 1}, 1} into an 
Array{float, 2} ?  reshape() and convert() both don't seem to do it.  I 
guess hcat() (or vcat()) could do it if it was called with each element in 
the original array as one of its arguments.

I read through the docs page but didn't see anything 
obvious: http://docs.julialang.org/en/release-0.3/manual/arrays/

This is also no better:

[f()' for i=1:3]

3-element Array{Array{Float64,2},1}:
 1x2 Array{Float64,2}:
 3.0  5.0
 1x2 Array{Float64,2}:
 3.0  5.0
 1x2 Array{Float64,2}:
 3.0  5.0



Re: [julia-users] Matlab minfunc -> Optim.jl where the function evaluates the main cost function and its gradient simultaneously

2014-08-13 Thread John Myles White
That's not quite right: the highest performance case requires that you have 
three separate functions:

(1) f, which only calculates the objective function as a pure function 
returning a Float64 value
(2) g! which only calculates the gradient by mutating a Float64 array
(3) fg!, which calculates both f and g! at the same.

At some point, I'd like to revise the Optim interface so that you provide a 
single function that decides whether to calculate a gradient based on the size 
(zero or non-zero) of the input array for the gradient. This is the interface 
for NLopt, so it would be nice that functions could be moved between the two 
libraries easily.

Looking at your sample code, I think the real performance gains require that 
you do some devectorization. Optim, for example, assumes that you're going to 
mutate your gradient vector, rather than reallocate on every iteration (as your 
DeltaW implies).

 -- John

On Aug 13, 2014, at 5:30 PM, Andre P.  wrote:

> I'm porting some Matlab code to Julia. 
> 
> The optimization objective function evaluates the main cost function and its 
> gradient simultaneously. Some of the interim calculations from the cost 
> function are plugged into to gradient calculation to avoid making the same 
> calculation twice. Here is the actual function.
> 
> function SparseFilteringObj (W, X, N)
> 
> # Reshape W into matrix form
> W = reshape(W, (N, size(X,1)))
> 
> # Feed Forward
> F = W * X # Linear Activation
> Fs = sqrt(F.^2 + 1e-8) # Soft-Absolute Activation
> NFs, L2Fs = l2row(Fs) # Normalize by Rows
> Fhat, L2Fn = l2row(NFs') # Normalize by Columns
> 
> # Compute Objective Function
> Obj = sum(sum(Fhat, 2), 1)
> 
> # Backprop through each feedforward step
> DeltaW = l2grad(NFs', Fhat, L2Fn, ones(size(Fhat)))
> DeltaW = l2grad(Fs, NFs, L2Fs, DeltaW')
> DeltaW = (DeltaW .* (F ./ Fs)) * X'
> DeltaW = DeltaW[:]
> 
> return Obj, DeltaW
> end
> 
> 
> This is my first time using Optim.jl. It seems the interface requires that 
> the objective function be separated into a cost and a gradient function, but 
> it also says that I can get better performance by providing a third function, 
> DifferentiableFunction(f,g!), that calculates both of these simultaneously. 
> So, as I understand it, I have to split them up, and then re-combine them 
> using DifferentiableFunction(f,g!) to get better performance.  Is this 
> correct?
> 
> Any suggestions on how to split this in a way that avoids duplicating 
> calculation? Do all the calculation that are shared as inline calcs perhaps?
> It feels like I missing some easy solution. Any advice would be appreciated. 
> 
> Gist of the as yet incomplete port:
> https://gist.github.com/Andy-P/5c88e524d46a3749ba5f
> 
> Original matlab code
> http://cs.stanford.edu/~jngiam/papers/NgiamKohChenBhaskarNg2011_Supplementary.pdf
> 



[julia-users] Matlab minfunc -> Optim.jl where the function evaluates the main cost function and its gradient simultaneously

2014-08-13 Thread Andre P.
I'm porting some Matlab code to Julia. 

The optimization objective function evaluates the main cost function and 
its gradient simultaneously. Some of the interim calculations from the cost 
function are plugged into to gradient calculation to avoid making the same 
calculation twice. Here is the actual function.

function SparseFilteringObj (W, X, N)

# Reshape W into matrix form
W = reshape(W, (N, size(X,1)))

# Feed Forward
F = W * X # Linear Activation
Fs = sqrt(F.^2 + 1e-8) # Soft-Absolute Activation
NFs, L2Fs = l2row(Fs) # Normalize by Rows
Fhat, L2Fn = l2row(NFs') # Normalize by Columns

# Compute Objective Function
Obj = sum(sum(Fhat, 2), 1)

# Backprop through each feedforward step
DeltaW = l2grad(NFs', Fhat, L2Fn, ones(size(Fhat)))
DeltaW = l2grad(Fs, NFs, L2Fs, DeltaW')
DeltaW = (DeltaW .* (F ./ Fs)) * X'
DeltaW = DeltaW[:]

return Obj, DeltaW
end


This is my first time using Optim.jl. It seems the interface requires that 
the objective function be separated into a cost and a gradient function, 
but it also says that I can get better performance by providing a third 
function, DifferentiableFunction(f,g!), that calculates both of these 
simultaneously. So, as I understand it, I have to split them up, and then 
re-combine them using DifferentiableFunction(f,g!) to get better performance. 
 Is this correct?

Any suggestions on how to split this in a way that avoids duplicating 
calculation? Do all the calculation that are shared as inline calcs perhaps?
It feels like I missing some easy solution. Any advice would be 
appreciated. 

Gist of the as yet incomplete port:
https://gist.github.com/Andy-P/5c88e524d46a3749ba5f

Original matlab code
http://cs.stanford.edu/~jngiam/papers/NgiamKohChenBhaskarNg2011_Supplementary.pdf



Re: [julia-users] bit wrangling advice

2014-08-13 Thread ggggg
Let me clarify.  Vector{Bool} works fine with JLD, it doesn't work well 
with extendible HDF5Datasets, which is what I actually want to do.

On Wednesday, August 13, 2014 6:04:46 PM UTC-6, g wrote:
>
> It turns out Vector{Bool} does not work well with JLD.  So I played around 
> with BitArray, and I figure out that it would be pretty easy to use for my 
> purposes. It seems to me that BitArray could be made a bit more useful by 
> exporting a reinterpret method.  That would certainly make my use case use 
> less code, but it could also replace the current implementation of bits.  I 
> think it makes more sense for bits to return a BitArray than a String 
> anyway, since it would be much faster for uses like bits(4)[1].  Would it 
> be worth a making a pull request adding something like this in base? 
> (Clearly redefining bits would change behavior and break things, so I'm not 
> sure how to approach that)
>
> I wrote up some simple example code and it works fine, however it isn't 
> actually any faster than the current bits implementation which I found 
> surprising. Maybe it would be a bit faster if BitArray were able to be 
> constructed from v directly, instead of allocating then immediately 
> replacing b.chunks.
> function reinterpret2(::Type{BitArray}, v::Vector{Uint64}, dims=(64,-1))
> dims[2] == -1 && (dims=(64,length(v)))
> # check to make sure the dims are appopriate for length of v
> b = BitArray(dims...)
> b.chunks = v
> b
> end
>
> function reinterpret2(::Type{BitArray}, i::Uint64, dims=64)
> assert(dims <= 64)
> b = BitArray(dims)
> b.chunks = [i]
> b
> end
>
> bits2(i::Uint64) = reinterpret2(BitArray, i)
> bits2(x) = reinterpret2(BitArray,reinterpret(Uint64, x))
>
> testbits(n) = [bits(i)[1] for i=1:n]
> testbits2(n) = Bool[bits2(i)[1] for i=1:n]
>
>
> testbits(1);
> @time testbits(10);
> testbits2(1);
> @time testbits2(10);
>
>
>
> On Tuesday, August 5, 2014 11:26:39 PM UTC-6, Simon Kornblith wrote:
>>
>> Assuming you have enough memory to write a BitArray to the JLD file 
>> initially, if you later open the JLD file with mmaparrays=true and read 
>> it, JLD will mmap the underlying Vector{Uint64} so that pieces are read 
>> from the disk as they are accessed. (The actual specifics of how this works 
>> is up to the OS, but generally it works well.) In principle you can also 
>> modify the BitArray the changes will be saved to the disk, although I'm not 
>> sure how well that works since I don't do it in my own code. There is no 
>> easy way to resize the BitArray if you do this, though.
>>
>> Simon
>>
>> On Tuesday, August 5, 2014 5:06:16 PM UTC-4, Tim Holy wrote:
>>>
>>> To me it sounds like you've come up with the main options: BitArray or 
>>> Array{Bool}. Since a BitArray is, underneath, a Vector{Uint64} with 
>>> different 
>>> indexing semantics, it seems you could probably come up with a 
>>> reasonable way 
>>> to update just part of it. But even if you use Array{Bool}, you're 
>>> "only" 
>>> talking a few hundred megabytes, which is not a catastrophically large. 
>>> Also 
>>> consider keeping everything in memory; with 100GB of RAM you could store 
>>> an 
>>> awful lot of selections. 
>>>
>>> --Tim 
>>>
>>> On Tuesday, August 05, 2014 12:01:58 PM g wrote: 
>>> > Hello, 
>>> > 
>>> > I have an application where I have a few hundred million events, and 
>>> I'd 
>>> > like to make and work with different selections of sets of those 
>>> events. 
>>> > The events each have various values associated with them, say for 
>>> > simplicity color, timestamp, and loudness. Say one selection includes 
>>> all 
>>> > the events within 5 minutes after a blue event.  Or I want to select 
>>> all 
>>> > events that aren't above some loudness threshold. I'd like to be able 
>>> to 
>>> > save these selections in a JLD file for later use on some or all 
>>> events. I 
>>> > also need to be able update the selections as I observe more events. 
>>> > 
>>> > My baseline plane it to have an integer associated with each event and 
>>> each 
>>> > bit in the integer i corresponds to a selection.  So bit 1 is true for 
>>> > events within 5 minutes and bit 2 is true for events above the 
>>> loudness 
>>> > threshold.  Then for each event's integer I can do bits(i)[1] or 
>>> bits(i)[2] 
>>> > to figure out if it is included in each selection. That seems like it 
>>> would 
>>> > be inefficient since bits() returns a string, so I would have to call 
>>> > bool(bits(i)[1]).  I could use a bitwise mask of some sort like 1&i==0 
>>> for 
>>> > the first bit and 2&i==0 for the second bit. 
>>> > 
>>> > A BitArray seems like a decent choice, except that you can only 
>>> read/write 
>>> > the entire array from a JLD file, rather than just a part of it.  That 
>>> will 
>>> > be inefficient since I'll often want to look at only a small subset of 
>>> the 
>>> > total events. And every time I want to update for new events, I would 
>>> need 
>>> > to read the entire BitArray, extend it in me

[julia-users] pkg.julialang.org updated for 0.3/0.4, new permalinks/badges

2014-08-13 Thread Iain Dunning
Hi all,

Just wanted to announce I've changed pkg.julialang.org to show 0.3 and 0.4 
packages.

I've also taken this opportunity to change the badge and permalink URLs to 
something more, well, permanent.

The old ones had specific Julia versions in which I feel like is a pain to 
maintain, so I've changed them to this format:

I've kept the old SVGs there for now, but I will be removing them in a 
month or so. So you'll need to update this one time, but after that you 
should be OK "forever".

Release/stable:

PERMALINK: http://pkg.julialang.org/?pkg=AffineTransforms&ver=release
BADGE SVG: http://pkg.julialang.org/badges/AffineTransforms_release.svg
MARKDOWN:  
[![AffineTransforms](http://pkg.julialang.org/badges/AffineTransforms_release.svg)](http://pkg.julialang.org/?pkg=AffineTransforms&ver=release)

Nightly/unstable:

PERMALINK: http://pkg.julialang.org/?pkg=AffineTransforms&ver=nightly
BADGE SVG: http://pkg.julialang.org/badges/AffineTransforms_nightly.svg
MARKDOWN:  
[![AffineTransforms](http://pkg.julialang.org/badges/AffineTransforms_nightly.svg)](http://pkg.julialang.org/?pkg=AffineTransforms&ver=nightly)



Re: [julia-users] bit wrangling advice

2014-08-13 Thread ggggg
It turns out Vector{Bool} does not work well with JLD.  So I played around 
with BitArray, and I figure out that it would be pretty easy to use for my 
purposes. It seems to me that BitArray could be made a bit more useful by 
exporting a reinterpret method.  That would certainly make my use case use 
less code, but it could also replace the current implementation of bits.  I 
think it makes more sense for bits to return a BitArray than a String 
anyway, since it would be much faster for uses like bits(4)[1].  Would it 
be worth a making a pull request adding something like this in base? 
(Clearly redefining bits would change behavior and break things, so I'm not 
sure how to approach that)

I wrote up some simple example code and it works fine, however it isn't 
actually any faster than the current bits implementation which I found 
surprising. Maybe it would be a bit faster if BitArray were able to be 
constructed from v directly, instead of allocating then immediately 
replacing b.chunks.
function reinterpret2(::Type{BitArray}, v::Vector{Uint64}, dims=(64,-1))
dims[2] == -1 && (dims=(64,length(v)))
# check to make sure the dims are appopriate for length of v
b = BitArray(dims...)
b.chunks = v
b
end

function reinterpret2(::Type{BitArray}, i::Uint64, dims=64)
assert(dims <= 64)
b = BitArray(dims)
b.chunks = [i]
b
end

bits2(i::Uint64) = reinterpret2(BitArray, i)
bits2(x) = reinterpret2(BitArray,reinterpret(Uint64, x))

testbits(n) = [bits(i)[1] for i=1:n]
testbits2(n) = Bool[bits2(i)[1] for i=1:n]


testbits(1);
@time testbits(10);
testbits2(1);
@time testbits2(10);



On Tuesday, August 5, 2014 11:26:39 PM UTC-6, Simon Kornblith wrote:
>
> Assuming you have enough memory to write a BitArray to the JLD file 
> initially, if you later open the JLD file with mmaparrays=true and read 
> it, JLD will mmap the underlying Vector{Uint64} so that pieces are read 
> from the disk as they are accessed. (The actual specifics of how this works 
> is up to the OS, but generally it works well.) In principle you can also 
> modify the BitArray the changes will be saved to the disk, although I'm not 
> sure how well that works since I don't do it in my own code. There is no 
> easy way to resize the BitArray if you do this, though.
>
> Simon
>
> On Tuesday, August 5, 2014 5:06:16 PM UTC-4, Tim Holy wrote:
>>
>> To me it sounds like you've come up with the main options: BitArray or 
>> Array{Bool}. Since a BitArray is, underneath, a Vector{Uint64} with 
>> different 
>> indexing semantics, it seems you could probably come up with a reasonable 
>> way 
>> to update just part of it. But even if you use Array{Bool}, you're "only" 
>> talking a few hundred megabytes, which is not a catastrophically large. 
>> Also 
>> consider keeping everything in memory; with 100GB of RAM you could store 
>> an 
>> awful lot of selections. 
>>
>> --Tim 
>>
>> On Tuesday, August 05, 2014 12:01:58 PM g wrote: 
>> > Hello, 
>> > 
>> > I have an application where I have a few hundred million events, and 
>> I'd 
>> > like to make and work with different selections of sets of those 
>> events. 
>> > The events each have various values associated with them, say for 
>> > simplicity color, timestamp, and loudness. Say one selection includes 
>> all 
>> > the events within 5 minutes after a blue event.  Or I want to select 
>> all 
>> > events that aren't above some loudness threshold. I'd like to be able 
>> to 
>> > save these selections in a JLD file for later use on some or all 
>> events. I 
>> > also need to be able update the selections as I observe more events. 
>> > 
>> > My baseline plane it to have an integer associated with each event and 
>> each 
>> > bit in the integer i corresponds to a selection.  So bit 1 is true for 
>> > events within 5 minutes and bit 2 is true for events above the loudness 
>> > threshold.  Then for each event's integer I can do bits(i)[1] or 
>> bits(i)[2] 
>> > to figure out if it is included in each selection. That seems like it 
>> would 
>> > be inefficient since bits() returns a string, so I would have to call 
>> > bool(bits(i)[1]).  I could use a bitwise mask of some sort like 1&i==0 
>> for 
>> > the first bit and 2&i==0 for the second bit. 
>> > 
>> > A BitArray seems like a decent choice, except that you can only 
>> read/write 
>> > the entire array from a JLD file, rather than just a part of it.  That 
>> will 
>> > be inefficient since I'll often want to look at only a small subset of 
>> the 
>> > total events. And every time I want to update for new events, I would 
>> need 
>> > to read the entire BitArray, extend it in memory, then delete the old 
>> JLD 
>> > object and replace it with a new JLD object.  It seems plausible I 
>> could 
>> > figure out how to read/write part of a BitArray from a JLD as I've 
>> already 
>> > done some hacking on HDF5.jl, but that could be a large amount of work. 
>> > 
>> > An Array{Bool} works well with JLD, and seems just as well suited as a 
>

Re: [julia-users] About conversion of a 5-decimal-digit float to string

2014-08-13 Thread Charles Novaes de Santana
Thank you, guys! It worked perfectly!

Best,

Charles


On Wed, Aug 13, 2014 at 7:24 PM, gentlebeldin 
wrote:

> That (after correcting the typo, the missing ") would give
> "cons_0.10". The right way would be
>
> charvar = @sprintf("cons_%.5f", 0.1)
>
> Am Mittwoch, 13. August 2014 13:48:40 UTC+2 schrieb Andreas Noack:
>>
>> One solution is to use the @sprintf macro, i.e. something like
>>  @sprintf("cons_%f, 0.1).
>>
>> Med venlig hilsen
>>
>> Andreas Noack
>>
>>
>> 2014-08-13 7:42 GMT-04:00 Charles Novaes de Santana > >:
>>
>> Dear all,
>>>
>>> I would like to convert a float variable with more than 5 decimal digits
>>> to a string, but in the literal notation, not in the "logarithmic" one.
>>>
>>> For example, if I do:
>>>
>>> floatvar = 0.1;
>>> charvar = string("cost_",floatvar);
>>> println(charvar);
>>>
>>> charvar is written as: "cost_1.0e-5". Instead of that, I would like to
>>> get "cost_0.1".
>>>
>>> Any idea about how to do that? I am sorry for this very basic question,
>>> but so far I couldn't realize by myself neither find in the forums a way to
>>> do that.
>>>
>>> Thank you for your attention and for any help!
>>>
>>> Best,
>>>
>>> Charles
>>>
>>>
>>> --
>>> Um axé! :)
>>>
>>> --
>>> Charles Novaes de Santana, PhD
>>> http://www.imedea.uib-csic.es/~charles
>>>
>>
>>


-- 
Um axé! :)

--
Charles Novaes de Santana, PhD
http://www.imedea.uib-csic.es/~charles


[julia-users] Proposal for inargs

2014-08-13 Thread vavasis
Dear Julia colleagues,

In June, I wondered on this newsgroup why Julia lacks an 'inarg' 
specification for functions.  The two major languages used nowadays for 
scientific programming, namely Fortran and C++, both provide mechanisms to 
declare that a function argument is read-only by the function.  Indeed, 
this was added to Fortran late in its life, so one assumes that there is 
some bitter experience underlying the decision to include it in Fortran. 
 (Matlab has only inargs, at least until you get to relatively advanced 
programming techniques, so this is not an issue.)

Stefan Karpinski provided a convincing explanation for why inarg and outarg 
specifications have been omitted from the Julia core.  Now that I am 
slightly more familiar with Julia, I would like to make a proposal for 
inarg that would not require changes to the core language.  The proposal 
would, however, entail substantial additional code, so it is intended for 
some version of Julia in the future.

Here is the proposal: suppose fn is a function that takes an array input 
"a" and wants to declare it to be read-only.  Then at the beginning of the 
function before any of the arguments gets used, there would be an 
assignment statement like this:

function fn(a::AbstractArray{Int,1})
a = readonly(a)

The way this would work is as follows: Julia would have new types, mostly 
invisible to the user, like ReadOnlyArray which would have a setindex! 
method that would throw an error, Then there would be methods like 
readonly{T.N}(a::Array{T,N}) that would use 'reinterpret' to change the 
Array to a ReadOnlyArray.  A programmer who wanted to write a function that 
could take either arrays or readonlyarrays as inputs would have to declare 
abstract argument types like DenseArray or AbstractArray.  The user would 
not, in general, have to worry about the read-only types; the situation 
when a user would have to worry about them is if he/she wants to develop a 
read-only version of his/her own data structure that internally uses the 
standard containers.

This proposal has several advantages:

(1) The above mechanism enforces the read-only property of a since fn no 
longer has access to the initial (writeable) definition of a.

(2) The above mechanism, if adopted as an idiom, could be easily spotted by 
program analysis tools that could then make optimizations based on the fact 
that a is read-only.

(3) There is hardly any performance penalty for this mechanism.

But obviously there is one big disadvantage:

(1) For each of the standard containers, a new read-only version would have 
to be written.  Furthermore, there would also have to be an abstract type 
to serve as a common parent.  E.g. there is currently no abstract parent 
for Set (although there is an open discussion about that matter on github).

and a second minor disadvantage

(2) The enforcement of read-only would probably would not work recursively, 
e.g., if a were an array of arrays.  In fact C++ has a similar gap in its 
'const' mechanism.

-- Steve Vavasis



[julia-users] Re: Pkg.update no ASCIIString?

2014-08-13 Thread Tony Kelman
That second one is my fault, there's a PR pending that Dahua probably just 
hasn't seen yet. If you're in a hurry, Pkg.add("BinDeps") first should fix 
it.


On Wednesday, August 13, 2014 11:03:21 AM UTC-7, TR NS wrote:
>
> Getting this error:
>
> julia> Pkg.update("LightXML")
> ERROR: `update` has no method matching update(::ASCIIString)
>
> Using Julia 0.4.0-dev+95
>
> Note, I also can install LightXML from scratch, add produced:
>
> julia> Pkg.add("LightXML")
> BinDeps not found
> while loading /home/trans/.julia/v0.4/LightXML/deps/build.jl, in 
> expression starting on line 1
>
>
>

Re: [julia-users] Re: Classification with Julia

2014-08-13 Thread Jason
A "Bayes" classifier  is a
well defined entity that is semantically separate from the "Optimal
Bayesian" Classifier. But you're right that the risk of confusion is
probably low seeing as the Bayes classifier is primarily theoretical (given
that the needed exact feature-label distribution is typically unknown).

Though now you've started me wondering about two more of my hastily named
(and even more nascent) Julia libraries: DAI.jl and MCBN.jl ;).Though their
full names are not very friendly either... (DiscreteApproximateInference.jl
and MonteCarloBayesianNetworks.jl)

Jason

I suspect the optimal is necessary as it's a common rhetoric in certain
> statistical communities. Cf. optimal classification as described in
> political science.
>
>  -- John
>
> On Aug 13, 2014, at 1:46 PM, Stefan Karpinski 
> wrote:
>
> Cool stuff. May I preemptively suggest calling it BayesianClassifiers? I'm
> assuming the "optimal" part is redundant since no one will be clamoring for
>  suboptimal Bayesian classifiers.
>
>


Re: [julia-users] Package Popularity Ranking

2014-08-13 Thread Miles Lubin
It would be cool to be able to sort by github stars (and later, github 
clones) on pkg.julialang.

On Wednesday, August 13, 2014 3:03:32 PM UTC-6, Iain Dunning wrote:
>
> Hi Michael,
>
> This is a problem I think about a lot, but definitely short on data. 
> pkg.julialang.org has the GitHub stars, which is possibly a decent proxy. 
> I could add an option to sort by github stars, which might help.
>
> And yes, github clone traffic just (yesterday) became available, so I'm 
> hopeful there.
>
> On Wednesday, August 13, 2014 10:53:58 AM UTC-4, John Myles White wrote:
>>
>> You can also use GitHub stars. I'd be really interested to know how those 
>> two measures correlate.
>>
>>  -- John
>>
>> On Aug 13, 2014, at 7:51 AM, Jacob Quinn  wrote:
>>
>> GitHub just started posting `git clone` data for individual repos, so 
>> this is definitely a possibility now. I wouldn't be surprised if Iain's 
>> Package 
>> Evaluator  started 
>> hooking into this data and using it to sort the package list 
>> .
>>
>> -Jacob
>>
>>
>> On Wed, Aug 13, 2014 at 9:03 AM, Michael Smith  wrote:
>>
>>> Is there some sort of way to rank the popularity of Julia packages?
>>> Haven't found anything like that (and apologies if I have missed 
>>> anything).
>>>
>>> The reason I'm asking is that, although I am aware that relying purely
>>> on rankings has several disadvantages, I still do believe that there are
>>> some strong advantages in having a rough idea about what the really
>>> important (or widely-used) packages are.
>>>
>>> This is particularly important considering the fact that the number of
>>> Julia packages is increasing, and for newbies it will be difficult to
>>> find their way around.
>>>
>>> Thanks,
>>>
>>> M
>>>
>>
>>
>>

Re: [julia-users] Is there a Julia version of R's rank(...) function?

2014-08-13 Thread John Myles White
tiedrank in StatsBase does some of what R's rank does.

 -- John

On Aug 13, 2014, at 2:16 PM, Ryan J. O'Neil  wrote:

> I’ve been looking around for this, but if it exists I haven’t been able to 
> find it in the docs.
> 
> In R, I can use order and rank to provide the permutation order and rank of 
> the elements in a vector.
> 
> > rank(c(3,5,2,9,8,1,4,7,6))
> [1] 3 5 2 9 8 1 4 7 6
> 
> > order(c(3,5,2,9,8,1,4,7,6))
> [1] 6 3 1 7 2 9 8 5 4
> It looks like Julia’s sortperm provides the same functionality as order.
> 
> julia> sortperm([3,5,2,9,8,1,4,7,6])'
> 1x9 Array{Int64,2}:
>  6  3  1  7  2  9  8  5  4
> Is there a version of R’s rank function?
> 
> Thanks,
> ​​
> Ryan J. O’Neil
> http://adventuresinoptimization.blogspot.com/
> @ryanjoneil
> 
> ​



[julia-users] Is there a Julia version of R's rank(...) function?

2014-08-13 Thread Ryan J. O'Neil
I’ve been looking around for this, but if it exists I haven’t been able to
find it in the docs.

In R, I can use order and rank to provide the permutation order and rank of
the elements in a vector.

> rank(c(3,5,2,9,8,1,4,7,6))
[1] 3 5 2 9 8 1 4 7 6

> order(c(3,5,2,9,8,1,4,7,6))
[1] 6 3 1 7 2 9 8 5 4

It looks like Julia’s sortperm provides the same functionality as order.

julia> sortperm([3,5,2,9,8,1,4,7,6])'
1x9 Array{Int64,2}:
 6  3  1  7  2  9  8  5  4

Is there a version of R’s rank function?

Thanks,
​​
Ryan J. O’Neil
http://adventuresinoptimization.blogspot.com/
@ryanjoneil
​


Re: [julia-users] trouble building julia on mac

2014-08-13 Thread Ivar Nesje
fftw does a ch


Re: [julia-users] Package Popularity Ranking

2014-08-13 Thread Iain Dunning
Hi Michael,

This is a problem I think about a lot, but definitely short on data. 
pkg.julialang.org has the GitHub stars, which is possibly a decent proxy. I 
could add an option to sort by github stars, which might help.

And yes, github clone traffic just (yesterday) became available, so I'm 
hopeful there.

On Wednesday, August 13, 2014 10:53:58 AM UTC-4, John Myles White wrote:
>
> You can also use GitHub stars. I'd be really interested to know how those 
> two measures correlate.
>
>  -- John
>
> On Aug 13, 2014, at 7:51 AM, Jacob Quinn  > wrote:
>
> GitHub just started posting `git clone` data for individual repos, so this 
> is definitely a possibility now. I wouldn't be surprised if Iain's Package 
> Evaluator  started hooking 
> into this data and using it to sort the package list 
> .
>
> -Jacob
>
>
> On Wed, Aug 13, 2014 at 9:03 AM, Michael Smith  > wrote:
>
>> Is there some sort of way to rank the popularity of Julia packages?
>> Haven't found anything like that (and apologies if I have missed 
>> anything).
>>
>> The reason I'm asking is that, although I am aware that relying purely
>> on rankings has several disadvantages, I still do believe that there are
>> some strong advantages in having a rough idea about what the really
>> important (or widely-used) packages are.
>>
>> This is particularly important considering the fact that the number of
>> Julia packages is increasing, and for newbies it will be difficult to
>> find their way around.
>>
>> Thanks,
>>
>> M
>>
>
>
>

Re: [julia-users] Re: Clipping Algorithm

2014-08-13 Thread Ryan J. O'Neil
I've been in need of a polygon clipper for Julia lately as well. In the
past I've used a Python wrapper around GPC (
http://www.cs.man.ac.uk/~toby/gpc/) and have been considering a Julia
version. If anyone else is interested in writing one, I'd be happy to
contribute.

Ryan J. O'Neil
http://adventuresinoptimization.blogspot.com/
@ryanjoneil



On Wed, Aug 13, 2014 at 3:21 PM, Andreas Lobinger 
wrote:

> you need inpolygon or polygon clipping?
>
>
>


[julia-users] Behavior of size()

2014-08-13 Thread Dominique Orban
I'm wondering if the following behavior is intentional and what the 
rationale is:

julia> x = rand(5);

julia> size(x)
(5,)

julia> n = size(x,1)
5

julia> m = size(x,2)
1

julia> (n, m) = size(x)
ERROR: BoundsError()

I would expect either both size(x,2) and (n,m) = size(x) to work and be 
consistent, or both to return the same error...



Re: [julia-users] Re: Classification with Julia

2014-08-13 Thread John Myles White
I suspect the optimal is necessary as it's a common rhetoric in certain 
statistical communities. Cf. optimal classification as described in political 
science.

 -- John

On Aug 13, 2014, at 1:46 PM, Stefan Karpinski  
wrote:

> Cool stuff. May I preemptively suggest calling it BayesianClassifiers? I'm 
> assuming the "optimal" part is redundant since no one will be clamoring for  
> suboptimal Bayesian classifiers.
> 
> On Aug 13, 2014, at 4:23 PM, Jason Knight  wrote:
> 
>> I'm currently working with Optimal Bayesian Classifiers with my 
>> not-really-ready-for-public-consumption package OBC.jl. It's currently quite 
>> specialized for bioinformatics (RNA-Seq) data, so probably not what you 
>> want, but I thought I'd throw it out there. :)
>> 
>> You can also read more about OBC here if interested.
>> 
>> Jason
>> 
>> On Wednesday, August 13, 2014 7:20:51 AM UTC-5, Anuj Prakash wrote:
>> Hey
>> 
>> I wanted to know about some good Julia packages for binary classification. 
>> Feel free to include those dealing with trees also.
>> 
>> Cheers,
>> 
>> Anuj



Re: [julia-users] Re: Classification with Julia

2014-08-13 Thread Stefan Karpinski
Cool stuff. May I preemptively suggest calling it BayesianClassifiers? I'm 
assuming the "optimal" part is redundant since no one will be clamoring for  
suboptimal Bayesian classifiers.

> On Aug 13, 2014, at 4:23 PM, Jason Knight  wrote:
> 
> I'm currently working with Optimal Bayesian Classifiers with my 
> not-really-ready-for-public-consumption package OBC.jl. It's currently quite 
> specialized for bioinformatics (RNA-Seq) data, so probably not what you want, 
> but I thought I'd throw it out there. :)
> 
> You can also read more about OBC here if interested.
> 
> Jason
> 
>> On Wednesday, August 13, 2014 7:20:51 AM UTC-5, Anuj Prakash wrote:
>> Hey
>> 
>> I wanted to know about some good Julia packages for binary classification. 
>> Feel free to include those dealing with trees also.
>> 
>> Cheers,
>> 
>> Anuj


[julia-users] Re: Classification with Julia

2014-08-13 Thread Jason Knight
I'm currently working with Optimal Bayesian Classifiers with my 
not-really-ready-for-public-consumption package OBC.jl 
. It's currently quite specialized 
for bioinformatics (RNA-Seq) data, so probably not what you want, but I 
thought I'd throw it out there. :)

You can also read more about OBC here 
 if interested.

Jason

On Wednesday, August 13, 2014 7:20:51 AM UTC-5, Anuj Prakash wrote:
>
> Hey
>
> I wanted to know about some good Julia packages for binary classification. 
> Feel free to include those dealing with trees also.
>
> Cheers,
>
> Anuj
>


[julia-users] ANN: Docile.jl Package Documentation (again)

2014-08-13 Thread Michael Hatherly


Hi all,

I had some time today to push some changes to my Docile.jl 
 package documentation 
experiments that I’ve been thinking about for a while.

Some highlights:

   - Use of a @doc macro to avoid preparsing source code for documentation. 
   Only supports documenting functions currently. 
   - Support for doctests. Quite basic, nothing fancy. 
   - @query macro that behaves in a similar manner to @which, but for 
   docstrings. 
   - query method for full text searches. 
   - Metadata section for docstrings using YAML formatted text. Works quite 
   well for things like function argument descriptions. 
   - Pretty-printed results from queries in the console using Markdown.jl. 
   Haven’t got to HTML output currently. 

Although I’ve seen that docstrings may be in the works for 0.4 I feel that 
something to use until then would be nice, so if there’s any interest I’ll 
try add this to METADATA later.

— Mike
​


Re: [julia-users] trouble building julia on mac

2014-08-13 Thread Adam Kapor
Thank you Elliot and Jameson.  I indeed recently upgraded Xcode and clang,
and `make -C deps distclean-fftw` did the trick.


On Wed, Aug 13, 2014 at 2:39 PM, Jameson Nash  wrote:

> Especially true if you just upgraded you OS / compiler, you should start
> again with a fresh clone
>
>
> On Wednesday, August 13, 2014, Elliot Saba  wrote:
>
>> Adam, is this julia codebase a fresh clone, or have you been building out
>> of this directory for a while?  If it's not 100% fresh, you might want to
>> try running `make -C deps distclean-fftw` and then trying again.  It's
>> possible that we fixed this issue a while back, and the cached configure
>> state of your fftw is behind a bit and needs to be reconfigured.
>> -E
>>
>>
>> On Wed, Aug 13, 2014 at 2:29 PM, Jeff Waller  wrote:
>>
>>> Likewise no problems compiling using an older version of clang (Xcode
>>> 5.0.2), but I do see that flag
>>>
>>> bizarro% clang --version
>>>
>>> Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
>>>
>>> Target: x86_64-apple-darwin13.3.0
>>>
>>> Thread model: posix
>>>
>>> It looks like it's in there.  There is a test to check (see below) but
>>> the compiler doesn't fail, it just warns so the test is perhaps concluding
>>> that yep, supported which is technically true.
>>>
>>> bizarro% find . -type f -exec grep malign-double {} /dev/null \;
>>>
>>> ...
>>>
>>> ./deps/fftw-3.3.3-double/config.log:clang: warning: argument unused
>>> during compilation: '-malign-double'
>>>
>>> ./deps/fftw-3.3.3-double/config.log:configure:14242: clang
>>> -stdlib=libc++ -mmacosx-version-min=10.7 -m64 -c -O3 -fomit-frame-pointer
>>> -mtune=native -malign-double -fstrict-aliasing -fno-schedule-insns
>>> -ffast-math
>>>
>>>
>>> ...
>>>
>>>
>>> ./deps/fftw-3.3.3-single/configure:$as_echo_n "checking whether C
>>> compiler accepts -malign-double... " >&6; }
>>>
>>> ./deps/fftw-3.3.3-single/configure:  CFLAGS="-malign-double"
>>>
>>> ./deps/fftw-3.3.3-single/configure: CFLAGS="$CFLAGS -malign-double"
>>>
>>> ./deps/fftw-3.3.3-single/configure: # -malign-double for x86 systems
>>>
>>> ./deps/fftw-3.3.3-single/configure:  { $as_echo
>>> "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts
>>> -malign-double" >&5
>>>
>>> ./deps/fftw-3.3.3-single/configure:$as_echo_n "checking whether C
>>> compiler accepts -malign-double... " >&6; }
>>>
>>> ./deps/fftw-3.3.3-single/configure:  CFLAGS="-malign-double"
>>>
>>> ./deps/fftw-3.3.3-single/configure: CFLAGS="$CFLAGS -malign-double"
>>>
>>> ./deps/fftw-3.3.3-single/configure: { $as_echo
>>> "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts
>>> -malign-double" >&5
>>>
>>> ./deps/fftw-3.3.3-single/configure:$as_echo_n "checking whether C
>>> compiler accepts -malign-double... " >&6; }
>>>
>>> ./deps/fftw-3.3.3-single/configure:  CFLAGS="-malign-double"
>>>
>>> ./deps/fftw-3.3.3-single/configure: CFLAGS="$CFLAGS -malign-double"
>>>
>>> ...
>>>
>>> Binary file ./usr/lib/libfftw3.3.dylib matches
>>>
>>> Binary file ./usr/lib/libfftw3.a matches
>>>
>>> Binary file ./usr/lib/libfftw3f.3.dylib matches
>>>
>>> Binary file ./usr/lib/libfftw3f.a matches
>>>
>>
>>


[julia-users] Re: Clipping Algorithm

2014-08-13 Thread Andreas Lobinger
you need inpolygon or polygon clipping?




Re: [julia-users] trouble building julia on mac

2014-08-13 Thread Jameson Nash
Especially true if you just upgraded you OS / compiler, you should start
again with a fresh clone

On Wednesday, August 13, 2014, Elliot Saba  wrote:

> Adam, is this julia codebase a fresh clone, or have you been building out
> of this directory for a while?  If it's not 100% fresh, you might want to
> try running `make -C deps distclean-fftw` and then trying again.  It's
> possible that we fixed this issue a while back, and the cached configure
> state of your fftw is behind a bit and needs to be reconfigured.
> -E
>
>
> On Wed, Aug 13, 2014 at 2:29 PM, Jeff Waller  > wrote:
>
>> Likewise no problems compiling using an older version of clang (Xcode
>> 5.0.2), but I do see that flag
>>
>> bizarro% clang --version
>>
>> Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
>>
>> Target: x86_64-apple-darwin13.3.0
>>
>> Thread model: posix
>>
>> It looks like it's in there.  There is a test to check (see below) but
>> the compiler doesn't fail, it just warns so the test is perhaps concluding
>> that yep, supported which is technically true.
>>
>> bizarro% find . -type f -exec grep malign-double {} /dev/null \;
>>
>> ...
>>
>> ./deps/fftw-3.3.3-double/config.log:clang: warning: argument unused
>> during compilation: '-malign-double'
>>
>> ./deps/fftw-3.3.3-double/config.log:configure:14242: clang -stdlib=libc++
>> -mmacosx-version-min=10.7 -m64 -c -O3 -fomit-frame-pointer -mtune=native
>> -malign-double -fstrict-aliasing -fno-schedule-insns -ffast-math
>>
>>
>> ...
>>
>>
>> ./deps/fftw-3.3.3-single/configure:$as_echo_n "checking whether C
>> compiler accepts -malign-double... " >&6; }
>>
>> ./deps/fftw-3.3.3-single/configure:  CFLAGS="-malign-double"
>>
>> ./deps/fftw-3.3.3-single/configure: CFLAGS="$CFLAGS -malign-double"
>>
>> ./deps/fftw-3.3.3-single/configure: # -malign-double for x86 systems
>>
>> ./deps/fftw-3.3.3-single/configure:  { $as_echo
>> "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts
>> -malign-double" >&5
>>
>> ./deps/fftw-3.3.3-single/configure:$as_echo_n "checking whether C
>> compiler accepts -malign-double... " >&6; }
>>
>> ./deps/fftw-3.3.3-single/configure:  CFLAGS="-malign-double"
>>
>> ./deps/fftw-3.3.3-single/configure: CFLAGS="$CFLAGS -malign-double"
>>
>> ./deps/fftw-3.3.3-single/configure: { $as_echo
>> "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts
>> -malign-double" >&5
>>
>> ./deps/fftw-3.3.3-single/configure:$as_echo_n "checking whether C
>> compiler accepts -malign-double... " >&6; }
>>
>> ./deps/fftw-3.3.3-single/configure:  CFLAGS="-malign-double"
>>
>> ./deps/fftw-3.3.3-single/configure: CFLAGS="$CFLAGS -malign-double"
>>
>> ...
>>
>> Binary file ./usr/lib/libfftw3.3.dylib matches
>>
>> Binary file ./usr/lib/libfftw3.a matches
>>
>> Binary file ./usr/lib/libfftw3f.3.dylib matches
>>
>> Binary file ./usr/lib/libfftw3f.a matches
>>
>
>


Re: [julia-users] trouble building julia on mac

2014-08-13 Thread Elliot Saba
Adam, is this julia codebase a fresh clone, or have you been building out
of this directory for a while?  If it's not 100% fresh, you might want to
try running `make -C deps distclean-fftw` and then trying again.  It's
possible that we fixed this issue a while back, and the cached configure
state of your fftw is behind a bit and needs to be reconfigured.
-E


On Wed, Aug 13, 2014 at 2:29 PM, Jeff Waller  wrote:

> Likewise no problems compiling using an older version of clang (Xcode
> 5.0.2), but I do see that flag
>
> bizarro% clang --version
>
> Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
>
> Target: x86_64-apple-darwin13.3.0
>
> Thread model: posix
>
> It looks like it's in there.  There is a test to check (see below) but the
> compiler doesn't fail, it just warns so the test is perhaps concluding that
> yep, supported which is technically true.
>
> bizarro% find . -type f -exec grep malign-double {} /dev/null \;
>
> ...
>
> ./deps/fftw-3.3.3-double/config.log:clang: warning: argument unused during
> compilation: '-malign-double'
>
> ./deps/fftw-3.3.3-double/config.log:configure:14242: clang -stdlib=libc++
> -mmacosx-version-min=10.7 -m64 -c -O3 -fomit-frame-pointer -mtune=native
> -malign-double -fstrict-aliasing -fno-schedule-insns -ffast-math
>
>
> ...
>
>
> ./deps/fftw-3.3.3-single/configure:$as_echo_n "checking whether C compiler
> accepts -malign-double... " >&6; }
>
> ./deps/fftw-3.3.3-single/configure:  CFLAGS="-malign-double"
>
> ./deps/fftw-3.3.3-single/configure: CFLAGS="$CFLAGS -malign-double"
>
> ./deps/fftw-3.3.3-single/configure: # -malign-double for x86 systems
>
> ./deps/fftw-3.3.3-single/configure:  { $as_echo
> "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts
> -malign-double" >&5
>
> ./deps/fftw-3.3.3-single/configure:$as_echo_n "checking whether C compiler
> accepts -malign-double... " >&6; }
>
> ./deps/fftw-3.3.3-single/configure:  CFLAGS="-malign-double"
>
> ./deps/fftw-3.3.3-single/configure: CFLAGS="$CFLAGS -malign-double"
>
> ./deps/fftw-3.3.3-single/configure: { $as_echo
> "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts
> -malign-double" >&5
>
> ./deps/fftw-3.3.3-single/configure:$as_echo_n "checking whether C compiler
> accepts -malign-double... " >&6; }
>
> ./deps/fftw-3.3.3-single/configure:  CFLAGS="-malign-double"
>
> ./deps/fftw-3.3.3-single/configure: CFLAGS="$CFLAGS -malign-double"
>
> ...
>
> Binary file ./usr/lib/libfftw3.3.dylib matches
>
> Binary file ./usr/lib/libfftw3.a matches
>
> Binary file ./usr/lib/libfftw3f.3.dylib matches
>
> Binary file ./usr/lib/libfftw3f.a matches
>


Re: [julia-users] trouble building julia on mac

2014-08-13 Thread Jeff Waller
Likewise no problems compiling using an older version of clang (Xcode 
5.0.2), but I do see that flag

bizarro% clang --version

Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)

Target: x86_64-apple-darwin13.3.0

Thread model: posix

It looks like it's in there.  There is a test to check (see below) but the 
compiler doesn't fail, it just warns so the test is perhaps concluding that 
yep, supported which is technically true.

bizarro% find . -type f -exec grep malign-double {} /dev/null \;

...

./deps/fftw-3.3.3-double/config.log:clang: warning: argument unused during 
compilation: '-malign-double'

./deps/fftw-3.3.3-double/config.log:configure:14242: clang -stdlib=libc++ 
-mmacosx-version-min=10.7 -m64 -c -O3 -fomit-frame-pointer -mtune=native 
-malign-double -fstrict-aliasing -fno-schedule-insns -ffast-math 


...


./deps/fftw-3.3.3-single/configure:$as_echo_n "checking whether C compiler 
accepts -malign-double... " >&6; }

./deps/fftw-3.3.3-single/configure:  CFLAGS="-malign-double"

./deps/fftw-3.3.3-single/configure: CFLAGS="$CFLAGS -malign-double"

./deps/fftw-3.3.3-single/configure: # -malign-double for x86 systems

./deps/fftw-3.3.3-single/configure:  { $as_echo 
"$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts 
-malign-double" >&5

./deps/fftw-3.3.3-single/configure:$as_echo_n "checking whether C compiler 
accepts -malign-double... " >&6; }

./deps/fftw-3.3.3-single/configure:  CFLAGS="-malign-double"

./deps/fftw-3.3.3-single/configure: CFLAGS="$CFLAGS -malign-double"

./deps/fftw-3.3.3-single/configure: { $as_echo 
"$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts 
-malign-double" >&5

./deps/fftw-3.3.3-single/configure:$as_echo_n "checking whether C compiler 
accepts -malign-double... " >&6; }

./deps/fftw-3.3.3-single/configure:  CFLAGS="-malign-double"

./deps/fftw-3.3.3-single/configure: CFLAGS="$CFLAGS -malign-double"

...

Binary file ./usr/lib/libfftw3.3.dylib matches

Binary file ./usr/lib/libfftw3.a matches

Binary file ./usr/lib/libfftw3f.3.dylib matches

Binary file ./usr/lib/libfftw3f.a matches


Re: [julia-users] Pkg.update no ASCIIString?

2014-08-13 Thread John Myles White
Right now you can't update only a single package: you have to update all 
packages.

 -- John

On Aug 13, 2014, at 11:03 AM, TR NS  wrote:

> Getting this error:
> 
> julia> Pkg.update("LightXML")
> ERROR: `update` has no method matching update(::ASCIIString)
> 
> Using Julia 0.4.0-dev+95
> 
> Note, I also can install LightXML from scratch, add produced:
> 
> julia> Pkg.add("LightXML")
> BinDeps not found
> while loading /home/trans/.julia/v0.4/LightXML/deps/build.jl, in 
> expression starting on line 1
> 
> 



[julia-users] Pkg.update no ASCIIString?

2014-08-13 Thread TR NS
Getting this error:

julia> Pkg.update("LightXML")
ERROR: `update` has no method matching update(::ASCIIString)

Using Julia 0.4.0-dev+95

Note, I also can install LightXML from scratch, add produced:

julia> Pkg.add("LightXML")
BinDeps not found
while loading /home/trans/.julia/v0.4/LightXML/deps/build.jl, in 
expression starting on line 1




Re: [julia-users] About conversion of a 5-decimal-digit float to string

2014-08-13 Thread gentlebeldin
That (after correcting the typo, the missing ") would give "cons_0.10". 
The right way would be

charvar = @sprintf("cons_%.5f", 0.1)

Am Mittwoch, 13. August 2014 13:48:40 UTC+2 schrieb Andreas Noack:
>
> One solution is to use the @sprintf macro, i.e. something like 
>  @sprintf("cons_%f, 0.1). 
>
> Med venlig hilsen
>
> Andreas Noack
>  
>
> 2014-08-13 7:42 GMT-04:00 Charles Novaes de Santana  >:
>
>> Dear all,
>>
>> I would like to convert a float variable with more than 5 decimal digits 
>> to a string, but in the literal notation, not in the "logarithmic" one.
>>
>> For example, if I do:
>>
>> floatvar = 0.1;
>> charvar = string("cost_",floatvar);
>> println(charvar);
>>
>> charvar is written as: "cost_1.0e-5". Instead of that, I would like to 
>> get "cost_0.1".
>>
>> Any idea about how to do that? I am sorry for this very basic question, 
>> but so far I couldn't realize by myself neither find in the forums a way to 
>> do that.
>>
>> Thank you for your attention and for any help!
>>
>> Best,
>>
>> Charles
>>
>>
>> -- 
>> Um axé! :)
>>
>> --
>> Charles Novaes de Santana, PhD
>> http://www.imedea.uib-csic.es/~charles
>>  
>
>

Re: [julia-users] trouble building julia on mac

2014-08-13 Thread Elliot Saba
Hey there.  I'm on OSX 10.9.4, with Xcode 5.1.1 (5B1008) and clang version
503.0.40.

When I compile julia's fftw on my computer, I don't get `-malign-double`
passed to clang ever. Do you have CFLAGS set in your environment?  Maybe
set in your Make.user file in Julia's root directory?


Re: [julia-users] Re: character encoding

2014-08-13 Thread Stefan Karpinski
Great – thanks for putting that on the record. It may well be useful to someone 
in the future!

> On Aug 13, 2014, at 10:02 AM, Frederico Novaes  
> wrote:
> 
> 
> 
>> On Tuesday, August 12, 2014 11:20:58 PM UTC-3, Keith Campbell wrote:
>> This might be easier to do on  the server side.
>> Many DBMS, including MySQL and PostGreSQL, support encoding conversions.  
>> 
>> eg convert('my_string', 'UTF8', 'ISO_8859_2')
>>   SELECT CAST(_latin1'test' AS CHAR CHARACTER SET utf8)
> 
> Thanks, it works ! For the record, the character encoding of our oracle DB 
> was WE8MSWIN1252, and to convert I just had to use:
> 
> SELECT CONVERT(col_name,'UTF8','WE8MSWIN1252') from ...
> 
> in the query. 


[julia-users] trouble building julia on mac

2014-08-13 Thread Adam Kapor
 

I just tried building the latest master on my mac; I get the following 
error.  Any ideas on what to do -- I'm pretty new to this.  Googling tells 
me that this is an issue with clang in Xcode 5.1 but what can I do to fix 
this?

Thanks,

Adam


adams-air:julia adamkapor$ make

Making install in support

Making install in kernel

libtool: compile:  clang -stdlib=libc++ -mmacosx-version-min=10.7 
-DHAVE_CONFIG_H -I. -I.. -I../simd -O3 -fomit-frame-pointer -mtune=native 
-malign-double -fstrict-aliasing -fno-schedule-insns -ffast-math -MT 
align.lo -MD -MP -MF .deps/align.Tpo -c align.c  -fno-common -DPIC -o 
.libs/align.o

clang: error: unknown argument: '-malign-double' 
[-Wunused-command-line-argument-hard-error-in-future]

clang: note: this will be a hard error (cannot be downgraded to a warning) 
in the future

make[5]: *** [align.lo] Error 1

make[4]: *** [install-recursive] Error 1

make[3]: *** [/Applications/julia/usr/lib/libfftw3f.dylib] Error 2

make[2]: *** [install-fftw] Error 2

make[1]: *** [julia-release] Error 2

make: *** [release] Error 2


Re: [julia-users] Read a certain number of lines in readdlm ?

2014-08-13 Thread Jameson Nash
Since `string` prints it's arguments, it was missing a ... to work as
intended:
string([readline(f) for i in 1:nlines]...)

Since you wanted an IOBuffer anyways, I would use the following approach,
which avoids lots of garbage creation over repeatedly calling `string` (aka
`*`):
function readnlines(f,n) lines = IOBuffer() for i = 1:n write(lines,
readline(f)) end return lines # or takebuf_string(lines) if you didn't want
an IOBuffer end



On Wed, Aug 13, 2014 at 7:08 AM, Jarvist Moore Frost 
wrote:

> Thank you both!
> However, the forming a string with string([readline(STDIN) for i in 1:2])
> leads to a type of
> "Union(ASCIIString,Array{Char,1},UTF8String)[\"1\\n\",\"2\\n\"]" the
> escaped white space formatting then follows through into the eventual
> readdlm object (i.e. fields aren’t properly interpreted).
>
> So the working code I have is much more nasty, temporary objects and all
> kinds of cludge:
>
> function readnlines(f,n)
> local lines=""
> local i=1
> for i=1:n
> lines=lines*readline(f)
> end
> return (lines)
> end
>
> readmatrix(f, nlines) = readdlm(IOBuffer(readnlines(f,nlines)))
>
> I think expanding a macro @readnlines(f,nlines) → (readline(f))^nlines)
> might be more elegant, but I don’t know whether a massive
> string*string*...string object is efficient to evaluate.
>
> Certainly in general I think a readnlines function is useful.
> So would having line ranges in readdlm - currently it supports a
> ‘skipstart’ option (not documented?) - making this a full line-range object
> would be nice.
>
>
> https://github.com/JuliaLang/julia/blob/454344fcea17021cb6ca5687d0a9f41daedd7e9e/base/datafmt.jl#L252
>
> - readdlm in the Julia source
>
> I also found this discussion from last-year on julia-dev, after trying for
> a while to use the multidimensional / tuple format form of readdlm, I read
> the source & decided that they were probably talking about prospective
> changes, not realised ones! (-:
>
> https://groups.google.com/d/msg/julia-dev/PpSy2NQmkG0/cl67UWJec4QJ
>
> On Tuesday, 12 August 2014 19:33:01 UTC+1, Jameson wrote:
>
> As a slight optimization, you could note that string works by creating an
>> IOBuffer and printing the arguments into it, and then converting the result
>> to a string. Thus, you could skip the extra conversion to a string and back
>> by making the IOBuffer directly.
>>
>>
>> On Tuesday, August 12, 2014, Iain Dunning  wrote:
>>
>>> No need for macros!
>>> Its an interesting feature request, maybe open a Github issue so people
>>> can discuss it.
>>>
>>> I think your solution is not terrible, you could generalize it to
>>>
>>> readcell(f, nlines) = readdlm(IOBuffer(string([readline(f) for i in
>>> 1:nlines])))
>>>
>>> Then do something like
>>>
>>> f = open("mydata","r")
>>> cells = {}
>>> while !eof(f)
>>>   push!(cells, readcell(f, 3))
>>> end
>>> close(f)
>>>
>>>
>>>
>>> On Tuesday, August 12, 2014 10:40:24 AM UTC-4, Jarvist Moore Frost wrote:

 I’m writing a Julia parser to read in a large output from a Fortran
 program which is essentially a load of concatenated matrices of differing
 dimensions. It would be really useful to be able to do something along the
 lines of readdlm(file,nlines=3) to pull in i.e. the 3x3 matrix you
 know that follows.

 Currently I’m resorting to things like:

 celltext=string(readline(f),readline(f),readline(f))
 cell=readdlm(IOBuffer(celltext))

 And this really doesn’t feel like a very elegant method (not helped as
 neither readline nor readlines appear to accept ‘number of lines’ as an
 argument).

 Am I missing the Julia way to do things here? Or should I start writing
 @macros to expand to this level of nitty gritty?
 ​

>>>  ​
>


Re: [julia-users] Package Popularity Ranking

2014-08-13 Thread John Myles White
You can also use GitHub stars. I'd be really interested to know how those two 
measures correlate.

 -- John

On Aug 13, 2014, at 7:51 AM, Jacob Quinn  wrote:

> GitHub just started posting `git clone` data for individual repos, so this is 
> definitely a possibility now. I wouldn't be surprised if Iain's Package 
> Evaluator started hooking into this data and using it to sort the package 
> list.
> 
> -Jacob
> 
> 
> On Wed, Aug 13, 2014 at 9:03 AM, Michael Smith  wrote:
> Is there some sort of way to rank the popularity of Julia packages?
> Haven't found anything like that (and apologies if I have missed anything).
> 
> The reason I'm asking is that, although I am aware that relying purely
> on rankings has several disadvantages, I still do believe that there are
> some strong advantages in having a rough idea about what the really
> important (or widely-used) packages are.
> 
> This is particularly important considering the fact that the number of
> Julia packages is increasing, and for newbies it will be difficult to
> find their way around.
> 
> Thanks,
> 
> M
> 



Re: [julia-users] Package Popularity Ranking

2014-08-13 Thread Jacob Quinn
GitHub just started posting `git clone` data for individual repos, so this
is definitely a possibility now. I wouldn't be surprised if Iain's Package
Evaluator  started hooking
into this data and using it to sort the package list
.

-Jacob


On Wed, Aug 13, 2014 at 9:03 AM, Michael Smith  wrote:

> Is there some sort of way to rank the popularity of Julia packages?
> Haven't found anything like that (and apologies if I have missed anything).
>
> The reason I'm asking is that, although I am aware that relying purely
> on rankings has several disadvantages, I still do believe that there are
> some strong advantages in having a rough idea about what the really
> important (or widely-used) packages are.
>
> This is particularly important considering the fact that the number of
> Julia packages is increasing, and for newbies it will be difficult to
> find their way around.
>
> Thanks,
>
> M
>


[julia-users] Running example code in packages

2014-08-13 Thread Júlio Hoffimann
Hi all,

I've just adapted my code to respect Julia package management standards:
https://github.com/juliohm/ImageQuilting.jl

The package is working well, but I would like to give the user the
possibility of running example code as explained in the README.md. What is
the best way of doing it?

Any other general tip you would like to share about package development?

Best,
Júlio.


Re: [julia-users] Re: character encoding

2014-08-13 Thread Milan Bouchet-Valat
Le mardi 12 août 2014 à 13:57 -0400, Stefan Karpinski a écrit :
> You'd have to implement that string encoding, unfortunately. If it's
> Latin-1, it would be much easier and we could probably just resurrect
> an old implementation that we used to have.
Much better than implementing a custom encoding (which is pure madness
IMHO) is converting the strings to Unicode.

In addition to doing the conversion from your DBMS, you should be able
to do that from within Julia using UnicodeExtras, by accessing the
underlying array of the string:
decode(s.data, "cp1252")


Regards



[julia-users] Re: character encoding

2014-08-13 Thread Frederico Novaes


On Tuesday, August 12, 2014 11:20:58 PM UTC-3, Keith Campbell wrote:
>
> This might be easier to do on  the server side.
> Many DBMS, including MySQL and PostGreSQL, support encoding conversions.  
>
> eg convert('my_string', 'UTF8', 'ISO_8859_2')
>   SELECT CAST(_latin1'test' AS CHAR CHARACTER SET utf8)
>
>
Thanks, it works ! For the record, the character encoding of our oracle DB 
was WE8MSWIN1252, and to convert I just had to use:

SELECT CONVERT(col_name,'UTF8','WE8MSWIN1252') from ...

in the query. 


[julia-users] Re: Classification with Julia

2014-08-13 Thread Keith Campbell
svaksha's curated listing is a good resource for this type of question--

https://github.com/svaksha/Julia.jl/blob/master/AI.md

On Wednesday, August 13, 2014 8:20:51 AM UTC-4, Anuj Prakash wrote:
>
> Hey
>
> I wanted to know about some good Julia packages for binary classification. 
> Feel free to include those dealing with trees also.
>
> Cheers,
>
> Anuj
>


[julia-users] Re: Clipping Algorithm

2014-08-13 Thread Viti VT
Hello Andreas, 
I also really need this function in Julia, and ..
I wonder if you could send me yours .. :)

Thank you,
Viti.  


On Saturday, May 10, 2014 3:57:16 PM UTC+3, Andreas Lobinger wrote:
>
> Hello colleague,
>
> On Friday, May 9, 2014 11:13:06 PM UTC+2, Steve Kelly wrote:
>>
>> I am going to be developing some software for 3D printing. For path 
>> planning, we will need to use the clipping algorithm. 
>>
>> Graphics.jl mentions a clip function. 
>> https://github.com/JuliaLang/julia/blob/master/base/graphics.jl
>> Cairo.jl uses the C implementation in Cairo.
>>
>> i'm not so sure if the call to cairo's clip - which is just a hint to the 
> internal polygon/tesselation units where to put paint and where not - is 
> the thing you need (especially as cairo is 2D only). So you probably need 
> to implement a 3D clipping anyway
>  
>
>> I would like to implement this algorithm natively in Julia. My question 
>> to the community is whether it be more appropriate to create a new package 
>> or optionally add the algorithm to Graphics.jl (or another package)?
>>
>
> I think Julia woud benefit of something like a computational geometry pkg 
> that deal with the basic problems of point/line/polygon/meshes and 
> inside/outside testing, clipping, intersection. 
>
> When i started looking at julia i was missing a inpolygon (matlab basic 
> command) counterpart. It wasn't there, i implemented a local julia 
> solution, but never found a place to contribute. 
>
> Wishing a happy day,
> Andreas
>


Re: [julia-users] GUI in Julia

2014-08-13 Thread Sean Garborg
That package list in the docs is a bit old (deprecated but not yet 
removed). To catch newer packages, try pkg.julialang.org.

On Tuesday, August 12, 2014 8:42:08 PM UTC-4, Pontus Stenetorp wrote:
>
> On 13 August 2014 09:24,  > wrote: 
> > 
> > Are there any GUI packages for julia available yet or is it too early to 
> > ask? 
>
> If you head over to the available packages list [1], there are 
> several.  While I have not experimented with them myself, Gtk.jl [2] 
> and Tk.jl [3] seems to be the most mature ones. 
>
> Pontus 
>
> [1]: http://julia.readthedocs.org/en/latest/packages/packagelist/ 
> [2]: https://github.com/JuliaLang/Gtk.jl 
> [3]: https://github.com/JuliaLang/Tk.jl 
>


[julia-users] Package Popularity Ranking

2014-08-13 Thread Michael Smith
Is there some sort of way to rank the popularity of Julia packages?
Haven't found anything like that (and apologies if I have missed anything).

The reason I'm asking is that, although I am aware that relying purely
on rankings has several disadvantages, I still do believe that there are
some strong advantages in having a rough idea about what the really
important (or widely-used) packages are.

This is particularly important considering the fact that the number of
Julia packages is increasing, and for newbies it will be difficult to
find their way around.

Thanks,

M


[julia-users] Classification with Julia

2014-08-13 Thread Anuj Prakash
Hey

I wanted to know about some good Julia packages for binary classification. 
Feel free to include those dealing with trees also.

Cheers,

Anuj


Re: [julia-users] About conversion of a 5-decimal-digit float to string

2014-08-13 Thread Andreas Noack
One solution is to use the @sprintf macro, i.e. something like
 @sprintf("cons_%f, 0.1).

Med venlig hilsen

Andreas Noack


2014-08-13 7:42 GMT-04:00 Charles Novaes de Santana <
charles.sant...@gmail.com>:

> Dear all,
>
> I would like to convert a float variable with more than 5 decimal digits
> to a string, but in the literal notation, not in the "logarithmic" one.
>
> For example, if I do:
>
> floatvar = 0.1;
> charvar = string("cost_",floatvar);
> println(charvar);
>
> charvar is written as: "cost_1.0e-5". Instead of that, I would like to get
> "cost_0.1".
>
> Any idea about how to do that? I am sorry for this very basic question,
> but so far I couldn't realize by myself neither find in the forums a way to
> do that.
>
> Thank you for your attention and for any help!
>
> Best,
>
> Charles
>
>
> --
> Um axé! :)
>
> --
> Charles Novaes de Santana, PhD
> http://www.imedea.uib-csic.es/~charles
>


[julia-users] About conversion of a 5-decimal-digit float to string

2014-08-13 Thread Charles Novaes de Santana
Dear all,

I would like to convert a float variable with more than 5 decimal digits to
a string, but in the literal notation, not in the "logarithmic" one.

For example, if I do:

floatvar = 0.1;
charvar = string("cost_",floatvar);
println(charvar);

charvar is written as: "cost_1.0e-5". Instead of that, I would like to get
"cost_0.1".

Any idea about how to do that? I am sorry for this very basic question, but
so far I couldn't realize by myself neither find in the forums a way to do
that.

Thank you for your attention and for any help!

Best,

Charles


-- 
Um axé! :)

--
Charles Novaes de Santana, PhD
http://www.imedea.uib-csic.es/~charles


Re: [julia-users] What's wrong? A simple condition is not working. [L. == 1] ERROR: BoundsError() in getindex_bool_1d at array.jl:285

2014-08-13 Thread Andreas Noack
This one is a bit tricky. The reason is that L is a Matrix and F[:,1] is a
vector. Try F[:,1][vec(L.==0)]

Med venlig hilsen

Andreas Noack


2014-08-13 7:06 GMT-04:00 paul analyst :

> F is dense
> julia> size(F)
> (6237437,284)
>
> julia> size(L)
> (6237437,1)
>
> julia> F[:,1][L.==0]
> ERROR: BoundsError()
>  in getindex_bool_1d at array.jl:285
>
> julia> L
> 6237437x1 sparse matrix with 20869 Int16 entries:
> [66 ,   1]  =  1
> [104,   1]  =  0
>
> Paul
>
>


Re: [julia-users] Read a certain number of lines in readdlm ?

2014-08-13 Thread Jarvist Moore Frost


Thank you both!
However, the forming a string with string([readline(STDIN) for i in 1:2]) 
leads to a type of 
"Union(ASCIIString,Array{Char,1},UTF8String)[\"1\\n\",\"2\\n\"]" the 
escaped white space formatting then follows through into the eventual 
readdlm object (i.e. fields aren’t properly interpreted).

So the working code I have is much more nasty, temporary objects and all 
kinds of cludge:

function readnlines(f,n)
local lines=""
local i=1
for i=1:n
lines=lines*readline(f)
end
return (lines)
end

readmatrix(f, nlines) = readdlm(IOBuffer(readnlines(f,nlines)))

I think expanding a macro @readnlines(f,nlines) → (readline(f))^nlines) 
might be more elegant, but I don’t know whether a massive 
string*string*...string object is efficient to evaluate.

Certainly in general I think a readnlines function is useful.
So would having line ranges in readdlm - currently it supports a 
‘skipstart’ option (not documented?) - making this a full line-range object 
would be nice.

https://github.com/JuliaLang/julia/blob/454344fcea17021cb6ca5687d0a9f41daedd7e9e/base/datafmt.jl#L252

- readdlm in the Julia source

I also found this discussion from last-year on julia-dev, after trying for 
a while to use the multidimensional / tuple format form of readdlm, I read 
the source & decided that they were probably talking about prospective 
changes, not realised ones! (-:

https://groups.google.com/d/msg/julia-dev/PpSy2NQmkG0/cl67UWJec4QJ

On Tuesday, 12 August 2014 19:33:01 UTC+1, Jameson wrote:

As a slight optimization, you could note that string works by creating an 
> IOBuffer and printing the arguments into it, and then converting the result 
> to a string. Thus, you could skip the extra conversion to a string and back 
> by making the IOBuffer directly. 
>
>
> On Tuesday, August 12, 2014, Iain Dunning  > wrote:
>
>> No need for macros!
>> Its an interesting feature request, maybe open a Github issue so people 
>> can discuss it.
>>
>> I think your solution is not terrible, you could generalize it to
>>
>> readcell(f, nlines) = readdlm(IOBuffer(string([readline(f) for i in 
>> 1:nlines])))
>>
>> Then do something like
>>
>> f = open("mydata","r")
>> cells = {}
>> while !eof(f)
>>   push!(cells, readcell(f, 3))
>> end
>> close(f)
>>
>>
>>
>> On Tuesday, August 12, 2014 10:40:24 AM UTC-4, Jarvist Moore Frost wrote:
>>>
>>> I’m writing a Julia parser to read in a large output from a Fortran 
>>> program which is essentially a load of concatenated matrices of differing 
>>> dimensions. It would be really useful to be able to do something along the 
>>> lines of readdlm(file,nlines=3) to pull in i.e. the 3x3 matrix you know 
>>> that follows.
>>>
>>> Currently I’m resorting to things like:
>>>
>>> celltext=string(readline(f),readline(f),readline(f))
>>> cell=readdlm(IOBuffer(celltext))
>>>
>>> And this really doesn’t feel like a very elegant method (not helped as 
>>> neither readline nor readlines appear to accept ‘number of lines’ as an 
>>> argument).
>>>
>>> Am I missing the Julia way to do things here? Or should I start writing 
>>> @macros to expand to this level of nitty gritty?
>>> ​
>>>
>>  ​


[julia-users] What's wrong? A simple condition is not working. [L. == 1] ERROR: BoundsError() in getindex_bool_1d at array.jl:285

2014-08-13 Thread paul analyst
F is dense 
julia> size(F)
(6237437,284)

julia> size(L)
(6237437,1)

julia> F[:,1][L.==0]
ERROR: BoundsError()
 in getindex_bool_1d at array.jl:285

julia> L
6237437x1 sparse matrix with 20869 Int16 entries:
[66 ,   1]  =  1
[104,   1]  =  0

Paul



Re: [julia-users] function perlRegexReplace

2014-08-13 Thread Kevin Squire
I implemented something related to this a long time ago (
https://github.com/JuliaLang/julia/pull/1448).  At the time, Stefan agreed
that something like it was needed, but didn't like my implementation.
 Still hasn't happened (other things have had greater priority), but I
think it would be worthwhile.

Kevin


On Wed, Aug 13, 2014 at 12:07 AM, Jameson Nash  wrote:

> right, in other words, it implements backreference substitutions
>
>
> On Wed, Aug 13, 2014 at 3:01 AM, Steven Siew 
> wrote:
>
>> replace(*string*, *pat*, *r*[, *n*])
>>
>> Search for the given pattern pat, and replace each occurrence with r. If
>> n is provided, replace at most n occurrences. As with search, the second
>> argument may be a single character, a vector or a set of characters, a
>> string, or a regular expression. If r is a function, each occurrence is
>> replaced with r(s) where s is the matched substring.
>>
>>
>>_
>>_   _ _(_)_ |  A fresh approach to technical computing
>>   (_) | (_) (_)|  Documentation: http://docs.julialang.org
>>_ _   _| |_  __ _   |  Type "help()" to list help topics
>>   | | | | | | |/ _` |  |
>>   | | |_| | | | (_| |  |  Version 0.2.0 (2013-11-16 23:44 UTC)
>>  _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org release
>> |__/   |  i686-w64-mingw32
>>
>> julia> originalstring="Mary had a little lamb, her skin is as white as
>> snow"
>>
>> "Mary had a little lamb, her skin is as white as snow"
>>
>> julia> replace(originalstring,r"\b([\w]*e) ([\w]*)","not \1 black \2")
>> "Mary had a not \x01 black \x02, her skin is as not \x01 black \x02 snow"
>>
>>
>>
>>
>> On Wednesday, August 13, 2014 4:05:23 PM UTC+10, John Myles White wrote:
>>
>>> Suspect I'm missing something. How is this different from the existing
>>> function replace?
>>>
>>>  -- John
>>>
>>> On Aug 12, 2014, at 11:03 PM, Steven Siew  wrote:
>>>
>>> > Using regex like in the programming language Perl to perform
>>> replacements.
>>> >
>>> >
>>> > function perlRegexReplace(str::ASCIIString,regex::Regex,rep::ASCIIString)
>>>
>>> >   local m,len,result,inter
>>> >   m = match(regex,str)
>>> >   len=length(m.captures)
>>> >   result = replace(str,regex,rep)
>>> >   if len > 0
>>> > inter = eachmatch(regex,str)
>>> > for (m in inter)
>>> >   for k = 1:len
>>> > # Comment out the next line when using function for production
>>> > println("Replacing \\",k," with ",m.captures[k])
>>> > result = replace(result,char(k),m.captures[k],1)
>>> >   end
>>> > end
>>> >   end
>>> >   result
>>> > end
>>> >
>>> > originalstring="Mary had a little lamb, her skin is as white as snow"
>>> >
>>> > resultstring = perlRegexReplace(originalstring,r"\b([\w]*e)
>>> ([\w]*)","not \1 black \2")
>>> >
>>> > println("ORIGINAL: ",originalstring)
>>> > println("RESULTST: ",resultstring)
>>> >
>>> >
>>> > ==
>>> >
>>> >
>>> > C:\oracle\julia\scripts> ..\julia.bat perlRegexReplace3.jl
>>> > Replacing \1 with little
>>> > Replacing \2 with lamb
>>> > Replacing \1 with white
>>> > Replacing \2 with as
>>> > ORIGINAL: Mary had a little lamb, her skin is as white as snow
>>> > RESULTST: Mary had a not little black lamb, her skin is as not white
>>> black as snow
>>>
>>>
>


Re: [julia-users] function perlRegexReplace

2014-08-13 Thread Jameson Nash
right, in other words, it implements backreference substitutions


On Wed, Aug 13, 2014 at 3:01 AM, Steven Siew  wrote:

> replace(*string*, *pat*, *r*[, *n*])
>
> Search for the given pattern pat, and replace each occurrence with r. If n
> is provided, replace at most n occurrences. As with search, the second
> argument may be a single character, a vector or a set of characters, a
> string, or a regular expression. If r is a function, each occurrence is
> replaced with r(s) where s is the matched substring.
>
>
>_
>_   _ _(_)_ |  A fresh approach to technical computing
>   (_) | (_) (_)|  Documentation: http://docs.julialang.org
>_ _   _| |_  __ _   |  Type "help()" to list help topics
>   | | | | | | |/ _` |  |
>   | | |_| | | | (_| |  |  Version 0.2.0 (2013-11-16 23:44 UTC)
>  _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org release
> |__/   |  i686-w64-mingw32
>
> julia> originalstring="Mary had a little lamb, her skin is as white as
> snow"
>
> "Mary had a little lamb, her skin is as white as snow"
>
> julia> replace(originalstring,r"\b([\w]*e) ([\w]*)","not \1 black \2")
> "Mary had a not \x01 black \x02, her skin is as not \x01 black \x02 snow"
>
>
>
>
> On Wednesday, August 13, 2014 4:05:23 PM UTC+10, John Myles White wrote:
>
>> Suspect I'm missing something. How is this different from the existing
>> function replace?
>>
>>  -- John
>>
>> On Aug 12, 2014, at 11:03 PM, Steven Siew  wrote:
>>
>> > Using regex like in the programming language Perl to perform
>> replacements.
>> >
>> >
>> > function perlRegexReplace(str::ASCIIString,regex::Regex,rep::ASCIIString)
>>
>> >   local m,len,result,inter
>> >   m = match(regex,str)
>> >   len=length(m.captures)
>> >   result = replace(str,regex,rep)
>> >   if len > 0
>> > inter = eachmatch(regex,str)
>> > for (m in inter)
>> >   for k = 1:len
>> > # Comment out the next line when using function for production
>> > println("Replacing \\",k," with ",m.captures[k])
>> > result = replace(result,char(k),m.captures[k],1)
>> >   end
>> > end
>> >   end
>> >   result
>> > end
>> >
>> > originalstring="Mary had a little lamb, her skin is as white as snow"
>> >
>> > resultstring = perlRegexReplace(originalstring,r"\b([\w]*e)
>> ([\w]*)","not \1 black \2")
>> >
>> > println("ORIGINAL: ",originalstring)
>> > println("RESULTST: ",resultstring)
>> >
>> >
>> > ==
>> >
>> >
>> > C:\oracle\julia\scripts> ..\julia.bat perlRegexReplace3.jl
>> > Replacing \1 with little
>> > Replacing \2 with lamb
>> > Replacing \1 with white
>> > Replacing \2 with as
>> > ORIGINAL: Mary had a little lamb, her skin is as white as snow
>> > RESULTST: Mary had a not little black lamb, her skin is as not white
>> black as snow
>>
>>


Re: [julia-users] function perlRegexReplace

2014-08-13 Thread Steven Siew
 replace(*string*, *pat*, *r*[, *n*])

Search for the given pattern pat, and replace each occurrence with r. If n 
is provided, replace at most n occurrences. As with search, the second 
argument may be a single character, a vector or a set of characters, a 
string, or a regular expression. If r is a function, each occurrence is 
replaced with r(s) where s is the matched substring.


   _
   _   _ _(_)_ |  A fresh approach to technical computing
  (_) | (_) (_)|  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" to list help topics
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.2.0 (2013-11-16 23:44 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org release
|__/   |  i686-w64-mingw32

julia> originalstring="Mary had a little lamb, her skin is as white as snow"
"Mary had a little lamb, her skin is as white as snow"

julia> replace(originalstring,r"\b([\w]*e) ([\w]*)","not \1 black \2")
"Mary had a not \x01 black \x02, her skin is as not \x01 black \x02 snow"



On Wednesday, August 13, 2014 4:05:23 PM UTC+10, John Myles White wrote:
>
> Suspect I'm missing something. How is this different from the existing 
> function replace? 
>
>  -- John 
>
> On Aug 12, 2014, at 11:03 PM, Steven Siew  > wrote: 
>
> > Using regex like in the programming language Perl to perform 
> replacements. 
> > 
> > 
> > function 
> perlRegexReplace(str::ASCIIString,regex::Regex,rep::ASCIIString) 
> >   local m,len,result,inter 
> >   m = match(regex,str) 
> >   len=length(m.captures) 
> >   result = replace(str,regex,rep) 
> >   if len > 0 
> > inter = eachmatch(regex,str) 
> > for (m in inter) 
> >   for k = 1:len 
> > # Comment out the next line when using function for production 
> > println("Replacing \\",k," with ",m.captures[k]) 
> > result = replace(result,char(k),m.captures[k],1) 
> >   end 
> > end 
> >   end 
> >   result 
> > end 
> > 
> > originalstring="Mary had a little lamb, her skin is as white as snow" 
> > 
> > resultstring = perlRegexReplace(originalstring,r"\b([\w]*e) 
> ([\w]*)","not \1 black \2") 
> > 
> > println("ORIGINAL: ",originalstring) 
> > println("RESULTST: ",resultstring) 
> > 
> > 
> > == 
> > 
> > 
> > C:\oracle\julia\scripts> ..\julia.bat perlRegexReplace3.jl 
> > Replacing \1 with little 
> > Replacing \2 with lamb 
> > Replacing \1 with white 
> > Replacing \2 with as 
> > ORIGINAL: Mary had a little lamb, her skin is as white as snow 
> > RESULTST: Mary had a not little black lamb, her skin is as not white 
> black as snow 
>
>