Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

1
vote
1answer
19 views

Is a good shuffle random state for training data really good for the model?

I'm using keras to train a binary classifier neural network. To shuffle the training data I am using shuffle function from scikit-learn. I observe that for some shuffle_random_state (seed for ...
3
votes
0answers
24 views

Scaling does not speed up the SVM model

I tried to standardize the training data with samples of 629,145 rows and 24 features: ...
2
votes
0answers
19 views

K-fold cross validation of scikit-learn with confusion matrix of Keras

I intend to display confusion matrix using Keras while K-fold of scikit-learn. My code using Keras is: ...
2
votes
2answers
17 views

What does a negative coefficient of determination mean for evaluating ridge regression?

Judging by the negative result being displayed from my ridge.score() I am guessing that I am doing something wrong. Maybe someone could point me in the right direction? ...
3
votes
1answer
29 views

Is shuffling training data beneficial for machine learning?

I was curious to know if shuffling ML training data is beneficial to better results? Sorry not a lot of wisdom here, but I have been reading a post from pythonprogramming.net for this topic. I ...
3
votes
0answers
30 views

Why I am getting prediction score 1 i.e. 100%

I am reading few parameters and trying to predict target value using Linear regression and GB. Surpicingly I am getting score = 1 on test data. How come? Can anyone tell me whats wrong with this code? ...
1
vote
0answers
7 views

Get Decision Tree Prediction With Random Forest

If I give random forest parameters as RandomForestClassifier(n_estimators=10,bootstrap=False,max_features=None,random_state=2019) Should it be creating 10 same ...
1
vote
1answer
11 views
1
vote
1answer
24 views

Why am I getting very different results between SVC, LinearSVC and Naive Bayes?

I am doing classification by using bag-of-words model. The goal is to locate users based on their tweets. Splitted the data as 80% training and 20% test. I did experiments with sklearn's SVC and ...
2
votes
1answer
51 views

ML regression poor performance

I am experimenting with 3 years time series electrical demand data (kW) for a building and attempting to create regression supervised ML models from sci kit learn regressor algorithms but I have very ...
2
votes
1answer
19 views

Normally distribute occurence or counts

I am creating a mock of sales data. One of the columns is salesperson_id where each id can occur more than once (a salesperson can have multiple sales). I want to ...
1
vote
0answers
18 views

Tool For Multi-Label Image Classification

I am currently working on a project that requires multi-label image classification. The best way to achieve this seems to be through Binary Relevance. I was intending to use a convolutional neural ...
1
vote
1answer
15 views

Online vs Batch Learning in Latent Dirichlet Allocation using Scikit Learn

Reference: https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.LatentDirichletAllocation.html I'm looking at the LDA algorithm from Scikit Learn for topic modeling. Can someone ...
6
votes
0answers
49 views

How to use Scikit-Learn Label Propagation on graph structured data?

As part of my research, I am interested in performing label propagation on a graph. I am especially interested in those two methods: Xiaojin Zhu and Zoubin Ghahramani. Learning from labeled and ...
1
vote
1answer
31 views

Is it possible to plot decision boundaries for only a subset of features?

I have a sklearn Random Forest classifier with 59 features as input. I'd like to plot the decision boundaries of only two features at indices i1 i2. If I use the average/median values for the ...
1
vote
1answer
21 views

How to find what values are assigned to labels that where encoded using LabelEncoder?

places = ['India','France','India','Australia','Australia','India','India','France'] Here places are the DataFrame Series, now how can I find that which label ...
4
votes
1answer
67 views

Does Gradient Boosting detect non-linear relationships?

I wish to train some data using the the Gradient Boosting Regressor of Scikit-Learn. My questions are: 1) Is the algorithm able to capture non-linear relationships? For example, in the case of y=x^2,...
1
vote
1answer
23 views

What is the difference between lightgbm.LGBMModel and lightgbm.LGBMClassifier?

https://lightgbm.readthedocs.io/en/latest/Python-API.html I have compared both of them in the lightgbm documentation and could not figure out which one I would choose and why I would choose one over ...
0
votes
1answer
18 views

sklearn predict: IndexingError: ('Too many indexers', 'occurred at index <name>')

The goal of what I'm trying to accomplish here is to have the output contain all of the use_cols but the model only be built to calculate on categorical_features. The output will then be used to ...
0
votes
0answers
18 views

Sci-Kit Learn Neural Network Attribute Advice

I'm working on a neural network for a set of weather data, and I'm looking for advice on what attributes should be included, and which are unnecessary. The data I'm working with includes 16,000 ...
1
vote
1answer
32 views

SciKit-Learn Decision Tree Overfitting

I'm pursuing a computer science minor at my university, and one class I'm in is Machine Learning. We have a project to utilize a few algorithms we have learned so far. I've been using SciKit-Learn to ...
1
vote
1answer
26 views

Document parsing modeling and approach?

I'm relatively new to data science / machine learning (yes, I know) and am experimenting with text analysis. I only want a relatively naive approach and am looking to know whether my approach is valid ...
0
votes
0answers
17 views

Feature selection using a filter for multiclass problem: What if many features are strongly predictive of few classes?

I'm doing text classification with a bit more than 100 classes. First, I would like to do feature selection by using a filter approach (mutual information or chi2). I planned on using ...
0
votes
1answer
17 views

Using keras with sklearn: apply class_weight with cross_val_score

I have a highly imbalanced dataset (± 5% positive instances), for which I am training binary classifiers. I am using nested 5-fold cross-validation with grid search for hyperparameter tuning. I want ...
1
vote
1answer
62 views

How to use sklearn train_test_split to stratify data for multi-label classification?

I am attempting to mirror a machine learning program by Ahmed Besbes, but scaled up for multi-label classification. It seems that any attempt to stratify the data returns the following error: ...
0
votes
2answers
25 views

Why is Local Outlier Factor classified as Unsupervised if it requires training data with no outliers?

In Scikit-Learn, the Local Outlier Factor (LOF) algorithm is defined as an unsupervised anomaly detection method. So then I don't understand why this algorithm requires pre-filtered training data. ...
1
vote
1answer
33 views

Cross validation for highly imbalanced data with undersampling

In my problem, I am dealing with a highly imbalanced data set, say for every positive class there are 10000 negative one. A normal starting method to train a model is to undersample the data. In this ...
0
votes
1answer
12 views

What is difference between leave one subject out and leave one out cross validation

What is the difference between leave one subject out cv and leave one out cross validation (loocv)? are they same or different?. I have images of 24 subject and according to literature, leave one ...
3
votes
1answer
34 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 ...
1
vote
0answers
29 views

Improve model performance on unseen data

NOTE: This question was first posted on a different SO forum but I received suggestions to move it here This is a follow-up question to a question I had previously posted on this forum We conducted ...
0
votes
0answers
10 views

What is the difference between PySpark's featuresCol, labelCol, predictionCol, and probabilityCol?

I am attempting to train a random forest classifier (pyspark.ml.classification.RandomForestClassifier) on a large dataset (~70gb). However, I am not sure what to ...
1
vote
0answers
9 views

Qualitative prediction based off data containing mixed qualitative and quantitative values? [closed]

