ML建模之逻辑回归实操
数据集可以点击此下载
加载数据
# 导包
from pyspark.sql.session import SparkSession
from pyspark import SparkContext
import pyspark.sql.types as typ
# 穿键spark通信
sc = SparkContext.getOrCreate()
spark = SparkSession(sc)
# 这里采用了指定数据类型的方式创建DF
labels = [
('INFANT_ALIVE_AT_REPORT', typ.IntegerType()),
('BIRTH_PLACE', typ.StringType()),
('MOTHER_AGE_YEARS', typ.IntegerType()),
('FATHER_COMBINED_AGE', typ.IntegerType()),
('CIG_BEFORE', typ.IntegerType()),
('CIG_1_TRI', typ.IntegerType()),
('CIG_2_TRI', typ.IntegerType()),
('CIG_3_TRI', typ.IntegerType()