Re: [julia-users] Re: pycall to use sklearn

2014-09-26 Thread Cedric St-Jean
I use it without pycall on Julia 0.3: @pyimport sklearn.linear_model as lm XX = reshape([1:10],(10,1)) lm.LinearRegression()[:fit](XX, linspace(0,200,10))[:predict]([3]) Cédric On Friday, September 26, 2014 12:07:02 AM UTC-4, Arshak Navruzyan wrote: Didn't seem to work either PyError

[julia-users] Re: Learning to Type?

2014-10-22 Thread Cedric St-Jean
Somewhat OT: since the JIT compiles a different function for each argument type combination, couldn't it compile a different type object for every field type combination? On Wednesday, October 22, 2014 10:53:26 AM UTC-4, Iain Dunning wrote: Do you feel like you are over-typing things? In

Re: [julia-users] Naive question about data frames -- What are they used for?

2014-10-25 Thread Cedric St-Jean
Yeah, whenever you have a matrix of data and each column represents something different, then using a DataFrame is very convenient (and that's really all there is to it - convenience). For instance, given student exam data I might express Compute the average grade for each socioeconomic group,

[julia-users] Re: Question about modules and overloaded functions

2015-05-24 Thread Cedric St-Jean
I'm not a big Julia user yet, but if it's anything like Common Lisp (and I think it is), then your problem is not with overloading - it's with symbols. A::f and B::f are two different symbols. To solve that, you want to have a module C that exports f (without necessarily defining anything

Re: [julia-users] Assistance with understanding typing

2015-08-12 Thread Cedric St-Jean
cannot be constructed What kind of object is a Vector{Tuple{AbstractString,AbstractString}}()? Does it have memory allocated to it? What is that construction good for? Cédric On Wed, Aug 12, 2015 at 12:09 AM, Cedric St-Jean cedric...@gmail.com javascript: wrote: Is it correct to say

Re: [julia-users] Performance between R, Julia and Cpp

2015-08-22 Thread Cedric St-Jean
Also, Julia compiles code on the fly, so you should put it in a function, then call it once before timing it to let it warm up. You can also profile the code and use ProfileView.jl to view where the bottleneck is. There are many tricks to making things faster. On Saturday, August 22, 2015 at

[julia-users] Non-destructive assignment operator

2015-08-02 Thread Cedric St-Jean
In my (generally functional) code, I frequently find myself asking for An object like X but with Y different, eg. that image but with the background set to transparent or that dataframe but with all inactive customers' profit set to 0. The usual idiom is: img2 = copy(img) img2[img2.==black] =

Re: [julia-users] Non-destructive assignment operator

2015-08-02 Thread Cedric St-Jean
immutable Foo x y end On Sunday, August 2, 2015, Cedric St-Jean cedric...@gmail.com javascript: wrote: In my (generally functional) code, I frequently find myself asking for An object like X but with Y different, eg. that image but with the background set to transparent

Re: [julia-users] $(esc(args)...)

2015-08-03 Thread Cedric St-Jean
Thank you for helping out again. It does work for $(map(esc, body)...), so it's probably a bug. I'll file an issue if no one comes up with something better. On Monday, August 3, 2015 at 11:03:47 PM UTC-4, Yichao Yu wrote: On Mon, Aug 3, 2015 at 10:47 PM, Cedric St-Jean cedric...@gmail.com

[julia-users] $(esc(args)...)

2015-08-03 Thread Cedric St-Jean
I'm trying to write a macro that takes up a function definition and outputs another one. It starts like: macro mac(fdef) @capture(fdef, begin function fname_ (args__) body__ end end) :(function $(esc(fname)) ($(args...)) ... end) end Macrotools are very convenient for getting the

Re: [julia-users] $(esc(args)...)

2015-08-04 Thread Cedric St-Jean
For whoever stumbles upon this issue: I solved it by escaping the whole expression esc(:(function ...)) and manually gensym'ing in whatever I needed. Cédric On Monday, August 3, 2015 at 11:11:21 PM UTC-4, Cedric St-Jean wrote: Thank you for helping out again. It does work for $(map(esc

Re: [julia-users] Determine current function name

2015-08-05 Thread Cedric St-Jean
I also wish that the name was visible... I wrote the macro a few days ago: macro expose_name(fdef) @capture(fdef, begin function fname_ (args__) body__ end end) esc(:(function $(fname) ($(args...)) let function_name = $(Expr(:quote, fname)) $(body...) end)) end

Re: [julia-users] Determine current function name

2015-08-05 Thread Cedric St-Jean
that exposes this in a first-class way? Both PHP and JavaScript seem to make this information available, but R does not (except for a callstack hack). On Wed, Aug 5, 2015 at 2:10 PM, Cedric St-Jean cedric...@gmail.com javascript: wrote: I also wish that the name was visible... I wrote the macro

Re: [julia-users] Determine current function name

2015-08-05 Thread Cedric St-Jean
Yichao Yu: How would you retrieve the counter's value? How would you distinguish between the counter in function foo vs. the one in function bar? On Wednesday, August 5, 2015 at 3:56:12 PM UTC-4, Yichao Yu wrote: On Wed, Aug 5, 2015 at 2:42 PM, Cedric St-Jean cedric...@gmail.com javascript

Re: [julia-users] Assistance with understanding typing

2015-08-11 Thread Cedric St-Jean
Is it correct to say that: baz(a::Vector{Tuple{AbstractString, AbstractString}}) = 3 is uncallable, since we can't instantiate an AbstractString? Maybe it should trigger an error/warning on definition. Cédric On Tuesday, August 11, 2015 at 4:18:38 PM UTC-4, Stefan Karpinski wrote: Same

Re: [julia-users] Assistance with understanding typing

2015-08-12 Thread Cedric St-Jean
Oh, of course, that makes sense! Thank you. On Wednesday, August 12, 2015 at 11:36:24 AM UTC-4, Mauro wrote: On Wed, 2015-08-12 at 17:28, Cedric St-Jean cedric...@gmail.com javascript: wrote: On Wednesday, August 12, 2015 at 12:15:19 AM UTC-4, Stefan Karpinski wrote: You can't

Re: [julia-users] Determine current function name

2015-08-06 Thread Cedric St-Jean
gensyms were oddly comforting. Cédric --Tim On Wednesday, August 05, 2015 06:47:31 PM Cedric St-Jean wrote: Yichao Yu: How would you retrieve the counter's value? How would you distinguish between the counter in function foo vs. the one in function bar? On Wednesday, August 5

[julia-users] Re: new way to search julia packages on duckduckgo.com

2015-08-06 Thread Cedric St-Jean
Hi Chaitanya, Looks neat. I use duckduckgo as my primary engine, but for any julia query, I always !g it because duckduckgo's results are very far below what Google returns. Eg. https://duckduckgo.com/?q=julia+imagesia=images Adding lang doesn't improve it (I get the package, but the results

[julia-users] :(a.b)

2015-07-26 Thread Cedric St-Jean
Why is . non-symmetric in a and b? :(a.b).args 2-element Array{Any,1}: :a :(:b) The second argument is a quotenode, how am I supposed to get to the :b inside it? eval works, but in the Lisp world, that was bad style. I've got a macro that works on this expression, and instead of

Re: [julia-users] Slicing DataFrames resets indexes

2015-08-24 Thread Cedric St-Jean
There was some discussion https://github.com/JuliaStats/DataFrames.jl/issues/187 about indexes on Github, but it didn't really get anywhere. I'm also not comfortable with that decision to not have indexes. It makes the dataframes asymmetric, whereas Pandas' and R's are matrices with named

[julia-users] Writing function documentation in 0.4

2015-10-24 Thread Cedric St-Jean
A lot of my documentation looks like this: """ Draws a rectangle of size `(width, height)` and color `color`""" function draw_rectangle(width::Int, height::Int; color="black") ... end The interactive help ?draw_rectangle shows: search: Draws a rectangle of size (width, height) and color color

[julia-users] Re: Writing function documentation in 0.4

2015-10-25 Thread Cedric St-Jean
, y) > > ... > > f(x) > > ... > > Function List > ≡≡≡ > > # 3 methods for generic function "f": > f(x) at /home/mike/M.jl:8 > f(x, y) at /home/mike/M.jl:15 > f(x, y, z) at /home/mike/M.jl:17 > > When searching for

[julia-users] Module reloading/Autoreloading workflow in 0.4

2015-10-21 Thread Cedric St-Jean
I'm struggling to get a good workflow going in 0.4. The docs tell me what I can do, but not so much what I should. How does everybody work? What does your "startup code" look like? In particular: 1. Should I `push!(LOAD_PATH, ".")`, or

Re: [julia-users] Re: Avoid type Unions in fields?

2015-10-28 Thread Cedric St-Jean
On Wednesday, October 28, 2015 at 8:10:41 AM UTC-4, Stefan Karpinski wrote: > > The key behavioral difference between these two is that with the > non-parametric union version you can change both the value and the type of > the field of a MyType object after construction, whereas in the

[julia-users] Re: Module reloading/Autoreloading workflow in 0.4

2015-10-21 Thread Cedric St-Jean
his forum). Its workflow is described in > https://github.com/JunoLab/atom-julia-client/blob/master/docs/workflow.md > . > > That said, please file an issue on > https://github.com/malmaud/Autoreload.jl to prod me to get it functional > again. > > On Wednesday, October 2

