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
7 views

How to handle features containing strings in XGBoost in AWS Sagemaker

How can i handle the string containing spaces and colons as a feature for my xgboost classifier model? AWS Sagemaker requires the input in csv format, I don't know how to convert the string to the ...
2
votes
2answers
112 views

How to use a set of pre-defined classifiers in Adaboost?

Suppose there are some classifiers as follows: ...
0
votes
1answer
25 views

How to use random forest with large number of categorical features and categories?

I have 2 features productName and productCategory , both of them are strings. I have a category named supplier. There are 4000 ...
1
vote
3answers
38 views

Are there ML Libs in Python robust to missing data?

So I was searching on how to handle missing data and came across this post from Machine Learning Mastery. This article states that some algorithms can be made robust to missing data, such as Naive ...
1
vote
1answer
116 views

How to use SMOTE in Stacking in SKLearn?

I have a data set X,y and split them to train and test data. ...
0
votes
1answer
16 views

How to prune the features using recursive feature elimination?

I have some kind of spatial data for nearly 1000 locations and at each location around 5000 features. I am doing neighborhood analysis to identify which features are predominant in local neighborhood. ...
1
vote
1answer
20 views

Using Sklearn's predefined split

I am working on a binary classification task using SVM. The dataset is quite large so I don't want to use k-fold CV for parameter tuning, but instead a simple train-validation-test split. I have done ...
0
votes
1answer
16 views

Neural network for a data with 5 inputs and 1 output of 3 different types

I am trying to create a neural network for my data which is as follows ...
1
vote
1answer
20 views

For multi-class classification in SGDClassifier how do I tell if it is using one-vs-rest or one-vs-one by default?

According to the Geron book, for multi-class classification, SGDClassifier in scikit-learn uses one-vs-rest. But how can I tell which one is used as it doesn't ...
0
votes
0answers
19 views

How to repeat classification experiment with different set of data by loop

I want to repeat my experiment pipeline to validate my feature extraction. My goal is with different set of data which randomly picked as train test and validation, I want to check if the result are ...
4
votes
1answer
186 views

How can precision be less than one in Leave-One-Subject-Out binary classification if each subject contains only one class

Say I'm trying to classify a medical condition. Theres only two classes: Sick and Healthy. I build a model and I can't split the data because I don't want data from the same patient being in training ...
1
vote
1answer
23 views

Why is the optimal C chosen by GridSearchCV so small?

I'm trying to use GridSearchCV to select the optimal C value in this simple SVM problem with non-separable samples. The issue I'm having is that when I run the code the optimal C is chosen to be ...
0
votes
0answers
70 views

How to Determine Alpha values in Random Forest Classifier

I am working on a classification problem where I am applying various machine learning models. I have used DecisionTreeClassifier from Sklearn on my dataset using the following steps: Calculated alpha ...
2
votes
2answers
33 views

Find 10 most similar data points from 100?

I am trying to solve a problem where I need to group battery cells that are most similar to each other to form a reliable battery pack. It seems like a clustering problem but I only need to find the ...
0
votes
1answer
25 views

How to professionally spell library names such as “scikit learn”?

For example for inclusion in a CV. This is mostly a question of whether one should use capital letters or not. Usually I search the library to find how the library name is spelled on the official page....
0
votes
0answers
17 views

How to write decider function for multiple models

I have trained two classifiers .. Text Classification and Image Classification. So both models gives score for each class. For example there are 3 classes. Each model give array of 3 confidence score ...
0
votes
1answer
22 views

Precision, recall and accuracy metrics significantly different between training/validation and actual predictions

I have two sequential models built with Keras that train on data from a CSV file. This is how they are built ...
0
votes
3answers
39 views

converting array to a true/false matrices

I have a data set where each record is a json document with a label, and an array of signals. The signals will vary for each record: ...
0
votes
1answer
49 views

How does class_weight work in Decision Tree?

I am interested in Cost-Sensitive learning. And I am trying to understand how class_weight in DecisionTree works in terms of math. I read a lot of articles that ...
2
votes
1answer
24 views

How does the inertia cython implementation in scikit-learn for kmeans work? [closed]

Specifically, what do the & symbol stand for? and why is the column index always 0? ...
2
votes
1answer
36 views

Is CRF suitable for multi-words Named Entity Recognition?

I've a problem where I should create a custom NER by using sklearn CRF. In the official tutorial, they are using CoNLL2002 corpus is available in NLTK where the entities are represented with a single ...
0
votes
1answer
29 views

unable to predict by LinearRegression

Should I add csv as text in SO question? There's lot more data. ...
0
votes
2answers
98 views

sklearn package with AttributeError: 'MissingValues' object has no attribute 'to_list'

I am currently trying to reproduce this tutorial on building a CNN based time series classifier for human activity recognition. My setup is: Windows 10, Pycharm IDE with a new project for this ...
1
vote
1answer
36 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 : ...
1
vote
0answers
30 views

How to implement your own word list for sentiment analysis?

I've finished web scraping and cleaning the text i'm interested in and i also have the sentiment word list i want to apply to it. However, i have a few conceptual and implementation problems. my ...
0
votes
0answers
63 views

sklearn gridsearch lasso regression: find specific number of coefficients

I am using GridSearchCV and Lasso regression in order to fit a dataset composed out of Gaussians. I keep this example similar to this tutorial. My goal is to find the best solution with a restricted ...
0
votes
0answers
9 views

