Thanks Skip.

FYI here's my post on how I used the plot to show the probability distribution of
letter bigrams in the Linux FAQ:

http://reckbo.com/2015/01/28/mackay03-in-j-bigrams/

ryan

On 28 Jan 2015, at 16:48, Skip Cave wrote:

This link seems to work:
http://www.cs.toronto.edu/~mackay/itprnn/book.pdf

Skip

Skip Cave
Cave Consulting LLC

On Tue, Jan 27, 2015 at 3:33 AM, Ryan <[email protected]> wrote:

Thanks Devon.

FYI I'm learning J by implementing the exercises in

Information theory, inference, and learning algorithms (Mackay 03)
http://www.inference.phy.cam.ac.uk/mackay/itila/



On 22 Jan 2015, at 0:37, Devon McCormick wrote:

Raul's example assumes your data is between 0 and 1, inclusive, so you may
need to scale it:
13 : 'y-<./,y'   NB. Subtract the smallest from each
] - [: <./ ,
13 : 'y%>./,y'   NB. Divide each by the largest
] % [: >./ ,
scale=: (] % [: >./ ,)@(] - [: <./ ,) NB. Combine to scale from 0 to 1

So, if
data=: +/~i.10
then, doing what Raul showed:
viewmat ,/0|:,/0 2|:data >:/ square


On Wed, Jan 21, 2015 at 1:55 AM, Raul Miller <[email protected]>
wrote:

It's certainly possible.

You didn't give any data, and I do not feel like trying to replicate your original numbers from the image you gave, so I will just use some
arbitrary numbers:

data=: ?10 10$0

Now, let's say that your squares are 25 pixels on a side. We can form
squares like this:

$square=: (>./~|i:12)%12
25 25

That's a bit big for email, so here's a smaller version:

4%~>./~|i:4
1    1    1    1    1    1    1    1 1
1 0.75 0.75 0.75 0.75 0.75 0.75 0.75 1
1 0.75  0.5  0.5  0.5  0.5  0.5 0.75 1
1 0.75  0.5 0.25 0.25 0.25  0.5 0.75 1
1 0.75  0.5 0.25    0 0.25  0.5 0.75 1
1 0.75  0.5 0.25 0.25 0.25  0.5 0.75 1
1 0.75  0.5  0.5  0.5  0.5  0.5 0.75 1
1 0.75 0.75 0.75 0.75 0.75 0.75 0.75 1
1    1    1    1    1    1    1    1 1

(That's basically the same expression, I just moved the division over to the left hand side, and changed the 12 to a 4, so it's 5 by 5. The
point isn't the expression so much as the resulting data. It's
arranged as a square with values ranging from 0 in the center to 1 at
the edge.)

Now, we just need to compare this to each of our original values, form
them into a square, and pass that on to viewmat:

require'viewmat'
viewmat ,/0|:,/0 2|:data >:/ square

Good enough?

Or would an explanation of the steps in any of those expressions help?

(You can shave off parts of an expression to see what was passed
along, and you can shrink the data so you can inspect those
intermediate results easier. You can also use J's trace facility
and/or dissect. You can also of course read up on things in the
dictionary. But sometimes, especially after you've tried some of those
other approaches, it can be good to have someone else give their
perspective - not so much because it's not simple but because having other people's words can help you think about things from a slightly
different perspective.)

Thanks,

--
Raul

On Tue, Jan 20, 2015 at 11:48 PM, Ryan <[email protected]> wrote:

I have a matrix of probabilities that I'd like to visualise similar to

this:


http://emotion.inrialpes.fr/people/synnaeve/phdthesis/
images/battleship_board_3_1miss.png

where the bigger the probability, the bigger the square. The closest

I've

come is a simple
density plot

  mymat=? 27 27$0
load 'graphics/plot viewmat'
'density' plot mymatrix
NB. or
viewmat mymatrix

I've looked through plot's source code but don't see an option for

something

like this.

Does someone know if it's possible to do?

thanks for any help,
Ryan



The information in this e-mail is intended only for the person to whom

it is

addressed. If you believe this e-mail was sent to you in error and the
e-mail
contains patient information, please contact the Partners Compliance
HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you

in

error
but does not contain patient information, please contact the sender and
properly
dispose of the e-mail.

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm




--
Devon McCormick, CFA
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to