Questions tagged [scikit-learn]

scikit-learn is a popular machine learning package for Python that has simple and efficient tools for predictive data analysis. Topics include classification, regression, clustering, dimensionality reduction, model selection, and preprocessing.

Filter by
Sorted by
Tagged with
0 votes
1 answer
23 views

How to compare between two methods of multivariate to filling NA

In the Titanic dataset, I performed two methods to fill Age NA. The first one is regression using Lasso: ...
user avatar
1 vote
0 answers
15 views

Can I "fit" a k-nearest neighbors classifier without precomputing anything?

I am currently trying to fit a KNeighborsClassifier (scikit-learn implementation) to about a gigabyte of training data. From every resource I've read online, a k-nearest-neighbors classifier is a &...
user avatar
0 votes
1 answer
20 views

sklearn - StandardScaler - Use in Production

I transformed my input data using StandardScaler as given here: https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.StandardScaler.html Code looks like this: ...
user avatar
  • 109
0 votes
0 answers
15 views

How to train ML model for time series data

I am trying to build a machine learning model in python. I used pytorch and sklearn to make the model. My model is a bit ...
user avatar
  • 101
0 votes
1 answer
22 views

Using Sci-Kit Learn Clustering and/or Random-Forest Classification on String Data with Multiple Sub-Classifications

I have a set of data with some numerical features and some string data. The string data is essentially a set of classes that are not inherently related. For example: ...
user avatar
1 vote
0 answers
14 views

Is it possible to "fine-tune" a pre-trained logistic regression model?

Fine tuning is a concept commonly used in deep learning. We may have a pre-trained model and then fine-tune it to our specific task. Does that apply to simple models, such as logistic regression? For ...
user avatar
1 vote
1 answer
15 views

Random search grid not displaying scoring metric

I want to do a grid search of some few hyperparameters through a XGBClassifier of a binary class, but whenever i run it the score value (roc_auc) is not being ...
user avatar
0 votes
1 answer
38 views

How can I export the best classifier from my code to a model for real future usage?

...
user avatar
  • 1
0 votes
2 answers
29 views

Exploratory data analysis (EDA) on large dataset

I am working with lots of data (we have a table that produces 30 million rows daily). What is the best way to explore it (do on EDA)? Take a frictional slicing of the data randomly (100000 rows) or ...
user avatar
  • 23
0 votes
1 answer
17 views

Need an example of a custom class whose instance is fed to sklearn Pipeline / make_pipeline to use with GridSearchCV

According to sklearn.pipeline.Pipeline documentation, the class whose instance is a pipeline element should implement fit() and transform(). I managed to create a custom class that has these methods ...
user avatar
  • 131
0 votes
0 answers
4 views

Null Inputs/Inhibiting Inputs & Outputs with Scikit-Learn MLPRegressor

I'm trying to build a general predictive model of a model of a machine. I've got a variable number of sensor inputs, and I'd like to create a MLPRegressor that can estimate outputs from the input ...
user avatar
0 votes
0 answers
14 views

How do I compute the Weighted average ROC Curve?

So i have a multiclass problem and successfully computed the micro and macro average curves, how do I calculate the weighted value for each TPR and FPR?
user avatar
0 votes
1 answer
8 views

Type Error When Running cross_validate [closed]

I am running into a type error when running the cross validate line (cv8 = ...). I used this exact line previously with KNNwithmeans instead of NMF with no issues. I am not sure what the issue here is....
user avatar
  • 1
2 votes
0 answers
60 views

random_state on train_test_split() appears to have large effect in performance metrics?

To summarize the problem: I have a data set with ~1450 samples, 19 features and a binary outcome where classes are fairly balanced (0.51 to 0.49). I split the data into a train set and a test set ...
user avatar
  • 31
1 vote
0 answers
25 views

Multi Linear Regression on String Values

I'm using datasets which involves mostly of string values. The main outcome of the project is that it should predict success. Now I can use OneHotEncoding to convert string values in numerical format ...
user avatar
0 votes
1 answer
22 views

DB-Scan with ring like data

I've been using the DBScan implementation of python from sklearn.cluster. The problem is, that I'm working with 360° lidar data which means, that my data is a ring ...
user avatar
0 votes
0 answers
9 views

How to interpret scikitlearn pca components output

I am trying to use PCA with scikitlearn for feature selection and there is something about PCA that I am not understanding. Can someone please fill in the blanks for me? I have a normalised dataset ...
user avatar
  • 111
0 votes
1 answer
19 views

Input shape error

I've this item: ['6', '1', '6', '843537', '3', '0', '5', '1006709', '3', '1', '4'] with shape: (11,) but when go to predict with: ...
user avatar
0 votes
0 answers
12 views

use pre-built model to predict audio file

i am using this code to build a model that recognizes emotions in speech, but i can't figure out how to use it after loading it in a new python file. this is what i have but the results are always the ...
user avatar
0 votes
0 answers
10 views

How do I get the "Ideal Characteristics" of a candidate for least attrition in Machine Learning?

I am working on a project to predict whether a candidate, after joining our organization, would leave us within 1 year or not. The model is based on different features present in their resumes (...
user avatar
0 votes
1 answer
27 views

Optimal clusters for K-means not clear - any ideas?

I have a toy dataset of 10,000 strings of people's names, addresses and birthdays. As a quirk of the data collection process it is highly likely there are duplicate people caused by typos and I am ...
user avatar
  • 187
1 vote
0 answers
25 views

How to draw each ROC curve of an SVM model with cross validation

I would like to make a graph like the following in python: That is, one curve for each fold. I have the following code where I use an SVM model to classify some data ...
user avatar
  • 320
0 votes
1 answer
13 views

What does a leaf size of 1 in K-neighbors regression mean?

I am doing hyperparameter tuning + cross validation and I'm constantly getting that the optimal size of the leaf should be 1. Should I worry? Is this a sign of overfitting?
user avatar
  • 109
0 votes
0 answers
7 views

Project/scale a set of 2D points to keep a set of similarities constraints

I have a problem similar to this one posted here MDS scikit-learn example. I have a set of similarities between 2D points that I want to place in a map/plane while ...
user avatar
  • 143
2 votes
0 answers
21 views

Association between categorical variables with no hierarchy in Python

I have a dataset with over 100 possible variable occurrences across 20 columns. At first glance this problem seemed to fit into hierarchical clustering. I started testing with Agglomerative Clustering,...
user avatar
  • 21
1 vote
0 answers
17 views

sklearn pipeline ValueError: Found input variables with inconsistent numbers of samples

I am receiving the following error. I have check shapes of X and y, and did no find error ...
user avatar
  • 11
0 votes
0 answers
19 views

How to get all the parameters of scikit-learn multiclass SVM classifier?

I have trained my multiclass SVM model for MNIST classification in Python using scikit-learn using the following code: ...
user avatar
  • 95
0 votes
1 answer
16 views

Kmeans clustering in python - Giving original labels to predicted clusters

I have a dataset with 7 labels in the target variable. X = data.drop('target', axis=1) Y = data['target'] Y.unique() array(['Normal_Weight', 'Overweight_Level_I', '...
user avatar
0 votes
1 answer
17 views

regarding computing the centroid of high dimensional data

In scikit-learn, or other python libraries, are there any existing implementations to compute centroid for high dimensional data sets?
user avatar
2 votes
0 answers
18 views

Not able to encode multiple categorical columns at once

I have written the following code for encoding categorical features of the dataframe( named 't') - ...
user avatar
1 vote
0 answers
18 views

How do I evaluate if my data represent the target variable before training a machine learning algorithm?

I have a dataset of points cloud where each point in the point cloud has a variable. I am trying to relate the local geometry features to that point variable by using FPFH, This means I am generating ...
user avatar
0 votes
0 answers
23 views

LightGBM predict_proba in thousandths place

Can someone explain to me how my lightgbm classification model's predict_proba() is in thousandths place for the positive class: ...
user avatar
  • 101
0 votes
0 answers
17 views

Predicting using previous data

I am doing an experiment using ultrasonic radar which rotates 180 degrees clockwise and anti-clockwise. When the sensor encounters an obstacle in front, the algorithm should determine which direction (...
user avatar
  • 1
0 votes
0 answers
22 views

AttributeError: 'MissingValues' object has no attribute 'to_list' while i am using LabelEncoder() from sklearn

the same process when done in python 3.9 with pandas and csv dataset it is working fine but how should i use label encoder on geopandas dataframe with python 3.6 and sklearn version 0.24.2.
user avatar
0 votes
0 answers
12 views

Good values for GridSearchCV testing

Good morning, I'm solving a data problem in several and I'm testing the different models between them: Ridge, Lasso and ElasticNet. I wanted the best parameters for my L1 and L2, but how do I choose ...
user avatar
1 vote
0 answers
33 views

Using F_regression to find the best significant features

We are trying to use SelectKBest F_Regression scoring function on a pool of 1000 numerical features, and solve a regression problem. Also, we wanted to paralellize the execution of SelectKBest and we ...
user avatar
0 votes
0 answers
28 views

regression.fit(x_train, y_train) is not working on python

I try to deal with my homework. The Job is to take the Achievement data and perform a multi-linear regression on it. The code is published here. I am quite new to programming in Python and in data ...
user avatar
0 votes
0 answers
13 views

what type of machine learning should i implement for this case

I'm still newbie in machine learning and i need a algorithm that can study linear functions it doesn't have to be a function as i have x and y coordinates and i can feed it that, what it should do is ...
user avatar
0 votes
0 answers
12 views

How to use Splitting for startifying in sklearn for multiple files

I have csv data file for binary classification. I divided it into 5 multiple files and tried to apply the stratification technique so the class label has the same proportion for all the files. but I ...
user avatar
  • 175
0 votes
0 answers
49 views

How to fix : "TypeError: 'StandardScaler' object is not iterable"?

I'm getting the error "TypeError: 'StandardScaler' object is not iterable". The error happens in this part of my code: ...
user avatar
  • 21
0 votes
0 answers
15 views

What is the good way to print classifier lines with sklear learn LinearSVC

I've tried to make a multivariate regression with LinearSVC and I have seen two ways to print the lines of the classifier, and they haven't the same output. I have seen one on this forum and the ...
user avatar
  • 1
0 votes
1 answer
36 views

regression model behaves (predicts) like classification

I have a simple data: ...
user avatar
  • 1
2 votes
1 answer
27 views

How to build regression model on residuals

Let's say you have a good-performing regression model, but the end result is not just yet there. One of the ideas, I came across to improve model performance is to build a second model using the first ...
user avatar
1 vote
0 answers
15 views

How should I OneHotEncod a column of (8128 rows and) 2058 nuniques?

The title, pretty much. I just want to know the best and most efficient way to OneHotEncode a column with like 2058 nuniques. Doing a ...
user avatar
0 votes
0 answers
65 views

ValueError: Found input variables with inconsistent numbers of samples: [1599, 1600]

I have the following code sample shown in the image: Both x and y have the same rows but the splitting fails. I am pretty new to this.
user avatar
2 votes
1 answer
30 views

How do I use wavelet transform for feature extraction correctly?

I'm trying to classify words based on EMG signals using a support vector machine as my model. My dataset includes 15 classes (words) with 230 repetitions and 1000 features each. I already merged all ...
user avatar
  • 21
0 votes
0 answers
11 views

I am getting the value input error

...
user avatar
1 vote
0 answers
19 views

Do these values of bias and variance make sense?

I have this code: ...
user avatar
0 votes
0 answers
25 views

How to make TensorFlow Decision Forests models compatible with scikit-learn?

I am trying to create an ensemble using a tensorflow_decision_forests.keras.CartModel (from TensorFlow Decision Forests) as the ...
user avatar
0 votes
0 answers
13 views

KDE Sampling with negative density and/or class-specific weighting

I have a dataset which contains two overlapping distributions/classes of points. I have been trying to sample from just one of these distributions/classes using the scikit learn Kernel Density class, ...
user avatar
  • 13

1
2 3 4 5
43