शुरू करेंमुफ़्त में शुरू करें

डेटा को विभाजित करें

एक dataframe df_examples उपलब्ध है, जिसमें कॉलम हैं: endword: string, features: vector, outvec: vector, और label: int. आप इसे training और testing सेट पाने के लिए विभाजित करेंगे, जिनका उपयोग आप एक classifier को train और test करने में करेंगे.

यह अभ्यास पाठ्यक्रम का हिस्सा है

Python में Spark SQL परिचय

पाठ्यक्रम देखें

अभ्यास निर्देश

  • उदाहरणों को 80/20 स्प्लिट के साथ train और test में बाँटें.
  • training examples की संख्या प्रिंट करें.
  • test examples की संख्या प्रिंट करें.

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

# Split the examples into train and test, use 80/20 split
df_trainset, df_testset = df_examples.____((____), 42)

# Print the number of training examples
print("Number training: ", ____.____)

# Print the number of test examples
print("Number test: ", ____.____)
कोड संपादित करें और चलाएँ