From 94aa21d1b5570c0fb1a2a87da91fcf4d43613511 Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Thu, 2 May 2024 11:25:20 +0200 Subject: [PATCH 01/14] feat: require latest runner version --- .../src/language/runtime/safe-ds-python-server.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/safe-ds-lang/src/language/runtime/safe-ds-python-server.ts b/packages/safe-ds-lang/src/language/runtime/safe-ds-python-server.ts index c276076d2..78c120ec3 100644 --- a/packages/safe-ds-lang/src/language/runtime/safe-ds-python-server.ts +++ b/packages/safe-ds-lang/src/language/runtime/safe-ds-python-server.ts @@ -16,8 +16,8 @@ import { UpdateRunnerNotification, } from '../communication/rpc.js'; -const LOWEST_SUPPORTED_RUNNER_VERSION = '0.13.0'; -const LOWEST_UNSUPPORTED_RUNNER_VERSION = '0.14.0'; +const LOWEST_SUPPORTED_RUNNER_VERSION = '0.14.0'; +const LOWEST_UNSUPPORTED_RUNNER_VERSION = '0.15.0'; const npmVersionRange = `>=${LOWEST_SUPPORTED_RUNNER_VERSION} <${LOWEST_UNSUPPORTED_RUNNER_VERSION}`; export const pipVersionRange = `>=${LOWEST_SUPPORTED_RUNNER_VERSION},<${LOWEST_UNSUPPORTED_RUNNER_VERSION}`; From acec7037f031bdd3e1f14f3825aa174c5dc5f5f3 Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Thu, 2 May 2024 11:55:33 +0200 Subject: [PATCH 02/14] fix: call `Row.number_of_columns` --- .../builtins/safeds/data/tabular/containers/row.sdsstub | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/row.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/row.sdsstub index cbe210a61..f6ca54c55 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/row.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/row.sdsstub @@ -35,7 +35,7 @@ class Row( * val numberOfColumns = row.numberOfColumns; // 2 * } */ - @PythonName("number_of_column") attr numberOfColumns: Int + @PythonName("number_of_columns") attr numberOfColumns: Int /** * Return the schema of the row. * From 012ec8c7abef771304469ab78efc3917f0755baf Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Thu, 2 May 2024 12:01:32 +0200 Subject: [PATCH 03/14] fix: call `Table.group_rows` --- .../builtins/safeds/data/tabular/containers/table.sdsstub | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/table.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/table.sdsstub index e7e1c5f98..490eb33a1 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/table.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/table.sdsstub @@ -440,7 +440,7 @@ class Table( * } */ @Pure - @PythonName("group_rows_by") + @PythonName("group_rows") fun groupRows( @PythonName("key_selector") keySelector: (row: Row) -> key: T ) -> tablesByKey: Map From 35718a6b27c0bacf69b45f05b10395a820d3bc50 Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Thu, 2 May 2024 15:52:19 +0200 Subject: [PATCH 04/14] feat: add `Row.sortColumns` --- .../data/tabular/containers/row.sdsstub | 62 +++++++++++-------- 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/row.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/row.sdsstub index f6ca54c55..f003c1c38 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/row.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/row.sdsstub @@ -122,33 +122,41 @@ class Row( @PythonName("column_name") columnName: String ) -> type: ColumnType - // // TODO Safe-DS does not support tuple types. - // /** - // * Sort the columns of a `Row` with the given comparator and return a new `Row`. - // * - // * The original row is not modified. The comparator is a function that takes two tuples of (ColumnName, - // * Value) `col1` and `col2` and returns an integer: - // * - // * * If `col1` should be ordered before `col2`, the function should return a negative number. - // * * If `col1` should be ordered after `col2`, the function should return a positive number. - // * * If the original order of `col1` and `col2` should be kept, the function should return 0. - // * - // * If no comparator is given, the columns will be sorted alphabetically by their name. - // * - // * @param comparator The function used to compare two tuples of (ColumnName, Value). - // * - // * @result sortedRow A new row with sorted columns. - // * - // * @example - // * pipeline example { - // * // TODO - // * } - // */ - // @Pure - // @PythonName("sort_columns") - // fun sortColumns( - // comparator: (param1: Tuple, param2: Tuple) -> param3: Int - // ) -> sortedRow: Row + /** + * Sort the columns of a `Row` with the given comparator and return a new `Row`. + * + * The original row is not modified. The comparator is a function with four parameters: + * + * * `name_1` is the name of the first column. + * * `value_1` is the value of the first column. + * * `name_2` is the name of the second column. + * * `value_2` is the value of the second column. + * + * It should return an integer, indicating the desired order of the columns: + * + * * If `col1` should be ordered before `col2`, the function should return a negative number. + * * If `col1` should be ordered after `col2`, the function should return a positive number. + * * If the original order of `col1` and `col2` should be kept, the function should return 0. + * + * If no comparator is given, the columns will be sorted alphabetically by their name. + * + * @param comparator The function used to compare two tuples of (ColumnName, Value). + * + * @result sortedRow A new row with sorted columns. + * + * @example + * pipeline example { + * val row = Row({"b": 2, "a": 1}); + * val sortedRow = row.sortColumns((name1, value1, name2, value2) -> + * (value1 as Int) - (value2 as Int) + * ); + * } + */ + @Pure + @PythonName("sort_columns") + fun sortColumns( + comparator: (name1: String, value1: Any, name2: String, value2: Any) -> comparison: Int + ) -> sortedRow: Row /** * Return a map of column names to column values. From 6b4f007ce1a2fadace3f815d96fb4159255b0619 Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Thu, 2 May 2024 15:59:10 +0200 Subject: [PATCH 05/14] feat: add `numberOfBins` parameter to `plotHistograms` --- .../builtins/safeds/data/tabular/containers/table.sdsstub | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/table.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/table.sdsstub index 490eb33a1..6f7f84eef 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/table.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/table.sdsstub @@ -1009,6 +1009,8 @@ class Table( /** * Plot a histogram for every column. * + * @param numberOfBins The number of bins to use in the histogram. + * * @result histograms The plot as an image. * * @example @@ -1019,7 +1021,11 @@ class Table( */ @Pure @PythonName("plot_histograms") - fun plotHistograms() -> histograms: Image + fun plotHistograms( + @PythonName("number_of_bins") const numberOfBins: Int = 10 + ) -> histograms: Image where { + numberOfBins > 0 + } /** * Write the data from the table into a CSV file. From 58fbc242f51a280d926cd05361daff1e7679edfc Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Thu, 2 May 2024 17:44:57 +0200 Subject: [PATCH 06/14] feat: include NN changes --- .../builtins/safeds/ml/nn/classifier.sdsstub | 18 ++++++++++-------- .../safeds/ml/nn/input_conversion.sdsstub | 7 +++++++ .../ml/nn/input_conversion_table.sdsstub | 13 +++++++++++++ .../ml/nn/{_layer.sdsstub => layer.sdsstub} | 4 ++-- .../safeds/ml/nn/output_conversion.sdsstub | 7 +++++++ .../ml/nn/output_conversion_table.sdsstub | 11 +++++++++++ .../builtins/safeds/ml/nn/regressor.sdsstub | 18 ++++++++++-------- 7 files changed, 60 insertions(+), 18 deletions(-) create mode 100644 packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/input_conversion.sdsstub create mode 100644 packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/input_conversion_table.sdsstub rename packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/{_layer.sdsstub => layer.sdsstub} (69%) create mode 100644 packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/output_conversion.sdsstub create mode 100644 packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/output_conversion_table.sdsstub diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/classifier.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/classifier.sdsstub index d1bc4d1cc..f68ab4180 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/classifier.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/classifier.sdsstub @@ -4,11 +4,13 @@ from safeds.data.tabular.containers import Table, TaggedTable from safeds.ml.nn import Layer @Experimental -class NeuralNetworkClassifier( - layers: List +class NeuralNetworkClassifier( + @PythonName("input_conversion") inputConversion: InputConversion, + layers: List, + @PythonName("output_conversion") outputConversion: OutputConversion ) { /** - * Check if the model is fitted. + * Whether the model is fitted. * * @example * pipeline example { @@ -38,13 +40,13 @@ class NeuralNetworkClassifier( */ @Pure fun fit( - @PythonName("train_data") trainData: TaggedTable, + @PythonName("train_data") trainData: FitIn, @PythonName("epoch_size") const epochSize: Int = 25, @PythonName("batch_size") const batchSize: Int = 1, @PythonName("learning_rate") learningRate: Float = 0.001, @PythonName("callback_on_batch_completion") callbackOnBatchCompletion: (param1: Int, param2: Float) -> () = (param1, param2) {}, @PythonName("callback_on_epoch_completion") callbackOnEpochCompletion: (param1: Int, param2: Float) -> () = (param1, param2) {} - ) -> fittedClassifier: NeuralNetworkClassifier where { + ) -> fittedClassifier: NeuralNetworkClassifier where { epochSize >= 1, batchSize >= 1 } @@ -56,7 +58,7 @@ class NeuralNetworkClassifier( * * @param testData The data the network should predict. * - * @result result1 The given test_data with an added "prediction" column at the end + * @result prediction The given test_data with an added "prediction" column at the end * * @example * pipeline example { @@ -65,6 +67,6 @@ class NeuralNetworkClassifier( */ @Pure fun predict( - @PythonName("test_data") testData: Table - ) -> result1: TaggedTable + @PythonName("test_data") testData: PredictIn + ) -> prediction: PredictOut } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/input_conversion.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/input_conversion.sdsstub new file mode 100644 index 000000000..da8f3ce9f --- /dev/null +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/input_conversion.sdsstub @@ -0,0 +1,7 @@ +package safeds.ml.nn + +/** + * The input conversion for a neural network, defines the input parameters for the neural network. + */ +@Experimental +class InputConversion diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/input_conversion_table.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/input_conversion_table.sdsstub new file mode 100644 index 000000000..f56da2765 --- /dev/null +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/input_conversion_table.sdsstub @@ -0,0 +1,13 @@ +package safeds.ml.nn + +/** + * The input conversion for a neural network defines the input parameters for the neural network. + * + * @param featureNames The names of the features for the input table, used as features for the training. + * @param targetName The name of the target for the input table, used as target for the training. + */ +@Experimental +class InputConversionTable( + @PythonName("feature_names") featureNames: List, + @PythonName("target_name") targetName: String +) sub InputConversion diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/_layer.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/layer.sdsstub similarity index 69% rename from packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/_layer.sdsstub rename to packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/layer.sdsstub index 451368fe0..5f12f65e5 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/_layer.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/layer.sdsstub @@ -3,11 +3,11 @@ package safeds.ml.nn @Experimental class Layer { /** - * Get the input_size of this layer. + * The input_size of this layer. */ @PythonName("input_size") attr inputSize: Int /** - * Get the output_size of this layer. + * The output_size of this layer. */ @PythonName("output_size") attr outputSize: Int } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/output_conversion.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/output_conversion.sdsstub new file mode 100644 index 000000000..a090225f8 --- /dev/null +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/output_conversion.sdsstub @@ -0,0 +1,7 @@ +package safeds.ml.nn + +/** + * The output conversion for a neural network, defines the output parameters for the neural network. + */ +@Experimental +class OutputConversion diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/output_conversion_table.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/output_conversion_table.sdsstub new file mode 100644 index 000000000..fccbb0576 --- /dev/null +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/output_conversion_table.sdsstub @@ -0,0 +1,11 @@ +package safeds.ml.nn + +/** + * The output conversion for a neural network defines the output parameters for the neural network. + * + * @param predictionName The name of the new column where the prediction will be stored. + */ +@Experimental +class OutputConversionTable( + @PythonName("prediction_name") predictionName: String = "prediction" +) sub OutputConversion diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/regressor.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/regressor.sdsstub index 4ac9ac161..1b7b32228 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/regressor.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/regressor.sdsstub @@ -4,11 +4,13 @@ from safeds.data.tabular.containers import Table, TaggedTable from safeds.ml.nn import Layer @Experimental -class NeuralNetworkRegressor( - layers: List +class NeuralNetworkRegressor( + @PythonName("input_conversion") inputConversion: InputConversion, + layers: List, + @PythonName("output_conversion") outputConversion: OutputConversion ) { /** - * Check if the model is fitted. + * Whether the model is fitted. * * @example * pipeline example { @@ -29,7 +31,7 @@ class NeuralNetworkRegressor( * @param callbackOnBatchCompletion Function used to view metrics while training. Gets called after a batch is completed with the index of the last batch and the overall loss average. * @param callbackOnEpochCompletion Function used to view metrics while training. Gets called after an epoch is completed with the index of the last epoch and the overall loss average. * - * @result trainedRegressor The trained Model + * @result fittedRegressor The trained Model * * @example * pipeline example { @@ -38,13 +40,13 @@ class NeuralNetworkRegressor( */ @Pure fun fit( - @PythonName("train_data") trainData: TaggedTable, + @PythonName("train_data") trainData: FitIn, @PythonName("epoch_size") const epochSize: Int = 25, @PythonName("batch_size") const batchSize: Int = 1, @PythonName("learning_rate") learningRate: Float = 0.001, @PythonName("callback_on_batch_completion") callbackOnBatchCompletion: (param1: Int, param2: Float) -> () = (param1, param2) {}, @PythonName("callback_on_epoch_completion") callbackOnEpochCompletion: (param1: Int, param2: Float) -> () = (param1, param2) {} - ) -> trainedRegressor: NeuralNetworkRegressor where { + ) -> fittedRegressor: NeuralNetworkRegressor where { epochSize >= 1, batchSize >= 1 } @@ -65,6 +67,6 @@ class NeuralNetworkRegressor( */ @Pure fun predict( - @PythonName("test_data") testData: Table - ) -> prediction: TaggedTable + @PythonName("test_data") testData: PredictIn + ) -> prediction: PredictOut } From 5ec3191f277e3124396f527438272508c4008250 Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Thu, 2 May 2024 17:52:21 +0200 Subject: [PATCH 07/14] feat: make `isFitted` always an attribute --- .../transformation/table_transformer.sdsstub | 14 +++++--------- .../ml/classical/classification/classifier.sdsstub | 14 +++++--------- .../safeds/ml/classical/regression/arima.sdsstub | 14 +++++--------- .../ml/classical/regression/regressor.sdsstub | 14 +++++--------- .../builtins/safeds/ml/nn/classifier.sdsstub | 7 +------ .../builtins/safeds/ml/nn/regressor.sdsstub | 7 +------ 6 files changed, 22 insertions(+), 48 deletions(-) diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/transformation/table_transformer.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/transformation/table_transformer.sdsstub index fb673e737..5c5c7bac0 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/transformation/table_transformer.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/transformation/table_transformer.sdsstub @@ -6,6 +6,11 @@ from safeds.data.tabular.containers import Table * Learn a transformation for a set of columns in a `Table` and transform another `Table` with the same columns. */ class TableTransformer { + /** + * Whether the transformer is fitted. + */ + @PythonName("is_fitted") attr isFitted: Boolean + /** * Learn a transformation for a set of columns in a table. * @@ -63,15 +68,6 @@ class TableTransformer { @PythonName("get_names_of_removed_columns") fun getNamesOfRemovedColumns() -> result1: List - /** - * Check if the transformer is fitted. - * - * @result result1 Whether the transformer is fitted. - */ - @Pure - @PythonName("is_fitted") - fun isFitted() -> result1: Boolean - /** * Learn a transformation for a set of columns in a table and apply the learned transformation to the same table. * diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/classifier.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/classifier.sdsstub index 9b0741c2c..d1563c9ed 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/classifier.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/classifier.sdsstub @@ -6,6 +6,11 @@ from safeds.data.tabular.containers import Table, TaggedTable * Abstract base class for all classifiers. */ class Classifier { + /** + * Whether the classifier is fitted. + */ + @PythonName("is_fitted") attr isFitted: Boolean + /** * Create a copy of this classifier and fit it with the given training data. * @@ -32,15 +37,6 @@ class Classifier { dataset: Table ) -> prediction: TaggedTable - /** - * Check if the classifier is fitted. - * - * @result isFitted Whether the classifier is fitted. - */ - @Pure - @PythonName("is_fitted") - fun isFitted() -> isFitted: Boolean - /** * Compute the accuracy of the classifier on the given data. * diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/arima.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/arima.sdsstub index 7864f3736..31a90a637 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/arima.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/arima.sdsstub @@ -11,6 +11,11 @@ package safeds.ml.classical.regression @Experimental @PythonName("ArimaModelRegressor") class ArimaRegressor() { + /** + * Whether the regressor is fitted. + */ + @PythonName("is_fitted") attr isFitted: Boolean + /** * Create a copy of this ARIMA Model and fit it with the given training data. * @@ -49,13 +54,4 @@ class ArimaRegressor() { fun plotPredictions( @PythonName("test_series") testSeries: TimeSeries ) -> image: Image - - /** - * Check if the classifier is fitted. - * - * @result isFitted Whether the regressor is fitted. - */ - @Pure - @PythonName("is_fitted") - fun isFitted() -> isFitted: Boolean } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/regressor.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/regressor.sdsstub index bda8bef78..9abf9a3dd 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/regressor.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/regressor.sdsstub @@ -6,6 +6,11 @@ from safeds.data.tabular.containers import Table, TaggedTable * Abstract base class for all regressors. */ class Regressor { + /** + * Whether the regressor is fitted. + */ + @PythonName("is_fitted") attr isFitted: Boolean + /** * Create a copy of this regressor and fit it with the given training data. * @@ -32,15 +37,6 @@ class Regressor { dataset: Table ) -> prediction: TaggedTable - /** - * Check if the classifier is fitted. - * - * @result isFitted Whether the regressor is fitted. - */ - @Pure - @PythonName("is_fitted") - fun isFitted() -> isFitted: Boolean - /** * Compute the mean squared error (MSE) on the given data. * diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/classifier.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/classifier.sdsstub index f68ab4180..0ca937d15 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/classifier.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/classifier.sdsstub @@ -10,12 +10,7 @@ class NeuralNetworkClassifier( @PythonName("output_conversion") outputConversion: OutputConversion ) { /** - * Whether the model is fitted. - * - * @example - * pipeline example { - * // TODO - * } + * Whether the classifier is fitted. */ @PythonName("is_fitted") attr isFitted: Boolean diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/regressor.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/regressor.sdsstub index 1b7b32228..2213db812 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/regressor.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/regressor.sdsstub @@ -10,12 +10,7 @@ class NeuralNetworkRegressor( @PythonName("output_conversion") outputConversion: OutputConversion ) { /** - * Whether the model is fitted. - * - * @example - * pipeline example { - * // TODO - * } + * Whether the regressor is fitted. */ @PythonName("is_fitted") attr isFitted: Boolean From 6f65bbc1105d2c38f22e20793e83a780a3aab4a9 Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Thu, 2 May 2024 17:53:53 +0200 Subject: [PATCH 08/14] fix: require latest `safe-ds-runner` --- .../safe-ds-lang/src/language/runtime/safe-ds-python-server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/safe-ds-lang/src/language/runtime/safe-ds-python-server.ts b/packages/safe-ds-lang/src/language/runtime/safe-ds-python-server.ts index 78c120ec3..da88030a4 100644 --- a/packages/safe-ds-lang/src/language/runtime/safe-ds-python-server.ts +++ b/packages/safe-ds-lang/src/language/runtime/safe-ds-python-server.ts @@ -16,7 +16,7 @@ import { UpdateRunnerNotification, } from '../communication/rpc.js'; -const LOWEST_SUPPORTED_RUNNER_VERSION = '0.14.0'; +const LOWEST_SUPPORTED_RUNNER_VERSION = '0.14.1'; const LOWEST_UNSUPPORTED_RUNNER_VERSION = '0.15.0'; const npmVersionRange = `>=${LOWEST_SUPPORTED_RUNNER_VERSION} <${LOWEST_UNSUPPORTED_RUNNER_VERSION}`; export const pipVersionRange = `>=${LOWEST_SUPPORTED_RUNNER_VERSION},<${LOWEST_UNSUPPORTED_RUNNER_VERSION}`; From acf6a48cfdde9cc421c827075770889791915f28 Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Thu, 2 May 2024 17:56:29 +0200 Subject: [PATCH 09/14] feat: add `Column.missingValueCount` --- .../data/tabular/containers/column.sdsstub | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/column.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/column.sdsstub index 8cfa49032..a0d4fe2cc 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/column.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/column.sdsstub @@ -335,6 +335,27 @@ class Column( @Pure fun minimum() -> minimum: Float + /** + * Return the number of missing values in the column. + * + * @result count The number of missing values. + * + * @example + * pipeline example { + * val column = Column("test", [1, 2, 3, 4]); + * val missingValueCount = column.missingValueCount(); // 0 + * } + * + * @example + * pipeline example { + * val column = Column("test", [1, 2, 3, null]); + * val missingValueCount = column.missingValueCount(); // 1 + * } + */ + @Pure + @PythonName("missing_value_count") + fun missingValueCount() -> count: Int + /** * Return the ratio of missing values to the total number of elements in the column. * From 3af8a36bb7124f8ddcc3f9b973625ab7c0fc8cad Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Thu, 2 May 2024 18:01:53 +0200 Subject: [PATCH 10/14] feat: replace `Table.tagColumns` with `Table.toTabularDataset` --- .../data/tabular/containers/table.sdsstub | 80 +++++++++---------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/table.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/table.sdsstub index 6f7f84eef..707a76115 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/table.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/table.sdsstub @@ -815,46 +815,6 @@ class Table( @PythonName("percentage_in_first") ratioInFirst: Float ) -> (first: Table, second: Table) - /** - * Return a new `TaggedTable` with columns marked as a target column or feature columns. - * - * The original table is not modified. - * - * @param targetName - * Name of the target column. - * - * @param featureNames - * Names of the feature columns. If None, all columns except the target column are used. Use this to hide columns - * during training but still keep them in the input, to easily link predictions back to the original data. - * - * @result taggedTable A new tagged table with the given target and feature names. - * - * @example - * pipeline example { - * val table = Table({ - * "age": [23, 16], - * "survived": [ 0, 1], - * }); - * val taggedTable = table.tagColumns("survived"); - * } - * - * @example - * pipeline example { - * val table = Table({ - * "id": [ 1, 2], - * "age": [23, 16], - * "survived": [ 0, 1], - * }); - * val taggedTable = table.tagColumns("target", featureNames = ["age"]); - * } - */ - @Pure - @PythonName("tag_columns") - fun tagColumns( - @PythonName("target_name") targetName: String, - @PythonName("feature_names") featureNames: List? = null - ) -> taggedTable: TaggedTable - /** * Return a new `Table` with the provided column transformed by calling the provided transformer. * @@ -1151,4 +1111,44 @@ class Table( @Pure @PythonName("to_rows") fun toRows() -> rows: List + + /** + * Return a new `TabularDataset` with columns marked as a target column or feature columns. + * + * The original table is not modified. + * + * @param targetName + * Name of the target column. + * + * @param extraNames + * Names of the columns that are neither features nor target. If None, no extra columns are used, i.e. all but the + * target column are used as features. + * + * @result dataset A new tabular dataset with the given target and extras. + * + * @example + * pipeline example { + * val table = Table({ + * "age": [23, 16], + * "survived": [ 0, 1], + * }); + * val dataset = table.toTabularDataset("survived"); + * } + * + * @example + * pipeline example { + * val table = Table({ + * "id": [ 1, 2], + * "age": [23, 16], + * "survived": [ 0, 1], + * }); + * val dataset = table.toTabularDataset("target", extraNames = ["id"]); + * } + */ + @Pure + @PythonName("to_tabular_dataset") + fun toTabularDataset( + @PythonName("target_name") targetName: String, + @PythonName("extra_names") extraNames: List = [] + ) -> dataset: TabularDataset } From f002ea2a33e9f086b986fb72a8abb98548308058 Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Thu, 2 May 2024 18:09:05 +0200 Subject: [PATCH 11/14] feat: replace `TaggedTable` with `TabularDataset` --- .../containers/tabular_dataset.sdsstub | 57 +++ .../tabular/containers/tagged_table.sdsstub | 468 ------------------ 2 files changed, 57 insertions(+), 468 deletions(-) create mode 100644 packages/safe-ds-lang/src/resources/builtins/safeds/data/labeled/containers/tabular_dataset.sdsstub delete mode 100644 packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/tagged_table.sdsstub diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/data/labeled/containers/tabular_dataset.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/data/labeled/containers/tabular_dataset.sdsstub new file mode 100644 index 000000000..fde89ff2d --- /dev/null +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/data/labeled/containers/tabular_dataset.sdsstub @@ -0,0 +1,57 @@ +package safeds.data.labeled.containers + +/** + * A tabular dataset maps feature columns to a target column. + * + * Create a tabular dataset from a mapping of column names to their values. + * + * @param data + * The data. + * + * @param targetName + * Name of the target column. + * + * @param extraNames + * Names of the columns that are neither features nor target. If None, no extra columns are used, i.e. all but the + * target column are used as features. + * + * @example + * pipeline example { + * val dataset = TabularDataset( + * {"id": [1, 2, 3], "feature": [4, 5, 6], "target": [1, 2, 3]}, + * targetName="target", + * extraNames=["id"] + * ) + * } + */ +class TabularDataset( + data: union>, Table>, + @PythonName("target_name") targetName: String, + @PythonName("extra_names") extraNames: List = [] +) { + /** + * The feature columns of the tabular dataset. + */ + attr features: Table + /** + * The target column of the tabular dataset. + */ + attr target: Column + /** + * Additional columns of the tabular dataset that are neither features nor target. + * + * These can be used to store additional information about instances, such as IDs. + */ + attr extras: Table + + /** + * Return a new `Table` containing the feature columns and the target column. + * + * The original `TabularDataset` is not modified. + * + * @result table A table containing the feature columns and the target column. + */ + @Pure + @PythonName("to_table") + fun toTable() -> table: Table +} diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/tagged_table.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/tagged_table.sdsstub deleted file mode 100644 index 217f06dbe..000000000 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/tagged_table.sdsstub +++ /dev/null @@ -1,468 +0,0 @@ -package safeds.data.tabular.containers - -from safeds.data.tabular.containers import Column, Row, Table - -/** - * A tagged table is a table that additionally knows which columns are features and which are the target to predict. - * - * @param data The data. - * @param targetName Name of the target column. - * @param featureNames Names of the feature columns. If None, all columns except the target column are used. - * - * @example - * pipeline example { - * // TODO - * } - */ -@Experimental -class TaggedTable( - data: Map>, - @PythonName("target_name") targetName: String, - @PythonName("feature_names") featureNames: List? = null -) sub Table { - /** - * Get the feature columns of the tagged table. - * - * @example - * pipeline example { - * // TODO - * } - */ - attr features: Table - /** - * Get the target column of the tagged table. - * - * @example - * pipeline example { - * // TODO - * } - */ - attr target: Column - - /** - * Return a new table with the provided column attached at the end, as a feature column. - * - * the original table is not modified. - * - * @param column The column to be added. - * - * @result result1 The table with the attached feature column. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("add_column_as_feature") - fun addColumnAsFeature( - column: Column - ) -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with the provided columns attached at the end, as feature columns. - * - * The original table is not modified. - * - * @param columns The columns to be added as features. - * - * @result result1 The table with the attached feature columns. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("add_columns_as_features") - fun addColumnsAsFeatures( - columns: union, Table> - ) -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with the provided column attached at the end, as neither target nor feature column. - * - * The original table is not modified. - * - * @param column The column to be added. - * - * @result result1 The table with the column attached as neither target nor feature column. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("add_column") - fun addColumn( - column: Column - ) -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with multiple added columns, as neither target nor feature columns. - * - * The original table is not modified. - * - * @param columns The columns to be added. - * - * @result result1 A new table combining the original table and the given columns as neither target nor feature columns. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("add_columns") - fun addColumns( - columns: union, Table> - ) -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with an added Row attached. - * - * The original table is not modified. - * - * @param row The row to be added. - * - * @result result1 A new tagged table with the added row at the end. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("add_row") - fun addRow( - row: Row - ) -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with multiple added Rows attached. - * - * The original table is not modified. - * - * @param rows The rows to be added. - * - * @result result1 A new tagged table which combines the original table and the given rows. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("add_rows") - fun addRows( - rows: union, Table> - ) -> result1: TaggedTable - - /** - * Return a new `TaggedTable` containing only rows that match the given Callable (e.g. lambda function). - * - * The original tagged table is not modified. - * - * @param query A Callable that is applied to all rows. - * - * @result result1 A new tagged table containing only the rows to match the query. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("filter_rows") - fun filterRows( - query: (row: Row) -> matches: Boolean - ) -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with only the given column(s). - * - * The original table is not modified. - * - * @param columnNames A list containing only the columns to be kept. - * - * @result result1 A table containing only the given column(s). - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("keep_only_columns") - fun keepOnlyColumns( - @PythonName("column_names") columnNames: List - ) -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with the given column(s) removed from the table. - * - * The original table is not modified. - * - * @param columnNames The names of all columns to be dropped. - * - * @result result1 A table without the given columns. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("remove_columns") - fun removeColumns( - @PythonName("column_names") columnNames: List - ) -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with every column that misses values removed. - * - * The original table is not modified. - * - * @result result1 A table without the columns that contain missing values. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("remove_columns_with_missing_values") - fun removeColumnsWithMissingValues() -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with every column that contains non-numerical values removed. - * - * The original table is not modified. - * - * @result result1 A table without the columns that contain non-numerical values. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("remove_columns_with_non_numerical_values") - fun removeColumnsWithNonNumericalValues() -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with all row duplicates removed. - * - * The original table is not modified. - * - * @result result1 The table with the duplicate rows removed. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("remove_duplicate_rows") - fun removeDuplicateRows() -> result1: TaggedTable - - /** - * Return a new `TaggedTable` without the rows that contain missing values. - * - * The original table is not modified. - * - * @result result1 A table without the rows that contain missing values. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("remove_rows_with_missing_values") - fun removeRowsWithMissingValues() -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with all rows that contain at least one outlier removed. - * - * We define an outlier as a value that has a distance of more than 3 standard deviations from the column mean. - * Missing values are not considered outliers. They are also ignored during the calculation of the standard - * deviation. - * - * The original table is not modified. - * - * @result result1 A new table without rows containing outliers. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("remove_rows_with_outliers") - fun removeRowsWithOutliers() -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with a single column renamed. - * - * The original table is not modified. - * - * @param oldName The old name of the target column. - * @param newName The new name of the target column. - * - * @result result1 The Table with the renamed column. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("rename_column") - fun renameColumn( - @PythonName("old_name") oldName: String, - @PythonName("new_name") newName: String - ) -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with the specified old column replaced by a list of new columns. - * - * If the column to be replaced is the target column, it must be replaced by exactly one column. That column - * becomes the new target column. If the column to be replaced is a feature column, the new columns that replace it - * all become feature columns. - * - * The order of columns is kept. The original table is not modified. - * - * @param oldColumnName The name of the column to be replaced. - * @param newColumns The new columns replacing the old column. - * - * @result result1 A table with the old column replaced by the new column. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("replace_column") - fun replaceColumn( - @PythonName("old_column_name") oldColumnName: String, - @PythonName("new_columns") newColumns: List - ) -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with randomly shuffled rows of this table. - * - * The original table is not modified. - * - * @result result1 The shuffled Table. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("shuffle_rows") - fun shuffleRows() -> result1: TaggedTable - - /** - * Slice a part of the table into a new `TaggedTable`. - * - * The original table is not modified. - * - * @param start The first index of the range to be copied into a new table, None by default. - * @param end The last index of the range to be copied into a new table, None by default. - * @param step The step size used to iterate through the table, 1 by default. - * - * @result result1 The resulting table. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("slice_rows") - fun sliceRows( - start: Int? = null, - end: Int? = null, - step: Int = 1 - ) -> result1: TaggedTable - - /** - * Sort the columns of a `TaggedTable` with the given comparator and return a new `TaggedTable`. - * - * The comparator is a function that takes two columns `col1` and `col2` and - * returns an integer: - * - * * If the function returns a negative number, `col1` will be ordered before `col2`. - * * If the function returns a positive number, `col1` will be ordered after `col2`. - * * If the function returns 0, the original order of `col1` and `col2` will be kept. - * - * If no comparator is given, the columns will be sorted alphabetically by their name. - * - * The original table is not modified. - * - * @param comparator The function used to compare two columns. - * - * @result result1 A new table with sorted columns. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("sort_columns") - fun sortColumns( - comparator: (column1: Column, column2: Column) -> comparison: Int - ) -> result1: TaggedTable - - /** - * Sort the rows of a `TaggedTable` with the given comparator and return a new `TaggedTable`. - * - * The comparator is a function that takes two rows `row1` and `row2` and - * returns an integer: - * - * * If the function returns a negative number, `row1` will be ordered before `row2`. - * * If the function returns a positive number, `row1` will be ordered after `row2`. - * * If the function returns 0, the original order of `row1` and `row2` will be kept. - * - * The original table is not modified. - * - * @param comparator The function used to compare two rows. - * - * @result result1 A new table with sorted rows. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("sort_rows") - fun sortRows( - comparator: (row1: Row, row2: Row) -> comparison: Int - ) -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with the provided column transformed by calling the provided transformer. - * - * The original table is not modified. - * - * @result transformedTable The table with the transformed column. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("transform_column") - fun transformColumn( - name: String, - transformer: (row: Row) -> newColumnValue: Any? - ) -> transformedTable: TaggedTable -} From 3a94005876cff3ee83f0e82eff5c5d976c089e32 Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Thu, 2 May 2024 18:15:07 +0200 Subject: [PATCH 12/14] fix: linking errors in stubs --- .../safeds/data/tabular/containers/table.sdsstub | 3 ++- .../ml/classical/classification/ada_boost.sdsstub | 5 +++-- .../classical/classification/classifier.sdsstub | 15 ++++++++------- .../classification/decision_tree.sdsstub | 5 +++-- .../classification/gradient_boosting.sdsstub | 5 +++-- .../classification/k_nearest_neighbors.sdsstub | 5 +++-- .../classification/logistic_regression.sdsstub | 5 +++-- .../classification/random_forest.sdsstub | 5 +++-- .../classification/support_vector_machine.sdsstub | 5 +++-- .../ml/classical/regression/ada_boost.sdsstub | 5 +++-- .../ml/classical/regression/decision_tree.sdsstub | 5 +++-- .../ml/classical/regression/elastic_net.sdsstub | 5 +++-- .../regression/gradient_boosting.sdsstub | 5 +++-- .../regression/k_nearest_neighbors.sdsstub | 5 +++-- .../safeds/ml/classical/regression/lasso.sdsstub | 5 +++-- .../regression/linear_regression.sdsstub | 5 +++-- .../ml/classical/regression/random_forest.sdsstub | 5 +++-- .../ml/classical/regression/regressor.sdsstub | 11 ++++++----- .../safeds/ml/classical/regression/ridge.sdsstub | 5 +++-- .../regression/support_vector_machine.sdsstub | 5 +++-- .../builtins/safeds/ml/nn/classifier.sdsstub | 3 ++- .../builtins/safeds/ml/nn/regressor.sdsstub | 3 ++- 22 files changed, 71 insertions(+), 49 deletions(-) diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/table.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/table.sdsstub index 707a76115..9f2790f3a 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/table.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/table.sdsstub @@ -1,7 +1,8 @@ package safeds.data.tabular.containers +from safeds.data.labeled.containers import TabularDataset from safeds.data.image.containers import Image -from safeds.data.tabular.containers import Column, Row, TaggedTable, TimeSeries +from safeds.data.tabular.containers import Column, Row, TimeSeries from safeds.data.tabular.transformation import InvertibleTableTransformer, TableTransformer from safeds.data.tabular.typing import ColumnType, Schema diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/ada_boost.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/ada_boost.sdsstub index ffbd7897c..e7cf48ba7 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/ada_boost.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/ada_boost.sdsstub @@ -1,6 +1,7 @@ package safeds.ml.classical.classification -from safeds.data.tabular.containers import Table, TaggedTable +from safeds.data.labeled.containers import TabularDataset +from safeds.data.tabular.containers import Table from safeds.ml.classical.classification import Classifier /** @@ -52,6 +53,6 @@ class AdaBoostClassifier( */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedClassifier: AdaBoostClassifier } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/classifier.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/classifier.sdsstub index d1563c9ed..9121ae867 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/classifier.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/classifier.sdsstub @@ -1,6 +1,7 @@ package safeds.ml.classical.classification -from safeds.data.tabular.containers import Table, TaggedTable +from safeds.data.labeled.containers import TabularDataset +from safeds.data.tabular.containers import Table /** * Abstract base class for all classifiers. @@ -22,7 +23,7 @@ class Classifier { */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedClassifier: Classifier /** @@ -35,7 +36,7 @@ class Classifier { @Pure fun predict( dataset: Table - ) -> prediction: TaggedTable + ) -> prediction: TabularDataset /** * Compute the accuracy of the classifier on the given data. @@ -46,7 +47,7 @@ class Classifier { */ @Pure fun accuracy( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> accuracy: Float /** @@ -60,7 +61,7 @@ class Classifier { */ @Pure fun precision( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> precision: Float @@ -75,7 +76,7 @@ class Classifier { */ @Pure fun recall( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> recall: Float @@ -91,7 +92,7 @@ class Classifier { @Pure @PythonName("f1_score") fun f1Score( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> f1Score: Float } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/decision_tree.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/decision_tree.sdsstub index 8bd1044ba..3e46a2937 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/decision_tree.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/decision_tree.sdsstub @@ -1,6 +1,7 @@ package safeds.ml.classical.classification -from safeds.data.tabular.containers import Table, TaggedTable +from safeds.data.labeled.containers import TabularDataset +from safeds.data.tabular.containers import Table from safeds.ml.classical.classification import Classifier /** @@ -26,6 +27,6 @@ class DecisionTreeClassifier() sub Classifier { */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedClassifier: DecisionTreeClassifier } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/gradient_boosting.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/gradient_boosting.sdsstub index 7b2789dfa..78ab72515 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/gradient_boosting.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/gradient_boosting.sdsstub @@ -1,6 +1,7 @@ package safeds.ml.classical.classification -from safeds.data.tabular.containers import Table, TaggedTable +from safeds.data.labeled.containers import TabularDataset +from safeds.data.tabular.containers import Table from safeds.ml.classical.classification import Classifier /** @@ -46,6 +47,6 @@ class GradientBoostingClassifier( */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedClassifier: GradientBoostingClassifier } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/k_nearest_neighbors.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/k_nearest_neighbors.sdsstub index 58399cca6..08498f35f 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/k_nearest_neighbors.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/k_nearest_neighbors.sdsstub @@ -1,6 +1,7 @@ package safeds.ml.classical.classification -from safeds.data.tabular.containers import Table, TaggedTable +from safeds.data.labeled.containers import TabularDataset +from safeds.data.tabular.containers import Table from safeds.ml.classical.classification import Classifier /** @@ -38,6 +39,6 @@ class KNearestNeighborsClassifier( */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedClassifier: KNearestNeighborsClassifier } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/logistic_regression.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/logistic_regression.sdsstub index 340d24d6e..e0124c985 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/logistic_regression.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/logistic_regression.sdsstub @@ -1,6 +1,7 @@ package safeds.ml.classical.classification -from safeds.data.tabular.containers import Table, TaggedTable +from safeds.data.labeled.containers import TabularDataset +from safeds.data.tabular.containers import Table from safeds.ml.classical.classification import Classifier /** @@ -26,6 +27,6 @@ class LogisticRegressionClassifier() sub Classifier { */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedClassifier: LogisticRegressionClassifier } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/random_forest.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/random_forest.sdsstub index e7776315c..f3ec0e6e6 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/random_forest.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/random_forest.sdsstub @@ -1,6 +1,7 @@ package safeds.ml.classical.classification -from safeds.data.tabular.containers import Table, TaggedTable +from safeds.data.labeled.containers import TabularDataset +from safeds.data.tabular.containers import Table from safeds.ml.classical.classification import Classifier /** @@ -37,6 +38,6 @@ class RandomForestClassifier( */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedClassifier: RandomForestClassifier } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/support_vector_machine.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/support_vector_machine.sdsstub index 9287bfac9..5499a193d 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/support_vector_machine.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/support_vector_machine.sdsstub @@ -1,6 +1,7 @@ package safeds.ml.classical.classification -from safeds.data.tabular.containers import Table, TaggedTable +from safeds.data.labeled.containers import TabularDataset +from safeds.data.tabular.containers import Table from safeds.ml.classical.classification import Classifier /** @@ -72,6 +73,6 @@ class SupportVectorMachineClassifier( */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedClassifier: SupportVectorMachineClassifier } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/ada_boost.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/ada_boost.sdsstub index f5ec5b0b9..9cba1de14 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/ada_boost.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/ada_boost.sdsstub @@ -1,6 +1,7 @@ package safeds.ml.classical.regression -from safeds.data.tabular.containers import Table, TaggedTable +from safeds.data.labeled.containers import TabularDataset +from safeds.data.tabular.containers import Table from safeds.ml.classical.regression import Regressor /** @@ -52,6 +53,6 @@ class AdaBoostRegressor( */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: AdaBoostRegressor } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/decision_tree.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/decision_tree.sdsstub index 309f91146..7ff62b122 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/decision_tree.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/decision_tree.sdsstub @@ -1,6 +1,7 @@ package safeds.ml.classical.regression -from safeds.data.tabular.containers import Table, TaggedTable +from safeds.data.labeled.containers import TabularDataset +from safeds.data.tabular.containers import Table from safeds.ml.classical.regression import Regressor /** @@ -26,6 +27,6 @@ class DecisionTreeRegressor() sub Regressor { */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: DecisionTreeRegressor } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/elastic_net.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/elastic_net.sdsstub index c4b9bdda9..620a60251 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/elastic_net.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/elastic_net.sdsstub @@ -1,6 +1,7 @@ package safeds.ml.classical.regression -from safeds.data.tabular.containers import Table, TaggedTable +from safeds.data.labeled.containers import TabularDataset +from safeds.data.tabular.containers import Table from safeds.ml.classical.regression import Regressor /** @@ -46,6 +47,6 @@ class ElasticNetRegressor( */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: ElasticNetRegressor } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/gradient_boosting.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/gradient_boosting.sdsstub index ffb4dcdf8..b9999041d 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/gradient_boosting.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/gradient_boosting.sdsstub @@ -1,6 +1,7 @@ package safeds.ml.classical.regression -from safeds.data.tabular.containers import Table, TaggedTable +from safeds.data.labeled.containers import TabularDataset +from safeds.data.tabular.containers import Table from safeds.ml.classical.regression import Regressor /** @@ -46,6 +47,6 @@ class GradientBoostingRegressor( */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: GradientBoostingRegressor } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/k_nearest_neighbors.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/k_nearest_neighbors.sdsstub index 401080b61..0bbef05fc 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/k_nearest_neighbors.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/k_nearest_neighbors.sdsstub @@ -1,6 +1,7 @@ package safeds.ml.classical.regression -from safeds.data.tabular.containers import Table, TaggedTable +from safeds.data.labeled.containers import TabularDataset +from safeds.data.tabular.containers import Table from safeds.ml.classical.regression import Regressor /** @@ -38,6 +39,6 @@ class KNearestNeighborsRegressor( */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: KNearestNeighborsRegressor } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/lasso.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/lasso.sdsstub index f41044943..1ae4c66ba 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/lasso.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/lasso.sdsstub @@ -1,6 +1,7 @@ package safeds.ml.classical.regression -from safeds.data.tabular.containers import Table, TaggedTable +from safeds.data.labeled.containers import TabularDataset +from safeds.data.tabular.containers import Table from safeds.ml.classical.regression import Regressor /** @@ -37,6 +38,6 @@ class LassoRegressor( */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: LassoRegressor } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/linear_regression.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/linear_regression.sdsstub index 0cb39af48..32933d441 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/linear_regression.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/linear_regression.sdsstub @@ -1,6 +1,7 @@ package safeds.ml.classical.regression -from safeds.data.tabular.containers import Table, TaggedTable +from safeds.data.labeled.containers import TabularDataset +from safeds.data.tabular.containers import Table from safeds.ml.classical.regression import Regressor /** @@ -26,6 +27,6 @@ class LinearRegressionRegressor() sub Regressor { */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: LinearRegressionRegressor } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/random_forest.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/random_forest.sdsstub index 72850a479..de1a392c9 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/random_forest.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/random_forest.sdsstub @@ -1,6 +1,7 @@ package safeds.ml.classical.regression -from safeds.data.tabular.containers import Table, TaggedTable +from safeds.data.labeled.containers import TabularDataset +from safeds.data.tabular.containers import Table from safeds.ml.classical.regression import Regressor /** @@ -37,6 +38,6 @@ class RandomForestRegressor( */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: RandomForestRegressor } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/regressor.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/regressor.sdsstub index 9abf9a3dd..9b055f265 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/regressor.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/regressor.sdsstub @@ -1,6 +1,7 @@ package safeds.ml.classical.regression -from safeds.data.tabular.containers import Table, TaggedTable +from safeds.data.labeled.containers import TabularDataset +from safeds.data.tabular.containers import Table /** * Abstract base class for all regressors. @@ -22,7 +23,7 @@ class Regressor { */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: Regressor /** @@ -35,7 +36,7 @@ class Regressor { @Pure fun predict( dataset: Table - ) -> prediction: TaggedTable + ) -> prediction: TabularDataset /** * Compute the mean squared error (MSE) on the given data. @@ -47,7 +48,7 @@ class Regressor { @Pure @PythonName("mean_squared_error") fun meanSquaredError( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> meanSquaredError: Float /** @@ -60,6 +61,6 @@ class Regressor { @Pure @PythonName("mean_absolute_error") fun meanAbsoluteError( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> meanAbsoluteError: Float } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/ridge.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/ridge.sdsstub index d73165325..3b3727618 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/ridge.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/ridge.sdsstub @@ -1,6 +1,7 @@ package safeds.ml.classical.regression -from safeds.data.tabular.containers import Table, TaggedTable +from safeds.data.labeled.containers import TabularDataset +from safeds.data.tabular.containers import Table from safeds.ml.classical.regression import Regressor /** @@ -37,6 +38,6 @@ class RidgeRegressor( */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: RidgeRegressor } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/support_vector_machine.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/support_vector_machine.sdsstub index d73116987..7507b576c 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/support_vector_machine.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/support_vector_machine.sdsstub @@ -1,6 +1,7 @@ package safeds.ml.classical.regression -from safeds.data.tabular.containers import Table, TaggedTable +from safeds.data.labeled.containers import TabularDataset +from safeds.data.tabular.containers import Table from safeds.ml.classical.regression import Regressor /** @@ -72,6 +73,6 @@ class SupportVectorMachineRegressor( */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: SupportVectorMachineRegressor } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/classifier.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/classifier.sdsstub index 0ca937d15..94d367a70 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/classifier.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/classifier.sdsstub @@ -1,6 +1,7 @@ package safeds.ml.nn -from safeds.data.tabular.containers import Table, TaggedTable +from safeds.data.labeled.containers import TabularDataset +from safeds.data.tabular.containers import Table from safeds.ml.nn import Layer @Experimental diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/regressor.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/regressor.sdsstub index 2213db812..3148fdc9d 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/regressor.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/nn/regressor.sdsstub @@ -1,6 +1,7 @@ package safeds.ml.nn -from safeds.data.tabular.containers import Table, TaggedTable +from safeds.data.labeled.containers import TabularDataset +from safeds.data.tabular.containers import Table from safeds.ml.nn import Layer @Experimental From f03f0b41ea5df7f8a9d86d15bbd88553c775a49f Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Thu, 2 May 2024 18:16:55 +0200 Subject: [PATCH 13/14] fix: examples in documentation comments --- .../safeds/data/labeled/containers/tabular_dataset.sdsstub | 2 +- .../safeds/ml/classical/classification/ada_boost.sdsstub | 4 ++-- .../safeds/ml/classical/classification/decision_tree.sdsstub | 4 ++-- .../ml/classical/classification/gradient_boosting.sdsstub | 4 ++-- .../ml/classical/classification/k_nearest_neighbors.sdsstub | 4 ++-- .../ml/classical/classification/logistic_regression.sdsstub | 4 ++-- .../safeds/ml/classical/classification/random_forest.sdsstub | 4 ++-- .../classical/classification/support_vector_machine.sdsstub | 4 ++-- .../builtins/safeds/ml/classical/regression/ada_boost.sdsstub | 4 ++-- .../safeds/ml/classical/regression/decision_tree.sdsstub | 4 ++-- .../safeds/ml/classical/regression/elastic_net.sdsstub | 4 ++-- .../safeds/ml/classical/regression/gradient_boosting.sdsstub | 4 ++-- .../ml/classical/regression/k_nearest_neighbors.sdsstub | 4 ++-- .../builtins/safeds/ml/classical/regression/lasso.sdsstub | 4 ++-- .../safeds/ml/classical/regression/linear_regression.sdsstub | 4 ++-- .../safeds/ml/classical/regression/random_forest.sdsstub | 4 ++-- .../builtins/safeds/ml/classical/regression/ridge.sdsstub | 4 ++-- .../ml/classical/regression/support_vector_machine.sdsstub | 4 ++-- 18 files changed, 35 insertions(+), 35 deletions(-) diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/data/labeled/containers/tabular_dataset.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/data/labeled/containers/tabular_dataset.sdsstub index fde89ff2d..d9613613a 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/data/labeled/containers/tabular_dataset.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/data/labeled/containers/tabular_dataset.sdsstub @@ -21,7 +21,7 @@ package safeds.data.labeled.containers * {"id": [1, 2, 3], "feature": [4, 5, 6], "target": [1, 2, 3]}, * targetName="target", * extraNames=["id"] - * ) + * ); * } */ class TabularDataset( diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/ada_boost.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/ada_boost.sdsstub index e7cf48ba7..509e4a54d 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/ada_boost.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/ada_boost.sdsstub @@ -15,8 +15,8 @@ from safeds.ml.classical.classification import Classifier * * @example * pipeline example { - * val training = Table.fromCsvFile("training.csv").tagColumns("target"); - * val test = Table.fromCsvFile("test.csv").tagColumns("target"); + * val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + * val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); * val classifier = AdaBoostClassifier(maximumNumberOfLearners = 100).fit(training); * val accuracy = classifier.accuracy(test); * } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/decision_tree.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/decision_tree.sdsstub index 3e46a2937..19251f07a 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/decision_tree.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/decision_tree.sdsstub @@ -9,8 +9,8 @@ from safeds.ml.classical.classification import Classifier * * @example * pipeline example { - * val training = Table.fromCsvFile("training.csv").tagColumns("target"); - * val test = Table.fromCsvFile("test.csv").tagColumns("target"); + * val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + * val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); * val classifier = DecisionTreeClassifier().fit(training); * val accuracy = classifier.accuracy(test); * } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/gradient_boosting.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/gradient_boosting.sdsstub index 78ab72515..c9dcae833 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/gradient_boosting.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/gradient_boosting.sdsstub @@ -14,8 +14,8 @@ from safeds.ml.classical.classification import Classifier * * @example * pipeline example { - * val training = Table.fromCsvFile("training.csv").tagColumns("target"); - * val test = Table.fromCsvFile("test.csv").tagColumns("target"); + * val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + * val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); * val classifier = GradientBoostingClassifier(numberOfTrees = 50).fit(training); * val accuracy = classifier.accuracy(test); * } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/k_nearest_neighbors.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/k_nearest_neighbors.sdsstub index 08498f35f..2892c1308 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/k_nearest_neighbors.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/k_nearest_neighbors.sdsstub @@ -12,8 +12,8 @@ from safeds.ml.classical.classification import Classifier * * @example * pipeline example { - * val training = Table.fromCsvFile("training.csv").tagColumns("target"); - * val test = Table.fromCsvFile("test.csv").tagColumns("target"); + * val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + * val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); * val classifier = KNearestNeighborsClassifier(5).fit(training); * val accuracy = classifier.accuracy(test); * } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/logistic_regression.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/logistic_regression.sdsstub index e0124c985..eae05d280 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/logistic_regression.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/logistic_regression.sdsstub @@ -9,8 +9,8 @@ from safeds.ml.classical.classification import Classifier * * @example * pipeline example { - * val training = Table.fromCsvFile("training.csv").tagColumns("target"); - * val test = Table.fromCsvFile("test.csv").tagColumns("target"); + * val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + * val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); * val classifier = LogisticRegressionClassifier().fit(training); * val accuracy = classifier.accuracy(test); * } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/random_forest.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/random_forest.sdsstub index f3ec0e6e6..adb481b07 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/random_forest.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/random_forest.sdsstub @@ -11,8 +11,8 @@ from safeds.ml.classical.classification import Classifier * * @example * pipeline example { - * val training = Table.fromCsvFile("training.csv").tagColumns("target"); - * val test = Table.fromCsvFile("test.csv").tagColumns("target"); + * val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + * val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); * val classifier = RandomForestClassifier(numberOfTrees = 10).fit(training); * val accuracy = classifier.accuracy(test); * } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/support_vector_machine.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/support_vector_machine.sdsstub index 5499a193d..0643793b1 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/support_vector_machine.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/support_vector_machine.sdsstub @@ -12,8 +12,8 @@ from safeds.ml.classical.classification import Classifier * * @example * pipeline example { - * val training = Table.fromCsvFile("training.csv").tagColumns("target"); - * val test = Table.fromCsvFile("test.csv").tagColumns("target"); + * val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + * val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); * val classifier = SupportVectorMachineClassifier( * kernel = SupportVectorMachineClassifier.Kernel.Linear * ).fit(training); diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/ada_boost.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/ada_boost.sdsstub index 9cba1de14..bd8f07fb6 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/ada_boost.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/ada_boost.sdsstub @@ -15,8 +15,8 @@ from safeds.ml.classical.regression import Regressor * * @example * pipeline example { - * val training = Table.fromCsvFile("training.csv").tagColumns("target"); - * val test = Table.fromCsvFile("test.csv").tagColumns("target"); + * val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + * val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); * val regressor = AdaBoostRegressor(maximumNumberOfLearners = 100).fit(training); * val meanSquaredError = regressor.meanSquaredError(test); * } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/decision_tree.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/decision_tree.sdsstub index 7ff62b122..687d4954d 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/decision_tree.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/decision_tree.sdsstub @@ -9,8 +9,8 @@ from safeds.ml.classical.regression import Regressor * * @example * pipeline example { - * val training = Table.fromCsvFile("training.csv").tagColumns("target"); - * val test = Table.fromCsvFile("test.csv").tagColumns("target"); + * val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + * val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); * val regressor = DecisionTreeRegressor().fit(training); * val meanSquaredError = regressor.meanSquaredError(test); * } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/elastic_net.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/elastic_net.sdsstub index 620a60251..b92bad02f 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/elastic_net.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/elastic_net.sdsstub @@ -13,8 +13,8 @@ from safeds.ml.classical.regression import Regressor * * @example * pipeline example { - * val training = Table.fromCsvFile("training.csv").tagColumns("target"); - * val test = Table.fromCsvFile("test.csv").tagColumns("target"); + * val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + * val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); * val regressor = ElasticNetRegressor(lassoRatio = 0.8).fit(training); * val meanSquaredError = regressor.meanSquaredError(test); * } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/gradient_boosting.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/gradient_boosting.sdsstub index b9999041d..4ee9f3f29 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/gradient_boosting.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/gradient_boosting.sdsstub @@ -14,8 +14,8 @@ from safeds.ml.classical.regression import Regressor * * @example * pipeline example { - * val training = Table.fromCsvFile("training.csv").tagColumns("target"); - * val test = Table.fromCsvFile("test.csv").tagColumns("target"); + * val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + * val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); * val regressor = GradientBoostingRegressor(numberOfTrees = 50).fit(training); * val meanSquaredError = regressor.meanSquaredError(test); * } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/k_nearest_neighbors.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/k_nearest_neighbors.sdsstub index 0bbef05fc..ace899c14 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/k_nearest_neighbors.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/k_nearest_neighbors.sdsstub @@ -12,8 +12,8 @@ from safeds.ml.classical.regression import Regressor * * @example * pipeline example { - * val training = Table.fromCsvFile("training.csv").tagColumns("target"); - * val test = Table.fromCsvFile("test.csv").tagColumns("target"); + * val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + * val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); * val regressor = KNearestNeighborsRegressor(numberOfNeighbors = 5).fit(training); * val meanSquaredError = regressor.meanSquaredError(test); * } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/lasso.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/lasso.sdsstub index 1ae4c66ba..1bbfdbcde 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/lasso.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/lasso.sdsstub @@ -11,8 +11,8 @@ from safeds.ml.classical.regression import Regressor * * @example * pipeline example { - * val training = Table.fromCsvFile("training.csv").tagColumns("target"); - * val test = Table.fromCsvFile("test.csv").tagColumns("target"); + * val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + * val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); * val regressor = LassoRegressor(alpha = 2.0).fit(training); * val meanSquaredError = regressor.meanSquaredError(test); * } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/linear_regression.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/linear_regression.sdsstub index 32933d441..945e0de00 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/linear_regression.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/linear_regression.sdsstub @@ -9,8 +9,8 @@ from safeds.ml.classical.regression import Regressor * * @example * pipeline example { - * val training = Table.fromCsvFile("training.csv").tagColumns("target"); - * val test = Table.fromCsvFile("test.csv").tagColumns("target"); + * val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + * val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); * val regressor = LinearRegressionRegressor().fit(training); * val meanSquaredError = regressor.meanSquaredError(test); * } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/random_forest.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/random_forest.sdsstub index de1a392c9..977265d47 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/random_forest.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/random_forest.sdsstub @@ -11,8 +11,8 @@ from safeds.ml.classical.regression import Regressor * * @example * pipeline example { - * val training = Table.fromCsvFile("training.csv").tagColumns("target"); - * val test = Table.fromCsvFile("test.csv").tagColumns("target"); + * val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + * val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); * val regressor = RandomForestRegressor(numberOfTrees = 10).fit(training); * val meanSquaredError = regressor.meanSquaredError(test); * } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/ridge.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/ridge.sdsstub index 3b3727618..f91095e75 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/ridge.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/ridge.sdsstub @@ -11,8 +11,8 @@ from safeds.ml.classical.regression import Regressor * * @example * pipeline example { - * val training = Table.fromCsvFile("training.csv").tagColumns("target"); - * val test = Table.fromCsvFile("test.csv").tagColumns("target"); + * val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + * val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); * val regressor = RidgeRegressor(alpha = 2.0).fit(training); * val meanSquaredError = regressor.meanSquaredError(test); * } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/support_vector_machine.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/support_vector_machine.sdsstub index 7507b576c..18b841836 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/support_vector_machine.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/regression/support_vector_machine.sdsstub @@ -12,8 +12,8 @@ from safeds.ml.classical.regression import Regressor * * @example * pipeline example { - * val training = Table.fromCsvFile("training.csv").tagColumns("target"); - * val test = Table.fromCsvFile("test.csv").tagColumns("target"); + * val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + * val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); * val regressor = SupportVectorMachineRegressor( * kernel = SupportVectorMachineRegressor.Kernel.Linear * ).fit(training); From eda3e71ddd6a28dabaea9536e171eef465ee7425 Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Thu, 2 May 2024 18:17:24 +0200 Subject: [PATCH 14/14] docs: regenerate API docs --- docs/api/SUMMARY.md | 8 +- .../data/labeled/containers/TabularDataset.md | 101 + .../safeds/data/tabular/containers/Column.md | 72 +- .../api/safeds/data/tabular/containers/Row.md | 120 +- .../safeds/data/tabular/containers/Table.md | 304 +-- .../data/tabular/containers/TaggedTable.md | 2064 ----------------- .../data/tabular/containers/TimeSeries.md | 160 +- .../tabular/transformation/Discretizer.md | 34 +- .../data/tabular/transformation/Imputer.md | 34 +- .../InvertibleTableTransformer.md | 40 +- .../tabular/transformation/LabelEncoder.md | 36 +- .../tabular/transformation/OneHotEncoder.md | 36 +- .../tabular/transformation/RangeScaler.md | 36 +- .../tabular/transformation/StandardScaler.md | 36 +- .../transformation/TableTransformer.md | 50 +- .../classification/AdaBoostClassifier.md | 68 +- .../ml/classical/classification/Classifier.md | 88 +- .../classification/DecisionTreeClassifier.md | 68 +- .../GradientBoostingClassifier.md | 68 +- .../KNearestNeighborsClassifier.md | 68 +- .../LogisticRegressionClassifier.md | 68 +- .../classification/RandomForestClassifier.md | 68 +- .../SupportVectorMachineClassifier.md | 70 +- .../classical/regression/AdaBoostRegressor.md | 56 +- .../ml/classical/regression/ArimaRegressor.md | 44 +- .../regression/DecisionTreeRegressor.md | 56 +- .../regression/ElasticNetRegressor.md | 56 +- .../regression/GradientBoostingRegressor.md | 56 +- .../regression/KNearestNeighborsRegressor.md | 56 +- .../ml/classical/regression/LassoRegressor.md | 56 +- .../regression/LinearRegressionRegressor.md | 56 +- .../regression/RandomForestRegressor.md | 56 +- .../ml/classical/regression/Regressor.md | 72 +- .../ml/classical/regression/RidgeRegressor.md | 56 +- .../SupportVectorMachineRegressor.md | 58 +- docs/api/safeds/ml/nn/ForwardLayer.md | 2 +- docs/api/safeds/ml/nn/InputConversion.md | 25 + docs/api/safeds/ml/nn/InputConversionTable.md | 21 + docs/api/safeds/ml/nn/Layer.md | 10 +- .../safeds/ml/nn/NeuralNetworkClassifier.md | 65 +- .../safeds/ml/nn/NeuralNetworkRegressor.md | 65 +- docs/api/safeds/ml/nn/OutputConversion.md | 25 + .../api/safeds/ml/nn/OutputConversionTable.md | 19 + 43 files changed, 1263 insertions(+), 3344 deletions(-) create mode 100644 docs/api/safeds/data/labeled/containers/TabularDataset.md delete mode 100644 docs/api/safeds/data/tabular/containers/TaggedTable.md create mode 100644 docs/api/safeds/ml/nn/InputConversion.md create mode 100644 docs/api/safeds/ml/nn/InputConversionTable.md create mode 100644 docs/api/safeds/ml/nn/OutputConversion.md create mode 100644 docs/api/safeds/ml/nn/OutputConversionTable.md diff --git a/docs/api/SUMMARY.md b/docs/api/SUMMARY.md index e771a5fe4..6380810f3 100644 --- a/docs/api/SUMMARY.md +++ b/docs/api/SUMMARY.md @@ -9,12 +9,14 @@ search: - containers - [Image](safeds/data/image/containers/Image.md) - [ImageList](safeds/data/image/containers/ImageList.md) + - labeled + - containers + - [TabularDataset](safeds/data/labeled/containers/TabularDataset.md) - tabular - containers - [Column](safeds/data/tabular/containers/Column.md) - [Row](safeds/data/tabular/containers/Row.md) - [Table](safeds/data/tabular/containers/Table.md) - - [TaggedTable](safeds/data/tabular/containers/TaggedTable.md) - [TimeSeries](safeds/data/tabular/containers/TimeSeries.md) - transformation - [Discretizer](safeds/data/tabular/transformation/Discretizer.md) @@ -79,6 +81,10 @@ search: - [SupportVectorMachineRegressor](safeds/ml/classical/regression/SupportVectorMachineRegressor.md) - nn - [ForwardLayer](safeds/ml/nn/ForwardLayer.md) + - [InputConversion](safeds/ml/nn/InputConversion.md) + - [InputConversionTable](safeds/ml/nn/InputConversionTable.md) - [Layer](safeds/ml/nn/Layer.md) - [NeuralNetworkClassifier](safeds/ml/nn/NeuralNetworkClassifier.md) - [NeuralNetworkRegressor](safeds/ml/nn/NeuralNetworkRegressor.md) + - [OutputConversion](safeds/ml/nn/OutputConversion.md) + - [OutputConversionTable](safeds/ml/nn/OutputConversionTable.md) diff --git a/docs/api/safeds/data/labeled/containers/TabularDataset.md b/docs/api/safeds/data/labeled/containers/TabularDataset.md new file mode 100644 index 000000000..abc0fa40d --- /dev/null +++ b/docs/api/safeds/data/labeled/containers/TabularDataset.md @@ -0,0 +1,101 @@ +# `#!sds class` TabularDataset {#safeds.data.labeled.containers.TabularDataset data-toc-label='TabularDataset'} + +A tabular dataset maps feature columns to a target column. + +Create a tabular dataset from a mapping of column names to their values. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `data` | `#!sds union>, Table>` | The data. | - | +| `targetName` | [`String`][safeds.lang.String] | Name of the target column. | - | +| `extraNames` | [`List`][safeds.lang.List] | Names of the columns that are neither features nor target. If None, no extra columns are used, i.e. all but the target column are used as features. | `#!sds []` | + +**Examples:** + +```sds hl_lines="2" +pipeline example { + val dataset = TabularDataset( + {"id": [1, 2, 3], "feature": [4, 5, 6], "target": [1, 2, 3]}, + targetName="target", + extraNames=["id"] + ); +} +``` + +??? quote "Stub code in `tabular_dataset.sdsstub`" + + ```sds linenums="27" + class TabularDataset( + data: union>, Table>, + @PythonName("target_name") targetName: String, + @PythonName("extra_names") extraNames: List = [] + ) { + /** + * The feature columns of the tabular dataset. + */ + attr features: Table + /** + * The target column of the tabular dataset. + */ + attr target: Column + /** + * Additional columns of the tabular dataset that are neither features nor target. + * + * These can be used to store additional information about instances, such as IDs. + */ + attr extras: Table + + /** + * Return a new `Table` containing the feature columns and the target column. + * + * The original `TabularDataset` is not modified. + * + * @result table A table containing the feature columns and the target column. + */ + @Pure + @PythonName("to_table") + fun toTable() -> table: Table + } + ``` + +## `#!sds attr` extras {#safeds.data.labeled.containers.TabularDataset.extras data-toc-label='extras'} + +Additional columns of the tabular dataset that are neither features nor target. + +These can be used to store additional information about instances, such as IDs. + +**Type:** [`Table`][safeds.data.tabular.containers.Table] + +## `#!sds attr` features {#safeds.data.labeled.containers.TabularDataset.features data-toc-label='features'} + +The feature columns of the tabular dataset. + +**Type:** [`Table`][safeds.data.tabular.containers.Table] + +## `#!sds attr` target {#safeds.data.labeled.containers.TabularDataset.target data-toc-label='target'} + +The target column of the tabular dataset. + +**Type:** [`Column`][safeds.data.tabular.containers.Column] + +## `#!sds fun` toTable {#safeds.data.labeled.containers.TabularDataset.toTable data-toc-label='toTable'} + +Return a new `Table` containing the feature columns and the target column. + +The original `TabularDataset` is not modified. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `table` | [`Table`][safeds.data.tabular.containers.Table] | A table containing the feature columns and the target column. | + +??? quote "Stub code in `tabular_dataset.sdsstub`" + + ```sds linenums="54" + @Pure + @PythonName("to_table") + fun toTable() -> table: Table + ``` diff --git a/docs/api/safeds/data/tabular/containers/Column.md b/docs/api/safeds/data/tabular/containers/Column.md index 256e386a0..01eb732f3 100644 --- a/docs/api/safeds/data/tabular/containers/Column.md +++ b/docs/api/safeds/data/tabular/containers/Column.md @@ -347,6 +347,27 @@ pipeline example { @Pure fun minimum() -> minimum: Float + /** + * Return the number of missing values in the column. + * + * @result count The number of missing values. + * + * @example + * pipeline example { + * val column = Column("test", [1, 2, 3, 4]); + * val missingValueCount = column.missingValueCount(); // 0 + * } + * + * @example + * pipeline example { + * val column = Column("test", [1, 2, 3, null]); + * val missingValueCount = column.missingValueCount(); // 1 + * } + */ + @Pure + @PythonName("missing_value_count") + fun missingValueCount() -> count: Int + /** * Return the ratio of missing values to the total number of elements in the column. * @@ -923,6 +944,39 @@ pipeline example { fun minimum() -> minimum: Float ``` +## `#!sds fun` missingValueCount {#safeds.data.tabular.containers.Column.missingValueCount data-toc-label='missingValueCount'} + +Return the number of missing values in the column. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `count` | [`Int`][safeds.lang.Int] | The number of missing values. | + +**Examples:** + +```sds hl_lines="3" +pipeline example { + val column = Column("test", [1, 2, 3, 4]); + val missingValueCount = column.missingValueCount(); // 0 +} +``` +```sds hl_lines="3" +pipeline example { + val column = Column("test", [1, 2, 3, null]); + val missingValueCount = column.missingValueCount(); // 1 +} +``` + +??? quote "Stub code in `column.sdsstub`" + + ```sds linenums="355" + @Pure + @PythonName("missing_value_count") + fun missingValueCount() -> count: Int + ``` + ## `#!sds fun` missingValueRatio {#safeds.data.tabular.containers.Column.missingValueRatio data-toc-label='missingValueRatio'} Return the ratio of missing values to the total number of elements in the column. @@ -950,7 +1004,7 @@ pipeline example { ??? quote "Stub code in `column.sdsstub`" - ```sds linenums="355" + ```sds linenums="376" @Pure @PythonName("missing_value_ratio") fun missingValueRatio() -> missinValueRatio: Float @@ -983,7 +1037,7 @@ pipeline example { ??? quote "Stub code in `column.sdsstub`" - ```sds linenums="376" + ```sds linenums="397" @Pure fun mode() -> mode: List ``` @@ -1049,7 +1103,7 @@ pipeline example { ??? quote "Stub code in `column.sdsstub`" - ```sds linenums="461" + ```sds linenums="482" @Pure @PythonName("plot_boxplot") fun plotBoxplot() -> boxplot: Image @@ -1076,7 +1130,7 @@ pipeline example { ??? quote "Stub code in `column.sdsstub`" - ```sds linenums="476" + ```sds linenums="497" @Pure @PythonName("plot_histogram") fun plotHistogram() -> histogram: Image @@ -1153,7 +1207,7 @@ pipeline example { ??? quote "Stub code in `column.sdsstub`" - ```sds linenums="404" + ```sds linenums="425" @Pure fun stability() -> stability: Float ``` @@ -1179,7 +1233,7 @@ pipeline example { ??? quote "Stub code in `column.sdsstub`" - ```sds linenums="418" + ```sds linenums="439" @Pure @PythonName("standard_deviation") fun standardDeviation() -> standardDeviation: Float @@ -1206,7 +1260,7 @@ pipeline example { ??? quote "Stub code in `column.sdsstub`" - ```sds linenums="433" + ```sds linenums="454" @Pure fun sum() -> sum: Float ``` @@ -1232,7 +1286,7 @@ pipeline example { ??? quote "Stub code in `column.sdsstub`" - ```sds linenums="491" + ```sds linenums="512" @Pure @PythonName("to_html") fun toHtml() -> html: String @@ -1301,7 +1355,7 @@ pipeline example { ??? quote "Stub code in `column.sdsstub`" - ```sds linenums="447" + ```sds linenums="468" @Pure fun variance() -> variance: Float ``` diff --git a/docs/api/safeds/data/tabular/containers/Row.md b/docs/api/safeds/data/tabular/containers/Row.md index d225bc3e7..9a6b2218c 100644 --- a/docs/api/safeds/data/tabular/containers/Row.md +++ b/docs/api/safeds/data/tabular/containers/Row.md @@ -41,7 +41,7 @@ pipeline example { * val numberOfColumns = row.numberOfColumns; // 2 * } */ - @PythonName("number_of_column") attr numberOfColumns: Int + @PythonName("number_of_columns") attr numberOfColumns: Int /** * Return the schema of the row. * @@ -128,33 +128,41 @@ pipeline example { @PythonName("column_name") columnName: String ) -> type: ColumnType - // // TODO Safe-DS does not support tuple types. - // /** - // * Sort the columns of a `Row` with the given comparator and return a new `Row`. - // * - // * The original row is not modified. The comparator is a function that takes two tuples of (ColumnName, - // * Value) `col1` and `col2` and returns an integer: - // * - // * * If `col1` should be ordered before `col2`, the function should return a negative number. - // * * If `col1` should be ordered after `col2`, the function should return a positive number. - // * * If the original order of `col1` and `col2` should be kept, the function should return 0. - // * - // * If no comparator is given, the columns will be sorted alphabetically by their name. - // * - // * @param comparator The function used to compare two tuples of (ColumnName, Value). - // * - // * @result sortedRow A new row with sorted columns. - // * - // * @example - // * pipeline example { - // * // TODO - // * } - // */ - // @Pure - // @PythonName("sort_columns") - // fun sortColumns( - // comparator: (param1: Tuple, param2: Tuple) -> param3: Int - // ) -> sortedRow: Row + /** + * Sort the columns of a `Row` with the given comparator and return a new `Row`. + * + * The original row is not modified. The comparator is a function with four parameters: + * + * * `name_1` is the name of the first column. + * * `value_1` is the value of the first column. + * * `name_2` is the name of the second column. + * * `value_2` is the value of the second column. + * + * It should return an integer, indicating the desired order of the columns: + * + * * If `col1` should be ordered before `col2`, the function should return a negative number. + * * If `col1` should be ordered after `col2`, the function should return a positive number. + * * If the original order of `col1` and `col2` should be kept, the function should return 0. + * + * If no comparator is given, the columns will be sorted alphabetically by their name. + * + * @param comparator The function used to compare two tuples of (ColumnName, Value). + * + * @result sortedRow A new row with sorted columns. + * + * @example + * pipeline example { + * val row = Row({"b": 2, "a": 1}); + * val sortedRow = row.sortColumns((name1, value1, name2, value2) -> + * (value1 as Int) - (value2 as Int) + * ); + * } + */ + @Pure + @PythonName("sort_columns") + fun sortColumns( + comparator: (name1: String, value1: Any, name2: String, value2: Any) -> comparison: Int + ) -> sortedRow: Row /** * Return a map of column names to column values. @@ -338,6 +346,58 @@ pipeline example { ) -> hasColumn: Boolean ``` +## `#!sds fun` sortColumns {#safeds.data.tabular.containers.Row.sortColumns data-toc-label='sortColumns'} + +Sort the columns of a `Row` with the given comparator and return a new `Row`. + +The original row is not modified. The comparator is a function with four parameters: + +* `name_1` is the name of the first column. +* `value_1` is the value of the first column. +* `name_2` is the name of the second column. +* `value_2` is the value of the second column. + +It should return an integer, indicating the desired order of the columns: + +* If `col1` should be ordered before `col2`, the function should return a negative number. +* If `col1` should be ordered after `col2`, the function should return a positive number. +* If the original order of `col1` and `col2` should be kept, the function should return 0. + +If no comparator is given, the columns will be sorted alphabetically by their name. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `comparator` | `#!sds (name1: String, value1: Any, name2: String, value2: Any) -> (comparison: Int)` | The function used to compare two tuples of (ColumnName, Value). | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `sortedRow` | [`Row`][safeds.data.tabular.containers.Row] | A new row with sorted columns. | + +**Examples:** + +```sds hl_lines="3" +pipeline example { + val row = Row({"b": 2, "a": 1}); + val sortedRow = row.sortColumns((name1, value1, name2, value2) -> + (value1 as Int) - (value2 as Int) + ); +} +``` + +??? quote "Stub code in `row.sdsstub`" + + ```sds linenums="155" + @Pure + @PythonName("sort_columns") + fun sortColumns( + comparator: (name1: String, value1: Any, name2: String, value2: Any) -> comparison: Int + ) -> sortedRow: Row + ``` + ## `#!sds fun` toHtml {#safeds.data.tabular.containers.Row.toHtml data-toc-label='toHtml'} Return an HTML representation of the row. @@ -359,7 +419,7 @@ pipeline example { ??? quote "Stub code in `row.sdsstub`" - ```sds linenums="179" + ```sds linenums="187" @Pure @PythonName("to_html") fun toHtml() -> html: String @@ -386,7 +446,7 @@ pipeline example { ??? quote "Stub code in `row.sdsstub`" - ```sds linenums="164" + ```sds linenums="172" @Pure @PythonName("to_dict") fun toMap() -> map: Map diff --git a/docs/api/safeds/data/tabular/containers/Table.md b/docs/api/safeds/data/tabular/containers/Table.md index e69c2183f..84a4b9085 100644 --- a/docs/api/safeds/data/tabular/containers/Table.md +++ b/docs/api/safeds/data/tabular/containers/Table.md @@ -22,7 +22,7 @@ Note: When removing the last column of the table, the `number_of_columns` proper **Inheritors:** -- [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] +- `#!sds TaggedTable` - [`TimeSeries`][safeds.data.tabular.containers.TimeSeries] **Examples:** @@ -35,7 +35,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="30" + ```sds linenums="31" class Table( data: Map>? = null // TODO: update default value to empty map ) { @@ -449,7 +449,7 @@ pipeline example { * } */ @Pure - @PythonName("group_rows_by") + @PythonName("group_rows") fun groupRows( @PythonName("key_selector") keySelector: (row: Row) -> key: T ) -> tablesByKey: Map @@ -824,46 +824,6 @@ pipeline example { @PythonName("percentage_in_first") ratioInFirst: Float ) -> (first: Table, second: Table) - /** - * Return a new `TaggedTable` with columns marked as a target column or feature columns. - * - * The original table is not modified. - * - * @param targetName - * Name of the target column. - * - * @param featureNames - * Names of the feature columns. If None, all columns except the target column are used. Use this to hide columns - * during training but still keep them in the input, to easily link predictions back to the original data. - * - * @result taggedTable A new tagged table with the given target and feature names. - * - * @example - * pipeline example { - * val table = Table({ - * "age": [23, 16], - * "survived": [ 0, 1], - * }); - * val taggedTable = table.tagColumns("survived"); - * } - * - * @example - * pipeline example { - * val table = Table({ - * "id": [ 1, 2], - * "age": [23, 16], - * "survived": [ 0, 1], - * }); - * val taggedTable = table.tagColumns("target", featureNames = ["age"]); - * } - */ - @Pure - @PythonName("tag_columns") - fun tagColumns( - @PythonName("target_name") targetName: String, - @PythonName("feature_names") featureNames: List? = null - ) -> taggedTable: TaggedTable - /** * Return a new `Table` with the provided column transformed by calling the provided transformer. * @@ -1018,6 +978,8 @@ pipeline example { /** * Plot a histogram for every column. * + * @param numberOfBins The number of bins to use in the histogram. + * * @result histograms The plot as an image. * * @example @@ -1028,7 +990,11 @@ pipeline example { */ @Pure @PythonName("plot_histograms") - fun plotHistograms() -> histograms: Image + fun plotHistograms( + @PythonName("number_of_bins") const numberOfBins: Int = 10 + ) -> histograms: Image where { + numberOfBins > 0 + } /** * Write the data from the table into a CSV file. @@ -1154,6 +1120,46 @@ pipeline example { @Pure @PythonName("to_rows") fun toRows() -> rows: List + + /** + * Return a new `TabularDataset` with columns marked as a target column or feature columns. + * + * The original table is not modified. + * + * @param targetName + * Name of the target column. + * + * @param extraNames + * Names of the columns that are neither features nor target. If None, no extra columns are used, i.e. all but the + * target column are used as features. + * + * @result dataset A new tabular dataset with the given target and extras. + * + * @example + * pipeline example { + * val table = Table({ + * "age": [23, 16], + * "survived": [ 0, 1], + * }); + * val dataset = table.toTabularDataset("survived"); + * } + * + * @example + * pipeline example { + * val table = Table({ + * "id": [ 1, 2], + * "age": [23, 16], + * "survived": [ 0, 1], + * }); + * val dataset = table.toTabularDataset("target", extraNames = ["id"]); + * } + */ + @Pure + @PythonName("to_tabular_dataset") + fun toTabularDataset( + @PythonName("target_name") targetName: String, + @PythonName("extra_names") extraNames: List = [] + ) -> dataset: TabularDataset } ``` @@ -1252,7 +1258,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="301" + ```sds linenums="302" @Pure @PythonName("add_column") fun addColumn( @@ -1297,7 +1303,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="330" + ```sds linenums="331" @Pure @PythonName("add_columns") fun addColumns( @@ -1344,7 +1350,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="361" + ```sds linenums="362" @Pure @PythonName("add_row") fun addRow( @@ -1390,7 +1396,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="391" + ```sds linenums="392" @Pure @PythonName("add_rows") fun addRows( @@ -1430,7 +1436,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="415" + ```sds linenums="416" @Pure @PythonName("filter_rows") fun filterRows( @@ -1465,7 +1471,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="202" + ```sds linenums="203" @Pure @PythonName("get_column") fun getColumn( @@ -1500,7 +1506,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="240" + ```sds linenums="241" @Pure @PythonName("get_column_type") fun getColumnType( @@ -1535,7 +1541,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="259" + ```sds linenums="260" @Pure @PythonName("get_row") fun getRow( @@ -1584,9 +1590,9 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="442" + ```sds linenums="443" @Pure - @PythonName("group_rows_by") + @PythonName("group_rows") fun groupRows( @PythonName("key_selector") keySelector: (row: Row) -> key: T ) -> tablesByKey: Map @@ -1619,7 +1625,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="221" + ```sds linenums="222" @Pure @PythonName("has_column") fun hasColumn( @@ -1659,7 +1665,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="928" + ```sds linenums="889" @Pure @PythonName("inverse_transform_table") fun inverseTransformTable( @@ -1699,7 +1705,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="466" + ```sds linenums="467" @Pure @PythonName("keep_only_columns") fun keepOnlyColumns( @@ -1728,7 +1734,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="1005" + ```sds linenums="966" @Pure @PythonName("plot_boxplots") fun plotBoxplots() -> boxplots: Image @@ -1755,7 +1761,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="945" + ```sds linenums="906" @Pure @PythonName("plot_correlation_heatmap") fun plotCorrelationHeatmap() -> correlationHeatmap: Image @@ -1765,6 +1771,12 @@ pipeline example { Plot a histogram for every column. +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `numberOfBins` | [`Int`][safeds.lang.Int] | The number of bins to use in the histogram. | `#!sds 10` | + **Results:** | Name | Type | Description | @@ -1782,10 +1794,14 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="1020" + ```sds linenums="983" @Pure @PythonName("plot_histograms") - fun plotHistograms() -> histograms: Image + fun plotHistograms( + @PythonName("number_of_bins") const numberOfBins: Int = 10 + ) -> histograms: Image where { + numberOfBins > 0 + } ``` ## `#!sds fun` plotLineplot {#safeds.data.tabular.containers.Table.plotLineplot data-toc-label='plotLineplot'} @@ -1819,7 +1835,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="966" + ```sds linenums="927" @Pure @PythonName("plot_lineplot") fun plotLineplot( @@ -1856,7 +1872,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="987" + ```sds linenums="948" @Pure @PythonName("plot_scatterplot") fun plotScatterplot( @@ -1897,7 +1913,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="490" + ```sds linenums="491" @Pure @PythonName("remove_columns") fun removeColumns( @@ -1931,7 +1947,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="512" + ```sds linenums="513" @Pure @PythonName("remove_columns_with_missing_values") fun removeColumnsWithMissingValues() -> projectedTable: Table @@ -1963,7 +1979,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="532" + ```sds linenums="533" @Pure @PythonName("remove_columns_with_non_numerical_values") fun removeColumnsWithNonNumericalValues() -> projectedTable: Table @@ -1993,7 +2009,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="550" + ```sds linenums="551" @Pure @PythonName("remove_duplicate_rows") fun removeDuplicateRows() -> filteredTable: Table @@ -2023,7 +2039,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="568" + ```sds linenums="569" @Pure @PythonName("remove_rows_with_missing_values") fun removeRowsWithMissingValues() -> filteredTable: Table @@ -2063,7 +2079,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="596" + ```sds linenums="597" @Pure @PythonName("remove_rows_with_outliers") fun removeRowsWithOutliers() -> filteredTable: Table @@ -2100,7 +2116,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="617" + ```sds linenums="618" @Pure @PythonName("rename_column") fun renameColumn( @@ -2152,7 +2168,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="653" + ```sds linenums="654" @Pure @PythonName("replace_column") fun replaceColumn( @@ -2184,7 +2200,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="673" + ```sds linenums="674" @Pure @PythonName("shuffle_rows") fun shuffleRows() -> shuffledTable: Table @@ -2236,7 +2252,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="709" + ```sds linenums="710" @Pure @PythonName("slice_rows") fun sliceRows( @@ -2292,7 +2308,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="749" + ```sds linenums="750" @Pure @PythonName("sort_columns") fun sortColumns( @@ -2344,7 +2360,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="785" + ```sds linenums="786" @Pure @PythonName("sort_rows") fun sortRows( @@ -2385,7 +2401,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="812" + ```sds linenums="813" @Pure @PythonName("split_rows") fun splitRows( @@ -2416,64 +2432,12 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="278" + ```sds linenums="279" @Pure @PythonName("summarize_statistics") fun summarizeStatistics() -> statistics: Table ``` -## `#!sds fun` tagColumns {#safeds.data.tabular.containers.Table.tagColumns data-toc-label='tagColumns'} - -Return a new `TaggedTable` with columns marked as a target column or feature columns. - -The original table is not modified. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `targetName` | [`String`][safeds.lang.String] | Name of the target column. | - | -| `featureNames` | [`List?`][safeds.lang.List] | Names of the feature columns. If None, all columns except the target column are used. Use this to hide columns during training but still keep them in the input, to easily link predictions back to the original data. | `#!sds null` | - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `taggedTable` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A new tagged table with the given target and feature names. | - -**Examples:** - -```sds hl_lines="6" -pipeline example { - val table = Table({ - "age": [23, 16], - "survived": [ 0, 1], - }); - val taggedTable = table.tagColumns("survived"); -} -``` -```sds hl_lines="7" -pipeline example { - val table = Table({ - "id": [ 1, 2], - "age": [23, 16], - "survived": [ 0, 1], - }); - val taggedTable = table.tagColumns("target", featureNames = ["age"]); -} -``` - -??? quote "Stub code in `table.sdsstub`" - - ```sds linenums="851" - @Pure - @PythonName("tag_columns") - fun tagColumns( - @PythonName("target_name") targetName: String, - @PythonName("feature_names") featureNames: List? = null - ) -> taggedTable: TaggedTable - ``` - ## `#!sds fun` toColumns {#safeds.data.tabular.containers.Table.toColumns data-toc-label='toColumns'} Return a list of the columns. @@ -2496,7 +2460,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="1128" + ```sds linenums="1095" @Pure @PythonName("to_columns") fun toColumns() -> columns: List @@ -2526,7 +2490,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="1038" + ```sds linenums="1005" @Impure([ImpurityReason.FileWriteToParameterizedPath("path")]) @PythonName("to_csv_file") fun toCsvFile( @@ -2559,7 +2523,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="1059" + ```sds linenums="1026" @Impure([ImpurityReason.FileWriteToParameterizedPath("path")]) @PythonName("to_excel_file") fun toExcelFile( @@ -2588,7 +2552,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="1112" + ```sds linenums="1079" @Pure @PythonName("to_html") fun toHtml() -> html: String @@ -2618,7 +2582,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="1079" + ```sds linenums="1046" @Impure([ImpurityReason.FileWriteToParameterizedPath("path")]) @PythonName("to_json_file") fun toJsonFile( @@ -2648,7 +2612,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="1097" + ```sds linenums="1064" @Pure @PythonName("to_dict") fun toMap() -> map: Map> @@ -2676,13 +2640,65 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="1144" + ```sds linenums="1111" @Experimental @Pure @PythonName("to_rows") fun toRows() -> rows: List ``` +## `#!sds fun` toTabularDataset {#safeds.data.tabular.containers.Table.toTabularDataset data-toc-label='toTabularDataset'} + +Return a new `TabularDataset` with columns marked as a target column or feature columns. + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `targetName` | [`String`][safeds.lang.String] | Name of the target column. | - | +| `extraNames` | [`List`][safeds.lang.List] | Names of the columns that are neither features nor target. If None, no extra columns are used, i.e. all but the target column are used as features. | `#!sds []` | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `dataset` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | A new tabular dataset with the given target and extras. | + +**Examples:** + +```sds hl_lines="6" +pipeline example { + val table = Table({ + "age": [23, 16], + "survived": [ 0, 1], + }); + val dataset = table.toTabularDataset("survived"); +} +``` +```sds hl_lines="7" +pipeline example { + val table = Table({ + "id": [ 1, 2], + "age": [23, 16], + "survived": [ 0, 1], + }); + val dataset = table.toTabularDataset("target", extraNames = ["id"]); +} +``` + +??? quote "Stub code in `table.sdsstub`" + + ```sds linenums="1149" + @Pure + @PythonName("to_tabular_dataset") + fun toTabularDataset( + @PythonName("target_name") targetName: String, + @PythonName("extra_names") extraNames: List = [] + ) -> dataset: TabularDataset + ``` + ## `#!sds fun` transformColumn {#safeds.data.tabular.containers.Table.transformColumn data-toc-label='transformColumn'} Return a new `Table` with the provided column transformed by calling the provided transformer. @@ -2722,7 +2738,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="880" + ```sds linenums="841" @Pure @PythonName("transform_column") fun transformColumn( @@ -2762,7 +2778,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="904" + ```sds linenums="865" @Pure @PythonName("transform_table") fun transformTable( @@ -2798,7 +2814,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="162" + ```sds linenums="163" @Pure @PythonName("from_columns") static fun fromColumns( @@ -2832,7 +2848,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="86" + ```sds linenums="87" @Impure([ImpurityReason.FileReadFromParameterizedPath("path")]) @PythonName("from_csv_file") static fun fromCsvFile( @@ -2868,7 +2884,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="106" + ```sds linenums="107" @Impure([ImpurityReason.FileReadFromParameterizedPath("path")]) @PythonName("from_excel_file") static fun fromExcelFile( @@ -2902,7 +2918,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="124" + ```sds linenums="125" @Impure([ImpurityReason.FileReadFromParameterizedPath("path")]) @PythonName("from_json_file") static fun fromJsonFile( @@ -2936,7 +2952,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="142" + ```sds linenums="143" @Pure @PythonName("from_dict") static fun fromMap( @@ -2972,7 +2988,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="182" + ```sds linenums="183" @Experimental @Pure @PythonName("from_rows") diff --git a/docs/api/safeds/data/tabular/containers/TaggedTable.md b/docs/api/safeds/data/tabular/containers/TaggedTable.md deleted file mode 100644 index edbf28ce7..000000000 --- a/docs/api/safeds/data/tabular/containers/TaggedTable.md +++ /dev/null @@ -1,2064 +0,0 @@ -# :test_tube:{ title="Experimental" } `#!sds class` TaggedTable {#safeds.data.tabular.containers.TaggedTable data-toc-label='TaggedTable'} - -A tagged table is a table that additionally knows which columns are features and which are the target to predict. - -**Parent type:** [`Table`][safeds.data.tabular.containers.Table] - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `data` | [`Map>`][safeds.lang.Map] | The data. | - | -| `targetName` | [`String`][safeds.lang.String] | Name of the target column. | - | -| `featureNames` | [`List?`][safeds.lang.List] | Names of the feature columns. If None, all columns except the target column are used. | `#!sds null` | - -**Examples:** - -```sds -pipeline example { - // TODO -} -``` - -??? quote "Stub code in `tagged_table.sdsstub`" - - ```sds linenums="18" - class TaggedTable( - data: Map>, - @PythonName("target_name") targetName: String, - @PythonName("feature_names") featureNames: List? = null - ) sub Table { - /** - * Get the feature columns of the tagged table. - * - * @example - * pipeline example { - * // TODO - * } - */ - attr features: Table - /** - * Get the target column of the tagged table. - * - * @example - * pipeline example { - * // TODO - * } - */ - attr target: Column - - /** - * Return a new table with the provided column attached at the end, as a feature column. - * - * the original table is not modified. - * - * @param column The column to be added. - * - * @result result1 The table with the attached feature column. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("add_column_as_feature") - fun addColumnAsFeature( - column: Column - ) -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with the provided columns attached at the end, as feature columns. - * - * The original table is not modified. - * - * @param columns The columns to be added as features. - * - * @result result1 The table with the attached feature columns. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("add_columns_as_features") - fun addColumnsAsFeatures( - columns: union, Table> - ) -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with the provided column attached at the end, as neither target nor feature column. - * - * The original table is not modified. - * - * @param column The column to be added. - * - * @result result1 The table with the column attached as neither target nor feature column. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("add_column") - fun addColumn( - column: Column - ) -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with multiple added columns, as neither target nor feature columns. - * - * The original table is not modified. - * - * @param columns The columns to be added. - * - * @result result1 A new table combining the original table and the given columns as neither target nor feature columns. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("add_columns") - fun addColumns( - columns: union, Table> - ) -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with an added Row attached. - * - * The original table is not modified. - * - * @param row The row to be added. - * - * @result result1 A new tagged table with the added row at the end. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("add_row") - fun addRow( - row: Row - ) -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with multiple added Rows attached. - * - * The original table is not modified. - * - * @param rows The rows to be added. - * - * @result result1 A new tagged table which combines the original table and the given rows. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("add_rows") - fun addRows( - rows: union, Table> - ) -> result1: TaggedTable - - /** - * Return a new `TaggedTable` containing only rows that match the given Callable (e.g. lambda function). - * - * The original tagged table is not modified. - * - * @param query A Callable that is applied to all rows. - * - * @result result1 A new tagged table containing only the rows to match the query. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("filter_rows") - fun filterRows( - query: (row: Row) -> matches: Boolean - ) -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with only the given column(s). - * - * The original table is not modified. - * - * @param columnNames A list containing only the columns to be kept. - * - * @result result1 A table containing only the given column(s). - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("keep_only_columns") - fun keepOnlyColumns( - @PythonName("column_names") columnNames: List - ) -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with the given column(s) removed from the table. - * - * The original table is not modified. - * - * @param columnNames The names of all columns to be dropped. - * - * @result result1 A table without the given columns. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("remove_columns") - fun removeColumns( - @PythonName("column_names") columnNames: List - ) -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with every column that misses values removed. - * - * The original table is not modified. - * - * @result result1 A table without the columns that contain missing values. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("remove_columns_with_missing_values") - fun removeColumnsWithMissingValues() -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with every column that contains non-numerical values removed. - * - * The original table is not modified. - * - * @result result1 A table without the columns that contain non-numerical values. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("remove_columns_with_non_numerical_values") - fun removeColumnsWithNonNumericalValues() -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with all row duplicates removed. - * - * The original table is not modified. - * - * @result result1 The table with the duplicate rows removed. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("remove_duplicate_rows") - fun removeDuplicateRows() -> result1: TaggedTable - - /** - * Return a new `TaggedTable` without the rows that contain missing values. - * - * The original table is not modified. - * - * @result result1 A table without the rows that contain missing values. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("remove_rows_with_missing_values") - fun removeRowsWithMissingValues() -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with all rows that contain at least one outlier removed. - * - * We define an outlier as a value that has a distance of more than 3 standard deviations from the column mean. - * Missing values are not considered outliers. They are also ignored during the calculation of the standard - * deviation. - * - * The original table is not modified. - * - * @result result1 A new table without rows containing outliers. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("remove_rows_with_outliers") - fun removeRowsWithOutliers() -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with a single column renamed. - * - * The original table is not modified. - * - * @param oldName The old name of the target column. - * @param newName The new name of the target column. - * - * @result result1 The Table with the renamed column. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("rename_column") - fun renameColumn( - @PythonName("old_name") oldName: String, - @PythonName("new_name") newName: String - ) -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with the specified old column replaced by a list of new columns. - * - * If the column to be replaced is the target column, it must be replaced by exactly one column. That column - * becomes the new target column. If the column to be replaced is a feature column, the new columns that replace it - * all become feature columns. - * - * The order of columns is kept. The original table is not modified. - * - * @param oldColumnName The name of the column to be replaced. - * @param newColumns The new columns replacing the old column. - * - * @result result1 A table with the old column replaced by the new column. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("replace_column") - fun replaceColumn( - @PythonName("old_column_name") oldColumnName: String, - @PythonName("new_columns") newColumns: List - ) -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with randomly shuffled rows of this table. - * - * The original table is not modified. - * - * @result result1 The shuffled Table. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("shuffle_rows") - fun shuffleRows() -> result1: TaggedTable - - /** - * Slice a part of the table into a new `TaggedTable`. - * - * The original table is not modified. - * - * @param start The first index of the range to be copied into a new table, None by default. - * @param end The last index of the range to be copied into a new table, None by default. - * @param step The step size used to iterate through the table, 1 by default. - * - * @result result1 The resulting table. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("slice_rows") - fun sliceRows( - start: Int? = null, - end: Int? = null, - step: Int = 1 - ) -> result1: TaggedTable - - /** - * Sort the columns of a `TaggedTable` with the given comparator and return a new `TaggedTable`. - * - * The comparator is a function that takes two columns `col1` and `col2` and - * returns an integer: - * - * * If the function returns a negative number, `col1` will be ordered before `col2`. - * * If the function returns a positive number, `col1` will be ordered after `col2`. - * * If the function returns 0, the original order of `col1` and `col2` will be kept. - * - * If no comparator is given, the columns will be sorted alphabetically by their name. - * - * The original table is not modified. - * - * @param comparator The function used to compare two columns. - * - * @result result1 A new table with sorted columns. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("sort_columns") - fun sortColumns( - comparator: (column1: Column, column2: Column) -> comparison: Int - ) -> result1: TaggedTable - - /** - * Sort the rows of a `TaggedTable` with the given comparator and return a new `TaggedTable`. - * - * The comparator is a function that takes two rows `row1` and `row2` and - * returns an integer: - * - * * If the function returns a negative number, `row1` will be ordered before `row2`. - * * If the function returns a positive number, `row1` will be ordered after `row2`. - * * If the function returns 0, the original order of `row1` and `row2` will be kept. - * - * The original table is not modified. - * - * @param comparator The function used to compare two rows. - * - * @result result1 A new table with sorted rows. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("sort_rows") - fun sortRows( - comparator: (row1: Row, row2: Row) -> comparison: Int - ) -> result1: TaggedTable - - /** - * Return a new `TaggedTable` with the provided column transformed by calling the provided transformer. - * - * The original table is not modified. - * - * @result transformedTable The table with the transformed column. - * - * @example - * pipeline example { - * // TODO - * } - */ - @Pure - @PythonName("transform_column") - fun transformColumn( - name: String, - transformer: (row: Row) -> newColumnValue: Any? - ) -> transformedTable: TaggedTable - } - ``` - -## `#!sds attr` columnNames {#safeds.data.tabular.containers.TaggedTable.columnNames data-toc-label='columnNames'} - -Return a list of all column names in this table. - -**Type:** [`List`][safeds.lang.List] - -**Examples:** - -```sds hl_lines="3" -pipeline example { - val table = Table({"a": [1, 2], "b": [3, 4]}); - val columnNames = table.columnNames; // ["a", "b"] -} -``` - -## `#!sds attr` features {#safeds.data.tabular.containers.TaggedTable.features data-toc-label='features'} - -Get the feature columns of the tagged table. - -**Type:** [`Table`][safeds.data.tabular.containers.Table] - -**Examples:** - -```sds -pipeline example { - // TODO -} -``` - -## `#!sds attr` numberOfColumns {#safeds.data.tabular.containers.TaggedTable.numberOfColumns data-toc-label='numberOfColumns'} - -Return the number of columns. - -**Type:** [`Int`][safeds.lang.Int] - -**Examples:** - -```sds hl_lines="3" -pipeline example { - val table = Table({"a": [1, 2], "b": [3, 4]}); - val numberOfColumns = table.numberOfColumns; // 2 -} -``` - -## `#!sds attr` numberOfRows {#safeds.data.tabular.containers.TaggedTable.numberOfRows data-toc-label='numberOfRows'} - -Return the number of rows. - -**Type:** [`Int`][safeds.lang.Int] - -**Examples:** - -```sds hl_lines="3" -pipeline example { - val table = Table({"a": [1, 2], "b": [3, 4]}); - val numberOfRows = table.numberOfRows; // 2 -} -``` - -## `#!sds attr` schema {#safeds.data.tabular.containers.TaggedTable.schema data-toc-label='schema'} - -Return the schema of the table. - -**Type:** [`Schema`][safeds.data.tabular.typing.Schema] - -**Examples:** - -```sds hl_lines="3" -pipeline example { - val table = Table({"a": [1, 2], "b": [3, 4]}); - val `schema` = table.`schema`; -} -``` - -## `#!sds attr` target {#safeds.data.tabular.containers.TaggedTable.target data-toc-label='target'} - -Get the target column of the tagged table. - -**Type:** [`Column`][safeds.data.tabular.containers.Column] - -**Examples:** - -```sds -pipeline example { - // TODO -} -``` - -## `#!sds fun` addColumn {#safeds.data.tabular.containers.TaggedTable.addColumn data-toc-label='addColumn'} - -Return a new `TaggedTable` with the provided column attached at the end, as neither target nor feature column. - -The original table is not modified. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `column` | [`Column`][safeds.data.tabular.containers.Column] | The column to be added. | - | - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The table with the column attached as neither target nor feature column. | - -**Examples:** - -```sds -pipeline example { - // TODO -} -``` - -??? quote "Stub code in `tagged_table.sdsstub`" - - ```sds linenums="96" - @Pure - @PythonName("add_column") - fun addColumn( - column: Column - ) -> result1: TaggedTable - ``` - -## `#!sds fun` addColumnAsFeature {#safeds.data.tabular.containers.TaggedTable.addColumnAsFeature data-toc-label='addColumnAsFeature'} - -Return a new table with the provided column attached at the end, as a feature column. - -the original table is not modified. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `column` | [`Column`][safeds.data.tabular.containers.Column] | The column to be added. | - | - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The table with the attached feature column. | - -**Examples:** - -```sds -pipeline example { - // TODO -} -``` - -??? quote "Stub code in `tagged_table.sdsstub`" - - ```sds linenums="56" - @Pure - @PythonName("add_column_as_feature") - fun addColumnAsFeature( - column: Column - ) -> result1: TaggedTable - ``` - -## `#!sds fun` addColumns {#safeds.data.tabular.containers.TaggedTable.addColumns data-toc-label='addColumns'} - -Return a new `TaggedTable` with multiple added columns, as neither target nor feature columns. - -The original table is not modified. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `columns` | `#!sds union>, Table>` | The columns to be added. | - | - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A new table combining the original table and the given columns as neither target nor feature columns. | - -**Examples:** - -```sds -pipeline example { - // TODO -} -``` - -??? quote "Stub code in `tagged_table.sdsstub`" - - ```sds linenums="116" - @Pure - @PythonName("add_columns") - fun addColumns( - columns: union, Table> - ) -> result1: TaggedTable - ``` - -## `#!sds fun` addColumnsAsFeatures {#safeds.data.tabular.containers.TaggedTable.addColumnsAsFeatures data-toc-label='addColumnsAsFeatures'} - -Return a new `TaggedTable` with the provided columns attached at the end, as feature columns. - -The original table is not modified. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `columns` | `#!sds union>, Table>` | The columns to be added as features. | - | - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The table with the attached feature columns. | - -**Examples:** - -```sds -pipeline example { - // TODO -} -``` - -??? quote "Stub code in `tagged_table.sdsstub`" - - ```sds linenums="76" - @Pure - @PythonName("add_columns_as_features") - fun addColumnsAsFeatures( - columns: union, Table> - ) -> result1: TaggedTable - ``` - -## `#!sds fun` addRow {#safeds.data.tabular.containers.TaggedTable.addRow data-toc-label='addRow'} - -Return a new `TaggedTable` with an added Row attached. - -The original table is not modified. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `row` | [`Row`][safeds.data.tabular.containers.Row] | The row to be added. | - | - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A new tagged table with the added row at the end. | - -**Examples:** - -```sds -pipeline example { - // TODO -} -``` - -??? quote "Stub code in `tagged_table.sdsstub`" - - ```sds linenums="136" - @Pure - @PythonName("add_row") - fun addRow( - row: Row - ) -> result1: TaggedTable - ``` - -## `#!sds fun` addRows {#safeds.data.tabular.containers.TaggedTable.addRows data-toc-label='addRows'} - -Return a new `TaggedTable` with multiple added Rows attached. - -The original table is not modified. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `rows` | `#!sds union, Table>` | The rows to be added. | - | - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A new tagged table which combines the original table and the given rows. | - -**Examples:** - -```sds -pipeline example { - // TODO -} -``` - -??? quote "Stub code in `tagged_table.sdsstub`" - - ```sds linenums="156" - @Pure - @PythonName("add_rows") - fun addRows( - rows: union, Table> - ) -> result1: TaggedTable - ``` - -## `#!sds fun` filterRows {#safeds.data.tabular.containers.TaggedTable.filterRows data-toc-label='filterRows'} - -Return a new `TaggedTable` containing only rows that match the given Callable (e.g. lambda function). - -The original tagged table is not modified. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `query` | `#!sds (row: Row) -> (matches: Boolean)` | A Callable that is applied to all rows. | - | - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A new tagged table containing only the rows to match the query. | - -**Examples:** - -```sds -pipeline example { - // TODO -} -``` - -??? quote "Stub code in `tagged_table.sdsstub`" - - ```sds linenums="176" - @Pure - @PythonName("filter_rows") - fun filterRows( - query: (row: Row) -> matches: Boolean - ) -> result1: TaggedTable - ``` - -## `#!sds fun` getColumn {#safeds.data.tabular.containers.TaggedTable.getColumn data-toc-label='getColumn'} - -Return a column with the data of the specified column. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `columnName` | [`String`][safeds.lang.String] | The name of the column. | - | - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `column` | [`Column`][safeds.data.tabular.containers.Column] | The column. | - -**Examples:** - -```sds hl_lines="3" -pipeline example { - val table = Table({"a": [1, 2], "b": [3, 4]}); - val column = table.getColumn("a"); // Column("a", [1, 2]) -} -``` - -??? quote "Stub code in `table.sdsstub`" - - ```sds linenums="202" - @Pure - @PythonName("get_column") - fun getColumn( - @PythonName("column_name") columnName: String - ) -> column: Column - ``` - -## `#!sds fun` getColumnType {#safeds.data.tabular.containers.TaggedTable.getColumnType data-toc-label='getColumnType'} - -Return the type of the given column. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `columnName` | [`String`][safeds.lang.String] | The name of the column to be queried. | - | - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `type` | [`ColumnType`][safeds.data.tabular.typing.ColumnType] | The type of the column. | - -**Examples:** - -```sds hl_lines="3" -pipeline example { - val table = Table({"a": [1, 2], "b": [3, 4]}); - val type = table.getColumnType("a"); // Integer -} -``` - -??? quote "Stub code in `table.sdsstub`" - - ```sds linenums="240" - @Pure - @PythonName("get_column_type") - fun getColumnType( - @PythonName("column_name") columnName: String - ) -> type: ColumnType - ``` - -## `#!sds fun` getRow {#safeds.data.tabular.containers.TaggedTable.getRow data-toc-label='getRow'} - -Return the row at a specified index. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `index` | [`Int`][safeds.lang.Int] | The index. | - | - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `row` | [`Row`][safeds.data.tabular.containers.Row] | The row of the table at the index. | - -**Examples:** - -```sds hl_lines="3" -pipeline example { - val table = Table({"a": [1, 2], "b": [3, 4]}); - val row = table.getRow(0); // Row({"a": 1, "b": 3}) -} -``` - -??? quote "Stub code in `table.sdsstub`" - - ```sds linenums="259" - @Pure - @PythonName("get_row") - fun getRow( - index: Int - ) -> row: Row - ``` - -## `#!sds fun` groupRows {#safeds.data.tabular.containers.TaggedTable.groupRows data-toc-label='groupRows'} - -Return a map with copies of the output tables as values and the keys from the key_selector. - -The original table is not modified. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `keySelector` | `#!sds (row: Row) -> (key: T)` | A Callable that is applied to all rows and returns the key of the group. | - | - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `tablesByKey` | [`Map`][safeds.lang.Map] | A map containing the new tables as values and the selected keys as keys. | - -**Type parameters:** - -| Name | Upper Bound | Description | Default | -|------|-------------|-------------|---------| -| `T` | [`Any?`][safeds.lang.Any] | - | - | - -**Examples:** - -```sds hl_lines="3" -pipeline example { - val table = Table({"a": [1, 2, 3], "b": [4, 5, 6]}); - val tablesByKey = table.groupRows((row) -> - row.getValue("a") as Int <= 2 - ); - // { - // true: Table({"a": [1, 2], "b": [4, 5]}), - // false: Table({"a": [3], "b": [6]}), - // } -} -``` - -??? quote "Stub code in `table.sdsstub`" - - ```sds linenums="442" - @Pure - @PythonName("group_rows_by") - fun groupRows( - @PythonName("key_selector") keySelector: (row: Row) -> key: T - ) -> tablesByKey: Map - ``` - -## `#!sds fun` hasColumn {#safeds.data.tabular.containers.TaggedTable.hasColumn data-toc-label='hasColumn'} - -Return whether the table contains a given column. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `columnName` | [`String`][safeds.lang.String] | The name of the column. | - | - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `hasColumn` | [`Boolean`][safeds.lang.Boolean] | True if the column exists. | - -**Examples:** - -```sds hl_lines="3" -pipeline example { - val table = Table({"a": [1, 2], "b": [3, 4]}); - val hasColumn = table.hasColumn("a"); // true -} -``` - -??? quote "Stub code in `table.sdsstub`" - - ```sds linenums="221" - @Pure - @PythonName("has_column") - fun hasColumn( - @PythonName("column_name") columnName: String - ) -> hasColumn: Boolean - ``` - -## `#!sds fun` inverseTransformTable {#safeds.data.tabular.containers.TaggedTable.inverseTransformTable data-toc-label='inverseTransformTable'} - -Return a new `Table` with the inverted transformation applied by the given transformer. - -The original table is not modified. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `transformer` | [`InvertibleTableTransformer`][safeds.data.tabular.transformation.InvertibleTableTransformer] | A transformer that was fitted with columns, which are all present in the table. | - | - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `originalTable` | [`Table`][safeds.data.tabular.containers.Table] | The original table. | - -**Examples:** - -```sds hl_lines="5" -pipeline example { - val table = Table({"a": ["z", "y"], "b": [3, 4]}); - val encoder = LabelEncoder().fit(table, ["a"]); - val transformedTable = table.transformTable(encoder); - val originalTable = transformedTable.inverseTransformTable(encoder); - // Table({"a": ["z", "y"], "b": [3, 4]}) -} -``` - -??? quote "Stub code in `table.sdsstub`" - - ```sds linenums="928" - @Pure - @PythonName("inverse_transform_table") - fun inverseTransformTable( - transformer: InvertibleTableTransformer - ) -> originalTable: Table - ``` - -## `#!sds fun` keepOnlyColumns {#safeds.data.tabular.containers.TaggedTable.keepOnlyColumns data-toc-label='keepOnlyColumns'} - -Return a new `TaggedTable` with only the given column(s). - -The original table is not modified. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `columnNames` | [`List`][safeds.lang.List] | A list containing only the columns to be kept. | - | - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A table containing only the given column(s). | - -**Examples:** - -```sds -pipeline example { - // TODO -} -``` - -??? quote "Stub code in `tagged_table.sdsstub`" - - ```sds linenums="196" - @Pure - @PythonName("keep_only_columns") - fun keepOnlyColumns( - @PythonName("column_names") columnNames: List - ) -> result1: TaggedTable - ``` - -## `#!sds fun` plotBoxplots {#safeds.data.tabular.containers.TaggedTable.plotBoxplots data-toc-label='plotBoxplots'} - -Plot a boxplot for every numerical column. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `boxplots` | [`Image`][safeds.data.image.containers.Image] | The plot as an image. | - -**Examples:** - -```sds hl_lines="3" -pipeline example { - val table = Table({"a": [1, 2], "b": [3, 4]}); - val boxplots = table.plotBoxplots(); -} -``` - -??? quote "Stub code in `table.sdsstub`" - - ```sds linenums="1005" - @Pure - @PythonName("plot_boxplots") - fun plotBoxplots() -> boxplots: Image - ``` - -## `#!sds fun` plotCorrelationHeatmap {#safeds.data.tabular.containers.TaggedTable.plotCorrelationHeatmap data-toc-label='plotCorrelationHeatmap'} - -Plot a correlation heatmap for all numerical columns of this `Table`. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `correlationHeatmap` | [`Image`][safeds.data.image.containers.Image] | The plot as an image. | - -**Examples:** - -```sds hl_lines="3" -pipeline example { - val table = Table({"a": [1, 2], "b": [3, 4]}); - val correlationHeatmap = table.plotCorrelationHeatmap(); -} -``` - -??? quote "Stub code in `table.sdsstub`" - - ```sds linenums="945" - @Pure - @PythonName("plot_correlation_heatmap") - fun plotCorrelationHeatmap() -> correlationHeatmap: Image - ``` - -## `#!sds fun` plotHistograms {#safeds.data.tabular.containers.TaggedTable.plotHistograms data-toc-label='plotHistograms'} - -Plot a histogram for every column. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `histograms` | [`Image`][safeds.data.image.containers.Image] | The plot as an image. | - -**Examples:** - -```sds hl_lines="3" -pipeline example { - val table = Table({"a": [1, 2], "b": [3, 4]}); - val histograms = table.plotHistograms(); -} -``` - -??? quote "Stub code in `table.sdsstub`" - - ```sds linenums="1020" - @Pure - @PythonName("plot_histograms") - fun plotHistograms() -> histograms: Image - ``` - -## `#!sds fun` plotLineplot {#safeds.data.tabular.containers.TaggedTable.plotLineplot data-toc-label='plotLineplot'} - -Plot two columns against each other in a lineplot. - -If there are multiple x-values for a y-value, the resulting plot will consist of a line representing the mean -and the lower-transparency area around the line representing the 95% confidence interval. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `xColumnName` | [`String`][safeds.lang.String] | The column name of the column to be plotted on the x-Axis. | - | -| `yColumnName` | [`String`][safeds.lang.String] | The column name of the column to be plotted on the y-Axis. | - | - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `lineplot` | [`Image`][safeds.data.image.containers.Image] | The plot as an image. | - -**Examples:** - -```sds hl_lines="3" -pipeline example { - val table = Table({"a": [1, 2], "b": [3, 4]}); - val lineplot = table.plotLineplot("a", "b"); -} -``` - -??? quote "Stub code in `table.sdsstub`" - - ```sds linenums="966" - @Pure - @PythonName("plot_lineplot") - fun plotLineplot( - @PythonName("x_column_name") xColumnName: String, - @PythonName("y_column_name") yColumnName: String - ) -> lineplot: Image - ``` - -## `#!sds fun` plotScatterplot {#safeds.data.tabular.containers.TaggedTable.plotScatterplot data-toc-label='plotScatterplot'} - -Plot two columns against each other in a scatterplot. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `xColumnName` | [`String`][safeds.lang.String] | The column name of the column to be plotted on the x-Axis. | - | -| `yColumnName` | [`String`][safeds.lang.String] | The column name of the column to be plotted on the y-Axis. | - | - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `scatterplot` | [`Image`][safeds.data.image.containers.Image] | The plot as an image. | - -**Examples:** - -```sds hl_lines="3" -pipeline example { - val table = Table({"a": [1, 2], "b": [3, 4]}); - val scatterplot = table.plotScatterplot("a", "b"); -} -``` - -??? quote "Stub code in `table.sdsstub`" - - ```sds linenums="987" - @Pure - @PythonName("plot_scatterplot") - fun plotScatterplot( - @PythonName("x_column_name") xColumnName: String, - @PythonName("y_column_name") yColumnName: String - ) -> scatterplot: Image - ``` - -## `#!sds fun` removeColumns {#safeds.data.tabular.containers.TaggedTable.removeColumns data-toc-label='removeColumns'} - -Return a new `TaggedTable` with the given column(s) removed from the table. - -The original table is not modified. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `columnNames` | [`List`][safeds.lang.List] | The names of all columns to be dropped. | - | - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A table without the given columns. | - -**Examples:** - -```sds -pipeline example { - // TODO -} -``` - -??? quote "Stub code in `tagged_table.sdsstub`" - - ```sds linenums="216" - @Pure - @PythonName("remove_columns") - fun removeColumns( - @PythonName("column_names") columnNames: List - ) -> result1: TaggedTable - ``` - -## `#!sds fun` removeColumnsWithMissingValues {#safeds.data.tabular.containers.TaggedTable.removeColumnsWithMissingValues data-toc-label='removeColumnsWithMissingValues'} - -Return a new `TaggedTable` with every column that misses values removed. - -The original table is not modified. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A table without the columns that contain missing values. | - -**Examples:** - -```sds -pipeline example { - // TODO -} -``` - -??? quote "Stub code in `tagged_table.sdsstub`" - - ```sds linenums="234" - @Pure - @PythonName("remove_columns_with_missing_values") - fun removeColumnsWithMissingValues() -> result1: TaggedTable - ``` - -## `#!sds fun` removeColumnsWithNonNumericalValues {#safeds.data.tabular.containers.TaggedTable.removeColumnsWithNonNumericalValues data-toc-label='removeColumnsWithNonNumericalValues'} - -Return a new `TaggedTable` with every column that contains non-numerical values removed. - -The original table is not modified. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A table without the columns that contain non-numerical values. | - -**Examples:** - -```sds -pipeline example { - // TODO -} -``` - -??? quote "Stub code in `tagged_table.sdsstub`" - - ```sds linenums="250" - @Pure - @PythonName("remove_columns_with_non_numerical_values") - fun removeColumnsWithNonNumericalValues() -> result1: TaggedTable - ``` - -## `#!sds fun` removeDuplicateRows {#safeds.data.tabular.containers.TaggedTable.removeDuplicateRows data-toc-label='removeDuplicateRows'} - -Return a new `TaggedTable` with all row duplicates removed. - -The original table is not modified. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The table with the duplicate rows removed. | - -**Examples:** - -```sds -pipeline example { - // TODO -} -``` - -??? quote "Stub code in `tagged_table.sdsstub`" - - ```sds linenums="266" - @Pure - @PythonName("remove_duplicate_rows") - fun removeDuplicateRows() -> result1: TaggedTable - ``` - -## `#!sds fun` removeRowsWithMissingValues {#safeds.data.tabular.containers.TaggedTable.removeRowsWithMissingValues data-toc-label='removeRowsWithMissingValues'} - -Return a new `TaggedTable` without the rows that contain missing values. - -The original table is not modified. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A table without the rows that contain missing values. | - -**Examples:** - -```sds -pipeline example { - // TODO -} -``` - -??? quote "Stub code in `tagged_table.sdsstub`" - - ```sds linenums="282" - @Pure - @PythonName("remove_rows_with_missing_values") - fun removeRowsWithMissingValues() -> result1: TaggedTable - ``` - -## `#!sds fun` removeRowsWithOutliers {#safeds.data.tabular.containers.TaggedTable.removeRowsWithOutliers data-toc-label='removeRowsWithOutliers'} - -Return a new `TaggedTable` with all rows that contain at least one outlier removed. - -We define an outlier as a value that has a distance of more than 3 standard deviations from the column mean. -Missing values are not considered outliers. They are also ignored during the calculation of the standard -deviation. - -The original table is not modified. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A new table without rows containing outliers. | - -**Examples:** - -```sds -pipeline example { - // TODO -} -``` - -??? quote "Stub code in `tagged_table.sdsstub`" - - ```sds linenums="302" - @Pure - @PythonName("remove_rows_with_outliers") - fun removeRowsWithOutliers() -> result1: TaggedTable - ``` - -## `#!sds fun` renameColumn {#safeds.data.tabular.containers.TaggedTable.renameColumn data-toc-label='renameColumn'} - -Return a new `TaggedTable` with a single column renamed. - -The original table is not modified. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `oldName` | [`String`][safeds.lang.String] | The old name of the target column. | - | -| `newName` | [`String`][safeds.lang.String] | The new name of the target column. | - | - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The Table with the renamed column. | - -**Examples:** - -```sds -pipeline example { - // TODO -} -``` - -??? quote "Stub code in `tagged_table.sdsstub`" - - ```sds linenums="321" - @Pure - @PythonName("rename_column") - fun renameColumn( - @PythonName("old_name") oldName: String, - @PythonName("new_name") newName: String - ) -> result1: TaggedTable - ``` - -## `#!sds fun` replaceColumn {#safeds.data.tabular.containers.TaggedTable.replaceColumn data-toc-label='replaceColumn'} - -Return a new `TaggedTable` with the specified old column replaced by a list of new columns. - -If the column to be replaced is the target column, it must be replaced by exactly one column. That column -becomes the new target column. If the column to be replaced is a feature column, the new columns that replace it -all become feature columns. - -The order of columns is kept. The original table is not modified. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `oldColumnName` | [`String`][safeds.lang.String] | The name of the column to be replaced. | - | -| `newColumns` | [`List>`][safeds.lang.List] | The new columns replacing the old column. | - | - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A table with the old column replaced by the new column. | - -**Examples:** - -```sds -pipeline example { - // TODO -} -``` - -??? quote "Stub code in `tagged_table.sdsstub`" - - ```sds linenums="347" - @Pure - @PythonName("replace_column") - fun replaceColumn( - @PythonName("old_column_name") oldColumnName: String, - @PythonName("new_columns") newColumns: List - ) -> result1: TaggedTable - ``` - -## `#!sds fun` shuffleRows {#safeds.data.tabular.containers.TaggedTable.shuffleRows data-toc-label='shuffleRows'} - -Return a new `TaggedTable` with randomly shuffled rows of this table. - -The original table is not modified. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The shuffled Table. | - -**Examples:** - -```sds -pipeline example { - // TODO -} -``` - -??? quote "Stub code in `tagged_table.sdsstub`" - - ```sds linenums="366" - @Pure - @PythonName("shuffle_rows") - fun shuffleRows() -> result1: TaggedTable - ``` - -## `#!sds fun` sliceRows {#safeds.data.tabular.containers.TaggedTable.sliceRows data-toc-label='sliceRows'} - -Slice a part of the table into a new `TaggedTable`. - -The original table is not modified. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `start` | [`Int?`][safeds.lang.Int] | The first index of the range to be copied into a new table, None by default. | `#!sds null` | -| `end` | [`Int?`][safeds.lang.Int] | The last index of the range to be copied into a new table, None by default. | `#!sds null` | -| `step` | [`Int`][safeds.lang.Int] | The step size used to iterate through the table, 1 by default. | `#!sds 1` | - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The resulting table. | - -**Examples:** - -```sds -pipeline example { - // TODO -} -``` - -??? quote "Stub code in `tagged_table.sdsstub`" - - ```sds linenums="386" - @Pure - @PythonName("slice_rows") - fun sliceRows( - start: Int? = null, - end: Int? = null, - step: Int = 1 - ) -> result1: TaggedTable - ``` - -## `#!sds fun` sortColumns {#safeds.data.tabular.containers.TaggedTable.sortColumns data-toc-label='sortColumns'} - -Sort the columns of a `TaggedTable` with the given comparator and return a new `TaggedTable`. - -The comparator is a function that takes two columns `col1` and `col2` and -returns an integer: - -* If the function returns a negative number, `col1` will be ordered before `col2`. -* If the function returns a positive number, `col1` will be ordered after `col2`. -* If the function returns 0, the original order of `col1` and `col2` will be kept. - -If no comparator is given, the columns will be sorted alphabetically by their name. - -The original table is not modified. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `comparator` | `#!sds (column1: Column, column2: Column) -> (comparison: Int)` | The function used to compare two columns. | - | - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A new table with sorted columns. | - -**Examples:** - -```sds -pipeline example { - // TODO -} -``` - -??? quote "Stub code in `tagged_table.sdsstub`" - - ```sds linenums="417" - @Pure - @PythonName("sort_columns") - fun sortColumns( - comparator: (column1: Column, column2: Column) -> comparison: Int - ) -> result1: TaggedTable - ``` - -## `#!sds fun` sortRows {#safeds.data.tabular.containers.TaggedTable.sortRows data-toc-label='sortRows'} - -Sort the rows of a `TaggedTable` with the given comparator and return a new `TaggedTable`. - -The comparator is a function that takes two rows `row1` and `row2` and -returns an integer: - -* If the function returns a negative number, `row1` will be ordered before `row2`. -* If the function returns a positive number, `row1` will be ordered after `row2`. -* If the function returns 0, the original order of `row1` and `row2` will be kept. - -The original table is not modified. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `comparator` | `#!sds (row1: Row, row2: Row) -> (comparison: Int)` | The function used to compare two rows. | - | - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A new table with sorted rows. | - -**Examples:** - -```sds -pipeline example { - // TODO -} -``` - -??? quote "Stub code in `tagged_table.sdsstub`" - - ```sds linenums="444" - @Pure - @PythonName("sort_rows") - fun sortRows( - comparator: (row1: Row, row2: Row) -> comparison: Int - ) -> result1: TaggedTable - ``` - -## `#!sds fun` splitRows {#safeds.data.tabular.containers.TaggedTable.splitRows data-toc-label='splitRows'} - -Split the table into two new tables. Consider using [Table.shuffleRows][safeds.data.tabular.containers.Table.shuffleRows] before splitting to ensure a random -distribution of rows in both tables. - -The original table is not modified. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `ratioInFirst` | [`Float`][safeds.lang.Float] | How many rows should be in the first table, expressed as a ratio of the total number of rows. Must be between 0 and 1. | - | - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `first` | [`Table`][safeds.data.tabular.containers.Table] | The first table with the specified size. | -| `second` | [`Table`][safeds.data.tabular.containers.Table] | The second table with the remaining rows. | - -**Examples:** - -```sds hl_lines="3" -pipeline example { - val table = Table({"a": [1, 2, 3, 4], "b": [5, 6, 7, 8]}); - val first, val second = table.splitRows(0.5); - // first: Table({"a": [1, 2], "b": [5, 6]}) - // second: Table({"a": [3, 4], "b": [7, 8]}) -} -``` - -??? quote "Stub code in `table.sdsstub`" - - ```sds linenums="812" - @Pure - @PythonName("split_rows") - fun splitRows( - @PythonName("percentage_in_first") ratioInFirst: Float - ) -> (first: Table, second: Table) - ``` - -## `#!sds fun` summarizeStatistics {#safeds.data.tabular.containers.TaggedTable.summarizeStatistics data-toc-label='summarizeStatistics'} - -Return a table with a number of statistical key values. - -The original table is not modified. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `statistics` | [`Table`][safeds.data.tabular.containers.Table] | The table with statistics. | - -**Examples:** - -```sds hl_lines="3" -pipeline example { - val table = Table({"a": [1, 2], "b": [3, 4]}); - val statistics = table.summarizeStatistics(); -} -``` - -??? quote "Stub code in `table.sdsstub`" - - ```sds linenums="278" - @Pure - @PythonName("summarize_statistics") - fun summarizeStatistics() -> statistics: Table - ``` - -## `#!sds fun` tagColumns {#safeds.data.tabular.containers.TaggedTable.tagColumns data-toc-label='tagColumns'} - -Return a new `TaggedTable` with columns marked as a target column or feature columns. - -The original table is not modified. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `targetName` | [`String`][safeds.lang.String] | Name of the target column. | - | -| `featureNames` | [`List?`][safeds.lang.List] | Names of the feature columns. If None, all columns except the target column are used. Use this to hide columns during training but still keep them in the input, to easily link predictions back to the original data. | `#!sds null` | - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `taggedTable` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A new tagged table with the given target and feature names. | - -**Examples:** - -```sds hl_lines="6" -pipeline example { - val table = Table({ - "age": [23, 16], - "survived": [ 0, 1], - }); - val taggedTable = table.tagColumns("survived"); -} -``` -```sds hl_lines="7" -pipeline example { - val table = Table({ - "id": [ 1, 2], - "age": [23, 16], - "survived": [ 0, 1], - }); - val taggedTable = table.tagColumns("target", featureNames = ["age"]); -} -``` - -??? quote "Stub code in `table.sdsstub`" - - ```sds linenums="851" - @Pure - @PythonName("tag_columns") - fun tagColumns( - @PythonName("target_name") targetName: String, - @PythonName("feature_names") featureNames: List? = null - ) -> taggedTable: TaggedTable - ``` - -## `#!sds fun` toColumns {#safeds.data.tabular.containers.TaggedTable.toColumns data-toc-label='toColumns'} - -Return a list of the columns. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `columns` | [`List>`][safeds.lang.List] | List of columns. | - -**Examples:** - -```sds hl_lines="3" -pipeline example { - val table = Table({"a": [1, 2], "b": [3, 4]}); - val columns = table.toColumns(); - // [Column("a", [1, 2]), Column("b", [3, 4])] -} -``` - -??? quote "Stub code in `table.sdsstub`" - - ```sds linenums="1128" - @Pure - @PythonName("to_columns") - fun toColumns() -> columns: List - ``` - -## `#!sds fun` toCsvFile {#safeds.data.tabular.containers.TaggedTable.toCsvFile data-toc-label='toCsvFile'} - -Write the data from the table into a CSV file. - -If the file and/or the directories do not exist they will be created. If the file already exists it will be -overwritten. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `path` | [`String`][safeds.lang.String] | The path to the output file. | - | - -**Examples:** - -```sds hl_lines="3" -pipeline example { - val table = Table({"a": [1, 2], "b": [3, 4]}); - table.toCsvFile("path/to/file.csv"); -} -``` - -??? quote "Stub code in `table.sdsstub`" - - ```sds linenums="1038" - @Impure([ImpurityReason.FileWriteToParameterizedPath("path")]) - @PythonName("to_csv_file") - fun toCsvFile( - path: String - ) - ``` - -## `#!sds fun` toExcelFile {#safeds.data.tabular.containers.TaggedTable.toExcelFile data-toc-label='toExcelFile'} - -Write the data from the table into an Excel file. - -Valid file extensions are `.xls`, '.xlsx', `.xlsm`, `.xlsb`, `.odf`, `.ods` and `.odt`. -If the file and/or the directories do not exist, they will be created. If the file already exists, it will be -overwritten. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `path` | [`String`][safeds.lang.String] | The path to the output file. | - | - -**Examples:** - -```sds hl_lines="3" -pipeline example { - val table = Table({"a": [1, 2], "b": [3, 4]}); - table.toExcelFile("path/to/file.xlsx"); -} -``` - -??? quote "Stub code in `table.sdsstub`" - - ```sds linenums="1059" - @Impure([ImpurityReason.FileWriteToParameterizedPath("path")]) - @PythonName("to_excel_file") - fun toExcelFile( - path: String - ) - ``` - -## `#!sds fun` toHtml {#safeds.data.tabular.containers.TaggedTable.toHtml data-toc-label='toHtml'} - -Return an HTML representation of the table. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `html` | [`String`][safeds.lang.String] | The generated HTML. | - -**Examples:** - -```sds hl_lines="3" -pipeline example { - val table = Table({"a": [1, 2], "b": [3, 4]}); - val html = table.toHtml(); -} -``` - -??? quote "Stub code in `table.sdsstub`" - - ```sds linenums="1112" - @Pure - @PythonName("to_html") - fun toHtml() -> html: String - ``` - -## `#!sds fun` toJsonFile {#safeds.data.tabular.containers.TaggedTable.toJsonFile data-toc-label='toJsonFile'} - -Write the data from the table into a JSON file. - -If the file and/or the directories do not exist, they will be created. If the file already exists it will be -overwritten. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `path` | [`String`][safeds.lang.String] | The path to the output file. | - | - -**Examples:** - -```sds hl_lines="3" -pipeline example { - val table = Table({"a": [1, 2], "b": [3, 4]}); - table.toJsonFile("path/to/file.json"); -} -``` - -??? quote "Stub code in `table.sdsstub`" - - ```sds linenums="1079" - @Impure([ImpurityReason.FileWriteToParameterizedPath("path")]) - @PythonName("to_json_file") - fun toJsonFile( - path: String - ) - ``` - -## `#!sds fun` toMap {#safeds.data.tabular.containers.TaggedTable.toMap data-toc-label='toMap'} - -Return a map of column names to column values. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `map` | [`Map>`][safeds.lang.Map] | Map representation of the table. | - -**Examples:** - -```sds hl_lines="3" -pipeline example { - val table = Table({"a": [1, 2], "b": [3, 4]}); - val map = table.toMap(); - // {"a": [1, 2], "b": [3, 4]} -} -``` - -??? quote "Stub code in `table.sdsstub`" - - ```sds linenums="1097" - @Pure - @PythonName("to_dict") - fun toMap() -> map: Map> - ``` - -## :test_tube:{ title="Experimental" } `#!sds fun` toRows {#safeds.data.tabular.containers.TaggedTable.toRows data-toc-label='toRows'} - -Return a list of the rows. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `rows` | [`List`][safeds.lang.List] | List of rows. | - -**Examples:** - -```sds hl_lines="3" -pipeline example { - val table = Table({"a": [1, 2], "b": [3, 4]}); - val rows = table.toRows(); - // [Row({"a": 1, "b": 3}), Row({"a": 2, "b": 4})] -} -``` - -??? quote "Stub code in `table.sdsstub`" - - ```sds linenums="1144" - @Experimental - @Pure - @PythonName("to_rows") - fun toRows() -> rows: List - ``` - -## `#!sds fun` transformColumn {#safeds.data.tabular.containers.TaggedTable.transformColumn data-toc-label='transformColumn'} - -Return a new `TaggedTable` with the provided column transformed by calling the provided transformer. - -The original table is not modified. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `name` | [`String`][safeds.lang.String] | - | - | -| `transformer` | `#!sds (row: Row) -> (newColumnValue: Any?)` | - | - | - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `transformedTable` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The table with the transformed column. | - -**Examples:** - -```sds -pipeline example { - // TODO -} -``` - -??? quote "Stub code in `tagged_table.sdsstub`" - - ```sds linenums="462" - @Pure - @PythonName("transform_column") - fun transformColumn( - name: String, - transformer: (row: Row) -> newColumnValue: Any? - ) -> transformedTable: TaggedTable - ``` - -## `#!sds fun` transformTable {#safeds.data.tabular.containers.TaggedTable.transformTable data-toc-label='transformTable'} - -Return a new `Table` with a learned transformation applied to this table. - -The original table is not modified. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `transformer` | [`TableTransformer`][safeds.data.tabular.transformation.TableTransformer] | The transformer which transforms the given table. | - | - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `transformedTable` | [`Table`][safeds.data.tabular.containers.Table] | The transformed table. | - -**Examples:** - -```sds hl_lines="4" -pipeline example { - val table = Table({"a": [1, null], "b": [3, 4]}); - val imputer = Imputer(Imputer.Strategy.Mean).fit(table, ["a"]); - val transformedTable = table.transformTable(imputer); - // Table({"a": [1, 1], "b": [3, 4]}) -} -``` - -??? quote "Stub code in `table.sdsstub`" - - ```sds linenums="904" - @Pure - @PythonName("transform_table") - fun transformTable( - transformer: TableTransformer - ) -> transformedTable: Table - ``` diff --git a/docs/api/safeds/data/tabular/containers/TimeSeries.md b/docs/api/safeds/data/tabular/containers/TimeSeries.md index 15ac31dae..430eb6650 100644 --- a/docs/api/safeds/data/tabular/containers/TimeSeries.md +++ b/docs/api/safeds/data/tabular/containers/TimeSeries.md @@ -890,7 +890,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="202" + ```sds linenums="203" @Pure @PythonName("get_column") fun getColumn( @@ -925,7 +925,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="240" + ```sds linenums="241" @Pure @PythonName("get_column_type") fun getColumnType( @@ -960,7 +960,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="259" + ```sds linenums="260" @Pure @PythonName("get_row") fun getRow( @@ -1009,9 +1009,9 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="442" + ```sds linenums="443" @Pure - @PythonName("group_rows_by") + @PythonName("group_rows") fun groupRows( @PythonName("key_selector") keySelector: (row: Row) -> key: T ) -> tablesByKey: Map @@ -1044,7 +1044,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="221" + ```sds linenums="222" @Pure @PythonName("has_column") fun hasColumn( @@ -1084,7 +1084,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="928" + ```sds linenums="889" @Pure @PythonName("inverse_transform_table") fun inverseTransformTable( @@ -1149,7 +1149,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="1005" + ```sds linenums="966" @Pure @PythonName("plot_boxplots") fun plotBoxplots() -> boxplots: Image @@ -1176,7 +1176,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="945" + ```sds linenums="906" @Pure @PythonName("plot_correlation_heatmap") fun plotCorrelationHeatmap() -> correlationHeatmap: Image @@ -1186,6 +1186,12 @@ pipeline example { Plot a histogram for every column. +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `numberOfBins` | [`Int`][safeds.lang.Int] | The number of bins to use in the histogram. | `#!sds 10` | + **Results:** | Name | Type | Description | @@ -1203,10 +1209,14 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="1020" + ```sds linenums="983" @Pure @PythonName("plot_histograms") - fun plotHistograms() -> histograms: Image + fun plotHistograms( + @PythonName("number_of_bins") const numberOfBins: Int = 10 + ) -> histograms: Image where { + numberOfBins > 0 + } ``` ## `#!sds fun` plotLagplot {#safeds.data.tabular.containers.TimeSeries.plotLagplot data-toc-label='plotLagplot'} @@ -1604,7 +1614,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="673" + ```sds linenums="674" @Pure @PythonName("shuffle_rows") fun shuffleRows() -> shuffledTable: Table @@ -1739,7 +1749,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="785" + ```sds linenums="786" @Pure @PythonName("sort_rows") fun sortRows( @@ -1780,7 +1790,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="812" + ```sds linenums="813" @Pure @PythonName("split_rows") fun splitRows( @@ -1811,64 +1821,12 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="278" + ```sds linenums="279" @Pure @PythonName("summarize_statistics") fun summarizeStatistics() -> statistics: Table ``` -## `#!sds fun` tagColumns {#safeds.data.tabular.containers.TimeSeries.tagColumns data-toc-label='tagColumns'} - -Return a new `TaggedTable` with columns marked as a target column or feature columns. - -The original table is not modified. - -**Parameters:** - -| Name | Type | Description | Default | -|------|------|-------------|---------| -| `targetName` | [`String`][safeds.lang.String] | Name of the target column. | - | -| `featureNames` | [`List?`][safeds.lang.List] | Names of the feature columns. If None, all columns except the target column are used. Use this to hide columns during training but still keep them in the input, to easily link predictions back to the original data. | `#!sds null` | - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `taggedTable` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A new tagged table with the given target and feature names. | - -**Examples:** - -```sds hl_lines="6" -pipeline example { - val table = Table({ - "age": [23, 16], - "survived": [ 0, 1], - }); - val taggedTable = table.tagColumns("survived"); -} -``` -```sds hl_lines="7" -pipeline example { - val table = Table({ - "id": [ 1, 2], - "age": [23, 16], - "survived": [ 0, 1], - }); - val taggedTable = table.tagColumns("target", featureNames = ["age"]); -} -``` - -??? quote "Stub code in `table.sdsstub`" - - ```sds linenums="851" - @Pure - @PythonName("tag_columns") - fun tagColumns( - @PythonName("target_name") targetName: String, - @PythonName("feature_names") featureNames: List? = null - ) -> taggedTable: TaggedTable - ``` - ## `#!sds fun` toColumns {#safeds.data.tabular.containers.TimeSeries.toColumns data-toc-label='toColumns'} Return a list of the columns. @@ -1891,7 +1849,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="1128" + ```sds linenums="1095" @Pure @PythonName("to_columns") fun toColumns() -> columns: List @@ -1921,7 +1879,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="1038" + ```sds linenums="1005" @Impure([ImpurityReason.FileWriteToParameterizedPath("path")]) @PythonName("to_csv_file") fun toCsvFile( @@ -1954,7 +1912,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="1059" + ```sds linenums="1026" @Impure([ImpurityReason.FileWriteToParameterizedPath("path")]) @PythonName("to_excel_file") fun toExcelFile( @@ -1983,7 +1941,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="1112" + ```sds linenums="1079" @Pure @PythonName("to_html") fun toHtml() -> html: String @@ -2013,7 +1971,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="1079" + ```sds linenums="1046" @Impure([ImpurityReason.FileWriteToParameterizedPath("path")]) @PythonName("to_json_file") fun toJsonFile( @@ -2043,7 +2001,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="1097" + ```sds linenums="1064" @Pure @PythonName("to_dict") fun toMap() -> map: Map> @@ -2071,13 +2029,65 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="1144" + ```sds linenums="1111" @Experimental @Pure @PythonName("to_rows") fun toRows() -> rows: List ``` +## `#!sds fun` toTabularDataset {#safeds.data.tabular.containers.TimeSeries.toTabularDataset data-toc-label='toTabularDataset'} + +Return a new `TabularDataset` with columns marked as a target column or feature columns. + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `targetName` | [`String`][safeds.lang.String] | Name of the target column. | - | +| `extraNames` | [`List`][safeds.lang.List] | Names of the columns that are neither features nor target. If None, no extra columns are used, i.e. all but the target column are used as features. | `#!sds []` | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `dataset` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | A new tabular dataset with the given target and extras. | + +**Examples:** + +```sds hl_lines="6" +pipeline example { + val table = Table({ + "age": [23, 16], + "survived": [ 0, 1], + }); + val dataset = table.toTabularDataset("survived"); +} +``` +```sds hl_lines="7" +pipeline example { + val table = Table({ + "id": [ 1, 2], + "age": [23, 16], + "survived": [ 0, 1], + }); + val dataset = table.toTabularDataset("target", extraNames = ["id"]); +} +``` + +??? quote "Stub code in `table.sdsstub`" + + ```sds linenums="1149" + @Pure + @PythonName("to_tabular_dataset") + fun toTabularDataset( + @PythonName("target_name") targetName: String, + @PythonName("extra_names") extraNames: List = [] + ) -> dataset: TabularDataset + ``` + ## `#!sds fun` transformColumn {#safeds.data.tabular.containers.TimeSeries.transformColumn data-toc-label='transformColumn'} Return a new `TimeSeries` with the provided column transformed by calling the provided transformer. @@ -2147,7 +2157,7 @@ pipeline example { ??? quote "Stub code in `table.sdsstub`" - ```sds linenums="904" + ```sds linenums="865" @Pure @PythonName("transform_table") fun transformTable( diff --git a/docs/api/safeds/data/tabular/transformation/Discretizer.md b/docs/api/safeds/data/tabular/transformation/Discretizer.md index 9d379bc45..ef2520a6f 100644 --- a/docs/api/safeds/data/tabular/transformation/Discretizer.md +++ b/docs/api/safeds/data/tabular/transformation/Discretizer.md @@ -47,6 +47,12 @@ pipeline example { } ``` +## `#!sds attr` isFitted {#safeds.data.tabular.transformation.Discretizer.isFitted data-toc-label='isFitted'} + +Whether the transformer is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + ## `#!sds fun` fit {#safeds.data.tabular.transformation.Discretizer.fit data-toc-label='fit'} Learn a transformation for a set of columns in a table. @@ -97,7 +103,7 @@ The table is not modified. If you also need the fitted transformer, use `fit` an ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="85" + ```sds linenums="81" @Pure @PythonName("fit_and_transform") fun fitAndTransform( @@ -118,7 +124,7 @@ Get the names of all new columns that have been added by the transformer. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="44" + ```sds linenums="49" @Pure @PythonName("get_names_of_added_columns") fun getNamesOfAddedColumns() -> result1: List @@ -136,7 +142,7 @@ Get the names of all columns that have been changed by the transformer. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="53" + ```sds linenums="58" @Pure @PythonName("get_names_of_changed_columns") fun getNamesOfChangedColumns() -> result1: List @@ -154,30 +160,12 @@ Get the names of all columns that have been removed by the transformer. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="62" + ```sds linenums="67" @Pure @PythonName("get_names_of_removed_columns") fun getNamesOfRemovedColumns() -> result1: List ``` -## `#!sds fun` isFitted {#safeds.data.tabular.transformation.Discretizer.isFitted data-toc-label='isFitted'} - -Check if the transformer is fitted. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `result1` | [`Boolean`][safeds.lang.Boolean] | Whether the transformer is fitted. | - -??? quote "Stub code in `table_transformer.sdsstub`" - - ```sds linenums="71" - @Pure - @PythonName("is_fitted") - fun isFitted() -> result1: Boolean - ``` - ## `#!sds fun` transform {#safeds.data.tabular.transformation.Discretizer.transform data-toc-label='transform'} Apply the learned transformation to a table. @@ -198,7 +186,7 @@ The table is not modified. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="34" + ```sds linenums="39" @Pure fun transform( table: Table diff --git a/docs/api/safeds/data/tabular/transformation/Imputer.md b/docs/api/safeds/data/tabular/transformation/Imputer.md index 726241524..1f47d3b9a 100644 --- a/docs/api/safeds/data/tabular/transformation/Imputer.md +++ b/docs/api/safeds/data/tabular/transformation/Imputer.md @@ -77,6 +77,12 @@ pipeline example { } ``` +## `#!sds attr` isFitted {#safeds.data.tabular.transformation.Imputer.isFitted data-toc-label='isFitted'} + +Whether the transformer is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + ## `#!sds fun` fit {#safeds.data.tabular.transformation.Imputer.fit data-toc-label='fit'} Learn a transformation for a set of columns in a table. @@ -127,7 +133,7 @@ The table is not modified. If you also need the fitted transformer, use `fit` an ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="85" + ```sds linenums="81" @Pure @PythonName("fit_and_transform") fun fitAndTransform( @@ -148,7 +154,7 @@ Get the names of all new columns that have been added by the transformer. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="44" + ```sds linenums="49" @Pure @PythonName("get_names_of_added_columns") fun getNamesOfAddedColumns() -> result1: List @@ -166,7 +172,7 @@ Get the names of all columns that have been changed by the transformer. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="53" + ```sds linenums="58" @Pure @PythonName("get_names_of_changed_columns") fun getNamesOfChangedColumns() -> result1: List @@ -184,30 +190,12 @@ Get the names of all columns that have been removed by the transformer. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="62" + ```sds linenums="67" @Pure @PythonName("get_names_of_removed_columns") fun getNamesOfRemovedColumns() -> result1: List ``` -## `#!sds fun` isFitted {#safeds.data.tabular.transformation.Imputer.isFitted data-toc-label='isFitted'} - -Check if the transformer is fitted. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `result1` | [`Boolean`][safeds.lang.Boolean] | Whether the transformer is fitted. | - -??? quote "Stub code in `table_transformer.sdsstub`" - - ```sds linenums="71" - @Pure - @PythonName("is_fitted") - fun isFitted() -> result1: Boolean - ``` - ## `#!sds fun` transform {#safeds.data.tabular.transformation.Imputer.transform data-toc-label='transform'} Apply the learned transformation to a table. @@ -228,7 +216,7 @@ The table is not modified. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="34" + ```sds linenums="39" @Pure fun transform( table: Table diff --git a/docs/api/safeds/data/tabular/transformation/InvertibleTableTransformer.md b/docs/api/safeds/data/tabular/transformation/InvertibleTableTransformer.md index b3c21f0cb..ed8187515 100644 --- a/docs/api/safeds/data/tabular/transformation/InvertibleTableTransformer.md +++ b/docs/api/safeds/data/tabular/transformation/InvertibleTableTransformer.md @@ -18,7 +18,7 @@ A `TableTransformer` that can also undo the learned transformation after it has ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="96" + ```sds linenums="92" class InvertibleTableTransformer sub TableTransformer { /** * Learn a transformation for a set of columns in a table. @@ -51,6 +51,12 @@ A `TableTransformer` that can also undo the learned transformation after it has } ``` +## `#!sds attr` isFitted {#safeds.data.tabular.transformation.InvertibleTableTransformer.isFitted data-toc-label='isFitted'} + +Whether the transformer is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + ## `#!sds fun` fit {#safeds.data.tabular.transformation.InvertibleTableTransformer.fit data-toc-label='fit'} Learn a transformation for a set of columns in a table. @@ -70,7 +76,7 @@ Learn a transformation for a set of columns in a table. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="105" + ```sds linenums="101" @Pure fun fit( table: Table, @@ -99,7 +105,7 @@ The table is not modified. If you also need the fitted transformer, use `fit` an ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="85" + ```sds linenums="81" @Pure @PythonName("fit_and_transform") fun fitAndTransform( @@ -120,7 +126,7 @@ Get the names of all new columns that have been added by the transformer. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="44" + ```sds linenums="49" @Pure @PythonName("get_names_of_added_columns") fun getNamesOfAddedColumns() -> result1: List @@ -138,7 +144,7 @@ Get the names of all columns that have been changed by the transformer. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="53" + ```sds linenums="58" @Pure @PythonName("get_names_of_changed_columns") fun getNamesOfChangedColumns() -> result1: List @@ -156,7 +162,7 @@ Get the names of all columns that have been removed by the transformer. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="62" + ```sds linenums="67" @Pure @PythonName("get_names_of_removed_columns") fun getNamesOfRemovedColumns() -> result1: List @@ -182,7 +188,7 @@ The table is not modified. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="120" + ```sds linenums="116" @Pure @PythonName("inverse_transform") fun inverseTransform( @@ -190,24 +196,6 @@ The table is not modified. ) -> result1: Table ``` -## `#!sds fun` isFitted {#safeds.data.tabular.transformation.InvertibleTableTransformer.isFitted data-toc-label='isFitted'} - -Check if the transformer is fitted. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `result1` | [`Boolean`][safeds.lang.Boolean] | Whether the transformer is fitted. | - -??? quote "Stub code in `table_transformer.sdsstub`" - - ```sds linenums="71" - @Pure - @PythonName("is_fitted") - fun isFitted() -> result1: Boolean - ``` - ## `#!sds fun` transform {#safeds.data.tabular.transformation.InvertibleTableTransformer.transform data-toc-label='transform'} Apply the learned transformation to a table. @@ -228,7 +216,7 @@ The table is not modified. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="34" + ```sds linenums="39" @Pure fun transform( table: Table diff --git a/docs/api/safeds/data/tabular/transformation/LabelEncoder.md b/docs/api/safeds/data/tabular/transformation/LabelEncoder.md index 73ae4a7f4..6522e14a1 100644 --- a/docs/api/safeds/data/tabular/transformation/LabelEncoder.md +++ b/docs/api/safeds/data/tabular/transformation/LabelEncoder.md @@ -39,6 +39,12 @@ pipeline example { } ``` +## `#!sds attr` isFitted {#safeds.data.tabular.transformation.LabelEncoder.isFitted data-toc-label='isFitted'} + +Whether the transformer is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + ## `#!sds fun` fit {#safeds.data.tabular.transformation.LabelEncoder.fit data-toc-label='fit'} Learn a transformation for a set of columns in a table. @@ -89,7 +95,7 @@ The table is not modified. If you also need the fitted transformer, use `fit` an ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="85" + ```sds linenums="81" @Pure @PythonName("fit_and_transform") fun fitAndTransform( @@ -110,7 +116,7 @@ Get the names of all new columns that have been added by the transformer. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="44" + ```sds linenums="49" @Pure @PythonName("get_names_of_added_columns") fun getNamesOfAddedColumns() -> result1: List @@ -128,7 +134,7 @@ Get the names of all columns that have been changed by the transformer. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="53" + ```sds linenums="58" @Pure @PythonName("get_names_of_changed_columns") fun getNamesOfChangedColumns() -> result1: List @@ -146,7 +152,7 @@ Get the names of all columns that have been removed by the transformer. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="62" + ```sds linenums="67" @Pure @PythonName("get_names_of_removed_columns") fun getNamesOfRemovedColumns() -> result1: List @@ -172,7 +178,7 @@ The table is not modified. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="120" + ```sds linenums="116" @Pure @PythonName("inverse_transform") fun inverseTransform( @@ -180,24 +186,6 @@ The table is not modified. ) -> result1: Table ``` -## `#!sds fun` isFitted {#safeds.data.tabular.transformation.LabelEncoder.isFitted data-toc-label='isFitted'} - -Check if the transformer is fitted. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `result1` | [`Boolean`][safeds.lang.Boolean] | Whether the transformer is fitted. | - -??? quote "Stub code in `table_transformer.sdsstub`" - - ```sds linenums="71" - @Pure - @PythonName("is_fitted") - fun isFitted() -> result1: Boolean - ``` - ## `#!sds fun` transform {#safeds.data.tabular.transformation.LabelEncoder.transform data-toc-label='transform'} Apply the learned transformation to a table. @@ -218,7 +206,7 @@ The table is not modified. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="34" + ```sds linenums="39" @Pure fun transform( table: Table diff --git a/docs/api/safeds/data/tabular/transformation/OneHotEncoder.md b/docs/api/safeds/data/tabular/transformation/OneHotEncoder.md index 919e2b943..686720127 100644 --- a/docs/api/safeds/data/tabular/transformation/OneHotEncoder.md +++ b/docs/api/safeds/data/tabular/transformation/OneHotEncoder.md @@ -62,6 +62,12 @@ pipeline example { } ``` +## `#!sds attr` isFitted {#safeds.data.tabular.transformation.OneHotEncoder.isFitted data-toc-label='isFitted'} + +Whether the transformer is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + ## `#!sds fun` fit {#safeds.data.tabular.transformation.OneHotEncoder.fit data-toc-label='fit'} Learn a transformation for a set of columns in a table. @@ -112,7 +118,7 @@ The table is not modified. If you also need the fitted transformer, use `fit` an ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="85" + ```sds linenums="81" @Pure @PythonName("fit_and_transform") fun fitAndTransform( @@ -133,7 +139,7 @@ Get the names of all new columns that have been added by the transformer. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="44" + ```sds linenums="49" @Pure @PythonName("get_names_of_added_columns") fun getNamesOfAddedColumns() -> result1: List @@ -151,7 +157,7 @@ Get the names of all columns that have been changed by the transformer. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="53" + ```sds linenums="58" @Pure @PythonName("get_names_of_changed_columns") fun getNamesOfChangedColumns() -> result1: List @@ -169,7 +175,7 @@ Get the names of all columns that have been removed by the transformer. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="62" + ```sds linenums="67" @Pure @PythonName("get_names_of_removed_columns") fun getNamesOfRemovedColumns() -> result1: List @@ -195,7 +201,7 @@ The table is not modified. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="120" + ```sds linenums="116" @Pure @PythonName("inverse_transform") fun inverseTransform( @@ -203,24 +209,6 @@ The table is not modified. ) -> result1: Table ``` -## `#!sds fun` isFitted {#safeds.data.tabular.transformation.OneHotEncoder.isFitted data-toc-label='isFitted'} - -Check if the transformer is fitted. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `result1` | [`Boolean`][safeds.lang.Boolean] | Whether the transformer is fitted. | - -??? quote "Stub code in `table_transformer.sdsstub`" - - ```sds linenums="71" - @Pure - @PythonName("is_fitted") - fun isFitted() -> result1: Boolean - ``` - ## `#!sds fun` transform {#safeds.data.tabular.transformation.OneHotEncoder.transform data-toc-label='transform'} Apply the learned transformation to a table. @@ -241,7 +229,7 @@ The table is not modified. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="34" + ```sds linenums="39" @Pure fun transform( table: Table diff --git a/docs/api/safeds/data/tabular/transformation/RangeScaler.md b/docs/api/safeds/data/tabular/transformation/RangeScaler.md index 296c39653..8b57a79a4 100644 --- a/docs/api/safeds/data/tabular/transformation/RangeScaler.md +++ b/docs/api/safeds/data/tabular/transformation/RangeScaler.md @@ -49,6 +49,12 @@ pipeline example { } ``` +## `#!sds attr` isFitted {#safeds.data.tabular.transformation.RangeScaler.isFitted data-toc-label='isFitted'} + +Whether the transformer is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + ## `#!sds fun` fit {#safeds.data.tabular.transformation.RangeScaler.fit data-toc-label='fit'} Learn a transformation for a set of columns in a table. @@ -99,7 +105,7 @@ The table is not modified. If you also need the fitted transformer, use `fit` an ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="85" + ```sds linenums="81" @Pure @PythonName("fit_and_transform") fun fitAndTransform( @@ -120,7 +126,7 @@ Get the names of all new columns that have been added by the transformer. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="44" + ```sds linenums="49" @Pure @PythonName("get_names_of_added_columns") fun getNamesOfAddedColumns() -> result1: List @@ -138,7 +144,7 @@ Get the names of all columns that have been changed by the transformer. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="53" + ```sds linenums="58" @Pure @PythonName("get_names_of_changed_columns") fun getNamesOfChangedColumns() -> result1: List @@ -156,7 +162,7 @@ Get the names of all columns that have been removed by the transformer. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="62" + ```sds linenums="67" @Pure @PythonName("get_names_of_removed_columns") fun getNamesOfRemovedColumns() -> result1: List @@ -182,7 +188,7 @@ The table is not modified. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="120" + ```sds linenums="116" @Pure @PythonName("inverse_transform") fun inverseTransform( @@ -190,24 +196,6 @@ The table is not modified. ) -> result1: Table ``` -## `#!sds fun` isFitted {#safeds.data.tabular.transformation.RangeScaler.isFitted data-toc-label='isFitted'} - -Check if the transformer is fitted. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `result1` | [`Boolean`][safeds.lang.Boolean] | Whether the transformer is fitted. | - -??? quote "Stub code in `table_transformer.sdsstub`" - - ```sds linenums="71" - @Pure - @PythonName("is_fitted") - fun isFitted() -> result1: Boolean - ``` - ## `#!sds fun` transform {#safeds.data.tabular.transformation.RangeScaler.transform data-toc-label='transform'} Apply the learned transformation to a table. @@ -228,7 +216,7 @@ The table is not modified. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="34" + ```sds linenums="39" @Pure fun transform( table: Table diff --git a/docs/api/safeds/data/tabular/transformation/StandardScaler.md b/docs/api/safeds/data/tabular/transformation/StandardScaler.md index 114892e75..7ec203047 100644 --- a/docs/api/safeds/data/tabular/transformation/StandardScaler.md +++ b/docs/api/safeds/data/tabular/transformation/StandardScaler.md @@ -39,6 +39,12 @@ pipeline example { } ``` +## `#!sds attr` isFitted {#safeds.data.tabular.transformation.StandardScaler.isFitted data-toc-label='isFitted'} + +Whether the transformer is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + ## `#!sds fun` fit {#safeds.data.tabular.transformation.StandardScaler.fit data-toc-label='fit'} Learn a transformation for a set of columns in a table. @@ -89,7 +95,7 @@ The table is not modified. If you also need the fitted transformer, use `fit` an ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="85" + ```sds linenums="81" @Pure @PythonName("fit_and_transform") fun fitAndTransform( @@ -110,7 +116,7 @@ Get the names of all new columns that have been added by the transformer. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="44" + ```sds linenums="49" @Pure @PythonName("get_names_of_added_columns") fun getNamesOfAddedColumns() -> result1: List @@ -128,7 +134,7 @@ Get the names of all columns that have been changed by the transformer. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="53" + ```sds linenums="58" @Pure @PythonName("get_names_of_changed_columns") fun getNamesOfChangedColumns() -> result1: List @@ -146,7 +152,7 @@ Get the names of all columns that have been removed by the transformer. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="62" + ```sds linenums="67" @Pure @PythonName("get_names_of_removed_columns") fun getNamesOfRemovedColumns() -> result1: List @@ -172,7 +178,7 @@ The table is not modified. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="120" + ```sds linenums="116" @Pure @PythonName("inverse_transform") fun inverseTransform( @@ -180,24 +186,6 @@ The table is not modified. ) -> result1: Table ``` -## `#!sds fun` isFitted {#safeds.data.tabular.transformation.StandardScaler.isFitted data-toc-label='isFitted'} - -Check if the transformer is fitted. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `result1` | [`Boolean`][safeds.lang.Boolean] | Whether the transformer is fitted. | - -??? quote "Stub code in `table_transformer.sdsstub`" - - ```sds linenums="71" - @Pure - @PythonName("is_fitted") - fun isFitted() -> result1: Boolean - ``` - ## `#!sds fun` transform {#safeds.data.tabular.transformation.StandardScaler.transform data-toc-label='transform'} Apply the learned transformation to a table. @@ -218,7 +206,7 @@ The table is not modified. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="34" + ```sds linenums="39" @Pure fun transform( table: Table diff --git a/docs/api/safeds/data/tabular/transformation/TableTransformer.md b/docs/api/safeds/data/tabular/transformation/TableTransformer.md index c77c0f598..3ee94dd7f 100644 --- a/docs/api/safeds/data/tabular/transformation/TableTransformer.md +++ b/docs/api/safeds/data/tabular/transformation/TableTransformer.md @@ -17,6 +17,11 @@ Learn a transformation for a set of columns in a `Table` and transform another ` ```sds linenums="8" class TableTransformer { + /** + * Whether the transformer is fitted. + */ + @PythonName("is_fitted") attr isFitted: Boolean + /** * Learn a transformation for a set of columns in a table. * @@ -74,15 +79,6 @@ Learn a transformation for a set of columns in a `Table` and transform another ` @PythonName("get_names_of_removed_columns") fun getNamesOfRemovedColumns() -> result1: List - /** - * Check if the transformer is fitted. - * - * @result result1 Whether the transformer is fitted. - */ - @Pure - @PythonName("is_fitted") - fun isFitted() -> result1: Boolean - /** * Learn a transformation for a set of columns in a table and apply the learned transformation to the same table. * @@ -102,6 +98,12 @@ Learn a transformation for a set of columns in a `Table` and transform another ` } ``` +## `#!sds attr` isFitted {#safeds.data.tabular.transformation.TableTransformer.isFitted data-toc-label='isFitted'} + +Whether the transformer is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + ## `#!sds fun` fit {#safeds.data.tabular.transformation.TableTransformer.fit data-toc-label='fit'} Learn a transformation for a set of columns in a table. @@ -123,7 +125,7 @@ This transformer is not modified. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="19" + ```sds linenums="24" @Pure fun fit( table: Table, @@ -152,7 +154,7 @@ The table is not modified. If you also need the fitted transformer, use `fit` an ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="85" + ```sds linenums="81" @Pure @PythonName("fit_and_transform") fun fitAndTransform( @@ -173,7 +175,7 @@ Get the names of all new columns that have been added by the transformer. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="44" + ```sds linenums="49" @Pure @PythonName("get_names_of_added_columns") fun getNamesOfAddedColumns() -> result1: List @@ -191,7 +193,7 @@ Get the names of all columns that have been changed by the transformer. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="53" + ```sds linenums="58" @Pure @PythonName("get_names_of_changed_columns") fun getNamesOfChangedColumns() -> result1: List @@ -209,30 +211,12 @@ Get the names of all columns that have been removed by the transformer. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="62" + ```sds linenums="67" @Pure @PythonName("get_names_of_removed_columns") fun getNamesOfRemovedColumns() -> result1: List ``` -## `#!sds fun` isFitted {#safeds.data.tabular.transformation.TableTransformer.isFitted data-toc-label='isFitted'} - -Check if the transformer is fitted. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `result1` | [`Boolean`][safeds.lang.Boolean] | Whether the transformer is fitted. | - -??? quote "Stub code in `table_transformer.sdsstub`" - - ```sds linenums="71" - @Pure - @PythonName("is_fitted") - fun isFitted() -> result1: Boolean - ``` - ## `#!sds fun` transform {#safeds.data.tabular.transformation.TableTransformer.transform data-toc-label='transform'} Apply the learned transformation to a table. @@ -253,7 +237,7 @@ The table is not modified. ??? quote "Stub code in `table_transformer.sdsstub`" - ```sds linenums="34" + ```sds linenums="39" @Pure fun transform( table: Table diff --git a/docs/api/safeds/ml/classical/classification/AdaBoostClassifier.md b/docs/api/safeds/ml/classical/classification/AdaBoostClassifier.md index 0af122826..b672a5eb7 100644 --- a/docs/api/safeds/ml/classical/classification/AdaBoostClassifier.md +++ b/docs/api/safeds/ml/classical/classification/AdaBoostClassifier.md @@ -16,8 +16,8 @@ Ada Boost classification. ```sds hl_lines="4" pipeline example { - val training = Table.fromCsvFile("training.csv").tagColumns("target"); - val test = Table.fromCsvFile("test.csv").tagColumns("target"); + val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); val classifier = AdaBoostClassifier(maximumNumberOfLearners = 100).fit(training); val accuracy = classifier.accuracy(test); } @@ -25,7 +25,7 @@ pipeline example { ??? quote "Stub code in `ada_boost.sdsstub`" - ```sds linenums="23" + ```sds linenums="24" class AdaBoostClassifier( learner: Classifier = DecisionTreeClassifier(), @PythonName("maximum_number_of_learners") const maximumNumberOfLearners: Int = 50, @@ -58,11 +58,17 @@ pipeline example { */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedClassifier: AdaBoostClassifier } ``` +## `#!sds attr` isFitted {#safeds.ml.classical.classification.AdaBoostClassifier.isFitted data-toc-label='isFitted'} + +Whether the classifier is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + ## `#!sds attr` learner {#safeds.ml.classical.classification.AdaBoostClassifier.learner data-toc-label='learner'} Get the base learner used for training the ensemble. @@ -89,7 +95,7 @@ Compute the accuracy of the classifier on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -99,10 +105,10 @@ Compute the accuracy of the classifier on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="51" + ```sds linenums="48" @Pure fun accuracy( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> accuracy: Float ``` @@ -114,7 +120,7 @@ Compute the classifier's $F_1$-score on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | | `positiveClass` | [`Any`][safeds.lang.Any] | The class to be considered positive. All other classes are considered negative. | - | **Results:** @@ -125,11 +131,11 @@ Compute the classifier's $F_1$-score on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="95" + ```sds linenums="92" @Pure @PythonName("f1_score") fun f1Score( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> f1Score: Float ``` @@ -144,7 +150,7 @@ This classifier is not modified. | Name | Type | Description | Default | |------|------|-------------|---------| -| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | +| `trainingSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The training data containing the feature and target vectors. | - | **Results:** @@ -154,31 +160,13 @@ This classifier is not modified. ??? quote "Stub code in `ada_boost.sdsstub`" - ```sds linenums="53" + ```sds linenums="54" @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedClassifier: AdaBoostClassifier ``` -## `#!sds fun` isFitted {#safeds.ml.classical.classification.AdaBoostClassifier.isFitted data-toc-label='isFitted'} - -Check if the classifier is fitted. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `isFitted` | [`Boolean`][safeds.lang.Boolean] | Whether the classifier is fitted. | - -??? quote "Stub code in `classifier.sdsstub`" - - ```sds linenums="40" - @Pure - @PythonName("is_fitted") - fun isFitted() -> isFitted: Boolean - ``` - ## `#!sds fun` precision {#safeds.ml.classical.classification.AdaBoostClassifier.precision data-toc-label='precision'} Compute the classifier's precision on the given data. @@ -187,7 +175,7 @@ Compute the classifier's precision on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | | `positiveClass` | [`Any`][safeds.lang.Any] | The class to be considered positive. All other classes are considered negative. | - | **Results:** @@ -198,10 +186,10 @@ Compute the classifier's precision on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="65" + ```sds linenums="62" @Pure fun precision( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> precision: Float ``` @@ -220,15 +208,15 @@ Predict a target vector using a dataset containing feature vectors. The model ha | Name | Type | Description | |------|------|-------------| -| `prediction` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A dataset containing the given feature vectors and the predicted target vector. | +| `prediction` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | A dataset containing the given feature vectors and the predicted target vector. | ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="30" + ```sds linenums="36" @Pure fun predict( dataset: Table - ) -> prediction: TaggedTable + ) -> prediction: TabularDataset ``` ## `#!sds fun` recall {#safeds.ml.classical.classification.AdaBoostClassifier.recall data-toc-label='recall'} @@ -239,7 +227,7 @@ Compute the classifier's recall on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | | `positiveClass` | [`Any`][safeds.lang.Any] | The class to be considered positive. All other classes are considered negative. | - | **Results:** @@ -250,10 +238,10 @@ Compute the classifier's recall on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="80" + ```sds linenums="77" @Pure fun recall( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> recall: Float ``` diff --git a/docs/api/safeds/ml/classical/classification/Classifier.md b/docs/api/safeds/ml/classical/classification/Classifier.md index 17c34167a..66d7b7b03 100644 --- a/docs/api/safeds/ml/classical/classification/Classifier.md +++ b/docs/api/safeds/ml/classical/classification/Classifier.md @@ -19,8 +19,13 @@ Abstract base class for all classifiers. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="8" + ```sds linenums="9" class Classifier { + /** + * Whether the classifier is fitted. + */ + @PythonName("is_fitted") attr isFitted: Boolean + /** * Create a copy of this classifier and fit it with the given training data. * @@ -32,7 +37,7 @@ Abstract base class for all classifiers. */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedClassifier: Classifier /** @@ -45,16 +50,7 @@ Abstract base class for all classifiers. @Pure fun predict( dataset: Table - ) -> prediction: TaggedTable - - /** - * Check if the classifier is fitted. - * - * @result isFitted Whether the classifier is fitted. - */ - @Pure - @PythonName("is_fitted") - fun isFitted() -> isFitted: Boolean + ) -> prediction: TabularDataset /** * Compute the accuracy of the classifier on the given data. @@ -65,7 +61,7 @@ Abstract base class for all classifiers. */ @Pure fun accuracy( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> accuracy: Float /** @@ -79,7 +75,7 @@ Abstract base class for all classifiers. */ @Pure fun precision( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> precision: Float @@ -94,7 +90,7 @@ Abstract base class for all classifiers. */ @Pure fun recall( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> recall: Float @@ -110,12 +106,18 @@ Abstract base class for all classifiers. @Pure @PythonName("f1_score") fun f1Score( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> f1Score: Float } ``` +## `#!sds attr` isFitted {#safeds.ml.classical.classification.Classifier.isFitted data-toc-label='isFitted'} + +Whether the classifier is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + ## `#!sds fun` accuracy {#safeds.ml.classical.classification.Classifier.accuracy data-toc-label='accuracy'} Compute the accuracy of the classifier on the given data. @@ -124,7 +126,7 @@ Compute the accuracy of the classifier on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -134,10 +136,10 @@ Compute the accuracy of the classifier on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="51" + ```sds linenums="48" @Pure fun accuracy( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> accuracy: Float ``` @@ -149,7 +151,7 @@ Compute the classifier's $F_1$-score on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | | `positiveClass` | [`Any`][safeds.lang.Any] | The class to be considered positive. All other classes are considered negative. | - | **Results:** @@ -160,11 +162,11 @@ Compute the classifier's $F_1$-score on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="95" + ```sds linenums="92" @Pure @PythonName("f1_score") fun f1Score( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> f1Score: Float ``` @@ -179,7 +181,7 @@ This classifier is not modified. | Name | Type | Description | Default | |------|------|-------------|---------| -| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | +| `trainingSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The training data containing the feature and target vectors. | - | **Results:** @@ -189,31 +191,13 @@ This classifier is not modified. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="18" + ```sds linenums="24" @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedClassifier: Classifier ``` -## `#!sds fun` isFitted {#safeds.ml.classical.classification.Classifier.isFitted data-toc-label='isFitted'} - -Check if the classifier is fitted. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `isFitted` | [`Boolean`][safeds.lang.Boolean] | Whether the classifier is fitted. | - -??? quote "Stub code in `classifier.sdsstub`" - - ```sds linenums="40" - @Pure - @PythonName("is_fitted") - fun isFitted() -> isFitted: Boolean - ``` - ## `#!sds fun` precision {#safeds.ml.classical.classification.Classifier.precision data-toc-label='precision'} Compute the classifier's precision on the given data. @@ -222,7 +206,7 @@ Compute the classifier's precision on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | | `positiveClass` | [`Any`][safeds.lang.Any] | The class to be considered positive. All other classes are considered negative. | - | **Results:** @@ -233,10 +217,10 @@ Compute the classifier's precision on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="65" + ```sds linenums="62" @Pure fun precision( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> precision: Float ``` @@ -255,15 +239,15 @@ Predict a target vector using a dataset containing feature vectors. The model ha | Name | Type | Description | |------|------|-------------| -| `prediction` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A dataset containing the given feature vectors and the predicted target vector. | +| `prediction` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | A dataset containing the given feature vectors and the predicted target vector. | ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="30" + ```sds linenums="36" @Pure fun predict( dataset: Table - ) -> prediction: TaggedTable + ) -> prediction: TabularDataset ``` ## `#!sds fun` recall {#safeds.ml.classical.classification.Classifier.recall data-toc-label='recall'} @@ -274,7 +258,7 @@ Compute the classifier's recall on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | | `positiveClass` | [`Any`][safeds.lang.Any] | The class to be considered positive. All other classes are considered negative. | - | **Results:** @@ -285,10 +269,10 @@ Compute the classifier's recall on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="80" + ```sds linenums="77" @Pure fun recall( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> recall: Float ``` diff --git a/docs/api/safeds/ml/classical/classification/DecisionTreeClassifier.md b/docs/api/safeds/ml/classical/classification/DecisionTreeClassifier.md index ee3c5695f..9513425a9 100644 --- a/docs/api/safeds/ml/classical/classification/DecisionTreeClassifier.md +++ b/docs/api/safeds/ml/classical/classification/DecisionTreeClassifier.md @@ -8,8 +8,8 @@ Decision tree classification. ```sds hl_lines="4" pipeline example { - val training = Table.fromCsvFile("training.csv").tagColumns("target"); - val test = Table.fromCsvFile("test.csv").tagColumns("target"); + val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); val classifier = DecisionTreeClassifier().fit(training); val accuracy = classifier.accuracy(test); } @@ -17,7 +17,7 @@ pipeline example { ??? quote "Stub code in `decision_tree.sdsstub`" - ```sds linenums="17" + ```sds linenums="18" class DecisionTreeClassifier() sub Classifier { /** * Create a copy of this classifier and fit it with the given training data. @@ -30,11 +30,17 @@ pipeline example { */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedClassifier: DecisionTreeClassifier } ``` +## `#!sds attr` isFitted {#safeds.ml.classical.classification.DecisionTreeClassifier.isFitted data-toc-label='isFitted'} + +Whether the classifier is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + ## `#!sds fun` accuracy {#safeds.ml.classical.classification.DecisionTreeClassifier.accuracy data-toc-label='accuracy'} Compute the accuracy of the classifier on the given data. @@ -43,7 +49,7 @@ Compute the accuracy of the classifier on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -53,10 +59,10 @@ Compute the accuracy of the classifier on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="51" + ```sds linenums="48" @Pure fun accuracy( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> accuracy: Float ``` @@ -68,7 +74,7 @@ Compute the classifier's $F_1$-score on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | | `positiveClass` | [`Any`][safeds.lang.Any] | The class to be considered positive. All other classes are considered negative. | - | **Results:** @@ -79,11 +85,11 @@ Compute the classifier's $F_1$-score on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="95" + ```sds linenums="92" @Pure @PythonName("f1_score") fun f1Score( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> f1Score: Float ``` @@ -98,7 +104,7 @@ This classifier is not modified. | Name | Type | Description | Default | |------|------|-------------|---------| -| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | +| `trainingSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The training data containing the feature and target vectors. | - | **Results:** @@ -108,31 +114,13 @@ This classifier is not modified. ??? quote "Stub code in `decision_tree.sdsstub`" - ```sds linenums="27" + ```sds linenums="28" @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedClassifier: DecisionTreeClassifier ``` -## `#!sds fun` isFitted {#safeds.ml.classical.classification.DecisionTreeClassifier.isFitted data-toc-label='isFitted'} - -Check if the classifier is fitted. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `isFitted` | [`Boolean`][safeds.lang.Boolean] | Whether the classifier is fitted. | - -??? quote "Stub code in `classifier.sdsstub`" - - ```sds linenums="40" - @Pure - @PythonName("is_fitted") - fun isFitted() -> isFitted: Boolean - ``` - ## `#!sds fun` precision {#safeds.ml.classical.classification.DecisionTreeClassifier.precision data-toc-label='precision'} Compute the classifier's precision on the given data. @@ -141,7 +129,7 @@ Compute the classifier's precision on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | | `positiveClass` | [`Any`][safeds.lang.Any] | The class to be considered positive. All other classes are considered negative. | - | **Results:** @@ -152,10 +140,10 @@ Compute the classifier's precision on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="65" + ```sds linenums="62" @Pure fun precision( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> precision: Float ``` @@ -174,15 +162,15 @@ Predict a target vector using a dataset containing feature vectors. The model ha | Name | Type | Description | |------|------|-------------| -| `prediction` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A dataset containing the given feature vectors and the predicted target vector. | +| `prediction` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | A dataset containing the given feature vectors and the predicted target vector. | ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="30" + ```sds linenums="36" @Pure fun predict( dataset: Table - ) -> prediction: TaggedTable + ) -> prediction: TabularDataset ``` ## `#!sds fun` recall {#safeds.ml.classical.classification.DecisionTreeClassifier.recall data-toc-label='recall'} @@ -193,7 +181,7 @@ Compute the classifier's recall on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | | `positiveClass` | [`Any`][safeds.lang.Any] | The class to be considered positive. All other classes are considered negative. | - | **Results:** @@ -204,10 +192,10 @@ Compute the classifier's recall on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="80" + ```sds linenums="77" @Pure fun recall( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> recall: Float ``` diff --git a/docs/api/safeds/ml/classical/classification/GradientBoostingClassifier.md b/docs/api/safeds/ml/classical/classification/GradientBoostingClassifier.md index 20ff5ae3f..695f5d17a 100644 --- a/docs/api/safeds/ml/classical/classification/GradientBoostingClassifier.md +++ b/docs/api/safeds/ml/classical/classification/GradientBoostingClassifier.md @@ -15,8 +15,8 @@ Gradient boosting classification. ```sds hl_lines="4" pipeline example { - val training = Table.fromCsvFile("training.csv").tagColumns("target"); - val test = Table.fromCsvFile("test.csv").tagColumns("target"); + val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); val classifier = GradientBoostingClassifier(numberOfTrees = 50).fit(training); val accuracy = classifier.accuracy(test); } @@ -24,7 +24,7 @@ pipeline example { ??? quote "Stub code in `gradient_boosting.sdsstub`" - ```sds linenums="22" + ```sds linenums="23" class GradientBoostingClassifier( @PythonName("number_of_trees") const numberOfTrees: Int = 100, @PythonName("learning_rate") const learningRate: Float = 0.1 @@ -52,11 +52,17 @@ pipeline example { */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedClassifier: GradientBoostingClassifier } ``` +## `#!sds attr` isFitted {#safeds.ml.classical.classification.GradientBoostingClassifier.isFitted data-toc-label='isFitted'} + +Whether the classifier is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + ## `#!sds attr` learningRate {#safeds.ml.classical.classification.GradientBoostingClassifier.learningRate data-toc-label='learningRate'} Get the learning rate. @@ -77,7 +83,7 @@ Compute the accuracy of the classifier on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -87,10 +93,10 @@ Compute the accuracy of the classifier on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="51" + ```sds linenums="48" @Pure fun accuracy( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> accuracy: Float ``` @@ -102,7 +108,7 @@ Compute the classifier's $F_1$-score on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | | `positiveClass` | [`Any`][safeds.lang.Any] | The class to be considered positive. All other classes are considered negative. | - | **Results:** @@ -113,11 +119,11 @@ Compute the classifier's $F_1$-score on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="95" + ```sds linenums="92" @Pure @PythonName("f1_score") fun f1Score( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> f1Score: Float ``` @@ -132,7 +138,7 @@ This classifier is not modified. | Name | Type | Description | Default | |------|------|-------------|---------| -| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | +| `trainingSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The training data containing the feature and target vectors. | - | **Results:** @@ -142,31 +148,13 @@ This classifier is not modified. ??? quote "Stub code in `gradient_boosting.sdsstub`" - ```sds linenums="47" + ```sds linenums="48" @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedClassifier: GradientBoostingClassifier ``` -## `#!sds fun` isFitted {#safeds.ml.classical.classification.GradientBoostingClassifier.isFitted data-toc-label='isFitted'} - -Check if the classifier is fitted. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `isFitted` | [`Boolean`][safeds.lang.Boolean] | Whether the classifier is fitted. | - -??? quote "Stub code in `classifier.sdsstub`" - - ```sds linenums="40" - @Pure - @PythonName("is_fitted") - fun isFitted() -> isFitted: Boolean - ``` - ## `#!sds fun` precision {#safeds.ml.classical.classification.GradientBoostingClassifier.precision data-toc-label='precision'} Compute the classifier's precision on the given data. @@ -175,7 +163,7 @@ Compute the classifier's precision on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | | `positiveClass` | [`Any`][safeds.lang.Any] | The class to be considered positive. All other classes are considered negative. | - | **Results:** @@ -186,10 +174,10 @@ Compute the classifier's precision on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="65" + ```sds linenums="62" @Pure fun precision( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> precision: Float ``` @@ -208,15 +196,15 @@ Predict a target vector using a dataset containing feature vectors. The model ha | Name | Type | Description | |------|------|-------------| -| `prediction` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A dataset containing the given feature vectors and the predicted target vector. | +| `prediction` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | A dataset containing the given feature vectors and the predicted target vector. | ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="30" + ```sds linenums="36" @Pure fun predict( dataset: Table - ) -> prediction: TaggedTable + ) -> prediction: TabularDataset ``` ## `#!sds fun` recall {#safeds.ml.classical.classification.GradientBoostingClassifier.recall data-toc-label='recall'} @@ -227,7 +215,7 @@ Compute the classifier's recall on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | | `positiveClass` | [`Any`][safeds.lang.Any] | The class to be considered positive. All other classes are considered negative. | - | **Results:** @@ -238,10 +226,10 @@ Compute the classifier's recall on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="80" + ```sds linenums="77" @Pure fun recall( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> recall: Float ``` diff --git a/docs/api/safeds/ml/classical/classification/KNearestNeighborsClassifier.md b/docs/api/safeds/ml/classical/classification/KNearestNeighborsClassifier.md index a3b4adc92..da6a2b8f1 100644 --- a/docs/api/safeds/ml/classical/classification/KNearestNeighborsClassifier.md +++ b/docs/api/safeds/ml/classical/classification/KNearestNeighborsClassifier.md @@ -14,8 +14,8 @@ K-nearest-neighbors classification. ```sds hl_lines="4" pipeline example { - val training = Table.fromCsvFile("training.csv").tagColumns("target"); - val test = Table.fromCsvFile("test.csv").tagColumns("target"); + val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); val classifier = KNearestNeighborsClassifier(5).fit(training); val accuracy = classifier.accuracy(test); } @@ -23,7 +23,7 @@ pipeline example { ??? quote "Stub code in `k_nearest_neighbors.sdsstub`" - ```sds linenums="20" + ```sds linenums="21" class KNearestNeighborsClassifier( @PythonName("number_of_neighbors") const numberOfNeighbors: Int ) sub Classifier where { @@ -45,11 +45,17 @@ pipeline example { */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedClassifier: KNearestNeighborsClassifier } ``` +## `#!sds attr` isFitted {#safeds.ml.classical.classification.KNearestNeighborsClassifier.isFitted data-toc-label='isFitted'} + +Whether the classifier is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + ## `#!sds attr` numberOfNeighbors {#safeds.ml.classical.classification.KNearestNeighborsClassifier.numberOfNeighbors data-toc-label='numberOfNeighbors'} Get the number of neighbors used for interpolation. @@ -64,7 +70,7 @@ Compute the accuracy of the classifier on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -74,10 +80,10 @@ Compute the accuracy of the classifier on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="51" + ```sds linenums="48" @Pure fun accuracy( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> accuracy: Float ``` @@ -89,7 +95,7 @@ Compute the classifier's $F_1$-score on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | | `positiveClass` | [`Any`][safeds.lang.Any] | The class to be considered positive. All other classes are considered negative. | - | **Results:** @@ -100,11 +106,11 @@ Compute the classifier's $F_1$-score on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="95" + ```sds linenums="92" @Pure @PythonName("f1_score") fun f1Score( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> f1Score: Float ``` @@ -119,7 +125,7 @@ This classifier is not modified. | Name | Type | Description | Default | |------|------|-------------|---------| -| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | +| `trainingSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The training data containing the feature and target vectors. | - | **Results:** @@ -129,31 +135,13 @@ This classifier is not modified. ??? quote "Stub code in `k_nearest_neighbors.sdsstub`" - ```sds linenums="39" + ```sds linenums="40" @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedClassifier: KNearestNeighborsClassifier ``` -## `#!sds fun` isFitted {#safeds.ml.classical.classification.KNearestNeighborsClassifier.isFitted data-toc-label='isFitted'} - -Check if the classifier is fitted. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `isFitted` | [`Boolean`][safeds.lang.Boolean] | Whether the classifier is fitted. | - -??? quote "Stub code in `classifier.sdsstub`" - - ```sds linenums="40" - @Pure - @PythonName("is_fitted") - fun isFitted() -> isFitted: Boolean - ``` - ## `#!sds fun` precision {#safeds.ml.classical.classification.KNearestNeighborsClassifier.precision data-toc-label='precision'} Compute the classifier's precision on the given data. @@ -162,7 +150,7 @@ Compute the classifier's precision on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | | `positiveClass` | [`Any`][safeds.lang.Any] | The class to be considered positive. All other classes are considered negative. | - | **Results:** @@ -173,10 +161,10 @@ Compute the classifier's precision on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="65" + ```sds linenums="62" @Pure fun precision( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> precision: Float ``` @@ -195,15 +183,15 @@ Predict a target vector using a dataset containing feature vectors. The model ha | Name | Type | Description | |------|------|-------------| -| `prediction` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A dataset containing the given feature vectors and the predicted target vector. | +| `prediction` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | A dataset containing the given feature vectors and the predicted target vector. | ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="30" + ```sds linenums="36" @Pure fun predict( dataset: Table - ) -> prediction: TaggedTable + ) -> prediction: TabularDataset ``` ## `#!sds fun` recall {#safeds.ml.classical.classification.KNearestNeighborsClassifier.recall data-toc-label='recall'} @@ -214,7 +202,7 @@ Compute the classifier's recall on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | | `positiveClass` | [`Any`][safeds.lang.Any] | The class to be considered positive. All other classes are considered negative. | - | **Results:** @@ -225,10 +213,10 @@ Compute the classifier's recall on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="80" + ```sds linenums="77" @Pure fun recall( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> recall: Float ``` diff --git a/docs/api/safeds/ml/classical/classification/LogisticRegressionClassifier.md b/docs/api/safeds/ml/classical/classification/LogisticRegressionClassifier.md index 3c625e06c..d222a7744 100644 --- a/docs/api/safeds/ml/classical/classification/LogisticRegressionClassifier.md +++ b/docs/api/safeds/ml/classical/classification/LogisticRegressionClassifier.md @@ -8,8 +8,8 @@ Regularized logistic regression. ```sds hl_lines="4" pipeline example { - val training = Table.fromCsvFile("training.csv").tagColumns("target"); - val test = Table.fromCsvFile("test.csv").tagColumns("target"); + val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); val classifier = LogisticRegressionClassifier().fit(training); val accuracy = classifier.accuracy(test); } @@ -17,7 +17,7 @@ pipeline example { ??? quote "Stub code in `logistic_regression.sdsstub`" - ```sds linenums="17" + ```sds linenums="18" class LogisticRegressionClassifier() sub Classifier { /** * Create a copy of this classifier and fit it with the given training data. @@ -30,11 +30,17 @@ pipeline example { */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedClassifier: LogisticRegressionClassifier } ``` +## `#!sds attr` isFitted {#safeds.ml.classical.classification.LogisticRegressionClassifier.isFitted data-toc-label='isFitted'} + +Whether the classifier is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + ## `#!sds fun` accuracy {#safeds.ml.classical.classification.LogisticRegressionClassifier.accuracy data-toc-label='accuracy'} Compute the accuracy of the classifier on the given data. @@ -43,7 +49,7 @@ Compute the accuracy of the classifier on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -53,10 +59,10 @@ Compute the accuracy of the classifier on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="51" + ```sds linenums="48" @Pure fun accuracy( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> accuracy: Float ``` @@ -68,7 +74,7 @@ Compute the classifier's $F_1$-score on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | | `positiveClass` | [`Any`][safeds.lang.Any] | The class to be considered positive. All other classes are considered negative. | - | **Results:** @@ -79,11 +85,11 @@ Compute the classifier's $F_1$-score on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="95" + ```sds linenums="92" @Pure @PythonName("f1_score") fun f1Score( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> f1Score: Float ``` @@ -98,7 +104,7 @@ This classifier is not modified. | Name | Type | Description | Default | |------|------|-------------|---------| -| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | +| `trainingSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The training data containing the feature and target vectors. | - | **Results:** @@ -108,31 +114,13 @@ This classifier is not modified. ??? quote "Stub code in `logistic_regression.sdsstub`" - ```sds linenums="27" + ```sds linenums="28" @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedClassifier: LogisticRegressionClassifier ``` -## `#!sds fun` isFitted {#safeds.ml.classical.classification.LogisticRegressionClassifier.isFitted data-toc-label='isFitted'} - -Check if the classifier is fitted. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `isFitted` | [`Boolean`][safeds.lang.Boolean] | Whether the classifier is fitted. | - -??? quote "Stub code in `classifier.sdsstub`" - - ```sds linenums="40" - @Pure - @PythonName("is_fitted") - fun isFitted() -> isFitted: Boolean - ``` - ## `#!sds fun` precision {#safeds.ml.classical.classification.LogisticRegressionClassifier.precision data-toc-label='precision'} Compute the classifier's precision on the given data. @@ -141,7 +129,7 @@ Compute the classifier's precision on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | | `positiveClass` | [`Any`][safeds.lang.Any] | The class to be considered positive. All other classes are considered negative. | - | **Results:** @@ -152,10 +140,10 @@ Compute the classifier's precision on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="65" + ```sds linenums="62" @Pure fun precision( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> precision: Float ``` @@ -174,15 +162,15 @@ Predict a target vector using a dataset containing feature vectors. The model ha | Name | Type | Description | |------|------|-------------| -| `prediction` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A dataset containing the given feature vectors and the predicted target vector. | +| `prediction` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | A dataset containing the given feature vectors and the predicted target vector. | ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="30" + ```sds linenums="36" @Pure fun predict( dataset: Table - ) -> prediction: TaggedTable + ) -> prediction: TabularDataset ``` ## `#!sds fun` recall {#safeds.ml.classical.classification.LogisticRegressionClassifier.recall data-toc-label='recall'} @@ -193,7 +181,7 @@ Compute the classifier's recall on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | | `positiveClass` | [`Any`][safeds.lang.Any] | The class to be considered positive. All other classes are considered negative. | - | **Results:** @@ -204,10 +192,10 @@ Compute the classifier's recall on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="80" + ```sds linenums="77" @Pure fun recall( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> recall: Float ``` diff --git a/docs/api/safeds/ml/classical/classification/RandomForestClassifier.md b/docs/api/safeds/ml/classical/classification/RandomForestClassifier.md index e34282b69..9cb2e6113 100644 --- a/docs/api/safeds/ml/classical/classification/RandomForestClassifier.md +++ b/docs/api/safeds/ml/classical/classification/RandomForestClassifier.md @@ -14,8 +14,8 @@ Random forest classification. ```sds hl_lines="4" pipeline example { - val training = Table.fromCsvFile("training.csv").tagColumns("target"); - val test = Table.fromCsvFile("test.csv").tagColumns("target"); + val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); val classifier = RandomForestClassifier(numberOfTrees = 10).fit(training); val accuracy = classifier.accuracy(test); } @@ -23,7 +23,7 @@ pipeline example { ??? quote "Stub code in `random_forest.sdsstub`" - ```sds linenums="19" + ```sds linenums="20" class RandomForestClassifier( @PythonName("number_of_trees") const numberOfTrees: Int = 100 ) sub Classifier where { @@ -45,11 +45,17 @@ pipeline example { */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedClassifier: RandomForestClassifier } ``` +## `#!sds attr` isFitted {#safeds.ml.classical.classification.RandomForestClassifier.isFitted data-toc-label='isFitted'} + +Whether the classifier is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + ## `#!sds attr` numberOfTrees {#safeds.ml.classical.classification.RandomForestClassifier.numberOfTrees data-toc-label='numberOfTrees'} Get the number of trees used in the random forest. @@ -64,7 +70,7 @@ Compute the accuracy of the classifier on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -74,10 +80,10 @@ Compute the accuracy of the classifier on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="51" + ```sds linenums="48" @Pure fun accuracy( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> accuracy: Float ``` @@ -89,7 +95,7 @@ Compute the classifier's $F_1$-score on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | | `positiveClass` | [`Any`][safeds.lang.Any] | The class to be considered positive. All other classes are considered negative. | - | **Results:** @@ -100,11 +106,11 @@ Compute the classifier's $F_1$-score on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="95" + ```sds linenums="92" @Pure @PythonName("f1_score") fun f1Score( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> f1Score: Float ``` @@ -119,7 +125,7 @@ This classifier is not modified. | Name | Type | Description | Default | |------|------|-------------|---------| -| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | +| `trainingSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The training data containing the feature and target vectors. | - | **Results:** @@ -129,31 +135,13 @@ This classifier is not modified. ??? quote "Stub code in `random_forest.sdsstub`" - ```sds linenums="38" + ```sds linenums="39" @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedClassifier: RandomForestClassifier ``` -## `#!sds fun` isFitted {#safeds.ml.classical.classification.RandomForestClassifier.isFitted data-toc-label='isFitted'} - -Check if the classifier is fitted. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `isFitted` | [`Boolean`][safeds.lang.Boolean] | Whether the classifier is fitted. | - -??? quote "Stub code in `classifier.sdsstub`" - - ```sds linenums="40" - @Pure - @PythonName("is_fitted") - fun isFitted() -> isFitted: Boolean - ``` - ## `#!sds fun` precision {#safeds.ml.classical.classification.RandomForestClassifier.precision data-toc-label='precision'} Compute the classifier's precision on the given data. @@ -162,7 +150,7 @@ Compute the classifier's precision on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | | `positiveClass` | [`Any`][safeds.lang.Any] | The class to be considered positive. All other classes are considered negative. | - | **Results:** @@ -173,10 +161,10 @@ Compute the classifier's precision on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="65" + ```sds linenums="62" @Pure fun precision( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> precision: Float ``` @@ -195,15 +183,15 @@ Predict a target vector using a dataset containing feature vectors. The model ha | Name | Type | Description | |------|------|-------------| -| `prediction` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A dataset containing the given feature vectors and the predicted target vector. | +| `prediction` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | A dataset containing the given feature vectors and the predicted target vector. | ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="30" + ```sds linenums="36" @Pure fun predict( dataset: Table - ) -> prediction: TaggedTable + ) -> prediction: TabularDataset ``` ## `#!sds fun` recall {#safeds.ml.classical.classification.RandomForestClassifier.recall data-toc-label='recall'} @@ -214,7 +202,7 @@ Compute the classifier's recall on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | | `positiveClass` | [`Any`][safeds.lang.Any] | The class to be considered positive. All other classes are considered negative. | - | **Results:** @@ -225,10 +213,10 @@ Compute the classifier's recall on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="80" + ```sds linenums="77" @Pure fun recall( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> recall: Float ``` diff --git a/docs/api/safeds/ml/classical/classification/SupportVectorMachineClassifier.md b/docs/api/safeds/ml/classical/classification/SupportVectorMachineClassifier.md index 93bbc6541..1516afaeb 100644 --- a/docs/api/safeds/ml/classical/classification/SupportVectorMachineClassifier.md +++ b/docs/api/safeds/ml/classical/classification/SupportVectorMachineClassifier.md @@ -15,8 +15,8 @@ Support vector machine. ```sds hl_lines="4 5" pipeline example { - val training = Table.fromCsvFile("training.csv").tagColumns("target"); - val test = Table.fromCsvFile("test.csv").tagColumns("target"); + val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); val classifier = SupportVectorMachineClassifier( kernel = SupportVectorMachineClassifier.Kernel.Linear ).fit(training); @@ -26,7 +26,7 @@ pipeline example { ??? quote "Stub code in `support_vector_machine.sdsstub`" - ```sds linenums="22" + ```sds linenums="23" class SupportVectorMachineClassifier( const c: Float = 1.0, kernel: SupportVectorMachineClassifier.Kernel = SupportVectorMachineClassifier.Kernel.RadialBasisFunction @@ -80,7 +80,7 @@ pipeline example { */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedClassifier: SupportVectorMachineClassifier } ``` @@ -91,6 +91,12 @@ Get the regularization strength. **Type:** [`Float`][safeds.lang.Float] +## `#!sds attr` isFitted {#safeds.ml.classical.classification.SupportVectorMachineClassifier.isFitted data-toc-label='isFitted'} + +Whether the classifier is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + ## `#!sds attr` kernel {#safeds.ml.classical.classification.SupportVectorMachineClassifier.kernel data-toc-label='kernel'} Get the type of kernel used. @@ -105,7 +111,7 @@ Compute the accuracy of the classifier on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -115,10 +121,10 @@ Compute the accuracy of the classifier on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="51" + ```sds linenums="48" @Pure fun accuracy( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> accuracy: Float ``` @@ -130,7 +136,7 @@ Compute the classifier's $F_1$-score on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | | `positiveClass` | [`Any`][safeds.lang.Any] | The class to be considered positive. All other classes are considered negative. | - | **Results:** @@ -141,11 +147,11 @@ Compute the classifier's $F_1$-score on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="95" + ```sds linenums="92" @Pure @PythonName("f1_score") fun f1Score( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> f1Score: Float ``` @@ -160,7 +166,7 @@ This classifier is not modified. | Name | Type | Description | Default | |------|------|-------------|---------| -| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | +| `trainingSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The training data containing the feature and target vectors. | - | **Results:** @@ -170,31 +176,13 @@ This classifier is not modified. ??? quote "Stub code in `support_vector_machine.sdsstub`" - ```sds linenums="73" + ```sds linenums="74" @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedClassifier: SupportVectorMachineClassifier ``` -## `#!sds fun` isFitted {#safeds.ml.classical.classification.SupportVectorMachineClassifier.isFitted data-toc-label='isFitted'} - -Check if the classifier is fitted. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `isFitted` | [`Boolean`][safeds.lang.Boolean] | Whether the classifier is fitted. | - -??? quote "Stub code in `classifier.sdsstub`" - - ```sds linenums="40" - @Pure - @PythonName("is_fitted") - fun isFitted() -> isFitted: Boolean - ``` - ## `#!sds fun` precision {#safeds.ml.classical.classification.SupportVectorMachineClassifier.precision data-toc-label='precision'} Compute the classifier's precision on the given data. @@ -203,7 +191,7 @@ Compute the classifier's precision on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | | `positiveClass` | [`Any`][safeds.lang.Any] | The class to be considered positive. All other classes are considered negative. | - | **Results:** @@ -214,10 +202,10 @@ Compute the classifier's precision on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="65" + ```sds linenums="62" @Pure fun precision( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> precision: Float ``` @@ -236,15 +224,15 @@ Predict a target vector using a dataset containing feature vectors. The model ha | Name | Type | Description | |------|------|-------------| -| `prediction` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A dataset containing the given feature vectors and the predicted target vector. | +| `prediction` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | A dataset containing the given feature vectors and the predicted target vector. | ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="30" + ```sds linenums="36" @Pure fun predict( dataset: Table - ) -> prediction: TaggedTable + ) -> prediction: TabularDataset ``` ## `#!sds fun` recall {#safeds.ml.classical.classification.SupportVectorMachineClassifier.recall data-toc-label='recall'} @@ -255,7 +243,7 @@ Compute the classifier's recall on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | | `positiveClass` | [`Any`][safeds.lang.Any] | The class to be considered positive. All other classes are considered negative. | - | **Results:** @@ -266,10 +254,10 @@ Compute the classifier's recall on the given data. ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="80" + ```sds linenums="77" @Pure fun recall( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset, @PythonName("positive_class") positiveClass: Any ) -> recall: Float ``` @@ -280,7 +268,7 @@ The kernel functions that can be used in the support vector machine. ??? quote "Stub code in `support_vector_machine.sdsstub`" - ```sds linenums="31" + ```sds linenums="32" enum Kernel { /** * A linear kernel. diff --git a/docs/api/safeds/ml/classical/regression/AdaBoostRegressor.md b/docs/api/safeds/ml/classical/regression/AdaBoostRegressor.md index c4253d19b..289c64b34 100644 --- a/docs/api/safeds/ml/classical/regression/AdaBoostRegressor.md +++ b/docs/api/safeds/ml/classical/regression/AdaBoostRegressor.md @@ -16,8 +16,8 @@ Ada Boost regression. ```sds hl_lines="4" pipeline example { - val training = Table.fromCsvFile("training.csv").tagColumns("target"); - val test = Table.fromCsvFile("test.csv").tagColumns("target"); + val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); val regressor = AdaBoostRegressor(maximumNumberOfLearners = 100).fit(training); val meanSquaredError = regressor.meanSquaredError(test); } @@ -25,7 +25,7 @@ pipeline example { ??? quote "Stub code in `ada_boost.sdsstub`" - ```sds linenums="23" + ```sds linenums="24" class AdaBoostRegressor( learner: Regressor = DecisionTreeRegressor(), @PythonName("maximum_number_of_learners") const maximumNumberOfLearners: Int = 50, @@ -58,11 +58,17 @@ pipeline example { */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: AdaBoostRegressor } ``` +## `#!sds attr` isFitted {#safeds.ml.classical.regression.AdaBoostRegressor.isFitted data-toc-label='isFitted'} + +Whether the regressor is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + ## `#!sds attr` learner {#safeds.ml.classical.regression.AdaBoostRegressor.learner data-toc-label='learner'} Get the base learner used for training the ensemble. @@ -91,7 +97,7 @@ This regressor is not modified. | Name | Type | Description | Default | |------|------|-------------|---------| -| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | +| `trainingSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The training data containing the feature and target vectors. | - | **Results:** @@ -101,31 +107,13 @@ This regressor is not modified. ??? quote "Stub code in `ada_boost.sdsstub`" - ```sds linenums="53" + ```sds linenums="54" @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: AdaBoostRegressor ``` -## `#!sds fun` isFitted {#safeds.ml.classical.regression.AdaBoostRegressor.isFitted data-toc-label='isFitted'} - -Check if the classifier is fitted. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `isFitted` | [`Boolean`][safeds.lang.Boolean] | Whether the regressor is fitted. | - -??? quote "Stub code in `regressor.sdsstub`" - - ```sds linenums="40" - @Pure - @PythonName("is_fitted") - fun isFitted() -> isFitted: Boolean - ``` - ## `#!sds fun` meanAbsoluteError {#safeds.ml.classical.regression.AdaBoostRegressor.meanAbsoluteError data-toc-label='meanAbsoluteError'} Compute the mean absolute error (MAE) of the regressor on the given data. @@ -134,7 +122,7 @@ Compute the mean absolute error (MAE) of the regressor on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -144,11 +132,11 @@ Compute the mean absolute error (MAE) of the regressor on the given data. ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="64" + ```sds linenums="61" @Pure @PythonName("mean_absolute_error") fun meanAbsoluteError( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> meanAbsoluteError: Float ``` @@ -160,7 +148,7 @@ Compute the mean squared error (MSE) on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -170,11 +158,11 @@ Compute the mean squared error (MSE) on the given data. ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="51" + ```sds linenums="48" @Pure @PythonName("mean_squared_error") fun meanSquaredError( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> meanSquaredError: Float ``` @@ -192,13 +180,13 @@ Predict a target vector using a dataset containing feature vectors. The model ha | Name | Type | Description | |------|------|-------------| -| `prediction` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A dataset containing the given feature vectors and the predicted target vector. | +| `prediction` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | A dataset containing the given feature vectors and the predicted target vector. | ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="30" + ```sds linenums="36" @Pure fun predict( dataset: Table - ) -> prediction: TaggedTable + ) -> prediction: TabularDataset ``` diff --git a/docs/api/safeds/ml/classical/regression/ArimaRegressor.md b/docs/api/safeds/ml/classical/regression/ArimaRegressor.md index 37cedccc6..2a324ba1d 100644 --- a/docs/api/safeds/ml/classical/regression/ArimaRegressor.md +++ b/docs/api/safeds/ml/classical/regression/ArimaRegressor.md @@ -14,6 +14,11 @@ pipeline example { ```sds linenums="13" class ArimaRegressor() { + /** + * Whether the regressor is fitted. + */ + @PythonName("is_fitted") attr isFitted: Boolean + /** * Create a copy of this ARIMA Model and fit it with the given training data. * @@ -52,18 +57,15 @@ pipeline example { fun plotPredictions( @PythonName("test_series") testSeries: TimeSeries ) -> image: Image - - /** - * Check if the classifier is fitted. - * - * @result isFitted Whether the regressor is fitted. - */ - @Pure - @PythonName("is_fitted") - fun isFitted() -> isFitted: Boolean } ``` +## `#!sds attr` isFitted {#safeds.ml.classical.regression.ArimaRegressor.isFitted data-toc-label='isFitted'} + +Whether the regressor is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + ## `#!sds fun` fit {#safeds.ml.classical.regression.ArimaRegressor.fit data-toc-label='fit'} Create a copy of this ARIMA Model and fit it with the given training data. @@ -84,31 +86,13 @@ This ARIMA Model is not modified. ??? quote "Stub code in `arima.sdsstub`" - ```sds linenums="23" + ```sds linenums="28" @Pure fun fit( @PythonName("time_series") timeSeries: TimeSeries ) -> fittedArima: ArimaRegressor ``` -## `#!sds fun` isFitted {#safeds.ml.classical.regression.ArimaRegressor.isFitted data-toc-label='isFitted'} - -Check if the classifier is fitted. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `isFitted` | [`Boolean`][safeds.lang.Boolean] | Whether the regressor is fitted. | - -??? quote "Stub code in `arima.sdsstub`" - - ```sds linenums="58" - @Pure - @PythonName("is_fitted") - fun isFitted() -> isFitted: Boolean - ``` - ## `#!sds fun` plotPredictions {#safeds.ml.classical.regression.ArimaRegressor.plotPredictions data-toc-label='plotPredictions'} Plot the predictions of the trained model to the given target of the time series. So you can see the predictions and the actual values in one plot. @@ -127,7 +111,7 @@ Plot the predictions of the trained model to the given target of the time series ??? quote "Stub code in `arima.sdsstub`" - ```sds linenums="47" + ```sds linenums="52" @Pure @PythonName("plot_predictions") fun plotPredictions( @@ -153,7 +137,7 @@ Predict a target vector using a time series target column. The model has to be t ??? quote "Stub code in `arima.sdsstub`" - ```sds linenums="35" + ```sds linenums="40" @Pure fun predict( @PythonName("time_series") timeSeries: TimeSeries diff --git a/docs/api/safeds/ml/classical/regression/DecisionTreeRegressor.md b/docs/api/safeds/ml/classical/regression/DecisionTreeRegressor.md index 6721f93a9..4b748a467 100644 --- a/docs/api/safeds/ml/classical/regression/DecisionTreeRegressor.md +++ b/docs/api/safeds/ml/classical/regression/DecisionTreeRegressor.md @@ -8,8 +8,8 @@ Decision tree regression. ```sds hl_lines="4" pipeline example { - val training = Table.fromCsvFile("training.csv").tagColumns("target"); - val test = Table.fromCsvFile("test.csv").tagColumns("target"); + val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); val regressor = DecisionTreeRegressor().fit(training); val meanSquaredError = regressor.meanSquaredError(test); } @@ -17,7 +17,7 @@ pipeline example { ??? quote "Stub code in `decision_tree.sdsstub`" - ```sds linenums="17" + ```sds linenums="18" class DecisionTreeRegressor() sub Regressor { /** * Create a copy of this regressor and fit it with the given training data. @@ -30,11 +30,17 @@ pipeline example { */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: DecisionTreeRegressor } ``` +## `#!sds attr` isFitted {#safeds.ml.classical.regression.DecisionTreeRegressor.isFitted data-toc-label='isFitted'} + +Whether the regressor is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + ## `#!sds fun` fit {#safeds.ml.classical.regression.DecisionTreeRegressor.fit data-toc-label='fit'} Create a copy of this regressor and fit it with the given training data. @@ -45,7 +51,7 @@ This regressor is not modified. | Name | Type | Description | Default | |------|------|-------------|---------| -| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | +| `trainingSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The training data containing the feature and target vectors. | - | **Results:** @@ -55,31 +61,13 @@ This regressor is not modified. ??? quote "Stub code in `decision_tree.sdsstub`" - ```sds linenums="27" + ```sds linenums="28" @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: DecisionTreeRegressor ``` -## `#!sds fun` isFitted {#safeds.ml.classical.regression.DecisionTreeRegressor.isFitted data-toc-label='isFitted'} - -Check if the classifier is fitted. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `isFitted` | [`Boolean`][safeds.lang.Boolean] | Whether the regressor is fitted. | - -??? quote "Stub code in `regressor.sdsstub`" - - ```sds linenums="40" - @Pure - @PythonName("is_fitted") - fun isFitted() -> isFitted: Boolean - ``` - ## `#!sds fun` meanAbsoluteError {#safeds.ml.classical.regression.DecisionTreeRegressor.meanAbsoluteError data-toc-label='meanAbsoluteError'} Compute the mean absolute error (MAE) of the regressor on the given data. @@ -88,7 +76,7 @@ Compute the mean absolute error (MAE) of the regressor on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -98,11 +86,11 @@ Compute the mean absolute error (MAE) of the regressor on the given data. ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="64" + ```sds linenums="61" @Pure @PythonName("mean_absolute_error") fun meanAbsoluteError( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> meanAbsoluteError: Float ``` @@ -114,7 +102,7 @@ Compute the mean squared error (MSE) on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -124,11 +112,11 @@ Compute the mean squared error (MSE) on the given data. ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="51" + ```sds linenums="48" @Pure @PythonName("mean_squared_error") fun meanSquaredError( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> meanSquaredError: Float ``` @@ -146,13 +134,13 @@ Predict a target vector using a dataset containing feature vectors. The model ha | Name | Type | Description | |------|------|-------------| -| `prediction` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A dataset containing the given feature vectors and the predicted target vector. | +| `prediction` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | A dataset containing the given feature vectors and the predicted target vector. | ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="30" + ```sds linenums="36" @Pure fun predict( dataset: Table - ) -> prediction: TaggedTable + ) -> prediction: TabularDataset ``` diff --git a/docs/api/safeds/ml/classical/regression/ElasticNetRegressor.md b/docs/api/safeds/ml/classical/regression/ElasticNetRegressor.md index a12814377..d7226d781 100644 --- a/docs/api/safeds/ml/classical/regression/ElasticNetRegressor.md +++ b/docs/api/safeds/ml/classical/regression/ElasticNetRegressor.md @@ -15,8 +15,8 @@ Elastic net regression. ```sds hl_lines="4" pipeline example { - val training = Table.fromCsvFile("training.csv").tagColumns("target"); - val test = Table.fromCsvFile("test.csv").tagColumns("target"); + val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); val regressor = ElasticNetRegressor(lassoRatio = 0.8).fit(training); val meanSquaredError = regressor.meanSquaredError(test); } @@ -24,7 +24,7 @@ pipeline example { ??? quote "Stub code in `elastic_net.sdsstub`" - ```sds linenums="21" + ```sds linenums="22" class ElasticNetRegressor( const alpha: Float = 1.0, @PythonName("lasso_ratio") const lassoRatio: Float = 0.5 @@ -53,7 +53,7 @@ pipeline example { */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: ElasticNetRegressor } ``` @@ -64,6 +64,12 @@ Get the regularization of the model. **Type:** [`Float`][safeds.lang.Float] +## `#!sds attr` isFitted {#safeds.ml.classical.regression.ElasticNetRegressor.isFitted data-toc-label='isFitted'} + +Whether the regressor is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + ## `#!sds attr` lassoRatio {#safeds.ml.classical.regression.ElasticNetRegressor.lassoRatio data-toc-label='lassoRatio'} Get the ratio between Lasso and Ridge regularization. @@ -80,7 +86,7 @@ This regressor is not modified. | Name | Type | Description | Default | |------|------|-------------|---------| -| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | +| `trainingSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The training data containing the feature and target vectors. | - | **Results:** @@ -90,31 +96,13 @@ This regressor is not modified. ??? quote "Stub code in `elastic_net.sdsstub`" - ```sds linenums="47" + ```sds linenums="48" @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: ElasticNetRegressor ``` -## `#!sds fun` isFitted {#safeds.ml.classical.regression.ElasticNetRegressor.isFitted data-toc-label='isFitted'} - -Check if the classifier is fitted. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `isFitted` | [`Boolean`][safeds.lang.Boolean] | Whether the regressor is fitted. | - -??? quote "Stub code in `regressor.sdsstub`" - - ```sds linenums="40" - @Pure - @PythonName("is_fitted") - fun isFitted() -> isFitted: Boolean - ``` - ## `#!sds fun` meanAbsoluteError {#safeds.ml.classical.regression.ElasticNetRegressor.meanAbsoluteError data-toc-label='meanAbsoluteError'} Compute the mean absolute error (MAE) of the regressor on the given data. @@ -123,7 +111,7 @@ Compute the mean absolute error (MAE) of the regressor on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -133,11 +121,11 @@ Compute the mean absolute error (MAE) of the regressor on the given data. ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="64" + ```sds linenums="61" @Pure @PythonName("mean_absolute_error") fun meanAbsoluteError( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> meanAbsoluteError: Float ``` @@ -149,7 +137,7 @@ Compute the mean squared error (MSE) on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -159,11 +147,11 @@ Compute the mean squared error (MSE) on the given data. ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="51" + ```sds linenums="48" @Pure @PythonName("mean_squared_error") fun meanSquaredError( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> meanSquaredError: Float ``` @@ -181,13 +169,13 @@ Predict a target vector using a dataset containing feature vectors. The model ha | Name | Type | Description | |------|------|-------------| -| `prediction` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A dataset containing the given feature vectors and the predicted target vector. | +| `prediction` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | A dataset containing the given feature vectors and the predicted target vector. | ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="30" + ```sds linenums="36" @Pure fun predict( dataset: Table - ) -> prediction: TaggedTable + ) -> prediction: TabularDataset ``` diff --git a/docs/api/safeds/ml/classical/regression/GradientBoostingRegressor.md b/docs/api/safeds/ml/classical/regression/GradientBoostingRegressor.md index 4781c3ee3..d0f4bb26b 100644 --- a/docs/api/safeds/ml/classical/regression/GradientBoostingRegressor.md +++ b/docs/api/safeds/ml/classical/regression/GradientBoostingRegressor.md @@ -15,8 +15,8 @@ Gradient boosting regression. ```sds hl_lines="4" pipeline example { - val training = Table.fromCsvFile("training.csv").tagColumns("target"); - val test = Table.fromCsvFile("test.csv").tagColumns("target"); + val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); val regressor = GradientBoostingRegressor(numberOfTrees = 50).fit(training); val meanSquaredError = regressor.meanSquaredError(test); } @@ -24,7 +24,7 @@ pipeline example { ??? quote "Stub code in `gradient_boosting.sdsstub`" - ```sds linenums="22" + ```sds linenums="23" class GradientBoostingRegressor( @PythonName("number_of_trees") const numberOfTrees: Int = 100, @PythonName("learning_rate") const learningRate: Float = 0.1 @@ -52,11 +52,17 @@ pipeline example { */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: GradientBoostingRegressor } ``` +## `#!sds attr` isFitted {#safeds.ml.classical.regression.GradientBoostingRegressor.isFitted data-toc-label='isFitted'} + +Whether the regressor is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + ## `#!sds attr` learningRate {#safeds.ml.classical.regression.GradientBoostingRegressor.learningRate data-toc-label='learningRate'} Get the learning rate. @@ -79,7 +85,7 @@ This regressor is not modified. | Name | Type | Description | Default | |------|------|-------------|---------| -| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | +| `trainingSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The training data containing the feature and target vectors. | - | **Results:** @@ -89,31 +95,13 @@ This regressor is not modified. ??? quote "Stub code in `gradient_boosting.sdsstub`" - ```sds linenums="47" + ```sds linenums="48" @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: GradientBoostingRegressor ``` -## `#!sds fun` isFitted {#safeds.ml.classical.regression.GradientBoostingRegressor.isFitted data-toc-label='isFitted'} - -Check if the classifier is fitted. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `isFitted` | [`Boolean`][safeds.lang.Boolean] | Whether the regressor is fitted. | - -??? quote "Stub code in `regressor.sdsstub`" - - ```sds linenums="40" - @Pure - @PythonName("is_fitted") - fun isFitted() -> isFitted: Boolean - ``` - ## `#!sds fun` meanAbsoluteError {#safeds.ml.classical.regression.GradientBoostingRegressor.meanAbsoluteError data-toc-label='meanAbsoluteError'} Compute the mean absolute error (MAE) of the regressor on the given data. @@ -122,7 +110,7 @@ Compute the mean absolute error (MAE) of the regressor on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -132,11 +120,11 @@ Compute the mean absolute error (MAE) of the regressor on the given data. ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="64" + ```sds linenums="61" @Pure @PythonName("mean_absolute_error") fun meanAbsoluteError( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> meanAbsoluteError: Float ``` @@ -148,7 +136,7 @@ Compute the mean squared error (MSE) on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -158,11 +146,11 @@ Compute the mean squared error (MSE) on the given data. ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="51" + ```sds linenums="48" @Pure @PythonName("mean_squared_error") fun meanSquaredError( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> meanSquaredError: Float ``` @@ -180,13 +168,13 @@ Predict a target vector using a dataset containing feature vectors. The model ha | Name | Type | Description | |------|------|-------------| -| `prediction` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A dataset containing the given feature vectors and the predicted target vector. | +| `prediction` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | A dataset containing the given feature vectors and the predicted target vector. | ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="30" + ```sds linenums="36" @Pure fun predict( dataset: Table - ) -> prediction: TaggedTable + ) -> prediction: TabularDataset ``` diff --git a/docs/api/safeds/ml/classical/regression/KNearestNeighborsRegressor.md b/docs/api/safeds/ml/classical/regression/KNearestNeighborsRegressor.md index a0f23f4af..817ab1f51 100644 --- a/docs/api/safeds/ml/classical/regression/KNearestNeighborsRegressor.md +++ b/docs/api/safeds/ml/classical/regression/KNearestNeighborsRegressor.md @@ -14,8 +14,8 @@ K-nearest-neighbors regression. ```sds hl_lines="4" pipeline example { - val training = Table.fromCsvFile("training.csv").tagColumns("target"); - val test = Table.fromCsvFile("test.csv").tagColumns("target"); + val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); val regressor = KNearestNeighborsRegressor(numberOfNeighbors = 5).fit(training); val meanSquaredError = regressor.meanSquaredError(test); } @@ -23,7 +23,7 @@ pipeline example { ??? quote "Stub code in `k_nearest_neighbors.sdsstub`" - ```sds linenums="20" + ```sds linenums="21" class KNearestNeighborsRegressor( @PythonName("number_of_neighbors") const numberOfNeighbors: Int ) sub Regressor where { @@ -45,11 +45,17 @@ pipeline example { */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: KNearestNeighborsRegressor } ``` +## `#!sds attr` isFitted {#safeds.ml.classical.regression.KNearestNeighborsRegressor.isFitted data-toc-label='isFitted'} + +Whether the regressor is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + ## `#!sds attr` numberOfNeighbors {#safeds.ml.classical.regression.KNearestNeighborsRegressor.numberOfNeighbors data-toc-label='numberOfNeighbors'} Get the number of neighbors used for interpolation. @@ -66,7 +72,7 @@ This regressor is not modified. | Name | Type | Description | Default | |------|------|-------------|---------| -| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | +| `trainingSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The training data containing the feature and target vectors. | - | **Results:** @@ -76,31 +82,13 @@ This regressor is not modified. ??? quote "Stub code in `k_nearest_neighbors.sdsstub`" - ```sds linenums="39" + ```sds linenums="40" @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: KNearestNeighborsRegressor ``` -## `#!sds fun` isFitted {#safeds.ml.classical.regression.KNearestNeighborsRegressor.isFitted data-toc-label='isFitted'} - -Check if the classifier is fitted. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `isFitted` | [`Boolean`][safeds.lang.Boolean] | Whether the regressor is fitted. | - -??? quote "Stub code in `regressor.sdsstub`" - - ```sds linenums="40" - @Pure - @PythonName("is_fitted") - fun isFitted() -> isFitted: Boolean - ``` - ## `#!sds fun` meanAbsoluteError {#safeds.ml.classical.regression.KNearestNeighborsRegressor.meanAbsoluteError data-toc-label='meanAbsoluteError'} Compute the mean absolute error (MAE) of the regressor on the given data. @@ -109,7 +97,7 @@ Compute the mean absolute error (MAE) of the regressor on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -119,11 +107,11 @@ Compute the mean absolute error (MAE) of the regressor on the given data. ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="64" + ```sds linenums="61" @Pure @PythonName("mean_absolute_error") fun meanAbsoluteError( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> meanAbsoluteError: Float ``` @@ -135,7 +123,7 @@ Compute the mean squared error (MSE) on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -145,11 +133,11 @@ Compute the mean squared error (MSE) on the given data. ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="51" + ```sds linenums="48" @Pure @PythonName("mean_squared_error") fun meanSquaredError( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> meanSquaredError: Float ``` @@ -167,13 +155,13 @@ Predict a target vector using a dataset containing feature vectors. The model ha | Name | Type | Description | |------|------|-------------| -| `prediction` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A dataset containing the given feature vectors and the predicted target vector. | +| `prediction` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | A dataset containing the given feature vectors and the predicted target vector. | ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="30" + ```sds linenums="36" @Pure fun predict( dataset: Table - ) -> prediction: TaggedTable + ) -> prediction: TabularDataset ``` diff --git a/docs/api/safeds/ml/classical/regression/LassoRegressor.md b/docs/api/safeds/ml/classical/regression/LassoRegressor.md index 693ea462f..9a987a311 100644 --- a/docs/api/safeds/ml/classical/regression/LassoRegressor.md +++ b/docs/api/safeds/ml/classical/regression/LassoRegressor.md @@ -14,8 +14,8 @@ Lasso regression. ```sds hl_lines="4" pipeline example { - val training = Table.fromCsvFile("training.csv").tagColumns("target"); - val test = Table.fromCsvFile("test.csv").tagColumns("target"); + val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); val regressor = LassoRegressor(alpha = 2.0).fit(training); val meanSquaredError = regressor.meanSquaredError(test); } @@ -23,7 +23,7 @@ pipeline example { ??? quote "Stub code in `lasso.sdsstub`" - ```sds linenums="19" + ```sds linenums="20" class LassoRegressor( const alpha: Float = 1.0 ) sub Regressor where { @@ -45,7 +45,7 @@ pipeline example { */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: LassoRegressor } ``` @@ -56,6 +56,12 @@ Get the regularization of the model. **Type:** [`Float`][safeds.lang.Float] +## `#!sds attr` isFitted {#safeds.ml.classical.regression.LassoRegressor.isFitted data-toc-label='isFitted'} + +Whether the regressor is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + ## `#!sds fun` fit {#safeds.ml.classical.regression.LassoRegressor.fit data-toc-label='fit'} Create a copy of this regressor and fit it with the given training data. @@ -66,7 +72,7 @@ This regressor is not modified. | Name | Type | Description | Default | |------|------|-------------|---------| -| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | +| `trainingSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The training data containing the feature and target vectors. | - | **Results:** @@ -76,31 +82,13 @@ This regressor is not modified. ??? quote "Stub code in `lasso.sdsstub`" - ```sds linenums="38" + ```sds linenums="39" @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: LassoRegressor ``` -## `#!sds fun` isFitted {#safeds.ml.classical.regression.LassoRegressor.isFitted data-toc-label='isFitted'} - -Check if the classifier is fitted. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `isFitted` | [`Boolean`][safeds.lang.Boolean] | Whether the regressor is fitted. | - -??? quote "Stub code in `regressor.sdsstub`" - - ```sds linenums="40" - @Pure - @PythonName("is_fitted") - fun isFitted() -> isFitted: Boolean - ``` - ## `#!sds fun` meanAbsoluteError {#safeds.ml.classical.regression.LassoRegressor.meanAbsoluteError data-toc-label='meanAbsoluteError'} Compute the mean absolute error (MAE) of the regressor on the given data. @@ -109,7 +97,7 @@ Compute the mean absolute error (MAE) of the regressor on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -119,11 +107,11 @@ Compute the mean absolute error (MAE) of the regressor on the given data. ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="64" + ```sds linenums="61" @Pure @PythonName("mean_absolute_error") fun meanAbsoluteError( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> meanAbsoluteError: Float ``` @@ -135,7 +123,7 @@ Compute the mean squared error (MSE) on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -145,11 +133,11 @@ Compute the mean squared error (MSE) on the given data. ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="51" + ```sds linenums="48" @Pure @PythonName("mean_squared_error") fun meanSquaredError( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> meanSquaredError: Float ``` @@ -167,13 +155,13 @@ Predict a target vector using a dataset containing feature vectors. The model ha | Name | Type | Description | |------|------|-------------| -| `prediction` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A dataset containing the given feature vectors and the predicted target vector. | +| `prediction` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | A dataset containing the given feature vectors and the predicted target vector. | ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="30" + ```sds linenums="36" @Pure fun predict( dataset: Table - ) -> prediction: TaggedTable + ) -> prediction: TabularDataset ``` diff --git a/docs/api/safeds/ml/classical/regression/LinearRegressionRegressor.md b/docs/api/safeds/ml/classical/regression/LinearRegressionRegressor.md index 9675be443..56a65249c 100644 --- a/docs/api/safeds/ml/classical/regression/LinearRegressionRegressor.md +++ b/docs/api/safeds/ml/classical/regression/LinearRegressionRegressor.md @@ -8,8 +8,8 @@ Linear regression. ```sds hl_lines="4" pipeline example { - val training = Table.fromCsvFile("training.csv").tagColumns("target"); - val test = Table.fromCsvFile("test.csv").tagColumns("target"); + val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); val regressor = LinearRegressionRegressor().fit(training); val meanSquaredError = regressor.meanSquaredError(test); } @@ -17,7 +17,7 @@ pipeline example { ??? quote "Stub code in `linear_regression.sdsstub`" - ```sds linenums="17" + ```sds linenums="18" class LinearRegressionRegressor() sub Regressor { /** * Create a copy of this regressor and fit it with the given training data. @@ -30,11 +30,17 @@ pipeline example { */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: LinearRegressionRegressor } ``` +## `#!sds attr` isFitted {#safeds.ml.classical.regression.LinearRegressionRegressor.isFitted data-toc-label='isFitted'} + +Whether the regressor is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + ## `#!sds fun` fit {#safeds.ml.classical.regression.LinearRegressionRegressor.fit data-toc-label='fit'} Create a copy of this regressor and fit it with the given training data. @@ -45,7 +51,7 @@ This regressor is not modified. | Name | Type | Description | Default | |------|------|-------------|---------| -| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | +| `trainingSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The training data containing the feature and target vectors. | - | **Results:** @@ -55,31 +61,13 @@ This regressor is not modified. ??? quote "Stub code in `linear_regression.sdsstub`" - ```sds linenums="27" + ```sds linenums="28" @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: LinearRegressionRegressor ``` -## `#!sds fun` isFitted {#safeds.ml.classical.regression.LinearRegressionRegressor.isFitted data-toc-label='isFitted'} - -Check if the classifier is fitted. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `isFitted` | [`Boolean`][safeds.lang.Boolean] | Whether the regressor is fitted. | - -??? quote "Stub code in `regressor.sdsstub`" - - ```sds linenums="40" - @Pure - @PythonName("is_fitted") - fun isFitted() -> isFitted: Boolean - ``` - ## `#!sds fun` meanAbsoluteError {#safeds.ml.classical.regression.LinearRegressionRegressor.meanAbsoluteError data-toc-label='meanAbsoluteError'} Compute the mean absolute error (MAE) of the regressor on the given data. @@ -88,7 +76,7 @@ Compute the mean absolute error (MAE) of the regressor on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -98,11 +86,11 @@ Compute the mean absolute error (MAE) of the regressor on the given data. ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="64" + ```sds linenums="61" @Pure @PythonName("mean_absolute_error") fun meanAbsoluteError( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> meanAbsoluteError: Float ``` @@ -114,7 +102,7 @@ Compute the mean squared error (MSE) on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -124,11 +112,11 @@ Compute the mean squared error (MSE) on the given data. ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="51" + ```sds linenums="48" @Pure @PythonName("mean_squared_error") fun meanSquaredError( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> meanSquaredError: Float ``` @@ -146,13 +134,13 @@ Predict a target vector using a dataset containing feature vectors. The model ha | Name | Type | Description | |------|------|-------------| -| `prediction` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A dataset containing the given feature vectors and the predicted target vector. | +| `prediction` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | A dataset containing the given feature vectors and the predicted target vector. | ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="30" + ```sds linenums="36" @Pure fun predict( dataset: Table - ) -> prediction: TaggedTable + ) -> prediction: TabularDataset ``` diff --git a/docs/api/safeds/ml/classical/regression/RandomForestRegressor.md b/docs/api/safeds/ml/classical/regression/RandomForestRegressor.md index 6ae6b7bb5..22610e1ed 100644 --- a/docs/api/safeds/ml/classical/regression/RandomForestRegressor.md +++ b/docs/api/safeds/ml/classical/regression/RandomForestRegressor.md @@ -14,8 +14,8 @@ Random forest regression. ```sds hl_lines="4" pipeline example { - val training = Table.fromCsvFile("training.csv").tagColumns("target"); - val test = Table.fromCsvFile("test.csv").tagColumns("target"); + val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); val regressor = RandomForestRegressor(numberOfTrees = 10).fit(training); val meanSquaredError = regressor.meanSquaredError(test); } @@ -23,7 +23,7 @@ pipeline example { ??? quote "Stub code in `random_forest.sdsstub`" - ```sds linenums="19" + ```sds linenums="20" class RandomForestRegressor( @PythonName("number_of_trees") const numberOfTrees: Int = 100 ) sub Regressor where { @@ -45,11 +45,17 @@ pipeline example { */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: RandomForestRegressor } ``` +## `#!sds attr` isFitted {#safeds.ml.classical.regression.RandomForestRegressor.isFitted data-toc-label='isFitted'} + +Whether the regressor is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + ## `#!sds attr` numberOfTrees {#safeds.ml.classical.regression.RandomForestRegressor.numberOfTrees data-toc-label='numberOfTrees'} Get the number of trees used in the random forest. @@ -66,7 +72,7 @@ This regressor is not modified. | Name | Type | Description | Default | |------|------|-------------|---------| -| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | +| `trainingSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The training data containing the feature and target vectors. | - | **Results:** @@ -76,31 +82,13 @@ This regressor is not modified. ??? quote "Stub code in `random_forest.sdsstub`" - ```sds linenums="38" + ```sds linenums="39" @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: RandomForestRegressor ``` -## `#!sds fun` isFitted {#safeds.ml.classical.regression.RandomForestRegressor.isFitted data-toc-label='isFitted'} - -Check if the classifier is fitted. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `isFitted` | [`Boolean`][safeds.lang.Boolean] | Whether the regressor is fitted. | - -??? quote "Stub code in `regressor.sdsstub`" - - ```sds linenums="40" - @Pure - @PythonName("is_fitted") - fun isFitted() -> isFitted: Boolean - ``` - ## `#!sds fun` meanAbsoluteError {#safeds.ml.classical.regression.RandomForestRegressor.meanAbsoluteError data-toc-label='meanAbsoluteError'} Compute the mean absolute error (MAE) of the regressor on the given data. @@ -109,7 +97,7 @@ Compute the mean absolute error (MAE) of the regressor on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -119,11 +107,11 @@ Compute the mean absolute error (MAE) of the regressor on the given data. ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="64" + ```sds linenums="61" @Pure @PythonName("mean_absolute_error") fun meanAbsoluteError( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> meanAbsoluteError: Float ``` @@ -135,7 +123,7 @@ Compute the mean squared error (MSE) on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -145,11 +133,11 @@ Compute the mean squared error (MSE) on the given data. ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="51" + ```sds linenums="48" @Pure @PythonName("mean_squared_error") fun meanSquaredError( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> meanSquaredError: Float ``` @@ -167,13 +155,13 @@ Predict a target vector using a dataset containing feature vectors. The model ha | Name | Type | Description | |------|------|-------------| -| `prediction` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A dataset containing the given feature vectors and the predicted target vector. | +| `prediction` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | A dataset containing the given feature vectors and the predicted target vector. | ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="30" + ```sds linenums="36" @Pure fun predict( dataset: Table - ) -> prediction: TaggedTable + ) -> prediction: TabularDataset ``` diff --git a/docs/api/safeds/ml/classical/regression/Regressor.md b/docs/api/safeds/ml/classical/regression/Regressor.md index 8bbbf5e8d..57ed29c0e 100644 --- a/docs/api/safeds/ml/classical/regression/Regressor.md +++ b/docs/api/safeds/ml/classical/regression/Regressor.md @@ -22,8 +22,13 @@ Abstract base class for all regressors. ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="8" + ```sds linenums="9" class Regressor { + /** + * Whether the regressor is fitted. + */ + @PythonName("is_fitted") attr isFitted: Boolean + /** * Create a copy of this regressor and fit it with the given training data. * @@ -35,7 +40,7 @@ Abstract base class for all regressors. */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: Regressor /** @@ -48,16 +53,7 @@ Abstract base class for all regressors. @Pure fun predict( dataset: Table - ) -> prediction: TaggedTable - - /** - * Check if the classifier is fitted. - * - * @result isFitted Whether the regressor is fitted. - */ - @Pure - @PythonName("is_fitted") - fun isFitted() -> isFitted: Boolean + ) -> prediction: TabularDataset /** * Compute the mean squared error (MSE) on the given data. @@ -69,7 +65,7 @@ Abstract base class for all regressors. @Pure @PythonName("mean_squared_error") fun meanSquaredError( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> meanSquaredError: Float /** @@ -82,11 +78,17 @@ Abstract base class for all regressors. @Pure @PythonName("mean_absolute_error") fun meanAbsoluteError( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> meanAbsoluteError: Float } ``` +## `#!sds attr` isFitted {#safeds.ml.classical.regression.Regressor.isFitted data-toc-label='isFitted'} + +Whether the regressor is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + ## `#!sds fun` fit {#safeds.ml.classical.regression.Regressor.fit data-toc-label='fit'} Create a copy of this regressor and fit it with the given training data. @@ -97,7 +99,7 @@ This regressor is not modified. | Name | Type | Description | Default | |------|------|-------------|---------| -| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | +| `trainingSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The training data containing the feature and target vectors. | - | **Results:** @@ -107,31 +109,13 @@ This regressor is not modified. ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="18" + ```sds linenums="24" @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: Regressor ``` -## `#!sds fun` isFitted {#safeds.ml.classical.regression.Regressor.isFitted data-toc-label='isFitted'} - -Check if the classifier is fitted. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `isFitted` | [`Boolean`][safeds.lang.Boolean] | Whether the regressor is fitted. | - -??? quote "Stub code in `regressor.sdsstub`" - - ```sds linenums="40" - @Pure - @PythonName("is_fitted") - fun isFitted() -> isFitted: Boolean - ``` - ## `#!sds fun` meanAbsoluteError {#safeds.ml.classical.regression.Regressor.meanAbsoluteError data-toc-label='meanAbsoluteError'} Compute the mean absolute error (MAE) of the regressor on the given data. @@ -140,7 +124,7 @@ Compute the mean absolute error (MAE) of the regressor on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -150,11 +134,11 @@ Compute the mean absolute error (MAE) of the regressor on the given data. ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="64" + ```sds linenums="61" @Pure @PythonName("mean_absolute_error") fun meanAbsoluteError( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> meanAbsoluteError: Float ``` @@ -166,7 +150,7 @@ Compute the mean squared error (MSE) on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -176,11 +160,11 @@ Compute the mean squared error (MSE) on the given data. ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="51" + ```sds linenums="48" @Pure @PythonName("mean_squared_error") fun meanSquaredError( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> meanSquaredError: Float ``` @@ -198,13 +182,13 @@ Predict a target vector using a dataset containing feature vectors. The model ha | Name | Type | Description | |------|------|-------------| -| `prediction` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A dataset containing the given feature vectors and the predicted target vector. | +| `prediction` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | A dataset containing the given feature vectors and the predicted target vector. | ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="30" + ```sds linenums="36" @Pure fun predict( dataset: Table - ) -> prediction: TaggedTable + ) -> prediction: TabularDataset ``` diff --git a/docs/api/safeds/ml/classical/regression/RidgeRegressor.md b/docs/api/safeds/ml/classical/regression/RidgeRegressor.md index ca9e2fa8c..fd322e594 100644 --- a/docs/api/safeds/ml/classical/regression/RidgeRegressor.md +++ b/docs/api/safeds/ml/classical/regression/RidgeRegressor.md @@ -14,8 +14,8 @@ Ridge regression. ```sds hl_lines="4" pipeline example { - val training = Table.fromCsvFile("training.csv").tagColumns("target"); - val test = Table.fromCsvFile("test.csv").tagColumns("target"); + val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); val regressor = RidgeRegressor(alpha = 2.0).fit(training); val meanSquaredError = regressor.meanSquaredError(test); } @@ -23,7 +23,7 @@ pipeline example { ??? quote "Stub code in `ridge.sdsstub`" - ```sds linenums="19" + ```sds linenums="20" class RidgeRegressor( const alpha: Float = 1.0 ) sub Regressor where { @@ -45,7 +45,7 @@ pipeline example { */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: RidgeRegressor } ``` @@ -56,6 +56,12 @@ Get the regularization of the model. **Type:** [`Float`][safeds.lang.Float] +## `#!sds attr` isFitted {#safeds.ml.classical.regression.RidgeRegressor.isFitted data-toc-label='isFitted'} + +Whether the regressor is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + ## `#!sds fun` fit {#safeds.ml.classical.regression.RidgeRegressor.fit data-toc-label='fit'} Create a copy of this regressor and fit it with the given training data. @@ -66,7 +72,7 @@ This regressor is not modified. | Name | Type | Description | Default | |------|------|-------------|---------| -| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | +| `trainingSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The training data containing the feature and target vectors. | - | **Results:** @@ -76,31 +82,13 @@ This regressor is not modified. ??? quote "Stub code in `ridge.sdsstub`" - ```sds linenums="38" + ```sds linenums="39" @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: RidgeRegressor ``` -## `#!sds fun` isFitted {#safeds.ml.classical.regression.RidgeRegressor.isFitted data-toc-label='isFitted'} - -Check if the classifier is fitted. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `isFitted` | [`Boolean`][safeds.lang.Boolean] | Whether the regressor is fitted. | - -??? quote "Stub code in `regressor.sdsstub`" - - ```sds linenums="40" - @Pure - @PythonName("is_fitted") - fun isFitted() -> isFitted: Boolean - ``` - ## `#!sds fun` meanAbsoluteError {#safeds.ml.classical.regression.RidgeRegressor.meanAbsoluteError data-toc-label='meanAbsoluteError'} Compute the mean absolute error (MAE) of the regressor on the given data. @@ -109,7 +97,7 @@ Compute the mean absolute error (MAE) of the regressor on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -119,11 +107,11 @@ Compute the mean absolute error (MAE) of the regressor on the given data. ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="64" + ```sds linenums="61" @Pure @PythonName("mean_absolute_error") fun meanAbsoluteError( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> meanAbsoluteError: Float ``` @@ -135,7 +123,7 @@ Compute the mean squared error (MSE) on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -145,11 +133,11 @@ Compute the mean squared error (MSE) on the given data. ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="51" + ```sds linenums="48" @Pure @PythonName("mean_squared_error") fun meanSquaredError( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> meanSquaredError: Float ``` @@ -167,13 +155,13 @@ Predict a target vector using a dataset containing feature vectors. The model ha | Name | Type | Description | |------|------|-------------| -| `prediction` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A dataset containing the given feature vectors and the predicted target vector. | +| `prediction` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | A dataset containing the given feature vectors and the predicted target vector. | ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="30" + ```sds linenums="36" @Pure fun predict( dataset: Table - ) -> prediction: TaggedTable + ) -> prediction: TabularDataset ``` diff --git a/docs/api/safeds/ml/classical/regression/SupportVectorMachineRegressor.md b/docs/api/safeds/ml/classical/regression/SupportVectorMachineRegressor.md index 566a9826b..05858f3bf 100644 --- a/docs/api/safeds/ml/classical/regression/SupportVectorMachineRegressor.md +++ b/docs/api/safeds/ml/classical/regression/SupportVectorMachineRegressor.md @@ -15,8 +15,8 @@ Support vector machine. ```sds hl_lines="4 5" pipeline example { - val training = Table.fromCsvFile("training.csv").tagColumns("target"); - val test = Table.fromCsvFile("test.csv").tagColumns("target"); + val training = Table.fromCsvFile("training.csv").toTabularDataset("target"); + val test = Table.fromCsvFile("test.csv").toTabularDataset("target"); val regressor = SupportVectorMachineRegressor( kernel = SupportVectorMachineRegressor.Kernel.Linear ).fit(training); @@ -26,7 +26,7 @@ pipeline example { ??? quote "Stub code in `support_vector_machine.sdsstub`" - ```sds linenums="22" + ```sds linenums="23" class SupportVectorMachineRegressor( const c: Float = 1.0, kernel: SupportVectorMachineRegressor.Kernel = SupportVectorMachineRegressor.Kernel.RadialBasisFunction @@ -80,7 +80,7 @@ pipeline example { */ @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: SupportVectorMachineRegressor } ``` @@ -91,6 +91,12 @@ Get the regularization strength. **Type:** [`Float`][safeds.lang.Float] +## `#!sds attr` isFitted {#safeds.ml.classical.regression.SupportVectorMachineRegressor.isFitted data-toc-label='isFitted'} + +Whether the regressor is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + ## `#!sds attr` kernel {#safeds.ml.classical.regression.SupportVectorMachineRegressor.kernel data-toc-label='kernel'} Get the type of kernel used. @@ -107,7 +113,7 @@ This regressor is not modified. | Name | Type | Description | Default | |------|------|-------------|---------| -| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | +| `trainingSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The training data containing the feature and target vectors. | - | **Results:** @@ -117,31 +123,13 @@ This regressor is not modified. ??? quote "Stub code in `support_vector_machine.sdsstub`" - ```sds linenums="73" + ```sds linenums="74" @Pure fun fit( - @PythonName("training_set") trainingSet: TaggedTable + @PythonName("training_set") trainingSet: TabularDataset ) -> fittedRegressor: SupportVectorMachineRegressor ``` -## `#!sds fun` isFitted {#safeds.ml.classical.regression.SupportVectorMachineRegressor.isFitted data-toc-label='isFitted'} - -Check if the classifier is fitted. - -**Results:** - -| Name | Type | Description | -|------|------|-------------| -| `isFitted` | [`Boolean`][safeds.lang.Boolean] | Whether the regressor is fitted. | - -??? quote "Stub code in `regressor.sdsstub`" - - ```sds linenums="40" - @Pure - @PythonName("is_fitted") - fun isFitted() -> isFitted: Boolean - ``` - ## `#!sds fun` meanAbsoluteError {#safeds.ml.classical.regression.SupportVectorMachineRegressor.meanAbsoluteError data-toc-label='meanAbsoluteError'} Compute the mean absolute error (MAE) of the regressor on the given data. @@ -150,7 +138,7 @@ Compute the mean absolute error (MAE) of the regressor on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -160,11 +148,11 @@ Compute the mean absolute error (MAE) of the regressor on the given data. ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="64" + ```sds linenums="61" @Pure @PythonName("mean_absolute_error") fun meanAbsoluteError( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> meanAbsoluteError: Float ``` @@ -176,7 +164,7 @@ Compute the mean squared error (MSE) on the given data. | Name | Type | Description | Default | |------|------|-------------|---------| -| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `validationOrTestSet` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | The validation or test set. | - | **Results:** @@ -186,11 +174,11 @@ Compute the mean squared error (MSE) on the given data. ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="51" + ```sds linenums="48" @Pure @PythonName("mean_squared_error") fun meanSquaredError( - @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + @PythonName("validation_or_test_set") validationOrTestSet: TabularDataset ) -> meanSquaredError: Float ``` @@ -208,15 +196,15 @@ Predict a target vector using a dataset containing feature vectors. The model ha | Name | Type | Description | |------|------|-------------| -| `prediction` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A dataset containing the given feature vectors and the predicted target vector. | +| `prediction` | [`TabularDataset`][safeds.data.labeled.containers.TabularDataset] | A dataset containing the given feature vectors and the predicted target vector. | ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="30" + ```sds linenums="36" @Pure fun predict( dataset: Table - ) -> prediction: TaggedTable + ) -> prediction: TabularDataset ``` ## `#!sds enum` Kernel {#safeds.ml.classical.regression.SupportVectorMachineRegressor.Kernel data-toc-label='Kernel'} @@ -225,7 +213,7 @@ The kernel functions that can be used in the support vector machine. ??? quote "Stub code in `support_vector_machine.sdsstub`" - ```sds linenums="31" + ```sds linenums="32" enum Kernel { /** * A linear kernel. diff --git a/docs/api/safeds/ml/nn/ForwardLayer.md b/docs/api/safeds/ml/nn/ForwardLayer.md index e843adff0..75041c826 100644 --- a/docs/api/safeds/ml/nn/ForwardLayer.md +++ b/docs/api/safeds/ml/nn/ForwardLayer.md @@ -1,6 +1,6 @@ # :test_tube:{ title="Experimental" } `#!sds class` ForwardLayer {#safeds.ml.nn.ForwardLayer data-toc-label='ForwardLayer'} -**Parent type:** [`Layer`][safeds.ml.nn.Layer] +**Parent type:** `#!sds Layer` **Parameters:** diff --git a/docs/api/safeds/ml/nn/InputConversion.md b/docs/api/safeds/ml/nn/InputConversion.md new file mode 100644 index 000000000..a9f232b10 --- /dev/null +++ b/docs/api/safeds/ml/nn/InputConversion.md @@ -0,0 +1,25 @@ +--- +search: + boost: 0.5 +--- + +# :test_tube:{ title="Experimental" } `#!sds abstract class` InputConversion {#safeds.ml.nn.InputConversion data-toc-label='InputConversion'} + +The input conversion for a neural network, defines the input parameters for the neural network. + +**Type parameters:** + +| Name | Upper Bound | Description | Default | +|------|-------------|-------------|---------| +| `FitIn` | [`Any?`][safeds.lang.Any] | - | - | +| `PredictIn` | [`Any?`][safeds.lang.Any] | - | - | + +**Inheritors:** + +- [`InputConversionTable`][safeds.ml.nn.InputConversionTable] + +??? quote "Stub code in `input_conversion.sdsstub`" + + ```sds linenums="7" + class InputConversion + ``` diff --git a/docs/api/safeds/ml/nn/InputConversionTable.md b/docs/api/safeds/ml/nn/InputConversionTable.md new file mode 100644 index 000000000..42c31a672 --- /dev/null +++ b/docs/api/safeds/ml/nn/InputConversionTable.md @@ -0,0 +1,21 @@ +# :test_tube:{ title="Experimental" } `#!sds class` InputConversionTable {#safeds.ml.nn.InputConversionTable data-toc-label='InputConversionTable'} + +The input conversion for a neural network defines the input parameters for the neural network. + +**Parent type:** [`InputConversion`][safeds.ml.nn.InputConversion] + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `featureNames` | [`List`][safeds.lang.List] | The names of the features for the input table, used as features for the training. | - | +| `targetName` | [`String`][safeds.lang.String] | The name of the target for the input table, used as target for the training. | - | + +??? quote "Stub code in `input_conversion_table.sdsstub`" + + ```sds linenums="10" + class InputConversionTable( + @PythonName("feature_names") featureNames: List, + @PythonName("target_name") targetName: String + ) sub InputConversion + ``` diff --git a/docs/api/safeds/ml/nn/Layer.md b/docs/api/safeds/ml/nn/Layer.md index 421c283b7..db47acd77 100644 --- a/docs/api/safeds/ml/nn/Layer.md +++ b/docs/api/safeds/ml/nn/Layer.md @@ -9,16 +9,16 @@ search: - [`ForwardLayer`][safeds.ml.nn.ForwardLayer] -??? quote "Stub code in `_layer.sdsstub`" +??? quote "Stub code in `layer.sdsstub`" ```sds linenums="4" class Layer { /** - * Get the input_size of this layer. + * The input_size of this layer. */ @PythonName("input_size") attr inputSize: Int /** - * Get the output_size of this layer. + * The output_size of this layer. */ @PythonName("output_size") attr outputSize: Int } @@ -26,12 +26,12 @@ search: ## `#!sds attr` inputSize {#safeds.ml.nn.Layer.inputSize data-toc-label='inputSize'} -Get the input_size of this layer. +The input_size of this layer. **Type:** [`Int`][safeds.lang.Int] ## `#!sds attr` outputSize {#safeds.ml.nn.Layer.outputSize data-toc-label='outputSize'} -Get the output_size of this layer. +The output_size of this layer. **Type:** [`Int`][safeds.lang.Int] diff --git a/docs/api/safeds/ml/nn/NeuralNetworkClassifier.md b/docs/api/safeds/ml/nn/NeuralNetworkClassifier.md index 6dbcb6f83..79e5a1ea0 100644 --- a/docs/api/safeds/ml/nn/NeuralNetworkClassifier.md +++ b/docs/api/safeds/ml/nn/NeuralNetworkClassifier.md @@ -4,21 +4,28 @@ | Name | Type | Description | Default | |------|------|-------------|---------| +| `inputConversion` | [`InputConversion`][safeds.ml.nn.InputConversion] | - | - | | `layers` | [`List`][safeds.lang.List] | - | - | +| `outputConversion` | [`OutputConversion`][safeds.ml.nn.OutputConversion] | - | - | + +**Type parameters:** + +| Name | Upper Bound | Description | Default | +|------|-------------|-------------|---------| +| `FitIn` | [`Any?`][safeds.lang.Any] | - | - | +| `PredictIn` | [`Any?`][safeds.lang.Any] | - | - | +| `PredictOut` | [`Any?`][safeds.lang.Any] | - | - | ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="7" - class NeuralNetworkClassifier( - layers: List + ```sds linenums="8" + class NeuralNetworkClassifier( + @PythonName("input_conversion") inputConversion: InputConversion, + layers: List, + @PythonName("output_conversion") outputConversion: OutputConversion ) { /** - * Check if the model is fitted. - * - * @example - * pipeline example { - * // TODO - * } + * Whether the classifier is fitted. */ @PythonName("is_fitted") attr isFitted: Boolean @@ -43,13 +50,13 @@ */ @Pure fun fit( - @PythonName("train_data") trainData: TaggedTable, + @PythonName("train_data") trainData: FitIn, @PythonName("epoch_size") const epochSize: Int = 25, @PythonName("batch_size") const batchSize: Int = 1, @PythonName("learning_rate") learningRate: Float = 0.001, @PythonName("callback_on_batch_completion") callbackOnBatchCompletion: (param1: Int, param2: Float) -> () = (param1, param2) {}, @PythonName("callback_on_epoch_completion") callbackOnEpochCompletion: (param1: Int, param2: Float) -> () = (param1, param2) {} - ) -> fittedClassifier: NeuralNetworkClassifier where { + ) -> fittedClassifier: NeuralNetworkClassifier where { epochSize >= 1, batchSize >= 1 } @@ -61,7 +68,7 @@ * * @param testData The data the network should predict. * - * @result result1 The given test_data with an added "prediction" column at the end + * @result prediction The given test_data with an added "prediction" column at the end * * @example * pipeline example { @@ -70,25 +77,17 @@ */ @Pure fun predict( - @PythonName("test_data") testData: Table - ) -> result1: TaggedTable + @PythonName("test_data") testData: PredictIn + ) -> prediction: PredictOut } ``` ## `#!sds attr` isFitted {#safeds.ml.nn.NeuralNetworkClassifier.isFitted data-toc-label='isFitted'} -Check if the model is fitted. +Whether the classifier is fitted. **Type:** [`Boolean`][safeds.lang.Boolean] -**Examples:** - -```sds -pipeline example { - // TODO -} -``` - ## `#!sds fun` fit {#safeds.ml.nn.NeuralNetworkClassifier.fit data-toc-label='fit'} Train the neural network with given training data. @@ -99,7 +98,7 @@ The original model is not modified. | Name | Type | Description | Default | |------|------|-------------|---------| -| `trainData` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The data the network should be trained on. | - | +| `trainData` | `#!sds FitIn` | The data the network should be trained on. | - | | `epochSize` | [`Int`][safeds.lang.Int] | The number of times the training cycle should be done. | `#!sds 25` | | `batchSize` | [`Int`][safeds.lang.Int] | The size of data batches that should be loaded at one time. | `#!sds 1` | | `learningRate` | [`Float`][safeds.lang.Float] | The learning rate of the neural network. | `#!sds 0.001` | @@ -110,7 +109,7 @@ The original model is not modified. | Name | Type | Description | |------|------|-------------| -| `fittedClassifier` | [`NeuralNetworkClassifier`][safeds.ml.nn.NeuralNetworkClassifier] | The trained Model | +| `fittedClassifier` | [`NeuralNetworkClassifier`][safeds.ml.nn.NeuralNetworkClassifier] | The trained Model | **Examples:** @@ -122,16 +121,16 @@ pipeline example { ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="39" + ```sds linenums="37" @Pure fun fit( - @PythonName("train_data") trainData: TaggedTable, + @PythonName("train_data") trainData: FitIn, @PythonName("epoch_size") const epochSize: Int = 25, @PythonName("batch_size") const batchSize: Int = 1, @PythonName("learning_rate") learningRate: Float = 0.001, @PythonName("callback_on_batch_completion") callbackOnBatchCompletion: (param1: Int, param2: Float) -> () = (param1, param2) {}, @PythonName("callback_on_epoch_completion") callbackOnEpochCompletion: (param1: Int, param2: Float) -> () = (param1, param2) {} - ) -> fittedClassifier: NeuralNetworkClassifier where { + ) -> fittedClassifier: NeuralNetworkClassifier where { epochSize >= 1, batchSize >= 1 } @@ -147,13 +146,13 @@ The original Model is not modified. | Name | Type | Description | Default | |------|------|-------------|---------| -| `testData` | [`Table`][safeds.data.tabular.containers.Table] | The data the network should predict. | - | +| `testData` | `#!sds PredictIn` | The data the network should predict. | - | **Results:** | Name | Type | Description | |------|------|-------------| -| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The given test_data with an added "prediction" column at the end | +| `prediction` | `#!sds PredictOut` | The given test_data with an added "prediction" column at the end | **Examples:** @@ -165,9 +164,9 @@ pipeline example { ??? quote "Stub code in `classifier.sdsstub`" - ```sds linenums="66" + ```sds linenums="64" @Pure fun predict( - @PythonName("test_data") testData: Table - ) -> result1: TaggedTable + @PythonName("test_data") testData: PredictIn + ) -> prediction: PredictOut ``` diff --git a/docs/api/safeds/ml/nn/NeuralNetworkRegressor.md b/docs/api/safeds/ml/nn/NeuralNetworkRegressor.md index 1409531f4..8d3a83f90 100644 --- a/docs/api/safeds/ml/nn/NeuralNetworkRegressor.md +++ b/docs/api/safeds/ml/nn/NeuralNetworkRegressor.md @@ -4,21 +4,28 @@ | Name | Type | Description | Default | |------|------|-------------|---------| +| `inputConversion` | [`InputConversion`][safeds.ml.nn.InputConversion] | - | - | | `layers` | [`List`][safeds.lang.List] | - | - | +| `outputConversion` | [`OutputConversion`][safeds.ml.nn.OutputConversion] | - | - | + +**Type parameters:** + +| Name | Upper Bound | Description | Default | +|------|-------------|-------------|---------| +| `FitIn` | [`Any?`][safeds.lang.Any] | - | - | +| `PredictIn` | [`Any?`][safeds.lang.Any] | - | - | +| `PredictOut` | [`Any?`][safeds.lang.Any] | - | - | ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="7" - class NeuralNetworkRegressor( - layers: List + ```sds linenums="8" + class NeuralNetworkRegressor( + @PythonName("input_conversion") inputConversion: InputConversion, + layers: List, + @PythonName("output_conversion") outputConversion: OutputConversion ) { /** - * Check if the model is fitted. - * - * @example - * pipeline example { - * // TODO - * } + * Whether the regressor is fitted. */ @PythonName("is_fitted") attr isFitted: Boolean @@ -34,7 +41,7 @@ * @param callbackOnBatchCompletion Function used to view metrics while training. Gets called after a batch is completed with the index of the last batch and the overall loss average. * @param callbackOnEpochCompletion Function used to view metrics while training. Gets called after an epoch is completed with the index of the last epoch and the overall loss average. * - * @result trainedRegressor The trained Model + * @result fittedRegressor The trained Model * * @example * pipeline example { @@ -43,13 +50,13 @@ */ @Pure fun fit( - @PythonName("train_data") trainData: TaggedTable, + @PythonName("train_data") trainData: FitIn, @PythonName("epoch_size") const epochSize: Int = 25, @PythonName("batch_size") const batchSize: Int = 1, @PythonName("learning_rate") learningRate: Float = 0.001, @PythonName("callback_on_batch_completion") callbackOnBatchCompletion: (param1: Int, param2: Float) -> () = (param1, param2) {}, @PythonName("callback_on_epoch_completion") callbackOnEpochCompletion: (param1: Int, param2: Float) -> () = (param1, param2) {} - ) -> trainedRegressor: NeuralNetworkRegressor where { + ) -> fittedRegressor: NeuralNetworkRegressor where { epochSize >= 1, batchSize >= 1 } @@ -70,25 +77,17 @@ */ @Pure fun predict( - @PythonName("test_data") testData: Table - ) -> prediction: TaggedTable + @PythonName("test_data") testData: PredictIn + ) -> prediction: PredictOut } ``` ## `#!sds attr` isFitted {#safeds.ml.nn.NeuralNetworkRegressor.isFitted data-toc-label='isFitted'} -Check if the model is fitted. +Whether the regressor is fitted. **Type:** [`Boolean`][safeds.lang.Boolean] -**Examples:** - -```sds -pipeline example { - // TODO -} -``` - ## `#!sds fun` fit {#safeds.ml.nn.NeuralNetworkRegressor.fit data-toc-label='fit'} Train the neural network with given training data. @@ -99,7 +98,7 @@ The original model is not modified. | Name | Type | Description | Default | |------|------|-------------|---------| -| `trainData` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The data the network should be trained on. | - | +| `trainData` | `#!sds FitIn` | The data the network should be trained on. | - | | `epochSize` | [`Int`][safeds.lang.Int] | The number of times the training cycle should be done. | `#!sds 25` | | `batchSize` | [`Int`][safeds.lang.Int] | The size of data batches that should be loaded at one time. | `#!sds 1` | | `learningRate` | [`Float`][safeds.lang.Float] | The learning rate of the neural network. | `#!sds 0.001` | @@ -110,7 +109,7 @@ The original model is not modified. | Name | Type | Description | |------|------|-------------| -| `trainedRegressor` | [`NeuralNetworkRegressor`][safeds.ml.nn.NeuralNetworkRegressor] | The trained Model | +| `fittedRegressor` | [`NeuralNetworkRegressor`][safeds.ml.nn.NeuralNetworkRegressor] | The trained Model | **Examples:** @@ -122,16 +121,16 @@ pipeline example { ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="39" + ```sds linenums="37" @Pure fun fit( - @PythonName("train_data") trainData: TaggedTable, + @PythonName("train_data") trainData: FitIn, @PythonName("epoch_size") const epochSize: Int = 25, @PythonName("batch_size") const batchSize: Int = 1, @PythonName("learning_rate") learningRate: Float = 0.001, @PythonName("callback_on_batch_completion") callbackOnBatchCompletion: (param1: Int, param2: Float) -> () = (param1, param2) {}, @PythonName("callback_on_epoch_completion") callbackOnEpochCompletion: (param1: Int, param2: Float) -> () = (param1, param2) {} - ) -> trainedRegressor: NeuralNetworkRegressor where { + ) -> fittedRegressor: NeuralNetworkRegressor where { epochSize >= 1, batchSize >= 1 } @@ -147,13 +146,13 @@ The original Model is not modified. | Name | Type | Description | Default | |------|------|-------------|---------| -| `testData` | [`Table`][safeds.data.tabular.containers.Table] | The data the network should predict. | - | +| `testData` | `#!sds PredictIn` | The data the network should predict. | - | **Results:** | Name | Type | Description | |------|------|-------------| -| `prediction` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The given test_data with an added "prediction" column at the end | +| `prediction` | `#!sds PredictOut` | The given test_data with an added "prediction" column at the end | **Examples:** @@ -165,9 +164,9 @@ pipeline example { ??? quote "Stub code in `regressor.sdsstub`" - ```sds linenums="66" + ```sds linenums="64" @Pure fun predict( - @PythonName("test_data") testData: Table - ) -> prediction: TaggedTable + @PythonName("test_data") testData: PredictIn + ) -> prediction: PredictOut ``` diff --git a/docs/api/safeds/ml/nn/OutputConversion.md b/docs/api/safeds/ml/nn/OutputConversion.md new file mode 100644 index 000000000..d2ba8a34b --- /dev/null +++ b/docs/api/safeds/ml/nn/OutputConversion.md @@ -0,0 +1,25 @@ +--- +search: + boost: 0.5 +--- + +# :test_tube:{ title="Experimental" } `#!sds abstract class` OutputConversion {#safeds.ml.nn.OutputConversion data-toc-label='OutputConversion'} + +The output conversion for a neural network, defines the output parameters for the neural network. + +**Type parameters:** + +| Name | Upper Bound | Description | Default | +|------|-------------|-------------|---------| +| `PredictIn` | [`Any?`][safeds.lang.Any] | - | - | +| `PredictOut` | [`Any?`][safeds.lang.Any] | - | - | + +**Inheritors:** + +- [`OutputConversionTable`][safeds.ml.nn.OutputConversionTable] + +??? quote "Stub code in `output_conversion.sdsstub`" + + ```sds linenums="7" + class OutputConversion + ``` diff --git a/docs/api/safeds/ml/nn/OutputConversionTable.md b/docs/api/safeds/ml/nn/OutputConversionTable.md new file mode 100644 index 000000000..a651ffdb6 --- /dev/null +++ b/docs/api/safeds/ml/nn/OutputConversionTable.md @@ -0,0 +1,19 @@ +# :test_tube:{ title="Experimental" } `#!sds class` OutputConversionTable {#safeds.ml.nn.OutputConversionTable data-toc-label='OutputConversionTable'} + +The output conversion for a neural network defines the output parameters for the neural network. + +**Parent type:** [`OutputConversion`][safeds.ml.nn.OutputConversion] + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `predictionName` | [`String`][safeds.lang.String] | The name of the new column where the prediction will be stored. | `#!sds "prediction"` | + +??? quote "Stub code in `output_conversion_table.sdsstub`" + + ```sds linenums="9" + class OutputConversionTable( + @PythonName("prediction_name") predictionName: String = "prediction" + ) sub OutputConversion + ```