[julia-users] Re: good textbook for Julia software engineering?

2015-10-22 Thread Cedric St-Jean
On Thursday, October 22, 2015 at 11:33:39 AM UTC-4, Sisyphuss wrote: > > I have some idea in the previous post. But it seems that they are just > ignored... > Not to derail this thread, but FWIW, I liked your OOP equivalences, and it made me consider writing shorter, focused modules. > > >

Re: [julia-users] Workflow for making pull request for others Packages?

2015-10-21 Thread Cedric St-Jean
That's really nice, I had no idea... It's well documented , too. On Wednesday, October 21, 2015 at 7:36:00 PM UTC-4, Tim Holy wrote: > > I find this much easier: > > julia>

[julia-users] Re: How to interrupt a loop with a keyboard keystroke

2015-11-10 Thread Cedric St-Jean
This works too: try while true end catch x if isa(x, InterruptException) return array end end On Tuesday, November 10, 2015 at 8:23:47 AM UTC-5, Felipe Jiménez wrote: > > Thank you, Palli and Cedri. > > Palli's answer shows it's not as easy as I thought. Cedric's answer

Re: [julia-users] Re: Google releases TensorFlow as open source

2015-11-11 Thread Cedric St-Jean
scikit-learn uses greek letters in its implementation, which I'm fine with since domain experts work on those, but I wish that in the visible interface they had consistently used more descriptive names (eg. regularization_strength instead of alpha). On Wednesday, November 11, 2015 at 11:00:56

