Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.
This repository was archived by the owner on Jan 3, 2023. It is now read-only.

the lambda passed to ds.map doesn't compile "SyntaxError: invalid syntax" #15

@activedecay

Description

@activedecay

Did you mean to pass t and decompose t's members like this?

#convert ndarray data into RDD[Sample]
def array2rdd(ds):
    #build Sample from ndarrays
    def build_sample(c0,c1,c2,c3,prediction):
        feature = np.array([c0, c1, c2, c3]).flatten()
        label = np.array(prediction)
        #print("what ami", Sample.from_ndarray(feature, label))
        return Sample.from_ndarray(feature, label)
    rdd = ds.map(lambda t: build_sample(t[0],t[1],t[2],t[3],t[4]))
    return rdd

iris_rdd_train = array2rdd(iris_k_train)
iris_rdd_train.cache()
print("Training Count: " + str(iris_rdd_train.count()))

iris_rdd_test = array2rdd(iris_k_test)
iris_rdd_test.cache()
print ("Test Count: " + str(iris_rdd_test.count()))

see feedforward-iris.ipynb

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions