Questions tagged [scikit-learn]

Scikit-learn is a Python module comprising of simple and efficient tool for machine learning, data mining and data analysis. It is built on NumPy, SciPy, and matplotlib. It is distributed under the 3-Clause BSD license.

Filter by
Sorted by
Tagged with
-1
votes
1answer
9 views

F1_score(average='micro') is equal to calculating accuracy for multiclasification

Is f1_score(average='micro') always the same as calculating the accuracy. Or it is just in this case? I have tried with different values and they gave the same answer but I don't have the analytical ...
1
vote
2answers
16 views
0
votes
1answer
16 views

Unsupervised Learning::Satellite Images::Single Bands

Has anyone has success with building models using KMeans for classification? I have images that only have one band and it continues to fail. My guess is that the issue is with both size of the image ...
2
votes
2answers
21 views

Clustering list of list of integers

I have ~100 sets of samples with integer IDs. For example, 3 of them could be: a = [0, 1, 3, 4, 6...] b = [1, 5, 9, 102...] c = [1, 7, 10, 42...] I am looking to ...
1
vote
1answer
32 views

Does this line in Python indicate that KNN is weighted?

Does this line in Python indicate that KNN is weighted? clf = KNeighborsClassifier(n_neighbors=5, metric='euclidean', weights='distance') Are the weights the ...
1
vote
1answer
15 views

How to use ADWIN with multiple columns

I want to perform drift detection on data with multiple input values (x0, x1, x2, x3). I'm using an adaptive window algorithm found from sci-kit found here. Doing ...
2
votes
2answers
21 views

What is my training score the mean_train_score or mean_test_score?

I am using sklearn to train some models (random forest, decision tree). For the training I am using RandomsearchCV with Stratified k-fold as cross-validation. Then I make a predictions on the test set ...
-3
votes
0answers
19 views

valueError:Expected 2D array, got scalar array instead ,reshape(1,-1) [closed]

This is the particular section of code: ...
1
vote
1answer
22 views
1
vote
1answer
19 views

Random Forest Model Giving Same Accuracy for different feature sets after tuning

I am having this weird issue and cannot seem to find a solution. I am trying to tune a different random forest model for every different feature-set. Basically from a given data set, I have created 3 ...
2
votes
0answers
30 views

Why does classifier chain ask for at least 2 classes, when I have it

I'm using Classifier Chain with logistic regression and when i try to use fit, i get This solver needs samples of at least 2 classes in the data, but the data contains only one class: 1 but I'm ...
1
vote
2answers
31 views

Can I force DecisionTreeClassifier to use integer conditions when the variable is integer?

I'm trying to visualize a decision tree in python for the purpose of explainability. I noticed that a condition like "NumGoals >= 1.23" could be quite vague for the user and I would much rather to see ...
1
vote
0answers
16 views

How to create an roc plot and calculate AUC for an svm (that does not return probabilities)?

I have some SVM classifier outputting final classifications for every sample in the test set, something like 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1 and so on. The "...
1
vote
1answer
63 views

Why might trees work so much better than boosting classifiers?

I am predicting 10 classes label encoded using scikit-learn with 6 factors, 1.2M cases. DecisionTreeClassifier RandomForestClassifier ExtraTreesClassifier give accuracies (and precision and recall) of ...
0
votes
2answers
29 views

How can I improve the results of my clustering

I am working on a project with the idea to cluster the sound waves of key strokes on a computer. So far what I have done was recorded about 50 keystrokes per key (only have done 1 - 10 so far), found ...
0
votes
1answer
27 views

bad input shape (5634, 2)

I tried everything and I am not sure how to resolve the following error: "ValueError: bad input shape (5634, 2)" This is my first machine learning example so please bear with me. This is the python ...
1
vote
0answers
14 views

Is kFoldLoss simply the average classification error?

I'm using a kNN classifier in MATLAB to classify ECG signals, with 5 fold cross validation I get almost 97% accuracy. However, I'm not entirely sure if this is truly the accuracy value. By default the ...
0
votes
1answer
11 views

Feature Selection algorithm/library for CRF

I am using the Conditional Random Fields CRF suite scikit-learn wrapper algorithm. I have read on the literature various approaches for feature selection, but I cannot find any on that package or, ...
0
votes
1answer
24 views

Naive Bayes / SVM classifiation - min. number of records (Python)

I am doing text classification with Python. I have around 120 records with 2 columns: text class I tokenize, stem and lematize the words, I also did some of my own text preprocessing. When I run the ...
0
votes
1answer
60 views

ValueError: Expected 2D array, got 1D array instead

I would like to extract the 20 most informative features of a very large set of features $X$ coming from a dataset containing clinical data by using the RFE function from scikit-learn in Python. $X$ ...
0
votes
0answers
18 views

Split time series data into Train Test and Valid sets in Python

I'm working on a project in which I have combined 2 datasets if time series (e.g D1, D2). D1 was with the 5-minutes interval and ...
0
votes
2answers
25 views

Managing NaN in target variables (testing)

Please can someone advise me on how to handle NaN in my target variables set? I've tried a variety of things but none is working. Here's what I've tried: Imputing zeros (0) in Y_test Replacing NaN ...
0
votes
1answer
30 views

How to encode an array of categories to feed into sklearn

I'm working on a recommendation problem, broadly following the Youtube paper on theirs. Their surrogate problem is to recommend the next video a user will watch. One feature they include in their ...
0
votes
0answers
22 views

Regression Task - Spark, PyTorch, TensorFlow or scikit

I know it's a broad question, sorry for that, but I'm still testing the waters with machine learning. I have a typical regression task (predict target numbers with the help of features x,y,z) and a ...
1
vote
4answers
102 views

How to combine GridSearchCV with Early Stopping?

I'm a beginner in machine learning and want to train a CNN (for image recognition) with optimized hyperparameter like dropout rate, learning rate and number of epochs. The optimal hyperparameter I ...
1
vote
2answers
26 views

Is it possible to know the output vectors of MLP Classifier of scikit learn?

I'm a beginner with scikiti-learn library. I have an ANN with 3 input, 2 hidden layers and 3 output. ...
0
votes
1answer
13 views

sklearn.feature_selection vs xgboost feature_importances?

sklearn.feature_selection vs xgboost feature_importances Can somebody explain in-detailed differences between sklearn.feature_selection and xgboost feature_importances? And how the algorithms work ...
1
vote
1answer
31 views

Why are my Decision Tree Leafs not pure?

I'm making a using DecisionTreeClassifier from SKlearn (v0.21.3) with its default settings, using Python. I do not want regularize it in any way, I want it to ...
0
votes
0answers
14 views

Problem with param_name in validation_curve while using Pipeline

I have got problem with sklearn function called validation_curve. ...
0
votes
0answers
20 views

Why XGBoost regressor predicts behavior but not the amplitude?

I am very new to machine learning and I am trying to use XGBoostRegressor for my machine learning model (it has to do with physical modeling). I found out that it works very well for predicting the ...
0
votes
0answers
16 views

Combining two CRF-models with sklearn-crfsuite

I'm experimenting with a concept I saw in this research paper. That is, first I train a CRF-model for named entity tagging, then I do implement an identical model, except for that one also takes the ...
2
votes
3answers
53 views

GridSearchCV vs RandomSearchCV and How it works?

GridSearchCV vs RandomSearchCV Can somebody explain in-detailed differences between GridSearchCV and RandomSearchCV? And how the algorithms work under the hood? As per my understanding from the ...
0
votes
0answers
8 views

SGDClassifier partial_fit() for online learning - is one step of gradient descent enough?

I'm interested in incremental (online) learning for my logistic regression model trained with SGDClassifier. Basically updating the model as more labeled data comes ...
2
votes
1answer
66 views

Is there any optimal way on feature selection for more than one classification algorithms?

