Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/mindsDb/node_modules/mindsdb-js-sdk/dist/models/ drwxr-xr-x | |
| Viewing file: Select action/file-type: "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Model = void 0;
/**
* Represents a MindsDB model and all supported operations.
*/
var Model = /** @class */ (function () {
/**
* Constructor.
*
* @param {ModelsApiClient} modelsApiClient
* @param {string} name - Name of the model.
* @param {string} project - Name of the project the model belongs to.
* @param {string} targetColumn - Target column the model predicts.
* @param {string} status - Training status of the model.
* @param {UpdateStatus} updateStatus - Status of the model being up to date or not.
* @param {number} version - Model version.
* @param {number} [accuracy] - Accuracy of model predictions between 0 and 1.
* @param {string} [tag] - User assigned model tag.
*/
function Model(modelsApiClient, name, project, targetColumn, status, updateStatus, version, accuracy, tag, active) {
this.modelsApiClient = modelsApiClient;
this.name = name;
this.project = project;
this.targetColumn = targetColumn;
this.status = status;
this.updateStatus = updateStatus;
this.version = version;
this.accuracy = accuracy;
this.tag = tag;
this.active = active;
}
/**
* Describes the features of this model.
* @returns {Array<ModelFeatureDescription>} - All feature descriptions of the model.
*/
Model.prototype.describe = function () {
return this.modelsApiClient.describeModel(this.name, this.project, this.version);
};
/**
* Describes an attribute of this model.
* @param {string} attribute - The attribute to describe.
* @param {string} unique_id - Optional unique id to filter the accuracy by.
* @returns {Array<ModelDescribeAttribute>} - Result.
*/
Model.prototype.describeAttribute = function (attribute, unique_id) {
return this.modelsApiClient.describeModelAttribute(this.name, this.project, attribute, this.version, unique_id);
};
/**
* Deletes this model.
* @throws {MindsDbError} - Something went wrong deleting this model.
*/
Model.prototype.delete = function () {
return this.modelsApiClient.deleteModel(this.name, this.project);
};
/**
* Queries this model for a single prediction. For batch predictions, use batchQuery.
* @param {QueryOptions} options - Options to use when querying the model.
* @returns {Promise<ModelPrediction>} - The prediction result.
* @throws {MindsDbError} - Something went wrong querying this model.
*/
Model.prototype.query = function (options) {
return this.modelsApiClient.queryModel(this.name, this.version, this.targetColumn, this.project, options);
};
/**
* Queries this model for a batch prediction by joining with another data source.
* @param {BatchQueryOptions} options - Options to use when querying the model.
* @returns {Promise<Array<ModelPrediction>>} - All prediction results from the batch query.
* @throws {MindsDbError} - Something went wrong batch querying this model.
*/
Model.prototype.batchQuery = function (options) {
return this.modelsApiClient.batchQueryModel(this.name, this.version, this.targetColumn, this.project, options);
};
/**
* Retrains this model with the given options.
* @param {TrainingOptions} options - Options to use when retraining the model.
* @throws {MindsDbError} - Something went wrong retraining this model.
*/
Model.prototype.retrain = function (options) {
if (options) {
return this.modelsApiClient.retrainModel(this.name, this.targetColumn, this.project, options);
}
return this.modelsApiClient.retrainModel(this.name, this.targetColumn, this.project);
};
/**
* Partially finetune this model with the given options.
* @param {string} integration - Integration name for the training data (e.g. mindsdb).
* @param {FinetuneOptions} options - Options to use when finetuning the model.
* @throws {MindsDbError} - Something went wrong finetuning this model.
*/
Model.prototype.finetune = function (integration, options) {
return this.modelsApiClient.finetuneModel(this.name, this.project, options);
};
/**
* Creates a Model instance from a row returned from the MindsDB database.
* @param {ModelRow} obj - Data row from the MindsDB database.
* @param {ModelsApiClient} modelsApiClient - Models API client to use for executing model operations.
* @returns {Model} - New Model instance created from the given data.
*/
Model.fromModelRow = function (obj, modelsApiClient) {
return new Model(modelsApiClient, obj['name'], obj['project'], obj['predict'], obj['status'], obj['update_status'], obj['version'], obj['accuracy'], obj['tag'], obj['active']);
};
return Model;
}());
exports.Model = Model;
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0051 ]-- |