xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 14.8MB
    文件類型: .zip
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2023-07-26
  • 語言: Python
  • 標(biāo)簽: 隨機(jī)森林??

資源簡介

決策樹對于數(shù)據(jù)分類的Python實(shí)現(xiàn),測試集和訓(xùn)練集分別給出,而且數(shù)據(jù)已經(jīng)處理好的,

資源截圖

代碼片段和文件信息

import?os
import?sys
import?logging

import?pandas?as?pd
train_file?=?os.path.join(“data““train.csv“)
test_file?=?os.path.join(“data““test.csv“)

train_df?=?pd.read_csv(train_filesep=““header?=?0quoting?=?3)

X_train=train_df.iloc[:1:]
y_train=train_df.iloc[::1]


test_df=pd.read_csv(test_filesep=‘‘header=0quoting=3)

X_test=test_df.iloc[::]

from?sklearn.ensemble?import?RandomForestClassifier
clf=RandomForestClassifier(n_estimators=100)
clf.fit(X_trainy_train)
y_pred=clf.predict(X_test)
print(y_pred)

with?open(os.path.join(‘random_forest.csv‘)‘w‘)?as?my_file:
my_file.write(‘ImageidLabel\n‘)
for?i?in?range(len(y_pred)):
my_file.write(‘%d%d\n‘%(iy_pred[i]))

print(‘save‘)







?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-05-15?17:31??隨機(jī)森林的應(yīng)用\
?????文件?????????745??2018-04-19?10:42??隨機(jī)森林的應(yīng)用\redom_forest.py
?????文件????51118296??2018-04-12?09:37??隨機(jī)森林的應(yīng)用\test.csv
?????文件????76775041??2018-04-12?09:37??隨機(jī)森林的應(yīng)用\train.csv

評論

共有 條評論