{
  "id": 5006,
  "title": "The new data and code",
  "url": "/competitions/cause-effect-pairs/discussion/5006",
  "author_name": "",
  "post_date": "2013-07-03T10:47:26.410Z",
  "votes": null,
  "comment_count": 1,
  "views": 942,
  "content": "<p>Dear Isabelle</p>\r\n<p></p>\r\n<p>Is it possible to have the Matlab file for the newly released 'final' set.&nbsp; Also, I am not sure how the 'standardize' object in the new code works.&nbsp; So if i have two arrays x and y, both nx1, then I could say:</p>\r\n<p></p>\r\n<p>model=standardize;<br>\r\n[resu, model]=train(model, data([x y]))<br>\r\n<br>\r\n</p>\r\n<p>I get an error on the above.&nbsp; I think standardize itself expects a CEpair but the train method is requiring a data object.&nbsp;&nbsp; Is it because of some conflict with the old spider 'data' object?&nbsp;</p>\r\n<p></p>\r\n<p>Thanks &amp; regards</p>\r\n<p>Mehreen</p>",
  "messages": [
    {
      "id": "26627",
      "postDate": "07/03/2013 10:47:26",
      "content": "<p>Dear Isabelle</p>\r\n<p></p>\r\n<p>Is it possible to have the Matlab file for the newly released 'final' set.&nbsp; Also, I am not sure how the 'standardize' object in the new code works.&nbsp; So if i have two arrays x and y, both nx1, then I could say:</p>\r\n<p></p>\r\n<p>model=standardize;<br>\r\n[resu, model]=train(model, data([x y]))<br>\r\n<br>\r\n</p>\r\n<p>I get an error on the above.&nbsp; I think standardize itself expects a CEpair but the train method is requiring a data object.&nbsp;&nbsp; Is it because of some conflict with the old spider 'data' object?&nbsp;</p>\r\n<p></p>\r\n<p>Thanks &amp; regards</p>\r\n<p>Mehreen</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "26704",
      "postDate": "07/05/2013 08:03:16",
      "content": "<p>Dear Mehreen,</p>\r\n<p>You will find the Matlab version at: http://www.causality.inf.ethz.ch/CEdata/CEfinal_matlab/<br>\r\nI was hesitating to provide it because when changes are made to the class @CEpair, it does not load properly anymore, hence it may not be backward compatible with previous sample code versions. What always works is to use the text csv version of the data. The\r\n first time you run CEmain or CEbrowse, the code loads the data from the text version and saves it in Matlab format for faster re-loading.</p>\r\n<p>Regarding the standardize object: it is a preprocessing object. Other preprocessing objects include quantize and scale. You need to chain them with a recognizer object like &quot;baseline&quot;. See examples below.</p>\r\n<p>Even though the syntax of the code is inspired by the Spider, there may not be full compatibility with the Spider because the Spider code uses the old type of Matlab object and the sample code of this challenge is based on the new type of objects. One important\r\n difference is also that the data objects are handles. Hence, when you copy them, you do not make a real copy. Also, when you call methods that perform calculations of the data objects, the data get modified. E.g. train(standardize, D) ==&gt; this will modify\r\n D. This is more efficient memory-wise but may have side effects.</p>\r\n<p>Let me know if you have further questions.</p>\r\n<p>Isabelle</p>\r\n<p>=========<br>\r\nExample 1<br>\r\n=========</p>\r\n<p>% Set path<br>\r\npublic_data_dir ='/Users/isabelle/Documents/Projects/Challenges/CauseEffectPairs//FormatData/CEfinal/PUBLIC/';<br>\r\ncode_dir='/Users/isabelle/Documents/Projects/Challenges/CauseEffectPairs/Sample_code/Code';<br>\r\naddpath(genpath(code_dir));</p>\r\n<p>% Load data<br>\r\nD=CEdata('CEfinal', 'train', public_data_dir);</p>\r\n<p>% Data browser<br>\r\nbrowse(D);</p>\r\n<p>% Baseline score<br>\r\nresu=test(baseline, D);<br>\r\nCEscore(resu)</p>\r\n<p>% D is a handle, the preprocessing changes the data; reload if you try <br>\r\n% different things<br>\r\nresu=test(chain({standardize, baseline}), D); <br>\r\n% or resu=test(chain({quantize('num=10000'), baseline}), D); <br>\r\n% or resu=test(chain({standardize, quantize('num=10000'), baseline}), D); <br>\r\nCEscore(resu)</p>\r\n<p>=========<br>\r\nExample 2<br>\r\n=========</p>\r\n<p>You can create an object @basic_example, code below, it inherits from chain. Then at the prompt type:<br>\r\n&gt; resu=test(basic_example('num=10000'), D);<br>\r\n&gt; CEscore(resu)<br>\r\nYou can then use the object @basic_example with CEmain.m.</p>\r\n<p>%==========================================================================<br>\r\n% BASIC_EXAMPLE <br>\r\n%==========================================================================<br>\r\n% a=basic_example(hyper) <br>\r\n%<br>\r\n% Usage:<br>\r\n% mymodel = basic_example('num=5000'); % num is the parameter of quantize<br>\r\n% [~, trained_model] = train(mymodel, Dtr); % train on some training data Dtr<br>\r\n% resu = test(trained_model, Dte);</p>\r\n<p>%Isabelle Guyon -- isabelle@clopinet.com -- July 2013</p>\r\n<p>classdef basic_example &lt; chain<br>\r\n&nbsp; methods<br>\r\n&nbsp; &nbsp; function a = basic_example(hyper) <br>\r\n&nbsp; &nbsp; &nbsp; if nargin&lt;1, hyper=[]; end<br>\r\n&nbsp; &nbsp; &nbsp; a=a@chain({standardize, quantize(hyper), baseline});<br>\r\n&nbsp; &nbsp; &nbsp;end <br>\r\n&nbsp; end %methods<br>\r\nend %classdef</p>",
      "rawMarkdown": "",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 26704,
      "author_name": "iguyon",
      "author_url": "",
      "post_date": "07/05/2013 08:03:16",
      "content": "<p>Dear Mehreen,</p>\r\n<p>You will find the Matlab version at: http://www.causality.inf.ethz.ch/CEdata/CEfinal_matlab/<br>\r\nI was hesitating to provide it because when changes are made to the class @CEpair, it does not load properly anymore, hence it may not be backward compatible with previous sample code versions. What always works is to use the text csv version of the data. The\r\n first time you run CEmain or CEbrowse, the code loads the data from the text version and saves it in Matlab format for faster re-loading.</p>\r\n<p>Regarding the standardize object: it is a preprocessing object. Other preprocessing objects include quantize and scale. You need to chain them with a recognizer object like &quot;baseline&quot;. See examples below.</p>\r\n<p>Even though the syntax of the code is inspired by the Spider, there may not be full compatibility with the Spider because the Spider code uses the old type of Matlab object and the sample code of this challenge is based on the new type of objects. One important\r\n difference is also that the data objects are handles. Hence, when you copy them, you do not make a real copy. Also, when you call methods that perform calculations of the data objects, the data get modified. E.g. train(standardize, D) ==&gt; this will modify\r\n D. This is more efficient memory-wise but may have side effects.</p>\r\n<p>Let me know if you have further questions.</p>\r\n<p>Isabelle</p>\r\n<p>=========<br>\r\nExample 1<br>\r\n=========</p>\r\n<p>% Set path<br>\r\npublic_data_dir ='/Users/isabelle/Documents/Projects/Challenges/CauseEffectPairs//FormatData/CEfinal/PUBLIC/';<br>\r\ncode_dir='/Users/isabelle/Documents/Projects/Challenges/CauseEffectPairs/Sample_code/Code';<br>\r\naddpath(genpath(code_dir));</p>\r\n<p>% Load data<br>\r\nD=CEdata('CEfinal', 'train', public_data_dir);</p>\r\n<p>% Data browser<br>\r\nbrowse(D);</p>\r\n<p>% Baseline score<br>\r\nresu=test(baseline, D);<br>\r\nCEscore(resu)</p>\r\n<p>% D is a handle, the preprocessing changes the data; reload if you try <br>\r\n% different things<br>\r\nresu=test(chain({standardize, baseline}), D); <br>\r\n% or resu=test(chain({quantize('num=10000'), baseline}), D); <br>\r\n% or resu=test(chain({standardize, quantize('num=10000'), baseline}), D); <br>\r\nCEscore(resu)</p>\r\n<p>=========<br>\r\nExample 2<br>\r\n=========</p>\r\n<p>You can create an object @basic_example, code below, it inherits from chain. Then at the prompt type:<br>\r\n&gt; resu=test(basic_example('num=10000'), D);<br>\r\n&gt; CEscore(resu)<br>\r\nYou can then use the object @basic_example with CEmain.m.</p>\r\n<p>%==========================================================================<br>\r\n% BASIC_EXAMPLE <br>\r\n%==========================================================================<br>\r\n% a=basic_example(hyper) <br>\r\n%<br>\r\n% Usage:<br>\r\n% mymodel = basic_example('num=5000'); % num is the parameter of quantize<br>\r\n% [~, trained_model] = train(mymodel, Dtr); % train on some training data Dtr<br>\r\n% resu = test(trained_model, Dte);</p>\r\n<p>%Isabelle Guyon -- isabelle@clopinet.com -- July 2013</p>\r\n<p>classdef basic_example &lt; chain<br>\r\n&nbsp; methods<br>\r\n&nbsp; &nbsp; function a = basic_example(hyper) <br>\r\n&nbsp; &nbsp; &nbsp; if nargin&lt;1, hyper=[]; end<br>\r\n&nbsp; &nbsp; &nbsp; a=a@chain({standardize, quantize(hyper), baseline});<br>\r\n&nbsp; &nbsp; &nbsp;end <br>\r\n&nbsp; end %methods<br>\r\nend %classdef</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "26627": "",
    "26704": ""
  },
  "source": "meta"
}