TitanicML.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:ML_lessons 作者: supcom-machine-learning 项目源码 文件源码
def applyRandomForestClassifier(self, train, test):
        #init algorithm 
        RFC = RandomForestClassifier()

        #training target 
        y_train = train[["Survived"]]
        x_train = train[train.columns.difference(["PassengerId","Survived"])]

        #fitting 
        RFC.fit(x_train, y_train)

        result = RFC.predict(test[test.columns.difference(["PassengerId"])])

        self.writeMessage("current training score")
        print RFC.score(x_train, y_train)

        test["Survived"] = result 

        return test
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号