Skip to content

Commit

Permalink
feat: Stubs for safe-ds version 0.22.1 (#1130)
Browse files Browse the repository at this point in the history
### Summary of Changes

* ⚠️ `Table.tagColumns` is now called `Table.toTabularDataset` and
expects names of extra columns instead of feature columns
    * **Migration Step 1:** Rename your call.
* **Migration Step 2:** Rename the parameter `featureNames` to
`extraNames`.
* **Migration Step 3:** Specify everything that should be neither target
nor feature as `extraNames`.
* ⚠️ `TaggedTable` is now called `TabularDataset` and has a greatly
reduced interface:
* **Migration:** Finish processing your `Table` before you create a
`TabularDataset`.
* ⚠️ `isFitted` is now always an attribute instead of a function:
    * **Migration:** You must no longer call it.
* New method `Row.sortColumns`
* New parameter `numberOfBins` on `Table.plotHistograms`
* New method `Column.missingValueCount`
* Several additions to the `safeds.ml.nn` package (neural networks)
  • Loading branch information
lars-reimann authored May 2, 2024
1 parent 0bb47f0 commit 6f7100d
Show file tree
Hide file tree
Showing 77 changed files with 1,612 additions and 4,031 deletions.
8 changes: 7 additions & 1 deletion docs/api/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
101 changes: 101 additions & 0 deletions docs/api/safeds/data/labeled/containers/TabularDataset.md
Original file line number Diff line number Diff line change
@@ -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<Map<String, List<Any>>, Table>` | The data. | - |
| `targetName` | [`String`][safeds.lang.String] | Name of the target column. | - |
| `extraNames` | [`List<String>`][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<Map<String, List<Any>>, Table>,
@PythonName("target_name") targetName: String,
@PythonName("extra_names") extraNames: List<String> = []
) {
/**
* 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<Any?>`][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
```
72 changes: 63 additions & 9 deletions docs/api/safeds/data/tabular/containers/Column.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -983,7 +1037,7 @@ pipeline example {

??? quote "Stub code in `column.sdsstub`"

```sds linenums="376"
```sds linenums="397"
@Pure
fun mode() -> mode: List<T>
```
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -1153,7 +1207,7 @@ pipeline example {

??? quote "Stub code in `column.sdsstub`"

```sds linenums="404"
```sds linenums="425"
@Pure
fun stability() -> stability: Float
```
Expand All @@ -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
Expand All @@ -1206,7 +1260,7 @@ pipeline example {

??? quote "Stub code in `column.sdsstub`"

```sds linenums="433"
```sds linenums="454"
@Pure
fun sum() -> sum: Float
```
Expand All @@ -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
Expand Down Expand Up @@ -1301,7 +1355,7 @@ pipeline example {

??? quote "Stub code in `column.sdsstub`"

```sds linenums="447"
```sds linenums="468"
@Pure
fun variance() -> variance: Float
```
Loading

0 comments on commit 6f7100d

Please sign in to comment.