[julia-users] Brew: No such keg for ImageMagick

2015-11-16 Thread Cedric St-Jean
My update to OSX El Capitan brought along a bunch of brew updates which broke my ImageMagick install. I followed someone's advice to rm -rf ~/.julia/v0.4/Homebrew/deps/usr/Cellar/imagemagick but maybe that was bad advice :) Now I can't build it at all: > Pkg.build("ImageMagick") INFO:

[julia-users] Re: Brew: No such keg for ImageMagick

2015-11-16 Thread Cedric St-Jean
Solved it cd ~/.julia/v0.4/Homebrew/deps/usr/bin ./brew install imagemagick This brought the keg back, then I could Pkg.build("ImageMagick") On Monday, November 16, 2015 at 3:22:18 PM UTC-5, Cedric St-Jean wrote: > > My update to OSX El Capitan brought along a bunch of br

[julia-users] Re: How to interrupt a loop with a keyboard keystroke

2015-11-10 Thread Cedric St-Jean
Couldn't you periodically (every N iterations) save the array to disk? Or even better, put it in a global variable? On Tuesday, November 10, 2015 at 5:07:17 AM UTC-5, Felipe Jiménez wrote: > > I have a long loop going. It solves a solitaire board-game by brute force > search, and depending on

Re: [julia-users] Re: The growth of Julia userbase

2015-11-09 Thread Cedric St-Jean
https://groups.google.com/forum/#!aboutgroup/julia-users has one year of data. On Monday, November 9, 2015 at 6:10:41 PM UTC-5, Ken B wrote: > > Here's a nice comparison of languages used in github repo's and Julia is > #43 out of 50: > http://githut.info/ > > On Thursday, 5 November 2015

[julia-users] Immutable storage

2015-11-02 Thread Cedric St-Jean
immutable Bird height::Float32 end immutable Cage bird::Bird end function catch(some_bird::Bird, some_animal) new_bird = Bird(10.2) c = Cage(b) ... new_bird end catch(b,b) 1. When are immutable values boxed? Is new_bird a boxed value? What about `some_bird` and

Re: [julia-users] Re: Re: are array slices views in 0.4?

2015-11-02 Thread Cedric St-Jean
Python's from __future__ import division was a reasonable way of transitioning. I would use it for slicing if it was available already. On Monday, November 2, 2015 at 2:46:04 PM UTC-5, David Anthoff wrote: > > The `using OldArrays` approach would essentially require an opt-in from > everyone

[julia-users] Re: how to restore a variable to its default value?

2015-11-01 Thread Cedric St-Jean
Ivar's solution worked for me. pi = Base.pi On Sunday, November 1, 2015 at 12:48:23 PM UTC-5, Kuan Xu wrote: > > I have the same question harven asked - how to reset pi to its factory > value if it was overwritten? > > It seems that nobody answered his questions and I didn't any other threads

[julia-users] Re: Setting default values in Composite Type definitions

2015-11-04 Thread Cedric St-Jean
+1 for parameters.jl. It's reserved for eventually making it default behavior. https://github.com/JuliaLang/julia/issues/10146 On Wednesday, November 4, 2015 at 3:09:00 AM UTC-5, Kristoffer Carlsson wrote: > > This is also a good package for default values in types, keyword arguments > in

[julia-users] Re: Getting my Python code to work in Julia (PyCall and all that)

2015-10-31 Thread Cedric St-Jean
Have you tried just `@pycall module_name` ? If your module is in your python search-path (or the current directory), it should be found. See the examples . On Saturday,

[julia-users] Re: Anyone know how to get help with Jupyter?

2015-10-31 Thread Cedric St-Jean
Does display(5+5) display(5+6) display(5+7) work for you? I find it useful for displaying multiple plots/images. On Saturday, October 31, 2015 at 4:57:01 PM UTC-4, Daniel Carrera wrote: > > I apologize for asking a non-Julia question here, but for the life of me I > cannot figure out how to

[julia-users] Re: Clsing IJulia in a neat way

2015-11-03 Thread Cedric St-Jean
Not sure if this will help, but you can launch Jupyter with `ipython notebook` at the command line (then select Julia kernels). If you make sure to `File -> Close and Halt` your notebooks (instead of just closing the tabs), they won't take up memory (it kills the process). As far as I know,

[julia-users] Re: IJulia notebook porting from one kernel to another

2015-10-18 Thread Cedric St-Jean
use IJulia complains it can not > understand notebooks > I wrote with kernels I no longer have. > Best regards, > Ferran. > > On Sunday, October 18, 2015 at 9:06:13 PM UTC+2, Cedric St-Jean wrote: >> >> Hi Ferran, >> >> I upgraded to Jupyter notebooks be

[julia-users] Re: How to escape array of symbols in a macro?

2015-10-19 Thread Cedric St-Jean
To be clear, $(map(esc, args)...) works everywhere I've tried it _except_ in function definition argument lists. On Monday, October 19, 2015 at 11:17:49 AM UTC-4, Cedric St-Jean wrote: > > Hi Andrei, > > On Monday, October 19, 2015 at 3:45:14 AM UTC-4, Andrei Zh wrote: >

[julia-users] Re: How to escape array of symbols in a macro?

2015-10-19 Thread Cedric St-Jean
Hi Andrei, On Monday, October 19, 2015 at 3:45:14 AM UTC-4, Andrei Zh wrote: > > I'm trying to write a macro for generation of new functions given their > name and arguments, e.g. given macro call: > > @deffun foo(a, b) > > Coming from Common Lisp, I tried writing similar macros but failed to

[julia-users] Re: IJulia notebook porting from one kernel to another

2015-10-18 Thread Cedric St-Jean
Hi Ferran, I upgraded to Jupyter notebooks before doing the switch to 0.4, and I haven't had any issue, except that Shift+Tab no longer works... On Sunday, October 18, 2015 at 8:09:08 AM UTC-4, Ferran Mazzanti wrote: > > > a) Are IJulia notebooks keeping track of the kernel version they use? >

[julia-users] Semicolon behaviour

2015-10-14 Thread Cedric St-Jean
I keep running into cases where I expect the semi-colon to remove the output (return nothing), but something is returned. Am I misunderstanding the semi-colon's role as a separator, or is that a parser bug? function whatev(fun) fun() end u = whatev() do 2; end @show u > u = 2

[julia-users] Re: Julia ESS mode in Emacs

2015-10-12 Thread Cedric St-Jean
Not sure if that can help, but on OSX, I had the same issue because it's easy to end up with two separately installed Emacs programs, and ESS got installed to only one of the two. On Monday, October 12, 2015 at 10:14:21 AM UTC-4, Andrei Zh wrote: > > Just tried the same commit on my Linux Mint

[julia-users] Re: Installing 0.3.x on Ubuntu 14.04 (trusty)

2015-10-09 Thread Cedric St-Jean
http://julialang.org/downloads/oldreleases.html ? On Friday, October 9, 2015 at 9:58:12 AM UTC-4, Stephen Chisholm wrote: > > With the release of Julia 0.4 today, the juliarelease ppa has been updated > with the 0.4 package but since it superseeded version 0.3.11 I can't seem > to find a simple

[julia-users] Re: what does Array{Type{T},1} mean?

2015-10-09 Thread Cedric St-Jean
Array{Int64, 1} is an array of Ints. Type{Int64} is the type of a type, so Array{Type{Int64}} is an array of types. On Friday, October 9, 2015 at 1:11:25 PM UTC-4, Gnimuc Key wrote: > > i think `Array{Type{Int64},1}` is a vector whose element type > is constrained to `Int64`, but i'm confused

Re: [julia-users] Re: Environment reification and lazy evaluation

2015-07-09 Thread Cedric St-Jean
On Thursday, July 9, 2015 at 10:25:24 AM UTC-4, Yichao Yu wrote: Julia already have `macroexpand` so I guess you are talking about editor/REPL feature? Yeah. Emacs' macroexpand makes a big difference in usability for macros IMO, otherwise one has to repeatedly cut and paste code in the

