MCPcopy Create free account
hub / github.com/dmlc/xgboost / create_spark_df

Function create_spark_df

demo/guide-python/spark_estimator_examples.py:21–27  ·  view source on GitHub ↗
(X: np.ndarray, y: np.ndarray)

Source from the content-addressed store, hash-verified

19
20
21def create_spark_df(X: np.ndarray, y: np.ndarray) -> DataFrame:
22 return spark.createDataFrame(
23 spark.sparkContext.parallelize(
24 [(Vectors.dense(features), float(label)) for features, label in zip(X, y)]
25 ),
26 ["features", "label"],
27 )
28
29
30# load diabetes dataset (regression dataset)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected