Scikit-learn is a machine-learning library for Python that provides simple and efficient tools for data analysis and data mining, with a focus on machine learning. It is accessible to everybody and reusable in various contexts. It is built on NumPy and SciPy. The project is open source and commercially usable (BSD license).
26,089
questions
0
votes
0
answers
11
views
My Grid Search keeps giving a bad score, why is that? (TFIDFVectorizer Pipeline)
I have made a pipeline using tfidfvectorizer and performed grid search but keep getting a high negative score when evaluating.
I'm importing a dataset and cleaning it through lowering the case, ...
0
votes
1
answer
11
views
ValueError: matmul: Input operand 1 has a mismatch in its core dimension 0, with gufunc signature (n?,k),(k,m?)->(n?,m?) (size 1 is different from 2)
First time trying to make a fit on Python. I have sets of measurements and need to make a non-linear fit on provided data. Fit should be quadratic polynomial. Here are the code and the error:
from ...
-2
votes
0
answers
32
views
Any idea what's happening here?
here is Clustering (Kmeans is applied and clusters are attained) then the radius for each cluster is being calculated between the center and the observations
but I don't understand this here [:,0] I ...
0
votes
0
answers
8
views
PLS regression MSE, RESS and PRESS
I want to evaluate the fit and prediction error analysis of a Partial Least Squares regression.
My input is X and response is y:
X = pd.DataFrame(np.array([[-0.267261, 0.662085, -0.534522, -0.408248], ...
1
vote
0
answers
14
views
ROC_AUC from prediction probabilities from .pred_proba are better than from predictions from .pred
I have a multiclass classification problem. Now, I want to get the predictions from my fit classifier (OneVsRestClassifier(XGBoost)) to obtain the Area under the ROC curves in Scikit-Learn.
I noticed ...
0
votes
1
answer
13
views
ML model error 'numpy.ndarray' object has no attribute 'predict'
I was trying to make a predictive model, but I can't find a way to solve this numpy-related issue with my code. I already imported the pickle file containing the model I saved from Google Colab, but I ...
0
votes
0
answers
6
views
Trying to use the SilhouetteVisualizer but its giving an error : AttributeError: 'NoneType' object has no attribute 'split'
I'm new to python and really need help with this.Trying to use the SilhouetteVisualizer but its giving an error : AttributeError: 'NoneType' object has no attribute 'split'. Please tell me what should ...
2
votes
1
answer
24
views
How to use RandomizedSearchCV of Scikit-Learn with ImageDataGenerator of Tensorflow
I'm trying to implement a RandomizedSearchCV using the ImageDataGenerators.
Here an example of the generator used for the train set:
train_datagen = ImageDataGenerator(rotation_range=20,
...
0
votes
0
answers
5
views
Persistent AttributeError ('TfidfVectorizer' object has no attribute 'get_feature_names_out') even after updating scikit-learn
I was attempting to retrieve the tfidf matrix shape and the feature names with the following code:
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text ...
-5
votes
0
answers
27
views
How to plot KNN decision boundary line?
I am trying to draw this black thick line. How can I draw it?
Here is the code I'm trying to edit. The code uses matplotlib and numpy libraries. I just want the black think line as shown in the first ...
-1
votes
1
answer
23
views
Unable to train ML model using sklearn
I am currently trying to train the model, But the model tries to convert "Names" to float. And presents an error.
So, from what I can understand. I cannot train model to identify male or ...
0
votes
0
answers
14
views
Transformer combining two OHE categorical features that encode the same information
When preprocessing data sometimes that are multiple features that encode the existence of some item and should be encoded together. For example, in the below data set, I would like OHE to be done on ...
1
vote
2
answers
41
views
X has 1 features, but LinearRegression is expecting 5 features as input
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import sklearn.linear_model
dados = pd.read_csv("dados.csv", thousands=',', sep = ";", header = 0, encoding='...
0
votes
1
answer
14
views
How does predict_proba work with cross-validation?
When using 5-fold cross-validation to create a model, 5 different models are created. The selection of the final model can vary:
best-estimated (or other criteria) model out of the 5-fold created ...
0
votes
0
answers
14
views
Circular import of numpy error in the scikit learn
Even during the build of the sklearn, at the end it showing a message like Partial import of sklearn during the build process, though it's successfully installed the scikit-learn
When i tried to run ...