I'm trying to find a way to predict an integer value based off of an item's prior sale history and am inquiring for a starting point on how to approach this. The factors are as follows (Data Type in ...
0
votes
0answers
9 views

Determine input array that approximates a target output array from complex numerical simulation?

I believe the following problem is ideally suited to a machine intelligence approach, but am unsure where to start. I've used scikit-learn previously with downloaded datasets, but the following seems ...
0
votes
0answers
12 views

Insights from RandomForestRegressor (or any RF output)

Beyond the feature importance calculations from a RandomForestRegressor in sklearn, what are some good strategies to draw ...
0
votes
1answer
26 views

Feature importance decision algorithms

I have a dataset with 100+ feature columns. My client asked me to choose "the top 10 most important features" from the 100+. From this post, I learnt that Random Forest can help me ranking the ...
0
votes
1answer
54 views

Mean Average Precision python code

How to compute MAP in python for evaluating recommender system effectiveness.Is there any library in sklearn or code in python for it? I want to compute the effectiveness of my Recommender System by ...
1
vote
2answers
36 views

How do I get the feature importace for a MLPClassifier?

I use the MLPClassifier from scikit learn. I have about 20 features. Is there a scikit method to get the feature importance? I found clf.feature_importances_ but it seems that it only exists for ...
0
votes
0answers
24 views

Decision Tree Classifier For Minimizing Arbitrary Cost Function

Assume the input $X$ of $n$ data points, and $m$ features. Also, assume I have four different Heuristic algorithms ($h_1$, $h_2$, $h_3$, $h_4$) that are obtained independently of $X$. Problem: ...
0
votes
1answer
20 views

Why is correlation between my independent variables helping my linear regression model?

I am working with PUBG data and developing a linear regression model for the same ! Now there were three features in my original dataset, ridedistance, swimdistance, walkdistance. I combined the three ...
2
votes
1answer
51 views

Finding a Data pattern [closed]

I am new to this data science field. I have data of points in 3D space and each point "helps" a metric. I have the sets of points and corresponding metrics. Data might look like: ...
0
votes
3answers
36 views

Kmeans large dataset

we are currently performing a K-MEANS under scikit-learn on a data set containing 236027 observations with 6 variables in double format (64 bits). According to our calculations, the complexity of the ...
0
votes
0answers
24 views

Basic code flow for training and finalizing models using sk_learn

I am new to machine learning. I am trying to implement a regression solution in my product, using sk-learn library. I came up with below execution plan. Please help me by reviewing the same. [1] ...
1
vote
2answers
48 views

Accuracy differs between MATLAB and scikit-learn for a decision tree

Is there any possibility to vary the accuracy of same data set in matlab and jupyter notebook by using python code ? For same data set, at first I applied it in matlab and get 96% accuracy for ...
1
vote
0answers
21 views

IQR Score outliers detection in Python [closed]

I have a large dataset "train" incl. a column ClientFreeSource from which I want to exclude an outliers. For that purpose I decide to use IQR score. I've tried: ...
0
votes
1answer
22 views

How can we apply PCA to reduce dimensionality of a heterogenous dataset?

I have a dataset containing insurance Claims with quantitative and qualitative variables but PCA refuses to convert or work with "string" type variables. This is the code I used : ...
1
vote
2answers
37 views

Reg. Pandas factorize()

-Hi Experts- I just read about factorise() function in Pandas. Using this I'm able to encode (enumerate) my string values into numbers. But, now I'm not able to understand what numbers corresponds ...
0
votes
1answer
12 views

Any cluster algo can cluster time series datasets based on variation ratio(or quantity)?

I learn machine learning from sciki and read its documents. Clustering cluster groups based on the euclidean distance and filter them by different ways ex: guassian distribution, or mean-shift...etc. ...
0
votes
0answers
21 views

How to structure a scikit-learn machine learning project for predicting sports outcomes?

I'm a beginner in machine learning so please bear with what seem like uninformed questions. I'm trying to create a model that can predict the outcomes of sporting events. My approach to training and ...
0
votes
0answers
183 views

ValueError: Found input variables with inconsistent numbers of samples

I am trying to apply randomized search from scikit learn to my Neural Network but i am having trouble with shape of X and Y My code follows ...
0
votes
1answer
68 views

How to calculate Accuracy, Precision, Recall and F1 score based on predict_proba matrix?

I found this link that defines Accuracy, Precision, Recall and ...