Skip to content

Commit 6e5a774

Browse files
committed
add datasetHelper.isScore method
1 parent 60ec16e commit 6e5a774

26 files changed

+183
-122
lines changed

dist/predicsis-jsSDK.js

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ angular
163163
* }
164164
* </pre>
165165
*
166-
* <h3>Splitted learning dataset -> learned part</h3>
166+
* <h3>Splitted learning dataset -> learned part (see {@link predicsis.jsSDK.helpers.datasetHelper#methods_istrainpart datasetHelper.isTrainPart(Dataset dataset)})</h3>
167167
* <pre>
168168
* {
169169
* ...
@@ -176,7 +176,7 @@ angular
176176
* }
177177
* </pre>
178178
*
179-
* <h3>Splitted learning dataset -> tested part</h3>
179+
* <h3>Splitted learning dataset -> tested part (see {@link predicsis.jsSDK.helpers.datasetHelper#methods_istestpart datasetHelper.isTestPart(Dataset dataset)})</h3>
180180
* <pre>
181181
* {
182182
* ...
@@ -216,7 +216,7 @@ angular
216216
* }
217217
* </pre>
218218
*
219-
* <h3>Scoreset</h3>
219+
* <h3>Scoreset (see {@link predicsis.jsSDK.helpers.datasetHelper#methods_isScore datasetHelper.isScore(Dataset dataset)})</h3>
220220
* <pre>
221221
* {
222222
* ...
@@ -226,6 +226,8 @@ angular
226226
* ...
227227
* }
228228
* </pre>
229+
*
230+
* Please also note that there is no distinction between a learning dataset and a scoring dataset.
229231
*/
230232
angular
231233
.module('predicsis.jsSDK.models')
@@ -2626,7 +2628,7 @@ angular
26262628
* @return {Boolean} <kbd>true</kbd> / <kbd>false</kbd>
26272629
*/
26282630
this.isChild = function(dataset) {
2629-
return Boolean(dataset.parant_dataset_id !== null);
2631+
return Boolean(dataset.parent_dataset_id !== null);
26302632
};
26312633

26322634
/**
@@ -2667,6 +2669,28 @@ angular
26672669
return Boolean(dataset.header !== null) && Boolean(dataset.separator !== null)
26682670
};
26692671

2672+
/**
2673+
* @ngdoc function
2674+
* @methodOf predicsis.jsSDK.helpers.datasetHelper
2675+
* @name isScore
2676+
* @description Tells if a dataset is the result of a score.
2677+
* A score result is identified by the following rules:
2678+
* <ul>
2679+
* <li><code>dataset.source_ids.length === 0</code></li>
2680+
* <li><code>dataset.main_modality !== null</code></li>
2681+
* <li><code>dataset.classifier !== null</code></li>
2682+
* <li><code>dataset.dataset_id !== null</code></li>
2683+
* </ul>
2684+
* @param {Object} dataset Instance of {@link predicsis.jsSDK.models.Datasets dataset}
2685+
* @return {Boolean} <kbd>true</kbd> / <kbd>false</kbd>
2686+
*/
2687+
this.isScore = function(dataset) {
2688+
return Boolean(dataset.source_ids.length === 0)
2689+
&& Boolean(dataset.main_modality !== null)
2690+
&& Boolean(dataset.classifier !== null)
2691+
&& Boolean(dataset.dataset_id !== null);
2692+
};
2693+
26702694
});
26712695

26722696
/**

dist/predicsis-jsSDK.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/predicsis-jsSDK.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/js/docs-setup.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ NG_DOCS={
1010
"type": "service",
1111
"moduleName": "predicsis.jsSDK.helpers",
1212
"shortDescription": "Give some utility method on a dataset object",
13-
"keywords": "api child children considered dataset datasethelper datasets defined function haschildren header helpers instance ischil isformatted isparent istestpart istrainpart jssdk method models negative null object orphan parent positive predicsis sampling separator service subset subsets tells test train utility"
13+
"keywords": "api child children classifier considered dataset dataset_id datasethelper datasets defined function haschildren header helpers identified instance ischil isformatted isparent isscore istestpart istrainpart jssdk length main_modality method models negative null object orphan parent positive predicsis result rules sampling score separator service source_ids subset subsets tells test train utility"
1414
},
1515
{
1616
"section": "api",
@@ -51,7 +51,7 @@ NG_DOCS={
5151
"type": "service",
5252
"moduleName": "predicsis.jsSDK.models",
5353
"shortDescription": "",
54-
"keywords": "$classifier_id $dataset_id $header $main_modality $modalities_set_id $name $q $separator api async awesome badge build changes children_dataset_ids class classifier_id colspan create created_at creation csv data_file datafile dataset dataset_id dataset_name datasets delete description destroy dictionary dictionary_ids differents documentation escape examples existing fetch file filename filenames function generated_dictionaries_ids generation getchildren going header https identifier job_ids jobshelper jssdk learned learned_learning_dataset learning learning-dataset learning_dataset learning_dataset_with_model list main_modality method methods_all methods_create methods_delete methods_get methods_getchildren methods_split methods_update modalities_set_id model models named nb_of_lines null original original_source_id paradox parameters params parent_dataset_id parent_dictionary patch permanently post predicsis preview ratio remove removed request requested required requires restangular s3 s3_url sampling scoreset scoring_dataset separator service set single size source source_ids split string subset subsets tabulation test tested tested_learning_dataset testing train true type update updated updated_at upload url user_id view"
54+
"keywords": "$classifier_id $dataset_id $header $main_modality $modalities_set_id $name $q $separator api async awesome badge build changes children_dataset_ids class classifier_id colspan create created_at creation csv data_file datafile dataset dataset_id dataset_name datasethelper datasets delete description destroy dictionary dictionary_ids differents distinction documentation escape examples existing fetch file filename filenames function generated_dictionaries_ids generation getchildren going header helpers https identifier isscore istestpart istrainpart job_ids jobshelper jssdk learned learned_learning_dataset learning learning-dataset learning_dataset learning_dataset_with_model list main_modality method methods_all methods_create methods_delete methods_get methods_getchildren methods_isscore methods_istestpart methods_istrainpart methods_split methods_update modalities_set_id model models named nb_of_lines note null original original_source_id paradox parameters params parent_dataset_id parent_dictionary patch permanently post predicsis preview ratio remove removed request requested required requires restangular s3 s3_url sampling scoreset scoring scoring_dataset separator service set single size source source_ids split string subset subsets tabulation test tested tested_learning_dataset testing train true type update updated updated_at upload url user_id view"
5555
},
5656
{
5757
"section": "api",

docs/partials/api/predicsis.jsSDK.helpers.datasetHelper.html

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/edit/master/lib/helper/datasetHelper.js" class="improve-docs"><i class="icon-edit"> </i>Improve this doc</a><a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/blob/84e8fff/lib/helper/datasetHelper.js#L6" class="view-source"><i class="icon-eye-open"> </i>View source</a><h1><code ng:non-bindable="">datasetHelper</code>
1+
<a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/edit/master/lib/helper/datasetHelper.js" class="improve-docs"><i class="icon-edit"> </i>Improve this doc</a><a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/blob/d47b9e6/lib/helper/datasetHelper.js#L6" class="view-source"><i class="icon-eye-open"> </i>View source</a><h1><code ng:non-bindable="">datasetHelper</code>
22
<div><span class="hint">service in module <code ng:non-bindable="">predicsis.jsSDK.helpers</code>
33
</span>
44
</div>
@@ -7,40 +7,52 @@
77
<div class="description"><div class="predicsis-jssdk-helpers-datasethelper-page"><p>Give some utility method on a <a href="#/api/predicsis.jsSDK.models.Datasets">dataset</a> object</p>
88
</div></div>
99
<div class="member method"><h2 id="methods">Methods</h2>
10-
<ul class="methods"><li><a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/blob/84e8fff/lib/helper/datasetHelper.js#L18" class="view-source icon-eye-open"> </a><h3 id="methods_haschildren">hasChildren(dataset)</h3>
10+
<ul class="methods"><li><a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/blob/d47b9e6/lib/helper/datasetHelper.js#L18" class="view-source icon-eye-open"> </a><h3 id="methods_haschildren">hasChildren(dataset)</h3>
1111
<div class="haschildren"><div class="haschildren-page"><p>Tells if a dataset has subsets</p>
1212
</div><h5 id="methods_haschildren_parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>dataset</td><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="haschildren-page"><p>Instance of <a href="#/api/predicsis.jsSDK.models.Datasets">dataset</a></p>
1313
</div></td></tr></tbody></table><h5 id="methods_haschildren_returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-boolean">Boolean</a></td><td><div class="haschildren-page"><p><kbd>true</kbd> / <kbd>false</kbd></p>
1414
</div></td></tr></table></div>
1515
</li>
16-
<li><a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/blob/84e8fff/lib/helper/datasetHelper.js#L44" class="view-source icon-eye-open"> </a><h3 id="methods_ischil">isChil(dataset)</h3>
16+
<li><a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/blob/d47b9e6/lib/helper/datasetHelper.js#L44" class="view-source icon-eye-open"> </a><h3 id="methods_ischil">isChil(dataset)</h3>
1717
<div class="ischil"><div class="ischil-page"><p>Tells if a dataset is a child dataset
1818
<b>Note:</b> A dataset is considered as a child if it has a parent. There is no orphan among datasets!</p>
1919
</div><h5 id="methods_ischil_parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>dataset</td><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="ischil-page"><p>Instance of <a href="#/api/predicsis.jsSDK.models.Datasets">dataset</a></p>
2020
</div></td></tr></tbody></table><h5 id="methods_ischil_returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-boolean">Boolean</a></td><td><div class="ischil-page"><p><kbd>true</kbd> / <kbd>false</kbd></p>
2121
</div></td></tr></table></div>
2222
</li>
23-
<li><a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/blob/84e8fff/lib/helper/datasetHelper.js#L82" class="view-source icon-eye-open"> </a><h3 id="methods_isformatted">isFormatted(dataset)</h3>
23+
<li><a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/blob/d47b9e6/lib/helper/datasetHelper.js#L82" class="view-source icon-eye-open"> </a><h3 id="methods_isformatted">isFormatted(dataset)</h3>
2424
<div class="isformatted"><div class="isformatted-page"><p>Tells if a dataset has both header and separator defined.</p>
2525
</div><h5 id="methods_isformatted_parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>dataset</td><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="isformatted-page"><p>Instance of <a href="#/api/predicsis.jsSDK.models.Datasets">dataset</a></p>
2626
</div></td></tr></tbody></table><h5 id="methods_isformatted_returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-boolean">Boolean</a></td><td><div class="isformatted-page"><p><kbd>true</kbd> / <kbd>false</kbd></p>
2727
</div></td></tr></table></div>
2828
</li>
29-
<li><a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/blob/84e8fff/lib/helper/datasetHelper.js#L31" class="view-source icon-eye-open"> </a><h3 id="methods_isparent">isParent(dataset)</h3>
29+
<li><a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/blob/d47b9e6/lib/helper/datasetHelper.js#L31" class="view-source icon-eye-open"> </a><h3 id="methods_isparent">isParent(dataset)</h3>
3030
<div class="isparent"><div class="isparent-page"><p>Tells if a dataset is a parent dataset.
3131
<b>Note:</b> A parent may have any children, but its <kbd>parent_dataset_id</kbd> must be null</p>
3232
</div><h5 id="methods_isparent_parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>dataset</td><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="isparent-page"><p>Instance of <a href="#/api/predicsis.jsSDK.models.Datasets">dataset</a></p>
3333
</div></td></tr></tbody></table><h5 id="methods_isparent_returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-boolean">Boolean</a></td><td><div class="isparent-page"><p><kbd>true</kbd> / <kbd>false</kbd></p>
3434
</div></td></tr></table></div>
3535
</li>
36-
<li><a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/blob/84e8fff/lib/helper/datasetHelper.js#L70" class="view-source icon-eye-open"> </a><h3 id="methods_istestpart">isTestPart(dataset)</h3>
36+
<li><a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/blob/d47b9e6/lib/helper/datasetHelper.js#L101" class="view-source icon-eye-open"> </a><h3 id="methods_isscore">isScore(dataset)</h3>
37+
<div class="isscore"><div class="isscore-page"><p>Tells if a dataset is the result of a score.
38+
A score result is identified by the following rules:</p>
39+
<ul>
40+
<li><code>dataset.source_ids.length === 0</code></li>
41+
<li><code>dataset.main_modality !== null</code></li>
42+
<li><code>dataset.classifier !== null</code></li>
43+
<li><code>dataset.dataset_id !== null</code></li>
44+
</ul></div><h5 id="methods_isscore_parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>dataset</td><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="isscore-page"><p>Instance of <a href="#/api/predicsis.jsSDK.models.Datasets">dataset</a></p>
45+
</div></td></tr></tbody></table><h5 id="methods_isscore_returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-boolean">Boolean</a></td><td><div class="isscore-page"><p><kbd>true</kbd> / <kbd>false</kbd></p>
46+
</div></td></tr></table></div>
47+
</li>
48+
<li><a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/blob/d47b9e6/lib/helper/datasetHelper.js#L70" class="view-source icon-eye-open"> </a><h3 id="methods_istestpart">isTestPart(dataset)</h3>
3749
<div class="istestpart"><div class="istestpart-page"><p>Tells if a dataset is a train subset.
3850
<b>Note:</b> A dataset is considered as a test subset if its sampling is negative</p>
3951
</div><h5 id="methods_istestpart_parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>dataset</td><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="istestpart-page"><p>Instance of <a href="#/api/predicsis.jsSDK.models.Datasets">dataset</a></p>
4052
</div></td></tr></tbody></table><h5 id="methods_istestpart_returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-boolean">Boolean</a></td><td><div class="istestpart-page"><p><kbd>true</kbd> / <kbd>false</kbd></p>
4153
</div></td></tr></table></div>
4254
</li>
43-
<li><a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/blob/84e8fff/lib/helper/datasetHelper.js#L57" class="view-source icon-eye-open"> </a><h3 id="methods_istrainpart">isTrainPart(dataset)</h3>
55+
<li><a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/blob/d47b9e6/lib/helper/datasetHelper.js#L57" class="view-source icon-eye-open"> </a><h3 id="methods_istrainpart">isTrainPart(dataset)</h3>
4456
<div class="istrainpart"><div class="istrainpart-page"><p>Tells if a dataset is a train subset.
4557
<b>Note:</b> A dataset is considered as a train subset if its sampling is positive</p>
4658
</div><h5 id="methods_istrainpart_parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>dataset</td><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="istrainpart-page"><p>Instance of <a href="#/api/predicsis.jsSDK.models.Datasets">dataset</a></p>

docs/partials/api/predicsis.jsSDK.helpers.jobsHelper.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/edit/master/lib/helper/jobsHelper.js" class="improve-docs"><i class="icon-edit"> </i>Improve this doc</a><a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/blob/84e8fff/lib/helper/jobsHelper.js#L25" class="view-source"><i class="icon-eye-open"> </i>View source</a><h1><code ng:non-bindable="">jobsHelper</code>
1+
<a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/edit/master/lib/helper/jobsHelper.js" class="improve-docs"><i class="icon-edit"> </i>Improve this doc</a><a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/blob/d47b9e6/lib/helper/jobsHelper.js#L25" class="view-source"><i class="icon-eye-open"> </i>View source</a><h1><code ng:non-bindable="">jobsHelper</code>
22
<div><span class="hint">service in module <code ng:non-bindable="">predicsis.jsSDK.helpers</code>
33
</span>
44
</div>
55
</h1>
66
<div><div class="member method"><h2 id="methods">Methods</h2>
7-
<ul class="methods"><li><a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/blob/84e8fff/lib/helper/jobsHelper.js#L47" class="view-source icon-eye-open"> </a><h3 id="methods_listen">listen(jobId)</h3>
7+
<ul class="methods"><li><a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/blob/d47b9e6/lib/helper/jobsHelper.js#L47" class="view-source icon-eye-open"> </a><h3 id="methods_listen">listen(jobId)</h3>
88
<div class="listen"><div class="listen-page"><p>Active pulling on a job waiting for its termination</p>
99
<p><b>Important notes:</b></p>
1010
<ul>
@@ -14,7 +14,7 @@
1414
</div></td></tr></tbody></table><h5 id="methods_listen_returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-promise">Promise</a></td><td><div class="listen-page"><p>A promise resolved only when the job succeeds</p>
1515
</div></td></tr></table></div>
1616
</li>
17-
<li><a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/blob/84e8fff/lib/helper/jobsHelper.js#L120" class="view-source icon-eye-open"> </a><h3 id="methods_wrapasyncpromise">wrapAsyncPromise(promise)</h3>
17+
<li><a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/blob/d47b9e6/lib/helper/jobsHelper.js#L120" class="view-source icon-eye-open"> </a><h3 id="methods_wrapasyncpromise">wrapAsyncPromise(promise)</h3>
1818
<div class="wrapasyncpromise"><div class="wrapasyncpromise-page"><p>Transform an async promise into the same promise resolving only when job is completed</p>
1919
<p>Usage example:
2020
<pre class="prettyprint linenums">

docs/partials/api/predicsis.jsSDK.helpers.modelHelper.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/edit/master/lib/helper/modelHelper.js" class="improve-docs"><i class="icon-edit"> </i>Improve this doc</a><a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/blob/84e8fff/lib/helper/modelHelper.js#L13" class="view-source"><i class="icon-eye-open"> </i>View source</a><h1><code ng:non-bindable="">modelHelper</code>
1+
<a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/edit/master/lib/helper/modelHelper.js" class="improve-docs"><i class="icon-edit"> </i>Improve this doc</a><a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/blob/d47b9e6/lib/helper/modelHelper.js#L13" class="view-source"><i class="icon-eye-open"> </i>View source</a><h1><code ng:non-bindable="">modelHelper</code>
22
<div><span class="hint">service in module <code ng:non-bindable="">predicsis.jsSDK.helpers</code>
33
</span>
44
</div>
@@ -17,7 +17,7 @@
1717
</div></li>
1818
</ul>
1919
<div class="member method"><h2 id="methods">Methods</h2>
20-
<ul class="methods"><li><a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/blob/84e8fff/lib/helper/modelHelper.js#L62" class="view-source icon-eye-open"> </a><h3 id="methods_learn">learn(project)</h3>
20+
<ul class="methods"><li><a href="https://github.com/yllieth/predicsis_ml_sdk-javascript/blob/d47b9e6/lib/helper/modelHelper.js#L62" class="view-source icon-eye-open"> </a><h3 id="methods_learn">learn(project)</h3>
2121
<div class="learn"><div class="learn-page"><p>Learn a model</p>
2222
<p>This function wraps the following requests:</p>
2323
<ul>

0 commit comments

Comments
 (0)