classification

predict_proba method available in OneVsRestClassifier

predict_proba method available in OneVsRestClassifier Question: I am using sklearn‘s OneVsOneClassifier in an pipeline like so: smt = SMOTE(random_state=42) base_model = LogisticRegression() pipeline = Pipeline([(‘sampler’, smt), (‘model’, base_model)]) classifier = OneVsOneClassifier(estimator=pipeline) classifier.fit(X_train, y_train) # prediction yhat = classifier.predict(X_test) But then I cannot do: yhat_prob = predict_proba(X_test) AttributeError: ‘OneVsOneClassifier’ object has no attribute ‘predict_proba’ scikit-learns OneVsRestClassifier …

Total answers: 2

I got attribute error while doing convolution

I got attribute error while doing convolution Question: I was trying to test my model for making a convolution using MNIST data keep_prob=1.0 ActivatedUnits = convolve1(sampleimage) filters = ActivatedUnits.shape[3] plt.figure(1, figsize=(20,20)) n_columns = 6 n_rows = np.math.ceil(filters / n_columns) + 1 for i in range(filters): plt.subplot(n_rows, n_columns, i+1) plt.title(‘Filter ‘ + str(i)) plt.imshow(ActivatedUnits[0,:,:,i], interpolation="nearest", cmap="gray") …

Total answers: 1

What it means when your model can't overfit a small batch of data?

What it means when your model can't overfit a small batch of data? Question: I am trying to train RNN model to classify sentences into 4 classes, but it doesn’t seem to work. I tried to overfit 4 examples (blue line) which worked, but even as little as 8 examples (red line) is not working, …

Total answers: 1

Compute class weight function issue in 'sklearn' library when used in 'Keras' classification (Python 3.8, only in VS code)

Compute class weight function issue in 'sklearn' library when used in 'Keras' classification (Python 3.8, only in VS code) Question: The classifier script I wrote is working fine and recently added weight balancing to the fitting. Since I added the weight estimate function using ‘sklearn’ library I get the following error : compute_class_weight() takes 1 …

Total answers: 4

How the probabilities are normalized in one-vs-rest scheme of sklearn Logistic Regression?

How the probabilities are normalized in one-vs-rest scheme of sklearn Logistic Regression? Question: In the sklearn LogisticRegression classifer, we can set the muti_class option to ovr which stands for one-vs-rest, as in the following code snippet: # logistic regression for multi-class classification using built-in one-vs-rest from sklearn.datasets import make_classification from sklearn.linear_model import LogisticRegression # define …

Total answers: 2

Error in Writing Video with OpenCV for Video Classification

Error in Writing Video with OpenCV for Video Classification Question: I am building a video classification model same as in this video: https://www.youtube.com/watch?v=l8XQsxlGxiY&list=PLxefhmF0pcPl_v-lLsqF3drP6NOoSYJR0&index=9 The model predicts which sport is being shown in the video: Tennis, swimming or Boxing. I already built my model and has a 96% accuracy. Now, I have a sample video to …

Total answers: 1

Scaling the sigmoid output

Scaling the sigmoid output Question: I am training a Network on images for binary classification. The input images are normalized to have pixel values in the range[0,1]. Also, the weight matrices are initialized from a normal distribution. However, the output from my last Dense layer with sigmoid activation yields values with a very minute difference …

Total answers: 2