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
0answers
6 views

What can be the approaches to merge (ensemble) a NON-Probabilistic model with RandomForest?

I have a RF for Text classification and it gives me accuracy. Almost same metric is given by another model built using ...
0
votes
2answers
14 views

p-value of chi squared test is exactly 0.0

I need to do a chi square test of two of my dataset's categorical variables. This two variables have basically the same meaning but comes from two different sources, so my idea is to use a chi square ...
1
vote
0answers
17 views

How can I plot the covariance matrix of scikit-learn's Gaussian process kernel?

How can I plot the covariance matrix of a Gaussian process kernel built with scikit-learn? This is my code ...
4
votes
1answer
97 views

Reduce multiclass classification targets to binary classification targets in scikit-learn

I would like to reduce multiclass classification targets to binary classification targets. Ideally, this mapping would happen within scikit-learn so the same transformation applies during both ...
1
vote
1answer
9k views

How to avoid memory error with Pandas pd.read_csv method call with GridSearchCV usage for DecisionTreeRegressor model?

I have been implementing a DecisionTreeRegressor model in Anaconda environment with a data set sourced from a 20 million row, 12-dimensional CSV file. I could get the chunks off of the data set with ...
1
vote
2answers
57 views

How do I correctly build model on given data to predict target parameter?

I have some dataset which contains different paramteres and data.head() looks like this Applied some preprocessing and performed Feature ranking - ...
0
votes
1answer
12 views

How to calculate the mean average of word embedding and then compare strings using sklearn.metrics.pairwise

I am totally new to this topic, that's why I am so confused or stuck in this code for a while, but I am not sure how to solve it correctly. My goal is to write a short text embedding using vector ...
1
vote
1answer
45 views

Imbalanced data set with Sample weighting - How to interpret the performance metrics?

Consider a binary classification scenario whereby the True class (5%) is severely outbalanced to the False class (95%). My data set contains numeric data. I am using SKLearn and trying some different ...
2
votes
3answers
3k views

how to prepare data for cross validation in mnist dataset?

How to use k-fold cross validation for MNIST dataset? I read article documentation on sci-kit learn ,in that example they used the whole iris dataset for cross validation. ...
1
vote
1answer
45 views

cannot import name 'LSHForest' from 'sklearn.neighbors'

from sklearn.neighbors import NearestNeighbors, LSHForest ImportError: cannot import name 'LSHForest' from 'sklearn.neighbors' I came to know that LSHForest is ...
1
vote
1answer
885 views

Adding machine learning classifier at the end of CNN layer

I wanted to use the CNN as feature extractor for my images and then fed these features to some machine learning classifiers such as SVM, decision tree and KNN. However when I was trying with SVM I got ...
0
votes
0answers
5 views

Isomap/LLE python library that allows precomputed distance matrix

I want apply some algorithm to the distance matrix before reducing dimensionality using Isomap, LLE and Laplacian Eigenmaps. Are there Python libraries I can use for this?
0
votes
1answer
30 views

SKLearn decisionTreeClassifier does not handle sparse or categorical data

Is there a way in fitting a decisionTreeClassifier in SKLearn to sparse tuples? The data that I have is based on about 100 features, but only a few of them are ever used to make the decision. ...
0
votes
0answers
11 views

Does sklearn.pipeline have a single mechanism for cross-validation regardless of model API?

With a single standard interface (sklearn.pipeline) on top of different regressors, how do I use cross-validation? The example below uses two regressors with different internal cross-validation ...
0
votes
0answers
10 views

How do you optimise BPNN with PSO?

In the context of prediction, how would you optimise a backpropogation neural network with particle swarm optimisation?
0
votes
1answer
12 views

How does Scikit learn KNN handle categorical input variables?

In some articles, it's said knn uses hamming distance for one-hot encoded categorical variables. Does the scikit learn implementation of knn follow the same way. Also are there any other ways to ...
3
votes
1answer
56 views

Issues with self-implemented logistic regression

I am trying to self-implement a logistic regression algorithm to do some self-learning but I am having a bit of trouble with achieving similar accuracy to the logistic regression of sklearn. Here is ...
1
vote
2answers
352 views

How can the labels of AgglomerativeClustering be re-computed?

I am using scikit-learn's AgglomerativeClustering on a large data set. I would like to modify the distance_threshold after the model has already been computed. ...
3
votes
1answer
1k views

How many coefficients does the Logistic regression model has as a function of the number of features?

I have built a logistic regression model using Python anaconda and was surprised to see that the number of model coefficients turned out to be proportional to the training sample size i.e. My ...
2
votes
1answer
290 views

MLP batch iteration in python

I'm using the MLPRegressor in sklearn to train a network with approx 1000 inputs and a continuous output variable. Essentially, the issue is one of image classification (1000 pixels) with the ...
0
votes
1answer
52 views

Dicsrete values as taget variable

I have discrete values in the target variable(Exactly 13 different values in total) . When I am giving that as input to Random forest Classifier ,it gives error that input as continuous. And if I give ...
2
votes
1answer
2k views

Low silhouette coefficient

I am doing a kmeans clustering on a dataset of selling values of articles. Each article has 52 selling values (one per week). I am trying to automatically calculate the optimum amount of clusters ...
3
votes
1answer
881 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 ...
1
vote
1answer
506 views

Using sklearn knn imputation on a large dataset

I have a large dataset ~ 1 million rows by 400 features and I want to impute the missing values using sklearn KNNImputer. Trying this off the bat I hit memory problems, but I think I can solve this by ...
0
votes
0answers
10 views

How can you predict the amount of each expression of the dependent variable for given independent variables?

The starting position is the following: There are categories 1 and 2, as well as features A, B and C. A representation would look like this: What is a way to not only predict the occuring categories (...
3
votes
2answers
139 views

How do I handle string feature while performing model generation

I have data which looks like this ...
0
votes
2answers
18 views

How to convert String data to something more meaningful for regression model training

I have a bunch of data of employees and their salaries. I would like to build a regression model that predicts The columns in question are countries, employment_status, job_title, education All of ...
4
votes
2answers
2k views
0
votes
1answer
26 views

sklearn Lasso vs LassoCV

I have the following code for finding the best alpha in Lasso - first I am using an explicit loop to fit Lasso for each alpha and in the second approach I am using <...
0
votes
0answers
11 views

How can I improve calibration curves?

I am training a binary xgboost classifer with an imbalance of : 85% = 0 class and 14 % = class 1. This was achieved after i took a random sample fromaround 11m to 1M. When i calibrate i get the ...
157
votes
14answers
265k views

Train/Test/Validation Set Splitting in Sklearn

How could I randomly split a data matrix and the corresponding label vector into a X_train, X_test, ...
1
vote
1answer
61 views

Conceptual clustering with sklearn?

How can I perform conceptual clustering in sklearn? My use case is that I have English Wikipedia articles that I'm doing unsupervised learning on (tfidf -> truncated svd -> l2 normalize), and I'd like ...
0
votes
1answer
153 views

KDE on TF-IDF - sensitive bandwidth

I am clustering text based on TF-IDF features and DBSCAN (density based), and trying to rank points based on their 'belonging' to the cluster. Since my clustering is density based and my points can ...
2
votes
2answers
31 views

The Differences Between Weka Random Forest and Scikit-Learn Random Forest

I have used both weka random forest and sklearn random forest in my research, but I have realised that they use different methods to combine the predictions of the base learners i.e. decision trees to ...
4
votes
1answer
178 views

How can I choose the best machine learning algorithms from all kinds of algorithms?

When I want to find a model for my data set, I find that there are lots of algorithms that I can use. I know how to minimize selection choices by separating supervised and unsupervised algorithms and ...
0
votes
1answer
41 views

How to deal with temporal trend in ML

I am fitting a binary classifier and I observe a temporal trend in the response variable, meaning that the actual percentage of positives fluctuates with time, I can see periods where it is high and ...
0
votes
1answer
1k views

Can I use Tensorboard to manage-fjobs and visualize learning on non-Tensorflow algoithrms? (e.g. Scikit?)

I am still searching for a great tool that manages jobs and visualizes learning from my models. Tensorboard is obviously one option given it's massive support. But is it possible to organize jobs ...
1
vote
1answer
47 views

Classification using texts as features

I want to build a classification model to match customers and products. I have a description of each product, and a description of each customer, and the label : ...
7
votes
3answers
9k views

Incremental Learning with sklearn: warm_start, partial_fit(), fit()

I have built an ML model with the goal of making predictions for targets of the following week. In general, new data will come in and be processed at the end of each week and be in the same data ...
0
votes
1answer
18 views

ValueError: Found input variables with inconsistent numbers of samples: [6, 366]

I'm trying to split my x and y into train and test data for my ML model but it's giving me this error: ...
4
votes
0answers
29 views

How sklearn SVM find the initial hyperplane before Optimisation?

The optimization goal of the SVM is to maximize the distance between the positive and negative hyperplanes. But before optimizing, how sklearn first find the positive and negative support vectors and ...
1
vote
1answer
76 views

Distribution of Regression Residuals: Is this a normal distribution?

I've created a histogram as well as a QQPlot from the residuals of my Regression Model: Mean: 0.35 Standard Deviation: 18.14 Judging from these plots, is it okay to say that my residuals are normally ...
0
votes
1answer
51 views

Single image feature reduction at inference time : SVM

I am trying to train a SVM classifier using scikit-learn.. At training time I want to reduce the feature vector dimension. I have used PCA to reduce the dimension. ...
1
vote
1answer
233 views

Decision Tree: Efficient splitting of nodes, minimize number of gini evaluations

I have a dataset specific problem where i need to use a splitting function other than gini_index. This requires me to re-write a decision tree from scratch. I have a working model, but itis highly ...
4
votes
2answers
271 views

Anomaly detection using clustering of highly correlated Categorical data

My data has two columns and both are highly correlated e.g. if column1 has value ABC, column2 should be XYZ i.e. ABC-->XYZ. If column2 has anything else it's Anomaly. Likewise, there are thousands ...
0
votes
1answer
4k 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
1answer
14 views

Cross Validation with One Class Classification in Python

I'm trying to do cross-validation with One Class Classification - I'm using the PyOD lib - but I don't know if I'm doing it right. The precision is too low and I'm also not able to bring up the mean ...
0
votes
1answer
913 views

How to refit GridSearchCV on Multiclass problem

I'm trying to use GridSearchCV for my Multiclass problem. For starters, wanted to test it on KNeighborsClassifier. First, here's the code where I define the function which uses GridSearchCV: ...
0
votes
1answer
50 views

Model Predictive Power and better prediction of 1 or 0 in scikit-learn?

I have two questions about the Logistic Regression model in scikit-learn: Which statistic can show me model predictive power? Which statistic can show me whether my model better predicts event 1 or ...
2
votes
2answers
41 views

SKlearn PolynomialFeatures R^2 score

I'm trying to create a linear regression model with use of PolynomialFeatures. But when I evaluate it, I get really strange scores. I know that R^2 can be applied to this model and I think I've trying ...

1
2 3 4 5
41