Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
5400934
Checking if googlecode's Git is more friendly to the appstore
jonasalmeida Sep 5, 2011
75c67d6
correction of URL in manifest
jonasalmeida Sep 5, 2011
e06b07e
appstore verification file
jonasalmeida Sep 5, 2011
a5403f9
appstore metatag added to jmat.html
jonasalmeida Sep 5, 2011
0dd298b
JSON style functions adopted
jonasalmeida Nov 7, 2011
54ccbcf
gId added
jonasalmeida Nov 7, 2011
6908233
array to mat and other experiments with ja array vs mat cell type
jonasalmeida Nov 10, 2011
be605a2
get url added
jonasalmeida Dec 2, 2011
780700f
fixed delete jobs
jonasalmeida Dec 7, 2011
9c895a9
working on reveal
jonasalmeida Dec 26, 2011
396709f
gId will look for classes if ids are not found
jonasalmeida Dec 26, 2011
08a3821
fieldnames
jonasalmeida Dec 26, 2011
1d29e90
cEl = document.createElement
jonasalmeida Dec 27, 2011
73ca578
returning gId to being about ID's only
jonasalmeida Dec 27, 2011
5ce3cbe
imread and imwrite
jonasalmeida Dec 29, 2011
974ba25
clone
jonasalmeida Dec 30, 2011
ca70e58
load and read local files (.loadFiles, .readFiles)
jonasalmeida Dec 30, 2011
c9283b1
catArray and generalization of webrw endpoint URL
jonasalmeida Jan 4, 2012
893ac9a
disp
jonasalmeida Jan 5, 2012
3cd7dfa
disp color blue
jonasalmeida Jan 5, 2012
8c94369
image segmentation started such as imthreshold
jonasalmeida Jan 9, 2012
fbff36a
plot started
jonasalmeida Jan 10, 2012
0e78240
arrayfun, imbw
jonasalmeida Jan 13, 2012
067c04f
jmat.load unload and on error function calls added
jonasalmeida Jan 22, 2012
94eece6
funTable added
jonasalmeida Jan 24, 2012
f559340
mergingTables
jonasalmeida Jan 24, 2012
e1e7b9d
rand and textread
jonasalmeida Feb 3, 2012
b8bb42d
dimFun + zeros, ones and rand rewritten o use it
jonasalmeida Feb 3, 2012
f28b543
webrw redirected to webrw.no.de
jonasalmeida Feb 8, 2012
db382e2
edge
jonasalmeida Feb 14, 2012
507fb95
imhalve and prod
jonasalmeida Feb 21, 2012
242be75
testing server side script loading from node
jonasalmeida Feb 22, 2012
fc14cdd
loadScripts and improved sum
jonasalmeida Mar 2, 2012
4c2980f
extraction of segmented features: extractSegs
jonasalmeida Mar 3, 2012
4ec7931
shorten numbers and strings, also of arrays thereof
jonasalmeida Mar 12, 2012
a6ad08a
compress and decompress
jonasalmeida Mar 19, 2012
d1ecfda
find and lookUp
jonasalmeida Apr 24, 2012
b336365
lookup finished
jonasalmeida Apr 26, 2012
9294bcc
Added changes from the Google Code repository
wilkinson May 1, 2012
8abf6c4
Added an "extractSegs2" function for comparison
wilkinson May 1, 2012
567f9cf
transposing rows of lookup table
jonasalmeida May 21, 2012
6db6831
oops, transposition was unecessary
jonasalmeida May 21, 2012
08e9bba
lets try transposition again for lookup
jonasalmeida May 21, 2012
45c9354
1st version of fminSearch
Jun 19, 2012
e06b486
fminsearch updated with a more flexible use of Options
Jun 19, 2012
2bab47b
fminsearch mostly done, syntax stable
Jun 20, 2012
c45aa42
cloneVector, fminsearch sped up a bit
Jun 21, 2012
fc09b99
updating tabular "cols" to "columns" to match Google's fusion tables …
Aug 28, 2012
3b76630
fminsearch playground
Sep 4, 2012
0e0a5f9
demo included
Sep 4, 2012
d15ff30
allow directing plot to a specific div id
Sep 4, 2012
a19931a
link to source code
Sep 4, 2012
f0f9758
thanks ALex :-) : clone abuse fixed
Sep 4, 2012
dd9c644
qmachine + twitter
Sep 26, 2012
9ab196f
machine added
Oct 1, 2012
7ec1528
qmachine.mapReduce
Oct 2, 2012
f5f6ae5
23andme App added
Oct 8, 2012
ed0e07b
playing with 23and me OAUTH
Oct 8, 2012
5edb9ca
jQuery added to 23andme app
Oct 8, 2012
a684cb7
fixing jQuery call
Oct 8, 2012
e50d19a
loading 23andme own JS library
Oct 8, 2012
903ed5b
Updated to Jonas's latest version
wilkinson Oct 9, 2012
d19596a
Added an ignore file
wilkinson Oct 9, 2012
6ae7d9b
Wow. I got the first 24% of jMat to pass JSLint, at least ...
wilkinson Oct 9, 2012
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#- Git configuration file