I have a wine dataset with 13 features that indicates 3 different wine classes (target), and k-NN, SVM with linear kernel and SVM with rbf kernel algorithms to be tried with this dataset. My goal is ...
2
votes
0answers
24 views

What is the scikit learn Non-negative Matrix Factorisation Coordinate Descent algorithm?

What is the scikit-learn Coordinate Descent (CD) algorithm for Non-negative Matrix Factorization (NMF)? The sklearn implementation of NMF has two different solvers, Coordinate Descent and ...
0
votes
1answer
13 views

Testing if a sample fits into an existing cluster

I have a sample of data I'd like to create a model from, which would create N clusters. After the fitting to clusters, I'd like to test various samples against the existing clusters, seeing if the ...
0
votes
1answer
30 views

Permutation feature importance vs. RandomForest feature importance

What is the difference between Permutation feature importance vs. RandomForest feature importance? What are the disadvantages vs. advantages of the two techniques?
1
vote
0answers
14 views

Using a trained classifier in an Android app

As the title suggests, I'm attempting to train some different classifiers into an android app. The main question I have is how to represent the different models in a neat and effective way, from ...
1
vote
1answer
20 views

How to interpret ANOVA results?

I am trying to identify what attributes are not relevant in my dataset to remove them before fitting a classifier. The target is a categorical variable with three different values. I also have a lot ...
3
votes
2answers
214 views

Need machine learning algorithm to fill in time-series data

I am currently dealing with a time-series data set with cyclical gaps every 30 minutes (30 minutes of data, 30 minutes of no data). Is there a relatively simple way of using scikit-learn (or some ...
0
votes
0answers
27 views

Multi-class classification with custom loss matrix?

Suppose I have classes A,B,C and some predictors. I want to minimize the loss function where the loss penalties are arbitrary penalties applied to each possible misclassification e.g.: $$L = \begin{...
1
vote
0answers
28 views

Linear Regression on data with bimodal outcome

I have a data set with 3,000 features and continuous dependent variables of time with 18,000 instances. The histogram of the dependent variables show that the they have a bimodal distribution. I am ...
0
votes
0answers
21 views

How do I get confidence intervals for an ElasticNet in sklearn?

I need to produce a row for the confidence interval for every field that I am calculating coefficients and scores off of. So here is my code so far- ...
0
votes
0answers
25 views

how to use sklearn without feature selection

I am trying to study the effect of using feature selection onmy text classification code . I want to make a rating without any feature selection, but sklearn use document frequency (df) by default ...
0
votes
1answer
54 views

TypeError: 'GridSearchCV' object is not callable - how do I use a pickle of an SVM (Scikit-learn)?

I have created an SVM in Scikit-learn for classification. It works; it prints out either 1 or 0 depending on the class. I converted it to a pickle file and tried to use it, but I am receiving this ...
4
votes
2answers
233 views

Training a model sample by sample

I'm training a Scikit model but it seems that in all examples, they call the fit method on the entire training set. What I want to do however is call it per sample (...
0
votes
1answer
48 views

Increase accuracy of classification problem [closed]

I am trying to build a classifier that predicts the compiler given some operations of assembly code. Here is the pandas dataframe: What I do is using a TfidfVectorizer and select the features that ...
1
vote
1answer
43 views

How do I force specified coefficients in a Linear Regression model to be positive?

Looking for a way to do this in Python. scipy.optimize.nnls forces all coefficients to be positive. Some additional context: I have a data frame with a some explanatory variables and a response ...
0
votes
0answers
12 views

can i get weights per iteration of MLP?

im building an mlp with scikit learn. Is there a way I can access weights and biases of the output layer per iteration? There is an option mlp.coefs_ But it ...
0
votes
1answer
25 views

Applying Standardization OLS estimator

I have basic understanding of how to perform linear regression with sklearn and statsmodels. There are several questions that I would like to ask regarding Linear Regression (OLS estimator) : Is ...