When I add the code to get an accuracy score, I get an error. The code I added was:
y_pred = DSL_learner.predict(X_train, y_train)
y_pred = numpy.argmax(y_pred,axis=1)
I am using numpy 1.14 and Ubuntu 16.04.4 .
See below:
===========================
from deepSuperLearner import *
ETC = ExtraTreesClassifier()
GB = GradientBoostingClassifier()
Base_learners = {'ETC':ETC, 'GB':GB}
np.random.seed(100)
DSL_learner = DeepSuperLearner(Base_learners)
DSL_learner.fit(X_train, y_train)
y_pred = DSL_learner.predict(X_train, y_train)
y_pred = numpy.argmax(y_pred,axis=1)
print('Final prediction accuracy score: [%.4f]' % accuracy_score(y_test, y_pred))
DSL_learner.get_precision_recall(X_test, y_test, show_graphs=True)
Iteration: 0 Loss: 0.6936235359636144
Weights: [0.95464725 0.04535275]
Iteration: 1 Loss: 0.6922511148906573
Weights: [0.96612301 0.03387699]
Iteration: 2 Loss: 0.6930091286990414
Weights: [1. 0.]
ValueError Traceback (most recent call last)
in ()
13 DSL_learner = DeepSuperLearner(Base_learners)
14 DSL_learner.fit(X_train, y_train)
---> 15 y_pred = DSL_learner.predict(X_train, y_train)
16 y_pred = numpy.argmax(y_pred,axis=1)
17 print('Final prediction accuracy score: [%.4f]' % accuracy_score(y_test, y_pred))
/usr/local/lib/python3.5/dist-packages/deepSuperLearner/deepSuperLearnerLib.py in predict(self, X, return_base_learners_probs)
239 X = np.hstack((X, avg_probs))
240
--> 241 if return_base_learners_probs:
242 return avg_probs, base_learners_probs
243
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
When I add the code to get an accuracy score, I get an error. The code I added was:
y_pred = DSL_learner.predict(X_train, y_train)
y_pred = numpy.argmax(y_pred,axis=1)
I am using numpy 1.14 and Ubuntu 16.04.4 .
See below:
===========================
from deepSuperLearner import *
ETC = ExtraTreesClassifier()
GB = GradientBoostingClassifier()
Base_learners = {'ETC':ETC, 'GB':GB}
np.random.seed(100)
DSL_learner = DeepSuperLearner(Base_learners)
DSL_learner.fit(X_train, y_train)
y_pred = DSL_learner.predict(X_train, y_train)
y_pred = numpy.argmax(y_pred,axis=1)
print('Final prediction accuracy score: [%.4f]' % accuracy_score(y_test, y_pred))
DSL_learner.get_precision_recall(X_test, y_test, show_graphs=True)
Iteration: 0 Loss: 0.6936235359636144
Weights: [0.95464725 0.04535275]
Iteration: 1 Loss: 0.6922511148906573
Weights: [0.96612301 0.03387699]
Iteration: 2 Loss: 0.6930091286990414
Weights: [1. 0.]
ValueError Traceback (most recent call last)
in ()
13 DSL_learner = DeepSuperLearner(Base_learners)
14 DSL_learner.fit(X_train, y_train)
---> 15 y_pred = DSL_learner.predict(X_train, y_train)
16 y_pred = numpy.argmax(y_pred,axis=1)
17 print('Final prediction accuracy score: [%.4f]' % accuracy_score(y_test, y_pred))
/usr/local/lib/python3.5/dist-packages/deepSuperLearner/deepSuperLearnerLib.py in predict(self, X, return_base_learners_probs)
239 X = np.hstack((X, avg_probs))
240
--> 241 if return_base_learners_probs:
242 return avg_probs, base_learners_probs
243
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()