Re: [julia-users] Re: Environment reification and lazy evaluation

2015-07-09 Thread Cedric St-Jean
Environments are very natural in interpreted languages, but I'm not aware of any fully-compiled language that supports them because they'd be a major headache. I agree that macro behavior can be hard to predict. In Common Lisp with Emacs, one can macroexpand any expression anywhere with one

Re: [julia-users] Re: Environment reification and lazy evaluation

2015-07-09 Thread Cedric St-Jean
On Thursday, July 9, 2015 at 4:14:32 PM UTC-4, Brandon Taylor wrote: Ok, here's where I'm getting hung up. You said that the compiler figures out the creation/lifetime of all variables at compile time. So does that mean there's a list like: a maps to location 0 and exists from line 3 to

Re: [julia-users] Re: Environment reification and lazy evaluation

2015-07-10 Thread Cedric St-Jean
)) which looks nicer (and also can avoid computing the determinant twice if d() is called twice). Cédric On Thursday, July 9, 2015 at 9:11:05 PM UTC-4, Cedric St-Jean wrote: On Thursday, July 9, 2015 at 4:14:32 PM UTC-4, Brandon Taylor wrote: Ok, here's where I'm getting hung up. You said

Re: [julia-users] Re: Environment reification and lazy evaluation

2015-07-10 Thread Cedric St-Jean
On Friday, July 10, 2015 at 5:51:05 AM UTC-4, Fabian Gans wrote: Hi Cedric, a macroexpand shortcut for the REPL shouldn't be a big problem, I just tried to prototype one and it seems to work fine: https://github.com/meggart/julia/commit/73c96897572cedf10f74fd09907232c706bbdf48 Is there

[julia-users] Re: Too many packages?

2015-07-12 Thread Cedric St-Jean
On Sunday, July 12, 2015 at 4:47:42 PM UTC-4, Tony Kelman wrote: The only thing I really would like to have included by default it plotting tools, because they are so essential for a lot of things. I don't think you're going to find a single plotting tool that satisfies everyone,

[julia-users] Accessing globals from C libraries

2015-11-18 Thread Cedric St-Jean
Is it possible to read the constants from a C header/source file? I found this discussion from 2012, but there was no clean solution. Is the standard practice just to copy-paste

Re: [julia-users] Always display all deprecation warnings (0.4)?

2015-08-30 Thread Cedric St-Jean
FWIW, I assume that those already exist for IJulia and are used by the AutoReload package, so you might look there. On Sunday, August 30, 2015 at 6:40:54 AM UTC-4, cormu...@mac.com wrote: Thanks Tim, that's useful (no more restarting). All I need now are these hooks

[julia-users] Memoization, macros and weak dictionaries