#- .gitignore ~~
# ~~ last updated 08 Oct 2012

#- Mercurial repository itself (if present)
.hg/

#- Vim swap files
*.swp

#- OS generated files
.DS_Store*
ehthumbs.db
Icon\?
.localized
Thumbs.db

#- vim:set syntax=gitconfig:
10 changes: 10 additions & 0 deletions 23andme.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="https://api.23andme.com/res/js/ttam-0.1.js"></script>
</head>
<body>
Experimenting with 23andme
<script src='https://dl.dropbox.com/s/19vygxl13daeor2/23andme.js?dl=1'></script>
</body>
</html>
33 changes: 33 additions & 0 deletions 23andme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//https://api.23andme.com/authorize/?redirect_uri=http://jmat.googlecode.com/git/23andme.html&response_type=code&client_id=09568fd79aa7911dad7727a024936f8d&scope=basic
// response directed to http://jmat.googlecode.com/git/23andme.html, alternative URL:
//https://dl-web.dropbox.com/get/http/jmat/23andme.html?w=bba1484b&code={borrow from above}
//
UAB={ // 23and me application document object model
code:null,
parms:{},
search4parms:function(){ // gets parameters from call and pushes them to .parms
var parms = window.document.location.search.slice(1).split('&');
parms.map(function(x){
xx = x.split('=');
UAB.parms[xx[0]]=xx[1]
})

//
}
}



