【发布时间】:2019-09-05 12:08:15
【问题描述】:
我通过对数据集(图像)使用迁移学习得到了特征向量
X =
[[0.06381412 1.5189143 0.7007909 ... 0.22550535 0.56980544 0.07307615]
[0.06381412 1.5189143 0.7007909 ... 0.22550535 0.56980544 0.07307615]
[0.06381412 1.5189143 0.7007909 ... 0.22550535 0.56980544 0.07307615]
...
[0.06381412 1.5189143 0.7007909 ... 0.22550535 0.56980544 0.07307615]
[0.06381412 1.5189143 0.7007909 ... 0.22550535 0.56980544 0.07307615]
[0.06381412 1.5189143 0.7007909 ... 0.22550535 0.56980544 0.07307615]]
imgs_train, imgs_test, y_train, y_test, = train_test_split(X, Y,test_size=0.33, random_state=42)
Mrfc = RandomForestClassifier(n_estimators = 1000,
bootstrap = True,
oob_score = True,
criterion = 'gini',
max_features = 'auto',
max_depth = dep,
min_samples_split = int(3000),
min_samples_leaf = int(1000),
max_leaf_nodes = None,
n_jobs=-1
)
Mrfc.fit(imgs_train,y_train)
y_predict = Mrfc.predict(imgs_train)
y_predict 的输出全为零:
[0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. ...]
Y 包含标签(0 或 1) 该模型无法做出预测。我能做什么?
【问题讨论】:
-
X 是 (1050, 2048)...1050 张图片...每张图片有 2048 个特征
标签: python classification random-forest