Skip to content

SupervisedModel

A model for supervised learning tasks.

Inheritors:

Stub code in SupervisedModel.sdsstub

class SupervisedModel {
    /**
     * Whether the model is fitted.
     */
    @PythonName("is_fitted") attr isFitted: Boolean

    /**
     * Create a copy of this model and fit it with the given training data.
     *
     * **Note:** This model is not modified.
     *
     * @param trainingSet The training data containing the features and target.
     *
     * @result fittedModel The fitted model.
     */
    @Pure
    fun fit(
        @PythonName("training_set") trainingSet: TabularDataset
    ) -> fittedModel: SupervisedModel

    /**
     * Predict the target values on the given dataset.
     *
     * **Note:** The model must be fitted.
     *
     * @param dataset The dataset containing at least the features.
     *
     * @result prediction The given dataset with an additional column for the predicted target values.
     */
    @Pure
    fun predict(
        dataset: union<Table, TabularDataset>
    ) -> prediction: TabularDataset

    /**
     * Return the names of the feature columns.
     *
     * **Note:** The model must be fitted.
     *
     * @result featureNames The names of the feature columns.
     */
    @Pure
    @PythonName("get_feature_names")
    fun getFeatureNames() -> featureNames: List<String>

    /**
     * Return the schema of the feature columns.
     *
     * **Note:** The model must be fitted.
     *
     * @result featureSchema The schema of the feature columns.
     */
    @Pure
    @PythonName("get_features_schema")
    fun getFeaturesSchema() -> featureSchema: Schema

    /**
     * Return the name of the target column.
     *
     * **Note:** The model must be fitted.
     *
     * @result targetName The name of the target column.
     */
    @Pure
    @PythonName("get_target_name")
    fun getTargetName() -> targetName: String

    /**
     * Return the type of the target column.
     *
     * **Note:** The model must be fitted.
     *
     * @result targetType The type of the target column.
     */
    @Pure
    @PythonName("get_target_type")
    fun getTargetType() -> targetType: ColumnType
}

isFitted

Whether the model is fitted.

Type: Boolean

fit

Create a copy of this model and fit it with the given training data.

Note: This model is not modified.

Parameters:

Name Type Description Default
trainingSet TabularDataset The training data containing the features and target. -

Results:

Name Type Description
fittedModel SupervisedModel The fitted model.
Stub code in SupervisedModel.sdsstub

@Pure
fun fit(
    @PythonName("training_set") trainingSet: TabularDataset
) -> fittedModel: SupervisedModel

getFeatureNames

Return the names of the feature columns.

Note: The model must be fitted.

Results:

Name Type Description
featureNames List<String> The names of the feature columns.
Stub code in SupervisedModel.sdsstub

@Pure
@PythonName("get_feature_names")
fun getFeatureNames() -> featureNames: List<String>

getFeaturesSchema

Return the schema of the feature columns.

Note: The model must be fitted.

Results:

Name Type Description
featureSchema Schema The schema of the feature columns.
Stub code in SupervisedModel.sdsstub

@Pure
@PythonName("get_features_schema")
fun getFeaturesSchema() -> featureSchema: Schema

getTargetName

Return the name of the target column.

Note: The model must be fitted.

Results:

Name Type Description
targetName String The name of the target column.
Stub code in SupervisedModel.sdsstub

@Pure
@PythonName("get_target_name")
fun getTargetName() -> targetName: String

getTargetType

Return the type of the target column.

Note: The model must be fitted.

Results:

Name Type Description
targetType ColumnType The type of the target column.
Stub code in SupervisedModel.sdsstub

@Pure
@PythonName("get_target_type")
fun getTargetType() -> targetType: ColumnType

predict

Predict the target values on the given dataset.

Note: The model must be fitted.

Parameters:

Name Type Description Default
dataset union<Table, TabularDataset> The dataset containing at least the features. -

Results:

Name Type Description
prediction TabularDataset The given dataset with an additional column for the predicted target values.
Stub code in SupervisedModel.sdsstub

@Pure
fun predict(
    dataset: union<Table, TabularDataset>
) -> prediction: TabularDataset