// find out what is being provided and push it to parms
UAB.search4parms();
if(!!UAB.parms.code){
UAB.code=UAB.parms.code;
console.log('code = '+UAB.code);
}
else if (!!localStorage.getItem('code')){ // find out if there is one in the localstorage
UAB.code = localStorage.getItem('code');
console.log('code = '+UAB.code);
}
else{
throw('23andme access code not found :-(')
}
Binary file added f.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions fminsearch.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<html>
<head>
<script src="fminsearch.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
</head>
<body>
<div>
<h2 style="color:maroon;font-family:verdana"><i>fminsearch</i> </h2>
<p style="color:navy;font-family:verdana;font-size:small">This page: <a href="http://jmat.googlecode.com/git/fminsearch.html">http://jmat.googlecode.com/git/fminsearch.html</a>, [<a href="https://code.google.com/p/jmat/source/browse/fminsearch.js">source code</a>]<br>
In the browser's console you could, for example, <button style="color:blue;font-family:verdana" onclick=fminsearch.demo()>try</button>:<br>
<ol style="color:green;font-family:verdana;font-size:small">
<li> <span style="color:blue;font-family:verdana;font-size:small">x=[32,37,42,47,52,57,62,67,72,77,82,87,92];y=[0,34,59,77,99,114,121,133,146,159,165,173,170];</span> // some data</li>
<li> <span style="color:blue;font-family:verdana;font-size:small">fun = function(x,P){return x.map(function(xi){return (1/(1/(P[0]*(xi-P[1]))+1/P[2]))})};</span> // some model</li>
<li> <span style="color:blue;font-family:verdana;font-size:small">P=fminsearch(fun,[34.6,32,173],x,y);</span> // the regression with some starting values</li>
</ol>
</p>
</div>
<div id="plot"></div>
<script>
google.load("visualization", "1", {packages:["corechart"]});
</script>
</body>
</html>
89 changes: 89 additions & 0 deletions fminsearch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
fminsearch=function(fun,Parm0,x,y,Opt){// fun = function(x,Parm)
// example
//
// x = [32,37,42,47,52,57,62,67,72,77,82,87,92];y=[749,1525,1947,2201,2380,2537,2671,2758,2803,2943,3007,2979,2992]
// fun = function(x,P){return x.map(function(xi){return (P[0]+1/(1/(P[1]*(xi-P[2]))+1/P[3]))})}
// Parms=jmat.fminsearch(fun,[100,30,10,5000],x,y)
//
// Another test:
// x=[32,37,42,47,52,57,62,67,72,77,82,87,92];y=[0,34,59,77,99,114,121,133,146,159,165,173,170];
//
// Opt is an object will all other parameters, from the objective function (cost function), to the
// number of iterations, initial step vector and the display switch, for example
// Parms=fminsearch(fun,[100,30,10,5000],x,y,{maxIter:10000,display:false})

if(!Opt){Opt={}};
if(!Opt.maxIter){Opt.maxIter=1000};
if(!Opt.step){// initial step is 1/100 of initial value (remember not to use zero in Parm0)
Opt.step=Parm0.map(function(p){return p/100});
Opt.step=Opt.step.map(function(si){if(si==0){return 1}else{ return si}}); // convert null steps into 1's
};
if(typeof(Opt.display)=='undefined'){Opt.display=true};
if(!Opt.objFun){Opt.objFun=function(y,yp){return y.map(function(yi,i){return Math.pow((yi-yp[i]),2)}).reduce(function(a,b){return a+b})}} //SSD

var cloneVector=function(V){return V.map(function(v){return v})};
var ya,y0,yb,fP0,fP1;
var P0=cloneVector(Parm0),P1=cloneVector(Parm0);
var n = P0.length;
var step=Opt.step;
var funParm=function(P){return Opt.objFun(y,fun(x,P))}//function (of Parameters) to minimize
// silly multi-univariate screening
for(var i=0;i<Opt.maxIter;i++){
for(var j=0;j<n;j++){ // take a step for each parameter
P1[j]+=step[j];
if(funParm(P1)<funParm(P0)){ // if parm value going in the righ direction
step[j]=1.2*step[j]; // then go a little faster
P0[j]=P1[j];
}
else{
step[j]=-(0.5*step[j]); // otherwiese reverse and go slower
P1[j]=P0[j];
}
}
if(Opt.display){if(i>(Opt.maxIter-10)){console.log(i+1,funParm(P0),P0)}}
}
if (!!document.getElementById('plot')){ // if there is then use it
fminsearch.plot(x,y,fun(x,P0),P0);
}
return P0
};

fminsearch.load=function(src){ // script loading
// example: fminsearch.load('http://localhost:8888/jmat/jmat.js')
var s = document.createElement('script');
s.src = src;
document.head.appendChild(s);
s.parentElement.removeChild(s);
};

