데이터 분할하기
df_examples라는 데이터프레임이 제공되어 있으며, endword: string, features: vector, outvec: vector, label: int 열을 포함합니다. 이 데이터를 학습용과 테스트용으로 분할한 뒤, 분류기를 학습하고 평가하는 데 사용할 거예요.
이 연습은 강의의 일부입니다
Python에서 Spark SQL 입문
연습 안내
- 예제를 80/20 비율로 학습용과 테스트용으로 분할하세요.
- 학습 예제 개수를 출력하세요.
- 테스트 예제 개수를 출력하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# 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: ", ____.____)