You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@systemds.apache.org by ba...@apache.org on 2021/06/30 09:21:44 UTC
[systemds] 01/02: [MINOR] Fix Python docs to use API correctly
This is an automated email from the ASF dual-hosted git repository.
baunsgaard pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/systemds.git
commit a1e1ae16f1b938cff12da6d782a8ab5c175fd5f4
Author: baunsgaard <ba...@tugraz.at>
AuthorDate: Wed Jun 30 11:18:52 2021 +0200
[MINOR] Fix Python docs to use API correctly
---
src/main/python/docs/source/api/operator/algorithms.rst | 2 +-
src/main/python/docs/source/getting_started/simple_examples.rst | 2 +-
src/main/python/docs/source/guide/algorithms_basics.rst | 9 ++++-----
src/main/python/docs/source/guide/federated.rst | 6 ++----
4 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/src/main/python/docs/source/api/operator/algorithms.rst b/src/main/python/docs/source/api/operator/algorithms.rst
index 5055c55..1ea5de4 100644
--- a/src/main/python/docs/source/api/operator/algorithms.rst
+++ b/src/main/python/docs/source/api/operator/algorithms.rst
@@ -28,7 +28,7 @@ As an example the lm algorithm can be used as follows:
.. code-block:: python
- # Import numpy and SystemDS matrix
+ # Import numpy and SystemDS
import numpy as np
from systemds.context import SystemDSContext
from systemds.operator.algorithm import lm
diff --git a/src/main/python/docs/source/getting_started/simple_examples.rst b/src/main/python/docs/source/getting_started/simple_examples.rst
index 8ca44a2..e1d3bfe 100644
--- a/src/main/python/docs/source/getting_started/simple_examples.rst
+++ b/src/main/python/docs/source/getting_started/simple_examples.rst
@@ -90,7 +90,7 @@ One example of this is l2SVM, a high level functions for Data-Scientists. Let's
.. code-block:: python
- # Import numpy and SystemDS matrix
+ # Import numpy and SystemDS
import numpy as np
from systemds.context import SystemDSContext
from systemds.operator.algorithm import l2svm
diff --git a/src/main/python/docs/source/guide/algorithms_basics.rst b/src/main/python/docs/source/guide/algorithms_basics.rst
index f16ddb4..096d1fa 100644
--- a/src/main/python/docs/source/guide/algorithms_basics.rst
+++ b/src/main/python/docs/source/guide/algorithms_basics.rst
@@ -96,7 +96,6 @@ Then setup the data
.. code-block:: python
- from systemds.operator import Matrix
X_ds = sds.from_numpy(X)
Y_ds = sds.from_numpy( Y)
@@ -210,12 +209,12 @@ this makes SystemDS responsible for adding the 1 to each value.
with SystemDSContext() as sds:
# Train Data
- X = Matrix(sds, d.get_train_data().reshape((60000, 28*28)))
- Y = Matrix(sds, d.get_train_labels()) + 1.0
+ X = sds.from_numpy(d.get_train_data().reshape((60000, 28*28)))
+ Y = sds.from_numpy(d.get_train_labels()) + 1.0
bias = multiLogReg(X, Y, maxi=30)
# Test data
- Xt = Matrix(sds, d.get_test_data().reshape((10000, 28*28)))
- Yt = Matrix(sds, d.get_test_labels()) + 1.0
+ Xt = sds.from_numpy(d.get_test_data().reshape((10000, 28*28)))
+ Yt = sds.from_numpy(d.get_test_labels()) + 1.0
[m, y_pred, acc] = multiLogRegPredict(Xt, bias, Yt).compute()
print(acc)
diff --git a/src/main/python/docs/source/guide/federated.rst b/src/main/python/docs/source/guide/federated.rst
index e903a55..628ac54 100644
--- a/src/main/python/docs/source/guide/federated.rst
+++ b/src/main/python/docs/source/guide/federated.rst
@@ -67,9 +67,8 @@ The aggregated sum using federated instructions in python SystemDS is done as fo
.. code-block:: python
- # Import numpy and SystemDS federated
+ # Import numpy and SystemDS
import numpy as np
- from systemds.matrix import Federated
from systemds.context import SystemDSContext
# Create a federated matrix
@@ -83,7 +82,7 @@ The aggregated sum using federated instructions in python SystemDS is done as fo
address = "localhost:8001/temp/test.csv"
with SystemDSContext() as sds:
- fed_a = Federated(sds, [address], [dims])
+ fed_a = sds.federated(sds, [address], [dims])
# Sum the federated matrix and call compute to execute
print(fed_a.sum().compute())
# Result should be 45.
@@ -107,7 +106,6 @@ Once all three workers are up and running we can leverage all three in the follo
.. code-block:: python
- # Import numpy and SystemDS federated
import numpy as np
from systemds.context import SystemDSContext