fminsearch.plot=function(x,y,yp,Parms,id){ // ploting results using <script type="text/javascript" src="https://www.google.com/jsapi"></script>
// defaults
var titulo='Model fitting';
if(!!Parms){titulo='Model parameters: '+Parms};
if(!id){var id='plot'}
// create Array in Google's format
var data = new google.visualization.DataTable();
data.addColumn('number', 'X');
data.addColumn('number', 'Observed');
data.addColumn('number', 'Model fit');
var n = x.length;
for (var i=0;i<n;i++){
data.addRow([x[i],y[i],yp[i]]);
};
var chart = new google.visualization.ComboChart(
document.getElementById(id));
chart.draw(data, {title: titulo,
width: 600, height: 400,
vAxis: {title: "Y", titleTextStyle: {color: "black"}},
hAxis: {title: "X", titleTextStyle: {color: "black"}},
seriesType: "scatter",
series: {1: {type: "line"}}}
);
};

fminsearch.demo=function(){ // demo example in http://jmat.googlecode.com/git/fminsearch.html
x=[32,37,42,47,52,57,62,67,72,77,82,87,92];y=[0,34,59,77,99,114,121,133,146,159,165,173,170]; // some data
fun = function(x,P){return x.map(function(xi){return (1/(1/(P[0]*(xi-P[1]))+1/P[2]))})}; // some model
P=fminsearch(fun,[34.6,32,173],x,y); // the regression with some starting values
};

19 changes: 19 additions & 0 deletions funTable.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<html>
<body>
<p>Fun With Tables</p>
<input type="file" id="files" multiple onchange="funTable.loadFiles(this.files,'readAsText')"></input>

<div id='work'>
</div>

<div id="chat">
<textarea id='console' style="border:none;color:blue" cols=50>></textarea><button onclick="funTable.clearConsole(this)">(x)</button><br>
<textarea id='msg'cols=50 style="border:none;color:navy" rows=10></textarea><button onclick="jmat.gId('msg').textContent='';jmat.gId('console').focus()">(x)</button>
</div>

<iframe id="loadingFrame" style="display:none"></iframe>

<script src="jmat.js"></script>
<script src="funTable.js"></script>
</body>
</html>
50 changes: 50 additions & 0 deletions funTable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
console.log('fun with tables (funTable) loaded');

funTable={
loadFiles:function(files,readAs,callback){
//<input type="file" id="files" multiple onchange="funTable.loadFiles(this.files,'readAsText')"></input>
if(!readAs){readAs='readAsDataURL'} // default is to read as dataURL
for(var i=0;i<files.length;i++){
this.readFile(files[i],readAs)
}
return i
},
readFile:function(f,readAs,callback){
var that = this;
if(!callback){callback=function(x){ // DEAFAULT CALLBACK - you may want to write your own
console.log('---'+x.file.fileName+'---');console.log(x.result); // comment out if you don't want to track reading in the cnsole
if(!that.work){that.work={}};if(!that.work.files){that.work.files=[]} // results stored in .work.files
that.work.files[x.file.fileName]={file:x.file,result:x.result}; // array indexed to file name
}
}
var reader = new FileReader();
reader.onload=(function(theFile){
return function(ev){
//if(!funTable.work.Files){funTable.work.Files=[]}
//funTable.work.Files[theFile.fileName]={file:theFile,result:ev.target.result};
callback({file:theFile,result:ev.target.result})
//console.log(ev.target.result,theFile)
}
})(f)
reader[readAs](f);
},
log:function(x){
console.log(x);
jmat.gId('msg').textContent+=x+'\n';
},
clearConsole:function(){
var c=jmat.gId('console');
c.textContent='>';
c.focus();
},
clearMsg:function(){
var m=jmat.gId('msg');
m.textContent='';
c.focus();
},
work:{
// workspace variables
}
}


1 change: 1 addition & 0 deletions google24741bc4ba4d02c3.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
google-site-verification: google24741bc4ba4d02c3.html
Binary file added icon128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 9 additions & 5 deletions jmat.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<html>
<body>
<script src="jmat.js"></script>
</body>
</html>
<html>
<head>
<meta name="google-site-verification" content="7fcghhoQd8T11z8Sk0to8AoJB_c209X1KJzd-QHKG5U" />
</head>
<body>
<script src="jmat.js"></script>
</body>
JMAT
</html>
Loading