Forecasting as a supervised regression task, with uneven length timeseries - how to split?

Consider a number of timeseries. Here we have 3, just to make it dead simple. Note that they're all different lengths. The very first thing I do is splitting by the original sample dimension: Then, ...
2
votes
3answers
64 views

Comparing ML models to baselines

When comparing ML models with baseline or "dummy" models, are there best practices for building and comparing baselines? I'm doing a binary classification task where 40% of the samples are ...
0
votes
0answers
32 views

Loss increasing and accuracy decreasing

I've implemented a shallow FC feedforward neural net with 2 input nodes, 1 hidden layer with 4 nodes (tanh activation) and 1 outputnode with sigmoid activation function and binary cross-entropy loss. ...
0
votes
0answers
20 views

Why is doing a ShuffleSplit with GridSearchCV decreasing the performance of my model?

I'm using the Boston Housing dataset in Keras, and neural networks for this regression problem. The following is the code I use to prepare the data, build the model, and fit it with GridSearchCV. <...
0
votes
0answers
12 views

Results Random Forest Regression Optimization [duplicate]

I'm going to optimize the hyperparameters of a Random Forest Regressor using scikit-learn and GridSearchCV, with the following code: ...
0
votes
1answer
25 views

Changing order of LabelEncoder() result

Assume I have a multi-class classification task. The labels are: Class 1 Class 2 Class 3 After LabelEncoder(), the labels are transformed into 0-1-2. My questions are: Do the labels have to start ...
1
vote
1answer
24 views

RF regressor for probabilites

I am using sklearn multioutput RF regressor to learn statistics in my data. So my target contains several probabilities for the different features, and the sum of all these probabilities is one as ...
0
votes
0answers
14 views

SelectKBest for regression `f_regression` behaves weird when changing the random_state parameter when splitting

I am working on a regression project using the Audi dataset from Kaggle. I have looked at other notebooks and i saw that people use SelectKbest. I tried using the same thing, but when I was splitting ...
3
votes
1answer
54 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 ...
0
votes
1answer
26 views

LinearRegression with fixed slope parameter

I have some data $(x_{1},y_{1}), (x_{2},y_{2}), ..., (x_{n},y_{n})$, where both $x$ and $y$ represent real numbers (float). I want use Scikit-learns LinearRegression model to fit a model of the form: $...
1
vote
0answers
22 views

How to evaluate KDE against histogram?

I am currently testing some approaches for density estimation, and I think the basic approach of histograms may not be the best option to me and KDE is certainly a good alternative to go. While ago I ...
0
votes
1answer
163 views

Classification Threshold Tuning with GridSearchCV

In Scikit-learn, GridSearchCV can be used to validate a model against a grid of parameters. A short example for grid-search cv against some of DecisionTreeClassifier parameters is given as follows: <...
1
vote
1answer
27 views

cost-complexity-pruning-path with pipeline

I'm using Kaggle's titanic set. I'm using pieplines and I'm trying to prune my decision tree and for that I want the cost_complexity_pruning_path. The last line of code produces the error: ...
0
votes
1answer
67 views

Statsmodel logit with sample weights

Using sklearn I can consider sample weights in my model, like this: ...
0
votes
0answers
26 views

Results of quadratic SVM in Matlab are different from the results obtained in Python

I am trying to replicate a quadratic SVM classifier from Matlab to Python, however I am having different results regarding the accuracy. In Matlab the accuracy is 0.8955 meanwhile in Python the ...
1
vote
1answer
22 views

What is different between R2 and mean of R2 in multiclassification probelm? Which one is correct?

I have a question. I have a big dataset (unfortunately confidential). What I did? I have trained my model with Naive-Bayes. ...
0
votes
2answers
27 views

How match output (pred value) to input value

I'm working with data(with 4 columns which are p(product), M(name of the store)), I want predict the demand of store for that I sued SVR on the data by theses formulation: ...
1
vote
0answers
32 views

Apply error analysis on the iris dataset for a specific type of misclassification

Suppose that I have the well known iris dataset and I want to perform error analysis on the misclassified examples, more specifically for a specific class. I don't ...
1
vote
0answers
20 views

Multiclass Classifier comparison decision regions

How can I get the very same effect of this tutorial in Scikit Documentation with more than 2 classes? Let's say we'll keep only the first dataset (the linear separable one) and substitute it with <...
1
vote
2answers
85 views

How can the labels of AgglomerativeClustering be re-computed?

I'm using scikit learn's AgglomerativeClustering on a large data set. I want to modify the distance_threshold after the model has already been computed. Computing ...
2
votes
0answers
15 views

Methods of de-emphasizing some dimensions in a cluster analysis

I'm trying to understand how "weightings" on different dimensions in a cluster analysis might relate to the range of values along a given dimension in the dataset. DATA SET List of 1,000 to ...
0
votes
1answer
55 views

IterativeImputer Evaluation

I am having a hard time evaluating my model of imputation. I used an iterative imputer model to fill in the missing values in all four columns. For the model on the iterative imputer, I am using a ...
1
vote
1answer
35 views

Geolocation Based Anomaly Detection in IPs Using Isolation Forest

I'm trying to detect anomalies based on geolocation from IP addresses on a server access log file. I have created two features country and geo_velocity, using the IP address and the timestamp of each ...

1
2
3 4 5
37