2015-08-30 Thread Cedric St-Jean
I tend to use memoization heavily in my mostly-functional code. Memoize.jl is neat, but it doesn't use a WeakKeyDict. 1. Is there any specific reason for that? Won't that code just hog the objects forever? 2. In SBCL, weak dictionaries and weak references had terrible O(N²) performance (I

Re: [julia-users] Slicing DataFrames resets indexes

2015-08-24 Thread Cedric St-Jean
I think that to the extent that they don't want a real index (and again, I also question that decision), printing the row number makes sense, since that's how you'll access the rows. If I have an array and I select half of its rows, the new array is still indexed 1:n, so they're following the

Re: [julia-users] IDE for Julia

2015-08-31 Thread Cedric St-Jean
Scott, do you have a way to run the notebooks (IJulia) inside Emacs? I run IJulia in the browser and edit code in Emacs, and would love to combine both. On Monday, August 31, 2015 at 9:04:28 PM UTC-4, Scott Jones wrote: > > The fact that Mike is working on it would make me confident of it. >

Re: [julia-users] Memoization, macros and weak dictionaries

2015-08-31 Thread Cedric St-Jean
quot;hash" property, if it doesn't exist > > --Tim > > On Sunday, August 30, 2015 10:04:26 PM Cedric St-Jean wrote: > > I tend to use memoization heavily in my mostly-functional code. > Memoize.jl > > is neat, but it doesn't use a WeakKeyDict. > > > >

Re: [julia-users] Memoization, macros and weak dictionaries

2015-08-31 Thread Cedric St-Jean
e you, I use types with > fields > in most other cases. > For memoization, what you suggested is a good strategy. If a call is costly enough to deserve caching its output, then a dictionary look-up is unlikely to be a bottle-neck Cédric > > --Tim > > On Monday, August 31,

Re: [julia-users] How do I know if a type is concrete?

2015-09-01 Thread Cedric St-Jean
Thank you. That doesn't seem to be the problem, I'll post an issue to Images.jl On Tuesday, September 1, 2015 at 2:18:43 PM UTC-4, Mauro wrote: > > Try isleaftype > > otherwise @code_warntype is a great tool which might be applicable to > your case. > > On Tue, 2015-09-0

[julia-users] How do I know if a type is concrete?

2015-09-01 Thread Cedric St-Jean
I have a type typealias TColor RGBA{UfixedBase{Uint8,8}} typealias TImage Image{TColor, 2, Array{TColor, 2}} How do I know if it's a concrete type or not? Is there an isconcrete function somewhere? Incidentally, I'm asking this because I just updated my packages and had to adjust to the

[julia-users] Re: overwriting an object - deep copy without copy needed

2015-09-07 Thread Cedric St-Jean
Do you ever modify an individual? If not, why not just write world[p].ind = newpop Also, did you profile to make sure that deepcopy is the bottleneck? If your structures are that simple, it's surprising to me that deepcopy is taking a long time. Cédric On Monday, September 7, 2015 at 1:08:50

[julia-users] Re: How can I delete columns of a matrix in-place?

2015-09-07 Thread Cedric St-Jean
It really depends on what you're trying to achieve. Low memory usage? Speed? Also consider: http://julia.readthedocs.org/en/release-0.3/stdlib/arrays/#Base.sub That should work even better in 0.4. It'll give you an object that behaves like what you asked for, but it won't actually free the

Re: [julia-users] Re: rownames in data matrices

2015-09-08 Thread Cedric St-Jean
DataFrame behavior has been discussed many times, eg. https://groups.google.com/d/msg/julia-users/8UFnEIfIW0k/QNEustV9BQAJ. Short answer: having row names is considered, but a bit of a philosophical difference, so it's not guaranteed to happen at some point. On Tuesday, September 8, 2015 at

Re: [julia-users] Converting vectors to dictionaries back and forth

2015-09-01 Thread Cedric St-Jean
BTW, if I'm not mistaken, your dict_to_vec function can be written as just collect(values(d)). On Tuesday, September 1, 2015 at 9:47:47 AM UTC-4, ami...@gmail.com wrote: > > Exactly what I needed, thanks a lot. >

[julia-users] Re: DataFrame filling NA values

2015-09-10 Thread Cedric St-Jean
: > > function replacena!(dframe::DataFrame, replacement::Any) > nrows, ncols = size(dframe) > for j = 1:ncols; for i = 1:nrows > if isna(dframe[i,j]); dframe[i,j] = replacement; end > end > end > end > > On Wednesday, September 9, 2015 at 1:42:37 PM

[julia-users] Re: Getting the best performance in Julia - Bayesian Inference with Julia

2015-09-09 Thread Cedric St-Jean
Cool to see more Bayesian inference in Julia! Those are the generic tips in case you haven't gone through them: http://julia.readthedocs.org/en/latest/manual/performance-tips/ I particularly recommend profiling your code with Profile.clear() @profile ...some_function_call... ProfileView.view()

[julia-users] Re: How to append data to a data frame?

2015-09-14 Thread Cedric St-Jean
`push!(df, [...values])` works, although I would worry a bit about efficiency. On Monday, September 14, 2015 at 7:37:04 AM UTC-4, Nils Gudat wrote: > > Works the same way it would in pandas: > > df = DataFrame(col1 = rand(10), col2 = rand(10)) > > add a column by doing: > > df[:col3] = rand(10)

[julia-users] Re: Julian way of tracking a "global" module setting

2015-09-13 Thread Cedric St-Jean
I'm not sure that I entirely understand your problem but it wouldn't be particularly hard to write macros such that you could define @single_threaded function foo(a::Int) ... end @parallel function foo(a::Int) ... end The expansion of @single_threaded would change the function name to be

[julia-users] Re: Regression on a singular matrix

2015-09-16 Thread Cedric St-Jean
UTC-4, Steven G. Johnson wrote: > > > > On Tuesday, September 15, 2015 at 10:22:47 AM UTC-4, Cedric St-Jean wrote: >> >> In the discussion of issue 9804 >> <https://github.com/JuliaLang/julia/pull/9804#issuecomment-140404574>, >> the general consensus seem

[julia-users] Re: Return both elapsed time and expression return value

2015-09-11 Thread Cedric St-Jean
Writing that macro wouldn't be particularly hard, but note that you can already write: ti = @elapsed xxx = 10 On Friday, September 11, 2015 at 5:08:15 PM UTC-4, holocro...@gmail.com wrote: > > To be clear, I want a macro while allows me to do: > value, time = @timeret(myfunc()) > where

[julia-users] Re: Regression on a singular matrix

2015-09-16 Thread Cedric St-Jean
D: > > julia> svdfact(X2)\y > 3-element Array{Float64,1}: > 1.28112 > 2.56223 > -0.146502 > > Pivoted QR should be slightly faster than SVD, but both should be much > faster than rref. > > Simon > > On Wednesday, September 16, 2015 at 10:02:49 AM UT

Re: [julia-users] Emacs, ESS and julia-mode

2015-09-17 Thread Cedric St-Jean
Tamas, I've hacked into SLIME/Swank before to support a DSL, and it wasn't too horrible. I'd love to get SLIME support for Julia, but my workflow revolves around notebooks these days, and I don't want to give those up. Do you see any way of combining the two? (thank you for your LLA library

[julia-users] Regression on a singular matrix

2015-09-15 Thread Cedric St-Jean
In the discussion of issue 9804 , the general consensus seemed to be: > Right. "rref" has no use in real numerical coding, but every use in pedagogy. I had a linear regression yield a PosDefError (the X matrix contains

[julia-users] Re: DataFrame filling NA values

2015-09-09 Thread Cedric St-Jean
Just found the DataFrames.isna() function, so that's solved, only the iteration question remains. On Wednesday, September 9, 2015 at 2:26:23 PM UTC-4, Cedric St-Jean wrote: > > In 0.3, what's the best way of replacing all NA with a given value (eg. > 0)? Pandas has df.fillna. I'v

[julia-users] DataFrame filling NA values

2015-09-09 Thread Cedric St-Jean
In 0.3, what's the best way of replacing all NA with a given value (eg. 0)? Pandas has df.fillna. I've noticed that isnan(DataFrames.NA) is undefined and DataFrames.NA == DataFrames.NA is NA. The docs say it's a singleton, so I assume that I should use === to check if it's NA? Likewise, how

[julia-users] Re: Julia code 5x to 30x slower than Matlab code

2015-09-19 Thread Cedric St-Jean
Unless you make the globals `const`, the compiler doesn't know the type of globals, so every single access to it must be "interpreted", so to speak. There are talks of adding a way to specify the type of globals, that would give them comparable speed to function arguments. On Saturday,

Re: [julia-users] Collections

2015-12-02 Thread Cedric St-Jean
There used to be a lot more functionality packaged with Julia, but there has been a concerted effort to spin them off. It makes development easier - contributing to a package is much less intimidating than contributing to base Julia. For collections, the package is part of "JuliaLang", which

Re: [julia-users] getindex for a real number

2015-12-02 Thread Cedric St-Jean
There's also x = [1 2; 3 4] x[:,[1]] # returns 2D array x[:, 1] # returns 1D array x[1, :] # AFAIK, returns 2D under Julia 0.4 and 1D under 0.5 I like the 0.5 behaviour a lot better. On Wednesday, December 2, 2015 at 12:21:34 PM UTC-5, Tim Holy wrote: > > Glen, that's a great list of bugs. Have

[julia-users] Re: Julia career advice question (x-post r/julia)

2015-12-01 Thread Cedric St-Jean
Hi, I spend half of my time on data science consulting in Python, and the other half on research in AI with Julia. Most of my data science work involves making clever use of already-built methods (i.e. scikit-learn), and Python's extensive libraries work great for this purpose. Furthermore, a

[julia-users] Anyone going to NIPS (Montreal) this week?

2015-12-06 Thread Cedric St-Jean
It would be nice to gather for a beer and see what everyone uses Julia for in the field of machine learning.

Re: [julia-users] Using macros to override lots of operators for a user-defined type

2015-12-15 Thread Cedric St-Jean
> but top-level definitions in a module are special. In what way? Does using @eval also creates "top-level definitions"? On Tuesday, December 15, 2015 at 12:31:30 PM UTC-5, Erik Schnetter wrote: > > Yes, this totally looks as if it should work... but top-level definitions > in a module are

[julia-users] Cumulative Profiling

2015-12-31 Thread Cedric St-Jean
I like ProfileView.jl a lot, but there are times where a traditional flat profiling output with `cumulative` would be more appropriate (eg. if I have 10 expensive functions with 10 call sites each, it's hard to tell which function to optimize in a heavily nested ProfileView visualization).

Re: [julia-users] Cumulative Profiling

2015-12-31 Thread Cedric St-Jean
15 at 19:32 Tim Holy <tim@gmail.com > > wrote: > >> If I understand what you're asking, Profile.print(format=:flat) should do >> the >> trick. >> >> --Tim >> >> On Thursday, December 31, 2015 07:56:37 AM Cedric St-Jean wrote: >> >

Re: [julia-users] Re: How to display in string?

2015-12-26 Thread Cedric St-Jean
> > That is, I'm solving a set of N polynomial equations, where N is a > parameter. > That sounds interesting, could you post some more details? At this stage, it's not clear if you really need to generate a new program at all. But if you do want to do that, then for sure, building the AST

Re: [julia-users] Moore foundation grant.

2015-12-27 Thread Cedric St-Jean
I've thought a few times about reimplementing Stan in Julia. I wonder how much of Stan's codebase is about parsing/code-generation (which would be drastically simpler in Julia) versus fine-tuning their NUTS sampler. And how much of that work about automatic differentiation/code generation could

Re: [julia-users] Re: How to display in string?

2015-12-27 Thread Cedric St-Jean
nce-degrading > global objects? If so, how do I mitigate that problem? > > At this point I am struggling with getting Newton's method to converge > properly for high N. However, that has to do with selecting the > correct initial condition -- i.e. a typical numerical analysis problem

[julia-users] Re: Help needed with understanding types and arguments re: methods(Complex)

2015-12-22 Thread Cedric St-Jean
The short version is that this is how default constructors are defined, and the details don't matter that much. Here are some clarifications: 12# this is a value of type Int Int # this is a type of type Type{Int} Julia is based on multiple dispatch, and there are circumstances where you

[julia-users] Re: How to organise (float) data in Julia?

2015-12-24 Thread Cedric St-Jean
I too am interested in this. It might be worth building a "GrowableArray" type for d>1. In the meantime, you can check out DataFrames, they do allow growing. IIRC they are built as a vector of vector, so you should get similar performance, but the syntax is nice if you have names for your

Re: [julia-users] Efficiently constructing a sparse matrix

2015-11-25 Thread Cedric St-Jean
push!(I, i); push!(J, j); push!(V, v) > end > > arry = sparse(I, J, V) > > --Tim > > On Wednesday, November 25, 2015 08:05:12 AM Cedric St-Jean wrote: > > How do people usually do this? Assignment is slow > > > > arr = spzeros(1000,1000) > > for .

[julia-users] Efficiently constructing a sparse matrix

2015-11-25 Thread Cedric St-Jean
How do people usually do this? Assignment is slow arr = spzeros(1000,1000) for ... arr[i,j] = ... ... and indeed, in scipy one would use a non-CSC format for construction, then convert it to CSC. I've seen some comments that one should just build the SparseMatrixCSC object directly for

Re: [julia-users] Re: Best practice for editing official packages?

2015-11-26 Thread Cedric St-Jean
Then for subsequent commits: > git remote add myfork https://github.com/username/ProjectName.jl.git # you > only need to do this once Everytime I want to push new changes to the pull request: > git push myfork branch-name:pull-request/2c9f2b3f # 2c9... taken from the > pull request page ?

[julia-users] Re: Concatenation without splatting

2015-11-27 Thread Cedric St-Jean
chance that foldl(vcat,arr_of_arr) will do the job? > > On Sunday, 22 November 2015 23:04:26 UTC+10, Cedric St-Jean wrote: >> >> I have a big vector of vectors. Is there any way to vcat/hcat them >> without splatting? >> >> arr_of_arr = Vector[[1],[2,3],[4,5]] >&

[julia-users] Re: Where does all the time go?

2015-11-28 Thread Cedric St-Jean
Also - run it more than once. On the first call to `sleep`, julia has to compile it, because julia is JIT'ed. On Saturday, November 28, 2015 at 12:34:25 PM UTC-5, Seth wrote: > > Probably has to do with global scope. Try putting it in a function: > > julia> function f() >tic() >

[julia-users] Re: slow wordcount

2015-11-29 Thread Cedric St-Jean
What I would try: 1. ProfileView to pinpoint the bottleneck further 2. FastAnonymous to fix the lambda 3. http://julia-demo.readthedocs.org/en/latest/manual/performance-tips.html In particular, you may check `code_typed`. I don't have experience with `split` and `eachline`. It's possible that

[julia-users] Re: Concatenation without splatting

2015-11-30 Thread Cedric St-Jean
v...) > # -> [1, 2, 3, 4, 5] > > But for hcat, what output would you want? hcat(v...) throws a > DimensionMismatch error stating that vectors must have the same length. > //T > > On Friday, November 27, 2015 at 1:39:34 PM UTC+1, Cedric St-Jean wrote: > > foldl woul

[julia-users] Concatenation without splatting

2015-11-22 Thread Cedric St-Jean
I have a big vector of vectors. Is there any way to vcat/hcat them without splatting? arr_of_arr = Vector[[1],[2,3],[4,5]] vcat(arr_of_arr...) I'm asking because splatting big arrays is a performance issue (and IIRC it blows the stack at some point).

[julia-users] Re: adding an axis to an array

2016-01-12 Thread Cedric St-Jean
It's been proposed already. I assume it will be part of the language in some form eventually, but I wouldn't hold my breath! On Monday, January 11, 2016 at 7:51:53 AM UTC-5, Michael Borregaard wrote: > > Would > a1 = cat(3, a) > > do what you

  1   2   3   >