machine-learning

Keras Reshape Layer Error: Total Size of New Array Must Be Unchanged

Keras Reshape Layer Error: Total Size of New Array Must Be Unchanged Question: This is my model import torch import os import cv2 import numpy as np import tensorflow as tf from tensorflow.keras.preprocessing.image import ImageDataGenerator import mediapipe as mp from sklearn.metrics import multilabel_confusion_matrix, accuracy_score # Define the path to your training and testing data directories …

Total answers: 1

shape of my dataframe(#rows) and that of final embeddings array doesn't match

shape of my dataframe(#rows) and that of final embeddings array doesn't match Question: I generated the word embeddings for my corpus(2-D List) then tried to generate the Average Word2Vec embeddings for each of the individual word list(that is for each comment which have been converted into a list though split() method) inside my corpus but …

Total answers: 1

How to plot a confusion matrix

How to plot a confusion matrix Question: I am trying to evaluate my renet50 model with a confusion matrix, but the confusion matrix looks like this: matrix = confusion_matrix(y_test, y_pred, normalize="pred") print(matrix) # output array([[1, 0], [1, 2]], dtype=int64) I am using scikit-learn for generating the confusion matrix and tf keras for making the model …

Total answers: 2

Multiclass confusion matrix in python

Multiclass confusion matrix in python Question: I’m trying to create a single multiclass confusion matrix in Python. df_true = pd.DataFrame({ "y_true": [0,0,1,1,0,2] }) df_pred = pd.DataFrame({ "y_pred": [0,1,2,0,1,2] }) And I want a single confusion matrix that tells me the actual and predict value for each case. Like this: Asked By: juanmac || Source Answers: …

Total answers: 1

Tensorflow model.trainable_variables doesn't update after setting layer.trainable

Tensorflow model.trainable_variables doesn't update after setting layer.trainable Question: Context I’m creating a script which randomly modifies some parameters in a Tensorflow model. It aims to "encrypt" the model by recording the modifications made so that the modifications can be undone by authorised users only. To enable this script, I want to freeze all model layers …

Total answers: 1

Analyze image similarity

Analyze image similarity Question: I am trying to check the similarity of n images I saved in an array (composed of 1797 samples, each of which is represented by 64 bits). My goal is to save the L1 distance of each pair of images in an array of size 1797×1797 (note that the method to …

Total answers: 1

model.parameters() alternative for TransUNet from transunet python library

model.parameters() alternative for TransUNet from transunet python library Question: I am trying to implement TransUNet for breakhis dataset I was making the optimizer like this optimizer = torch.optim.Adam(model.parameters(), lr=1e-4) my model is from transunet import TransUNet model = TransUNet(image_size=224, pretrain=True) But the parameter() function does not work with TransUNet This is the library I am …

Total answers: 1

Error during Recursive feature elimination using Histogram based GBM

Error during Recursive feature elimination using Histogram based GBM Question: I am implementing Recursive Feature Elimination using the HistGradientBoostingClassifier, but for some reason keeps on getting the following error: ValueError: when importance_getter==’auto’, the underlying estimator HistGradientBoostingClassifier should have coef_ or feature_importances_ attribute. Either pass a fitted estimator to feature selector or call fit before calling …

Total answers: 1