I thought of implementing kappaScore metrics using sklearn.metrics.cohen_kappa_score Error I get when I try to run this code: Here the type of y_true and y_pred requires to be in list or numpy array But the type of y_true and y_pred are, When directly try to print it (i.e, without type() function), it shows like this: Unable to use y_true.numpy() (Convert
Tag: scikit-learn
trying to callibrate keras model
I’m trying to calibrate my CNN model by Sklearn implementation CalibratedClassifierCV, tried to wrap it as KerasClassifier and to override the predict function but without success. someone could say me what I did wrong? this is the model code: this is me trying to calibrate it : the output : valX_cnn and val_y_cnn are of type np.array. tried even to
Scikit-learn pipeline: Non-finite test scores error / Inconsistent number of samples
I have a dataframe with two columns of texts and only the POS tags (of the same texts), which I want to use for language classification. I am trying to use both features as part of my model. This is what the data looks like: X_train.head() This is what the shape of the data looks like: When I run my
“Not enough values to unpack” in sklearn.fit
Here’s the piece of the code: This says: The train and test datasets had been prepared before, and they behave nicely with other classifiers. Such a generic error message tells me nothing. What is the problem here? Answer In short, the issue was that you passed the result of skf.split(titanic_dataset, surv_titanic) to the cv argument on LogisticRegressionCV when you needed
Audio recognition and fingerprint using sklean & librosa [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed last year. Improve this question I want to create a model that can predict who has speak with different word. In this case i try to
How to change colors for decision tree plot using sklearn plot_tree?
How to change colors in decision tree plot using sklearn.tree.plot_tree without using graphviz as in this question: Changing colors for decision tree plot created using export graphviz? Answer Many matplotlib functions follow the color cycler to assign default colors, but that doesn’t seem to apply here. The following approach loops through the generated annotation texts (artists) and the clf tree
Calculating hamming distance in a given year
I have a following dataframe: I would like to calculate pairwise hamming distance for each pair in a given year and save it into a new dataframe. Example: (Note: I made up the numbers for the hamming distance, and I don’t actually need to Pair column) I tried something like: Answer The function pairwise_distances can take in a matrix, so
logistic regression and GridSearchCV using python sklearn
I am trying code from this page. I ran up to the part LR (tf-idf) and got the similar results After that I decided to try GridSearchCV. My questions below: 1) Then I calculated f1 score manually. why it is not matching? If I try scoring=’precision’ why does it give below error? I am not clear mainly because I have
Fixing points as non-outliers during outlier detection in Python
I found this Scikit Learn page explaining how to use different algorithms to detect outliers: https://scikit-learn.org/stable/modules/outlier_detection.html Is it possible to set a group of instances as non-outliers so that the algorithms understand that those specific points should not be detected as outliers? Answer If you have enough so called non-outliers for training, one option is to use Novelty detection with
scikit-learn LinearRegression IndexError
I am working on a LinearRegression model to fill the null values for the feature Rupeepersqft. When I run the code, I am receiving this error: This is the code which gives me the error: This is how the data looks like: Can anyone help me out with this? Answer To assign values to a column in Pandas.DataFrame you should