Similarity Matrix
Hi! I know some of you are working on DSM-kind of matrix. Oscar has been working on a similarity matrix for Roassal. I just want to share a self-explanble screenshot with you guys. On this example, the methods of the subclasses of Set are compared between themselves. Black dot is a couple (m1, m2) that are very similar More on https://www.facebook.com/media/set/?set=a.550677725018829.1073741833.3405434... Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Really nice. In fact it would be ****great**** if we can plug the comparison between the x and y cells (which can be different). Because like that we get a simple matrix based comparator similar to the one of early paper of prejinshight work.
<Screen Shot 2013-11-29 at 6.12.39 PM.png>
Really nice. In fact it would be ****great**** if we can plug the comparison between the x and y cells (which can be different). Because like that we get a simple matrix based comparator similar to the one of early paper of prejinshight work.
This is the case actually. Consider this rather simple and small example: SimilarityMatrix new on: #('hello world' 'welcome to our world' 'hello means bonjour' 'bye bye') by: [ :m1 : m2 | (m1 substrings intersection: m2 substrings) size / ((1 max: (m1 substrings union: m2 substrings) size) + 1) "NB penalty for small methods" ]; gridView The output is It visually says that âhello worldâ is close to âwelcome to out worldâ and to âhello means bonjourâ, because âhelloâ and âworldâ are in common. Alexandre
then this is really cool :) On Dec 2, 2013, at 1:39 PM, Alexandre Bergel <alexandre.bergel@me.com> wrote:
Really nice. In fact it would be ****great**** if we can plug the comparison between the x and y cells (which can be different). Because like that we get a simple matrix based comparator similar to the one of early paper of prejinshight work.
This is the case actually.
Consider this rather simple and small example: SimilarityMatrix new on: #('hello world' 'welcome to our world' 'hello means bonjour' 'bye bye') by: [ :m1 : m2 | (m1 substrings intersection: m2 substrings) size / ((1 max: (m1 substrings union: m2 substrings) size) + 1) "NB penalty for small methods" ]; gridView
The output is
<Screen Shot 2013-12-02 at 9.36.58 AM.png>
It visually says that âhello worldâ is close to âwelcome to out worldâ and to âhello means bonjourâ, because âhelloâ and âworldâ are in common.
Alexandre
Very cool! Doru On Fri, Nov 29, 2013 at 10:16 PM, Alexandre Bergel <alexandre.bergel@me.com>wrote:
Hi!
I know some of you are working on DSM-kind of matrix. Oscar has been working on a similarity matrix for Roassal. I just want to share a self-explanble screenshot with you guys.
On this example, the methods of the subclasses of Set are compared between themselves. Black dot is a couple (m1, m2) that are very similar
More on https://www.facebook.com/media/set/?set=a.550677725018829.1073741833.3405434...
Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
-- www.tudorgirba.com "Every thing has its own flow"
Hi Alexandre, Just to provide you some feedback. My similarity matrices sometimes are calculated by other tools. However I want to display them using Roassal. For example this is a similarity matrix of 21 lines and 21 columns: ' a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 a21 a1 1 0.130 0.132 0.130 0.158 0.189 0.130 0.022 1.000 0.062 0.083 0.061 0.080 0.059 0.149 1.000 0.098 0.161 0.109 1.000 0.000 a2 1 0.195 0.487 0.220 0.220 1.000 0.060 0.130 0.118 0.234 0.234 0.224 0.200 0.622 0.130 0.342 0.235 0.425 0.130 0.000 a3 1 0.195 0.464 0.464 0.195 0.073 0.132 0.116 0.114 0.256 0.109 0.085 0.133 0.132 0.105 0.320 0.171 0.132 0.000 a4 1 0.220 0.190 0.487 0.060 0.130 0.118 0.160 0.234 0.154 0.132 0.395 0.130 0.342 0.235 0.425 0.130 0.000 a5 1 0.500 0.220 0.071 0.158 0.195 0.220 0.389 0.209 0.182 0.156 0.158 0.162 0.417 0.225 0.158 0.000 a6 1 0.220 0.071 0.189 0.114 0.136 0.282 0.130 0.106 0.156 0.189 0.132 0.360 0.167 0.189 0.000 a7 1 0.060 0.130 0.118 0.234 0.234 0.224 0.200 0.622 0.130 0.342 0.235 0.425 0.130 0.000 a8 1 0.022 0.156 0.104 0.082 0.100 0.100 0.019 0.022 0.095 0.088 0.061 0.022 0.028 a9 1 0.062 0.083 0.061 0.080 0.059 0.149 1.000 0.098 0.161 0.109 1.000 0.000 a10 1 0.541 0.140 0.372 0.283 0.073 0.062 0.111 0.139 0.143 0.062 0.025 a11 1 0.160 0.714 0.579 0.176 0.083 0.133 0.200 0.163 0.083 0.024 a12 1 0.154 0.132 0.176 0.061 0.308 0.235 0.239 0.061 0.000 a13 1 0.676 0.170 0.080 0.128 0.189 0.157 0.080 0.023 a14 1 0.148 0.059 0.128 0.158 0.135 0.059 0.023 a15 1 0.149 0.262 0.158 0.341 0.149 0.000 a16 1 0.098 0.161 0.109 1.000 0.000 a17 1 0.207 0.316 0.098 0.000 a18 1 0.206 0.161 0.000 a19 1 0.109 0.000 a20 1 0.000 a21 1 ' lines collect: [ : line | line trimBoth findTokens: Character tab ] May be your Comparison class could be tailored to set manually rhs, lhs and similarity? What do you recommend for raw matrices? Cheers, Hernán 2013/11/29 Alexandre Bergel <alexandre.bergel@me.com>
Hi!
I know some of you are working on DSM-kind of matrix. Oscar has been working on a similarity matrix for Roassal. I just want to share a self-explanble screenshot with you guys.
On this example, the methods of the subclasses of Set are compared between themselves. Black dot is a couple (m1, m2) that are very similar
More on https://www.facebook.com/media/set/?set=a.550677725018829.1073741833.3405434...
Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Hi Hernan, In that case, I suggest you to define your own builder to build the matrix you need. I have given a try, but I cannot properly parse your data. The problem is about separating column (is it 4 or 5 white spaces?). Having a â,â would help. I gave a try, as you can see with the script below. It produces the following: Each box gives its value when the mouse is above. -=-=-= -=-=-= -=-=-= -=-=-= -=-=-= | view f blockSize shape values el | values := ' a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 a21 a1 1 0.130 0.132 0.130 0.158 0.189 0.130 0.022 1.000 0.062 0.083 0.061 0.080 0.059 0.149 1.000 0.098 0.161 0.109 1.000 a2 1 0.195 0.487 0.220 0.220 1.000 0.060 0.130 0.118 0.234 0.234 0.224 0.200 0.622 0.130 0.342 0.235 0.425 0.130 0.000 a3 1 0.195 0.464 0.464 0.195 0.073 0.132 0.116 0.114 0.256 0.109 0.085 0.133 0.132 0.105 0.320 0.171 0.132 0.000 a4 1 0.220 0.190 0.487 0.060 0.130 0.118 0.160 0.234 0.154 0.132 0.395 0.130 0.342 0.235 0.425 0.130 0.000 a5 1 0.500 0.220 0.071 0.158 0.195 0.220 0.389 0.209 0.182 0.156 0.158 0.162 0.417 0.225 0.158 0.000 a6 1 0.220 0.071 0.189 0.114 0.136 0.282 0.130 0.106 0.156 0.189 0.132 0.360 0.167 0.189 0.000 a7 1 0.060 0.130 0.118 0.234 0.234 0.224 0.200 0.622 0.130 0.342 0.235 0.425 0.130 0.000 a8 1 0.022 0.156 0.104 0.082 0.100 0.100 0.019 0.022 0.095 0.088 0.061 0.022 0.028 a9 1 0.062 0.083 0.061 0.080 0.059 0.149 1.000 0.098 0.161 0.109 1.000 0.000 a10 1 0.541 0.140 0.372 0.283 0.073 0.062 0.111 0.139 0.143 0.062 0.025 a11 1 0.160 0.714 0.579 0.176 0.083 0.133 0.200 0.163 0.083 0.024 a12 1 0.154 0.132 0.176 0.061 0.308 0.235 0.239 0.061 0.000 a13 1 0.676 0.170 0.080 0.128 0.189 0.157 0.080 0.023 a14 1 0.148 0.059 0.128 0.158 0.135 0.059 0.023 a15 1 0.149 0.262 0.158 0.341 0.149 0.000 a16 1 0.098 0.161 0.109 1.000 0.000 a17 1 0.207 0.316 0.098 0.000 a18 1 0.206 0.161 0.000 a19 1 0.109 0.000 a20 1 0.000 a21 1 ' lines collect: [ : line | line trimBoth findTokens: ' ' ]. blockSize := 10. view := ROView new. values do: [ :lineOfValues | lineOfValues do: [ :v | shape := ROBox new size: blockSize; color: Color white. f := [Float readFrom: v readStream] ifError: [ -1 ]. f >= 0 ifTrue: [ shape color: (Color gray: f) ]. el := shape elementOn: f. el @ ROPopup. view add: el ]. "We fill the remaining of the line with white boxes. We need to have the same amount of boxes for all the lines" (values first size - lineOfValues size) timesRepeat: [ view add: (ROBox new color: Color white) element ]. ]. ROGridLayout new gapSize: 0; lineItemsCount: (values first size); on: view elements. view open. -=-=-= -=-=-= -=-=-= -=-=-= -=-=-= Cheers, Alexandre On Dec 15, 2013, at 12:56 AM, Hernán Morales Durand <hernan.morales@gmail.com> wrote:
Hi Alexandre,
Just to provide you some feedback. My similarity matrices sometimes are calculated by other tools. However I want to display them using Roassal. For example this is a similarity matrix of 21 lines and 21 columns:
' a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 a21 a1 1 0.130 0.132 0.130 0.158 0.189 0.130 0.022 1.000 0.062 0.083 0.061 0.080 0.059 0.149 1.000 0.098 0.161 0.109 1.000 0.000 a2 1 0.195 0.487 0.220 0.220 1.000 0.060 0.130 0.118 0.234 0.234 0.224 0.200 0.622 0.130 0.342 0.235 0.425 0.130 0.000 a3 1 0.195 0.464 0.464 0.195 0.073 0.132 0.116 0.114 0.256 0.109 0.085 0.133 0.132 0.105 0.320 0.171 0.132 0.000 a4 1 0.220 0.190 0.487 0.060 0.130 0.118 0.160 0.234 0.154 0.132 0.395 0.130 0.342 0.235 0.425 0.130 0.000 a5 1 0.500 0.220 0.071 0.158 0.195 0.220 0.389 0.209 0.182 0.156 0.158 0.162 0.417 0.225 0.158 0.000 a6 1 0.220 0.071 0.189 0.114 0.136 0.282 0.130 0.106 0.156 0.189 0.132 0.360 0.167 0.189 0.000 a7 1 0.060 0.130 0.118 0.234 0.234 0.224 0.200 0.622 0.130 0.342 0.235 0.425 0.130 0.000 a8 1 0.022 0.156 0.104 0.082 0.100 0.100 0.019 0.022 0.095 0.088 0.061 0.022 0.028 a9 1 0.062 0.083 0.061 0.080 0.059 0.149 1.000 0.098 0.161 0.109 1.000 0.000 a10 1 0.541 0.140 0.372 0.283 0.073 0.062 0.111 0.139 0.143 0.062 0.025 a11 1 0.160 0.714 0.579 0.176 0.083 0.133 0.200 0.163 0.083 0.024 a12 1 0.154 0.132 0.176 0.061 0.308 0.235 0.239 0.061 0.000 a13 1 0.676 0.170 0.080 0.128 0.189 0.157 0.080 0.023 a14 1 0.148 0.059 0.128 0.158 0.135 0.059 0.023 a15 1 0.149 0.262 0.158 0.341 0.149 0.000 a16 1 0.098 0.161 0.109 1.000 0.000 a17 1 0.207 0.316 0.098 0.000 a18 1 0.206 0.161 0.000 a19 1 0.109 0.000 a20 1 0.000 a21 1 ' lines collect: [ : line | line trimBoth findTokens: Character tab ]
May be your Comparison class could be tailored to set manually rhs, lhs and similarity? What do you recommend for raw matrices?
Cheers,
Hernán
2013/11/29 Alexandre Bergel <alexandre.bergel@me.com> Hi!
I know some of you are working on DSM-kind of matrix. Oscar has been working on a similarity matrix for Roassal. I just want to share a self-explanble screenshot with you guys.
On this example, the methods of the subclasses of Set are compared between themselves. Black dot is a couple (m1, m2) that are very similar <Screen Shot 2013-11-29 at 6.12.39 PM.png>
More on https://www.facebook.com/media/set/?set=a.550677725018829.1073741833.3405434...
Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
El 15/12/2013 13:30, Alexandre Bergel escribió:
Hi Hernan,
In that case, I suggest you to define your own builder to build the matrix you need. I have given a try, but I cannot properly parse your data. The problem is about separating column (is it 4 or 5 white spaces?). Having a â,â would help.
That should be a paste problem, matrix elements were delimited by tab. I was thinking more in terms of re-using the SimilarityMatrix by making it polymorphic with a Matrix, i.e.: | rawDataMatrix dataMatrix rowArray | rawDataMatrix := '1,0.130,0.132,0.130 ,1,0.195,0.487 ,,1,0.195 ,,,1'. " Build an Array for joining all rows in raw data matrix " rowArray := (NeoCSVReader on: rawDataMatrix readStream) upToEnd gather: [ : c | c ]. " Then create a Matrix " dataMatrix := Matrix new rows: 4 columns: 4 contents: rowArray. " Instead of passing a comparison block, let's just take the values in the data matrix " SimilarityMatrix new on: dataMatrix; viewMatrix
I gave a try, as you can see with the script below. It produces the following:
Each box gives its value when the mouse is above.
-=-=-= -=-=-= -=-=-= -=-=-= -=-=-= | view f blockSize shape values el | values := ' a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 a21 a1 1 0.130 0.132 0.130 0.158 0.189 0.130 0.022 1.000 0.062 0.083 0.061 0.080 0.059 0.149 1.000 0.098 0.161 0.109 1.000 a2 1 0.195 0.487 0.220 0.220 1.000 0.060 0.130 0.118 0.234 0.234 0.224 0.200 0.622 0.130 0.342 0.235 0.425 0.130 0.000 a3 1 0.195 0.464 0.464 0.195 0.073 0.132 0.116 0.114 0.256 0.109 0.085 0.133 0.132 0.105 0.320 0.171 0.132 0.000 a4 1 0.220 0.190 0.487 0.060 0.130 0.118 0.160 0.234 0.154 0.132 0.395 0.130 0.342 0.235 0.425 0.130 0.000 a5 1 0.500 0.220 0.071 0.158 0.195 0.220 0.389 0.209 0.182 0.156 0.158 0.162 0.417 0.225 0.158 0.000 a6 1 0.220 0.071 0.189 0.114 0.136 0.282 0.130 0.106 0.156 0.189 0.132 0.360 0.167 0.189 0.000 a7 1 0.060 0.130 0.118 0.234 0.234 0.224 0.200 0.622 0.130 0.342 0.235 0.425 0.130 0.000 a8 1 0.022 0.156 0.104 0.082 0.100 0.100 0.019 0.022 0.095 0.088 0.061 0.022 0.028 a9 1 0.062 0.083 0.061 0.080 0.059 0.149 1.000 0.098 0.161 0.109 1.000 0.000 a10 1 0.541 0.140 0.372 0.283 0.073 0.062 0.111 0.139 0.143 0.062 0.025 a11 1 0.160 0.714 0.579 0.176 0.083 0.133 0.200 0.163 0.083 0.024 a12 1 0.154 0.132 0.176 0.061 0.308 0.235 0.239 0.061 0.000 a13 1 0.676 0.170 0.080 0.128 0.189 0.157 0.080 0.023 a14 1 0.148 0.059 0.128 0.158 0.135 0.059 0.023 a15 1 0.149 0.262 0.158 0.341 0.149 0.000 a16 1 0.098 0.161 0.109 1.000 0.000 a17 1 0.207 0.316 0.098 0.000 a18 1 0.206 0.161 0.000 a19 1 0.109 0.000 a20 1 0.000 a21 1 ' lines collect: [ : line | line trimBoth findTokens: ' ' ].
blockSize := 10. view := ROView new. values do: [ :lineOfValues | lineOfValues do: [ :v | shape := ROBox new size: blockSize; color: Color white. f := [Float readFrom: v readStream] ifError: [ -1 ]. f >= 0 ifTrue: [ shape color: (Color gray: f) ]. el := shape elementOn: f. el @ ROPopup. view add: el ].
"We fill the remaining of the line with white boxes. We need to have the same amount of boxes for all the lines" (values first size - lineOfValues size) timesRepeat: [ view add: (ROBox new color: Color white) element ].
]. ROGridLayout new gapSize: 0; lineItemsCount: (values first size); on: view elements. view open. -=-=-= -=-=-= -=-=-= -=-=-= -=-=-=
Thanks for the script. Hernán
Cheers, Alexandre
On Dec 15, 2013, at 12:56 AM, Hernán Morales Durand <hernan.morales@gmail.com <mailto:hernan.morales@gmail.com>> wrote:
Hi Alexandre,
Just to provide you some feedback. My similarity matrices sometimes are calculated by other tools. However I want to display them using Roassal. For example this is a similarity matrix of 21 lines and 21 columns:
' a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 a21 a1 1 0.130 0.132 0.130 0.158 0.189 0.130 0.022 1.000 0.062 0.083 0.061 0.080 0.059 0.149 1.000 0.098 0.161 0.109 1.000 0.000 a2 1 0.195 0.487 0.220 0.220 1.000 0.060 0.130 0.118 0.234 0.234 0.224 0.200 0.622 0.130 0.342 0.235 0.425 0.130 0.000 a3 1 0.195 0.464 0.464 0.195 0.073 0.132 0.116 0.114 0.256 0.109 0.085 0.133 0.132 0.105 0.320 0.171 0.132 0.000 a4 1 0.220 0.190 0.487 0.060 0.130 0.118 0.160 0.234 0.154 0.132 0.395 0.130 0.342 0.235 0.425 0.130 0.000 a5 1 0.500 0.220 0.071 0.158 0.195 0.220 0.389 0.209 0.182 0.156 0.158 0.162 0.417 0.225 0.158 0.000 a6 1 0.220 0.071 0.189 0.114 0.136 0.282 0.130 0.106 0.156 0.189 0.132 0.360 0.167 0.189 0.000 a7 1 0.060 0.130 0.118 0.234 0.234 0.224 0.200 0.622 0.130 0.342 0.235 0.425 0.130 0.000 a8 1 0.022 0.156 0.104 0.082 0.100 0.100 0.019 0.022 0.095 0.088 0.061 0.022 0.028 a9 1 0.062 0.083 0.061 0.080 0.059 0.149 1.000 0.098 0.161 0.109 1.000 0.000 a10 1 0.541 0.140 0.372 0.283 0.073 0.062 0.111 0.139 0.143 0.062 0.025 a11 1 0.160 0.714 0.579 0.176 0.083 0.133 0.200 0.163 0.083 0.024 a12 1 0.154 0.132 0.176 0.061 0.308 0.235 0.239 0.061 0.000 a13 1 0.676 0.170 0.080 0.128 0.189 0.157 0.080 0.023 a14 1 0.148 0.059 0.128 0.158 0.135 0.059 0.023 a15 1 0.149 0.262 0.158 0.341 0.149 0.000 a16 1 0.098 0.161 0.109 1.000 0.000 a17 1 0.207 0.316 0.098 0.000 a18 1 0.206 0.161 0.000 a19 1 0.109 0.000 a20 1 0.000 a21 1 ' lines collect: [ : line | line trimBoth findTokens: Character tab ]
May be your Comparison class could be tailored to set manually rhs, lhs and similarity? What do you recommend for raw matrices?
Cheers,
Hernán
2013/11/29 Alexandre Bergel <alexandre.bergel@me.com <mailto:alexandre.bergel@me.com>> Hi!
I know some of you are working on DSM-kind of matrix. Oscar has been working on a similarity matrix for Roassal. I just want to share a self-explanble screenshot with you guys.
On this example, the methods of the subclasses of Set are compared between themselves. Black dot is a couple (m1, m2) that are very similar <Screen Shot 2013-11-29 at 6.12.39 PM.png>
More on https://www.facebook.com/media/set/?set=a.550677725018829.1073741833.3405434...
Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
On Sun, Dec 15, 2013 at 2:29 PM, Hernán Morales Durand < hernan.morales@gmail.com> wrote:
El 15/12/2013 13:30, Alexandre Bergel escribió:
Hi Hernan,
In that case, I suggest you to define your own builder to build the matrix you need. I have given a try, but I cannot properly parse your data. The problem is about separating column (is it 4 or 5 white spaces?). Having a â,â would help.
That should be a paste problem, matrix elements were delimited by tab.
Mail-server formatting. Should use binary attachment to send data or code to be filed-in.
The SimilarityMatrix is meant to work with one set of elements, which is the same in column and horizontal. Instead of having one class, SimilarityMatrix, we should have a framework to easily build matrixes. In your case, you simply want a matrix with a smart way of coloring. I am interesting in having such matrix. How do we proceed? Are you ready for a pair programming session these next days? I am now in Lille by the way, where are you? Alexandre On Dec 15, 2013, at 9:29 PM, Hernán Morales Durand <hernan.morales@gmail.com> wrote:
El 15/12/2013 13:30, Alexandre Bergel escribió:
Hi Hernan,
In that case, I suggest you to define your own builder to build the matrix you need. I have given a try, but I cannot properly parse your data. The problem is about separating column (is it 4 or 5 white spaces?). Having a â,â would help.
That should be a paste problem, matrix elements were delimited by tab.
I was thinking more in terms of re-using the SimilarityMatrix by making it polymorphic with a Matrix, i.e.:
| rawDataMatrix dataMatrix rowArray | rawDataMatrix := '1,0.130,0.132,0.130 ,1,0.195,0.487 ,,1,0.195 ,,,1'. " Build an Array for joining all rows in raw data matrix " rowArray := (NeoCSVReader on: rawDataMatrix readStream) upToEnd gather: [ : c | c ]. " Then create a Matrix " dataMatrix := Matrix new rows: 4 columns: 4 contents: rowArray. " Instead of passing a comparison block, let's just take the values in the data matrix " SimilarityMatrix new on: dataMatrix; viewMatrix
I gave a try, as you can see with the script below. It produces the following:
Each box gives its value when the mouse is above.
-=-=-= -=-=-= -=-=-= -=-=-= -=-=-= | view f blockSize shape values el | values := ' a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 a21 a1 1 0.130 0.132 0.130 0.158 0.189 0.130 0.022 1.000 0.062 0.083 0.061 0.080 0.059 0.149 1.000 0.098 0.161 0.109 1.000 a2 1 0.195 0.487 0.220 0.220 1.000 0.060 0.130 0.118 0.234 0.234 0.224 0.200 0.622 0.130 0.342 0.235 0.425 0.130 0.000 a3 1 0.195 0.464 0.464 0.195 0.073 0.132 0.116 0.114 0.256 0.109 0.085 0.133 0.132 0.105 0.320 0.171 0.132 0.000 a4 1 0.220 0.190 0.487 0.060 0.130 0.118 0.160 0.234 0.154 0.132 0.395 0.130 0.342 0.235 0.425 0.130 0.000 a5 1 0.500 0.220 0.071 0.158 0.195 0.220 0.389 0.209 0.182 0.156 0.158 0.162 0.417 0.225 0.158 0.000 a6 1 0.220 0.071 0.189 0.114 0.136 0.282 0.130 0.106 0.156 0.189 0.132 0.360 0.167 0.189 0.000 a7 1 0.060 0.130 0.118 0.234 0.234 0.224 0.200 0.622 0.130 0.342 0.235 0.425 0.130 0.000 a8 1 0.022 0.156 0.104 0.082 0.100 0.100 0.019 0.022 0.095 0.088 0.061 0.022 0.028 a9 1 0.062 0.083 0.061 0.080 0.059 0.149 1.000 0.098 0.161 0.109 1.000 0.000 a10 1 0.541 0.140 0.372 0.283 0.073 0.062 0.111 0.139 0.143 0.062 0.025 a11 1 0.160 0.714 0.579 0.176 0.083 0.133 0.200 0.163 0.083 0.024 a12 1 0.154 0.132 0.176 0.061 0.308 0.235 0.239 0.061 0.000 a13 1 0.676 0.170 0.080 0.128 0.189 0.157 0.080 0.023 a14 1 0.148 0.059 0.128 0.158 0.135 0.059 0.023 a15 1 0.149 0.262 0.158 0.341 0.149 0.000 a16 1 0.098 0.161 0.109 1.000 0.000 a17 1 0.207 0.316 0.098 0.000 a18 1 0.206 0.161 0.000 a19 1 0.109 0.000 a20 1 0.000 a21 1 ' lines collect: [ : line | line trimBoth findTokens: ' ' ].
blockSize := 10. view := ROView new. values do: [ :lineOfValues | lineOfValues do: [ :v | shape := ROBox new size: blockSize; color: Color white. f := [Float readFrom: v readStream] ifError: [ -1 ]. f >= 0 ifTrue: [ shape color: (Color gray: f) ]. el := shape elementOn: f. el @ ROPopup. view add: el ].
"We fill the remaining of the line with white boxes. We need to have the same amount of boxes for all the lines" (values first size - lineOfValues size) timesRepeat: [ view add: (ROBox new color: Color white) element ].
]. ROGridLayout new gapSize: 0; lineItemsCount: (values first size); on: view elements. view open. -=-=-= -=-=-= -=-=-= -=-=-= -=-=-=
Thanks for the script. Hernán
Cheers, Alexandre
On Dec 15, 2013, at 12:56 AM, Hernán Morales Durand <hernan.morales@gmail.com <mailto:hernan.morales@gmail.com>> wrote:
Hi Alexandre,
Just to provide you some feedback. My similarity matrices sometimes are calculated by other tools. However I want to display them using Roassal. For example this is a similarity matrix of 21 lines and 21 columns:
' a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 a21 a1 1 0.130 0.132 0.130 0.158 0.189 0.130 0.022 1.000 0.062 0.083 0.061 0.080 0.059 0.149 1.000 0.098 0.161 0.109 1.000 0.000 a2 1 0.195 0.487 0.220 0.220 1.000 0.060 0.130 0.118 0.234 0.234 0.224 0.200 0.622 0.130 0.342 0.235 0.425 0.130 0.000 a3 1 0.195 0.464 0.464 0.195 0.073 0.132 0.116 0.114 0.256 0.109 0.085 0.133 0.132 0.105 0.320 0.171 0.132 0.000 a4 1 0.220 0.190 0.487 0.060 0.130 0.118 0.160 0.234 0.154 0.132 0.395 0.130 0.342 0.235 0.425 0.130 0.000 a5 1 0.500 0.220 0.071 0.158 0.195 0.220 0.389 0.209 0.182 0.156 0.158 0.162 0.417 0.225 0.158 0.000 a6 1 0.220 0.071 0.189 0.114 0.136 0.282 0.130 0.106 0.156 0.189 0.132 0.360 0.167 0.189 0.000 a7 1 0.060 0.130 0.118 0.234 0.234 0.224 0.200 0.622 0.130 0.342 0.235 0.425 0.130 0.000 a8 1 0.022 0.156 0.104 0.082 0.100 0.100 0.019 0.022 0.095 0.088 0.061 0.022 0.028 a9 1 0.062 0.083 0.061 0.080 0.059 0.149 1.000 0.098 0.161 0.109 1.000 0.000 a10 1 0.541 0.140 0.372 0.283 0.073 0.062 0.111 0.139 0.143 0.062 0.025 a11 1 0.160 0.714 0.579 0.176 0.083 0.133 0.200 0.163 0.083 0.024 a12 1 0.154 0.132 0.176 0.061 0.308 0.235 0.239 0.061 0.000 a13 1 0.676 0.170 0.080 0.128 0.189 0.157 0.080 0.023 a14 1 0.148 0.059 0.128 0.158 0.135 0.059 0.023 a15 1 0.149 0.262 0.158 0.341 0.149 0.000 a16 1 0.098 0.161 0.109 1.000 0.000 a17 1 0.207 0.316 0.098 0.000 a18 1 0.206 0.161 0.000 a19 1 0.109 0.000 a20 1 0.000 a21 1 ' lines collect: [ : line | line trimBoth findTokens: Character tab ]
May be your Comparison class could be tailored to set manually rhs, lhs and similarity? What do you recommend for raw matrices?
Cheers,
Hernán
2013/11/29 Alexandre Bergel <alexandre.bergel@me.com <mailto:alexandre.bergel@me.com>> Hi!
I know some of you are working on DSM-kind of matrix. Oscar has been working on a similarity matrix for Roassal. I just want to share a self-explanble screenshot with you guys.
On this example, the methods of the subclasses of Set are compared between themselves. Black dot is a couple (m1, m2) that are very similar <Screen Shot 2013-11-29 at 6.12.39 PM.png>
More on https://www.facebook.com/media/set/?set=a.550677725018829.1073741833.3405434...
Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
El 15/12/2013 19:51, Alexandre Bergel escribió:
The SimilarityMatrix is meant to work with one set of elements, which is the same in column and horizontal.
Instead of having one class, SimilarityMatrix, we should have a framework to easily build matrixes. In your case, you simply want a matrix with a smart way of coloring.
Exactly. Matrix could be interpreted in many ways and one can display it as heatmap, graphs, etc.
I am interesting in having such matrix. How do we proceed? Are you ready for a pair programming session these next days?
For sure, let's schedule a session from wednesday onwards.
I am now in Lille by the way, where are you?
I am in La Plata now. But we can use some kind of collaborative tool? Anyone tried https://asana.com/ ? Hernán
participants (5)
-
Alexandre Bergel -
Chris Muller -
Hernán Morales Durand -
Stéphane Ducasse -
Tudor Girba