Skip to content

Commit 61dcc35

Browse files
Release v1.24.3
1 parent 1fdeeee commit 61dcc35

8 files changed

Lines changed: 509 additions & 0 deletions

sdk/studio/sdk/api/rawDataApi.ts

Lines changed: 293 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ import { CropSampleRequest } from '../model/cropSampleRequest';
3737
import { CropSampleResponse } from '../model/cropSampleResponse';
3838
import { DataExplorerPredictionsResponse } from '../model/dataExplorerPredictionsResponse';
3939
import { DataExplorerSettings } from '../model/dataExplorerSettings';
40+
import { DatasetStratificationOptions } from '../model/datasetStratificationOptions';
41+
import { DatasetStratificationPreviewResponse } from '../model/datasetStratificationPreviewResponse';
42+
4043
import { EditSampleLabelRequest } from '../model/editSampleLabelRequest';
4144
import { FindSegmentSampleRequest } from '../model/findSegmentSampleRequest';
4245
import { FindSegmentSampleResponse } from '../model/findSegmentSampleResponse';
@@ -5684,6 +5687,96 @@ export class RawDataApi {
56845687
);
56855688
}
56865689

5690+
/**
5691+
* Returns the results of a previously requested stratification preview job. This endpoint is used to retrieve the results after a stratification preview job has been started.
5692+
* @summary Get stratify preview results
5693+
* @param projectId Project ID
5694+
*/
5695+
public async getStratifyPreviewResults (projectId: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<DatasetStratificationPreviewResponse> {
5696+
const localVarPath = this.basePath + '/api/{projectId}/get-stratify-preview-results'
5697+
.replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
5698+
let localVarQueryParameters: Record<string, string> = {};
5699+
let localVarHeaderParams: Record<string, string> = {
5700+
'User-Agent': 'edgeimpulse-api nodejs',
5701+
'Content-Type': 'application/json',
5702+
...this.defaultHeaders,
5703+
};
5704+
const produces = ['application/json'];
5705+
// give precedence to 'application/json'
5706+
if (produces.indexOf('application/json') >= 0) {
5707+
localVarHeaderParams.Accept = 'application/json';
5708+
} else {
5709+
localVarHeaderParams.Accept = produces.join(',');
5710+
}
5711+
let localVarFormParams: Record<string, string> | FormData | UndiciFormData | undefined;
5712+
5713+
// verify required parameter 'projectId' is not null or undefined
5714+
5715+
5716+
if (projectId === null || projectId === undefined) {
5717+
throw new Error('Required parameter projectId was null or undefined when calling getStratifyPreviewResults.');
5718+
}
5719+
5720+
localVarHeaderParams = {
5721+
...localVarHeaderParams,
5722+
...options.headers,
5723+
...this.opts.extraHeaders,
5724+
};
5725+
5726+
const queryString = Object.entries(localVarQueryParameters)
5727+
.filter(([, value]) => value !== undefined)
5728+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
5729+
.join('&');
5730+
5731+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
5732+
let localVarRequestOptions: RequestOptionsType = {
5733+
method: 'GET',
5734+
headers: { ...localVarHeaderParams },
5735+
};
5736+
5737+
5738+
let requestOptions = localVarRequestOptions;
5739+
let url = localVarUrl;
5740+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
5741+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
5742+
url = auth_ApiKeyAuthentication.url;
5743+
5744+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
5745+
requestOptions = auth_JWTAuthentication.requestOptions;
5746+
url = auth_JWTAuthentication.url;
5747+
5748+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
5749+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
5750+
url = auth_JWTHttpHeaderAuthentication.url;
5751+
5752+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
5753+
requestOptions = auth_OAuth2.requestOptions;
5754+
url = auth_OAuth2.url;
5755+
5756+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
5757+
requestOptions = authDefault.requestOptions;
5758+
url = authDefault.url;
5759+
5760+
if (localVarFormParams) {
5761+
delete requestOptions.headers['Content-Type'];
5762+
if (localVarFormParams instanceof FormData) {
5763+
// FormData: fetch will handle Content-Type automatically.
5764+
requestOptions.body = localVarFormParams;
5765+
}
5766+
else if (Object.keys(localVarFormParams).length > 0) {
5767+
// URL-encoded form
5768+
requestOptions.body = new URLSearchParams(localVarFormParams as Record<string, string>).toString();
5769+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
5770+
}
5771+
}
5772+
5773+
const response = await fetch(url, requestOptions);
5774+
return this.handleResponse(
5775+
response,
5776+
'DatasetStratificationPreviewResponse'
5777+
);
5778+
}
5779+
56875780
/**
56885781
* Get the original, uncropped, downsampled data.
56895782
* @summary Get the original downsampled data
@@ -7963,6 +8056,206 @@ export class RawDataApi {
79638056
);
79648057
}
79658058

8059+
/**
8060+
* Performs a deterministic, in-place stratified split of the project\'s dataset into \"training\" and \"testing\" sets, based on the chosen stratification options. Stratification can use the label, one or more metadata keys, or both as a composite group. This is a deterministic process based on the hash of the name of the data. Returns immediately on small datasets, or starts a job on larger datasets. For example: { \"stratifyByLabel\": true, \"metadataKeys\": [\"site\", \"scanner\"], \"excludeDisabledSamples\": false, \"splitRatio\": 0.8 } With these options, samples are grouped by the combination of label, site, and scanner. Within each group, 80% are set to \"training\" and the rest to \"testing\".
8061+
* @summary Stratify dataset
8062+
* @param projectId Project ID
8063+
* @param datasetStratificationOptions
8064+
*/
8065+
public async stratifyDataset (projectId: number, datasetStratificationOptions: DatasetStratificationOptions, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<GenericApiResponse | StartJobResponse> {
8066+
const localVarPath = this.basePath + '/api/{projectId}/stratify'
8067+
.replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
8068+
let localVarQueryParameters: Record<string, string> = {};
8069+
let localVarHeaderParams: Record<string, string> = {
8070+
'User-Agent': 'edgeimpulse-api nodejs',
8071+
'Content-Type': 'application/json',
8072+
...this.defaultHeaders,
8073+
};
8074+
const produces = ['application/json'];
8075+
// give precedence to 'application/json'
8076+
if (produces.indexOf('application/json') >= 0) {
8077+
localVarHeaderParams.Accept = 'application/json';
8078+
} else {
8079+
localVarHeaderParams.Accept = produces.join(',');
8080+
}
8081+
let localVarFormParams: Record<string, string> | FormData | UndiciFormData | undefined;
8082+
8083+
// verify required parameter 'projectId' is not null or undefined
8084+
8085+
8086+
if (projectId === null || projectId === undefined) {
8087+
throw new Error('Required parameter projectId was null or undefined when calling stratifyDataset.');
8088+
}
8089+
8090+
// verify required parameter 'datasetStratificationOptions' is not null or undefined
8091+
8092+
8093+
if (datasetStratificationOptions === null || datasetStratificationOptions === undefined) {
8094+
throw new Error('Required parameter datasetStratificationOptions was null or undefined when calling stratifyDataset.');
8095+
}
8096+
8097+
localVarHeaderParams = {
8098+
...localVarHeaderParams,
8099+
...options.headers,
8100+
...this.opts.extraHeaders,
8101+
};
8102+
8103+
const queryString = Object.entries(localVarQueryParameters)
8104+
.filter(([, value]) => value !== undefined)
8105+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
8106+
.join('&');
8107+
8108+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
8109+
let localVarRequestOptions: RequestOptionsType = {
8110+
method: 'POST',
8111+
headers: { ...localVarHeaderParams },
8112+
};
8113+
8114+
localVarRequestOptions.body = JSON.stringify(ObjectSerializer.serialize(datasetStratificationOptions, "DatasetStratificationOptions"));
8115+
8116+
8117+
let requestOptions = localVarRequestOptions;
8118+
let url = localVarUrl;
8119+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
8120+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
8121+
url = auth_ApiKeyAuthentication.url;
8122+
8123+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
8124+
requestOptions = auth_JWTAuthentication.requestOptions;
8125+
url = auth_JWTAuthentication.url;
8126+
8127+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
8128+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
8129+
url = auth_JWTHttpHeaderAuthentication.url;
8130+
8131+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
8132+
requestOptions = auth_OAuth2.requestOptions;
8133+
url = auth_OAuth2.url;
8134+
8135+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
8136+
requestOptions = authDefault.requestOptions;
8137+
url = authDefault.url;
8138+
8139+
if (localVarFormParams) {
8140+
delete requestOptions.headers['Content-Type'];
8141+
if (localVarFormParams instanceof FormData) {
8142+
// FormData: fetch will handle Content-Type automatically.
8143+
requestOptions.body = localVarFormParams;
8144+
}
8145+
else if (Object.keys(localVarFormParams).length > 0) {
8146+
// URL-encoded form
8147+
requestOptions.body = new URLSearchParams(localVarFormParams as Record<string, string>).toString();
8148+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
8149+
}
8150+
}
8151+
8152+
const response = await fetch(url, requestOptions);
8153+
return this.handleResponse(
8154+
response,
8155+
'GenericApiResponse | StartJobResponse'
8156+
);
8157+
}
8158+
8159+
/**
8160+
* Returns a preview of how the project\'s dataset would be balanced if the current stratification options were applied. For each group (composite of label and/or metadata keys), shows the number and percentage of samples that would be assigned to each split (\"training\"/\"testing\"). This does not update the dataset, only provides a summary. Returns immediately on small datasets, or starts a job on larger datasets.
8161+
* @summary Stratify dataset preview
8162+
* @param projectId Project ID
8163+
* @param datasetStratificationOptions
8164+
*/
8165+
public async stratifyDatasetPreview (projectId: number, datasetStratificationOptions: DatasetStratificationOptions, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<DatasetStratificationPreviewResponse | StartJobResponse> {
8166+
const localVarPath = this.basePath + '/api/{projectId}/stratify-preview'
8167+
.replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
8168+
let localVarQueryParameters: Record<string, string> = {};
8169+
let localVarHeaderParams: Record<string, string> = {
8170+
'User-Agent': 'edgeimpulse-api nodejs',
8171+
'Content-Type': 'application/json',
8172+
...this.defaultHeaders,
8173+
};
8174+
const produces = ['application/json'];
8175+
// give precedence to 'application/json'
8176+
if (produces.indexOf('application/json') >= 0) {
8177+
localVarHeaderParams.Accept = 'application/json';
8178+
} else {
8179+
localVarHeaderParams.Accept = produces.join(',');
8180+
}
8181+
let localVarFormParams: Record<string, string> | FormData | UndiciFormData | undefined;
8182+
8183+
// verify required parameter 'projectId' is not null or undefined
8184+
8185+
8186+
if (projectId === null || projectId === undefined) {
8187+
throw new Error('Required parameter projectId was null or undefined when calling stratifyDatasetPreview.');
8188+
}
8189+
8190+
// verify required parameter 'datasetStratificationOptions' is not null or undefined
8191+
8192+
8193+
if (datasetStratificationOptions === null || datasetStratificationOptions === undefined) {
8194+
throw new Error('Required parameter datasetStratificationOptions was null or undefined when calling stratifyDatasetPreview.');
8195+
}
8196+
8197+
localVarHeaderParams = {
8198+
...localVarHeaderParams,
8199+
...options.headers,
8200+
...this.opts.extraHeaders,
8201+
};
8202+
8203+
const queryString = Object.entries(localVarQueryParameters)
8204+
.filter(([, value]) => value !== undefined)
8205+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
8206+
.join('&');
8207+
8208+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
8209+
let localVarRequestOptions: RequestOptionsType = {
8210+
method: 'POST',
8211+
headers: { ...localVarHeaderParams },
8212+
};
8213+
8214+
localVarRequestOptions.body = JSON.stringify(ObjectSerializer.serialize(datasetStratificationOptions, "DatasetStratificationOptions"));
8215+
8216+
8217+
let requestOptions = localVarRequestOptions;
8218+
let url = localVarUrl;
8219+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
8220+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
8221+
url = auth_ApiKeyAuthentication.url;
8222+
8223+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
8224+
requestOptions = auth_JWTAuthentication.requestOptions;
8225+
url = auth_JWTAuthentication.url;
8226+
8227+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
8228+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
8229+
url = auth_JWTHttpHeaderAuthentication.url;
8230+
8231+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
8232+
requestOptions = auth_OAuth2.requestOptions;
8233+
url = auth_OAuth2.url;
8234+
8235+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
8236+
requestOptions = authDefault.requestOptions;
8237+
url = authDefault.url;
8238+
8239+
if (localVarFormParams) {
8240+
delete requestOptions.headers['Content-Type'];
8241+
if (localVarFormParams instanceof FormData) {
8242+
// FormData: fetch will handle Content-Type automatically.
8243+
requestOptions.body = localVarFormParams;
8244+
}
8245+
else if (Object.keys(localVarFormParams).length > 0) {
8246+
// URL-encoded form
8247+
requestOptions.body = new URLSearchParams(localVarFormParams as Record<string, string>).toString();
8248+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
8249+
}
8250+
}
8251+
8252+
const response = await fetch(url, requestOptions);
8253+
return this.handleResponse(
8254+
response,
8255+
'DatasetStratificationPreviewResponse | StartJobResponse'
8256+
);
8257+
}
8258+
79668259
/**
79678260
* Track objects between two samples. Source sample should have bounding boxes set.
79688261
* @summary Track objects
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/**
2+
* Edge Impulse API
3+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4+
*
5+
* The version of the OpenAPI document: 1.0.0
6+
*
7+
*
8+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9+
* https://openapi-generator.tech
10+
* Do not edit the class manually.
11+
*/
12+
13+
14+
export class DatasetStratificationOptions {
15+
/**
16+
* Proportion of the dataset to use for training. The remainder will be used for testing. For example, a value of 0.8 means 80% training, 20% testing.
17+
*/
18+
'splitRatio': number;
19+
/**
20+
* Whether to stratify by label. If true, the label column will be used for stratification combined with metadataKeys. If false, only metadataKeys will be used.
21+
*/
22+
'stratifyByLabel': boolean;
23+
/**
24+
* List of metadata keys to use for stratification. If more than one, they will be combined into composite strata. If stratifyByLabel is true, the label column will be used as well.
25+
*/
26+
'metadataKeys': Array<string>;
27+
/**
28+
* Whether to exclude samples that are marked as disabled.
29+
*/
30+
'excludeDisabledSamples'?: boolean;
31+
32+
static discriminator: string | undefined = undefined;
33+
34+
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
35+
{
36+
"name": "splitRatio",
37+
"baseName": "splitRatio",
38+
"type": "number"
39+
},
40+
{
41+
"name": "stratifyByLabel",
42+
"baseName": "stratifyByLabel",
43+
"type": "boolean"
44+
},
45+
{
46+
"name": "metadataKeys",
47+
"baseName": "metadataKeys",
48+
"type": "Array<string>"
49+
},
50+
{
51+
"name": "excludeDisabledSamples",
52+
"baseName": "excludeDisabledSamples",
53+
"type": "boolean"
54+
} ];
55+
56+
static getAttributeTypeMap() {
57+
return DatasetStratificationOptions.attributeTypeMap;
58+
}
59+
}
60+

0 commit comments

Comments
 (0)