{"action":"closed","issue":{"url":"https://api.github.com/repos/yllieth/predicsis_ml_sdk-javascript/issues/19","labels_url":"https://api.github.com/repos/yllieth/predicsis_ml_sdk-javascript/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/yllieth/predicsis_ml_sdk-javascript/issues/19/comments","events_url":"https://api.github.com/repos/yllieth/predicsis_ml_sdk-javascript/issues/19/events","html_url":"https://github.com/yllieth/predicsis_ml_sdk-javascript/issues/19","id":105407761,"number":19,"title":"Error while retreiving train subset","user":{"login":"yllieth","id":1174557,"avatar_url":"https://avatars.githubusercontent.com/u/1174557?v=3","gravatar_id":"","url":"https://api.github.com/users/yllieth","html_url":"https://github.com/yllieth","followers_url":"https://api.github.com/users/yllieth/followers","following_url":"https://api.github.com/users/yllieth/following{/other_user}","gists_url":"https://api.github.com/users/yllieth/gists{/gist_id}","starred_url":"https://api.github.com/users/yllieth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yllieth/subscriptions","organizations_url":"https://api.github.com/users/yllieth/orgs","repos_url":"https://api.github.com/users/yllieth/repos","events_url":"https://api.github.com/users/yllieth/events{/privacy}","received_events_url":"https://api.github.com/users/yllieth/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/yllieth/predicsis_ml_sdk-javascript/labels/2%20-%20Working","name":"2 - Working","color":"CCCCCC"},{"url":"https://api.github.com/repos/yllieth/predicsis_ml_sdk-javascript/labels/bug%20/%20Fix","name":"bug / Fix","color":"eb6420"},{"url":"https://api.github.com/repos/yllieth/predicsis_ml_sdk-javascript/labels/High%20priority","name":"High priority","color":"e11d21"}],"state":"closed","locked":false,"assignee":{"login":"yllieth","id":1174557,"avatar_url":"https://avatars.githubusercontent.com/u/1174557?v=3","gravatar_id":"","url":"https://api.github.com/users/yllieth","html_url":"https://github.com/yllieth","followers_url":"https://api.github.com/users/yllieth/followers","following_url":"https://api.github.com/users/yllieth/following{/other_user}","gists_url":"https://api.github.com/users/yllieth/gists{/gist_id}","starred_url":"https://api.github.com/users/yllieth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yllieth/subscriptions","organizations_url":"https://api.github.com/users/yllieth/orgs","repos_url":"https://api.github.com/users/yllieth/repos","events_url":"https://api.github.com/users/yllieth/events{/privacy}","received_events_url":"https://api.github.com/users/yllieth/received_events","type":"User","site_admin":false},"milestone":null,"comments":0,"created_at":"2015-09-08T15:36:45Z","updated_at":"2015-09-14T14:39:15Z","closed_at":"2015-09-14T14:39:15Z","body":"Here is the code of the `getChildren()` function:\r\n\r\n```javascript\r\n// /lib/models/Datasets.js\r\n\r\nthis.getChildren = function(id) {\r\n  return self.get(id)\r\n    .then(function(originalDataset) {\r\n      return self.all(originalDataset.children_dataset_ids);\r\n    })\r\n    .then(function(subsets) {\r\n      return subsets.reduce(function(memo, child) {\r\n        if (child.sampling > 0) {\r\n          memo.train = child;\r\n        } else {\r\n          memo.test = child;\r\n        }\r\n\r\n        return memo;\r\n      }, {});\r\n   });\r\n};\r\n```\r\n\r\nWhen datasets have only 2 splits, this functions rocks, but the `subsets` array may contains multiple trains/test subsets et only checking `child.sampling > 0` is not enough. Indeed, when there is more than one train subset (where sampling > 0), this function will return the first one. \r\n\r\n<!---\r\n@huboard:{\"order\":1.603737473487854e-06,\"milestone_order\":19,\"custom_state\":\"\"}\n-->\r\n"}}