063c572b5b09fb8492beee938589cf5984f84926,art/estimators/classification/ensemble.py,EnsembleClassifier,class_gradient,#EnsembleClassifier#Any#Any#Any#,234
Before Change
`(batch_size, 1, input_shape)` when `label` parameter is specified. If `raw=True`, an additional
dimension is added at the beginning of the array, indexing the different classifiers.
grads = np.array(
[
self._classifier_weights[i] * self._classifiers[i].class_gradient(x, label)
for i in range(self._nb_classifiers)
]
)
if raw:
return grads
return np.sum(grads, axis=0)
def loss_gradient(self, x: np.ndarray, y: np.ndarray, raw: bool = False, **kwargs) -> np.ndarray:
After Change
// Set weights for classifiers
if classifier_weights is None:
classifier_weights = np.ones(self._nb_classifiers) / self._nb_classifiers
self._classifier_weights = classifier_weights
// check for consistent channels_first in ensemble members
for i_cls, cls in enumerate(classifiers):
if cls.channels_first != self.channels_first:
raise ValueError(
"The channels_first boolean of classifier {} is {} while this ensemble expects a "
"channels_first boolean of {}. The channels_first booleans of all classifiers and the "
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 6
Instances
Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 063c572b5b09fb8492beee938589cf5984f84926
Time: 2020-12-18
Author: beat.buesser@ie.ibm.com
File Name: art/estimators/classification/ensemble.py
Class Name: EnsembleClassifier
Method Name: class_gradient
Project Name: RaRe-Technologies/gensim
Commit Name: f96837d570ed738baa0f47924cfa09f40787cdbe
Time: 2010-09-06
Author: radimrehurek@seznam.cz
File Name: src/gensim/utils.py
Class Name:
Method Name: isCorpus
Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 063c572b5b09fb8492beee938589cf5984f84926
Time: 2020-12-18
Author: beat.buesser@ie.ibm.com
File Name: art/estimators/classification/ensemble.py
Class Name: EnsembleClassifier
Method Name: loss_gradient
Project Name: RaRe-Technologies/gensim
Commit Name: e0830d7736bb620f926545078bea5620a8b4a19c
Time: 2010-09-06
Author: piskvorky@92d0401f-a546-4972-9173-107b360ed7e5
File Name: src/gensim/utils.py
Class Name:
Method Name: isCorpus