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
1
vote
1answer
27 views
0
votes
3answers
17 views

Creating numeric word representation of input sentences resulting in MemoryError

I am trying to use CountVectorizer to obtain word numerical word representation of data which is essentialy list of 160000 English sentences: ...
0
votes
0answers
10 views

Are my classification results like accuracy, precision, recall etc significant and valid for general data?

So I have this data let's say of size (2000,11), and I want to do perform a binary classification based on these eleven features. There is a class Imbalance between ...
0
votes
1answer
16 views

roc_auc_score from sk-learn gives error when test label vector with classes has only a subset of the whole set

I have an imbalanced dataset. Does it make sense to compute the roc-auc for the classifier I created in a holdout set? Here's very artificial MWE: ...
1
vote
1answer
48 views

Imbalanced classification task – Discrepancy between learning curves and test set evaluation

I have a binary classification task related to customer churn for a bank. The dataset contains 10,000 instances and 11 features. The target variable is imbalanced (80% remained as customers (0), 20% ...
4
votes
1answer
158 views

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

I am a beginner at data science and I’ve been learning machine learning for a while with some courses online without any help of a teacher. After I’ve got to work with some real projects on my own, I ...
0
votes
1answer
16 views

how to choose the best machine learning algorithms from all kinds of algorithms? [duplicate]

guys, I am a beginner at data science and I’ve been learning machine learning for a while with some courses online without any help of a teacher and after I’ve got to work with some real projects on ...
0
votes
0answers
15 views

Could gini impurity rise as we go through decision tree?

I have a DecisionTreeClassifier built with sklearn (criterion="gini"), for which I need to explain how each particular ...
0
votes
0answers
26 views

Feature Importance interpretation

I want to audit the results of regressions I ran, and hopefully gain more insights about a treatment effect through sklearn's feature importance function (...
0
votes
0answers
6 views

Sktime import tsregression.org (.ts) file giving format error

I have to import these dataset (e.g AppliancesEnergy) from http://tseregression.org/, in order to do some Regression using XGBoost algorithm, these are .ts files. I've followed the tutorial in https://...
0
votes
1answer
17 views

Kernel dies or proses stuck when making LR prediction on dataframe using apply

I'm trying to making predictions with a simple model. model=LogisticRegression() model.fit(X_train,y_train) After fitting, i try to make predictions. A sample ...
2
votes
4answers
95 views

Predicting Disease Drugs

I have a dataset in the format: ...
0
votes
0answers
10 views

Class Weight in sklearn DecisionTreeClassifier impact during prediction

I understand that class weights are used during splitting to weigh whatever metric in the children of the split. However I cannot find anywhere whether class weights also impact prediction or are ...
0
votes
1answer
31 views

Encoding with OrdinalEncoder: TypeError: unhashable type: 'numpy.ndarray'

I'm trying to do a Random Forest in a data-set with numerical and categorical variables in order to obtain a categorical result (two possible classes, column name "predicción"). I'm using ...
1
vote
1answer
31 views

Why RandomForestClassifier doesn't have cost_complexity_pruning_path method?

In trying to prevent my Random Forest model from overfitting on the training dataset, I looked at the ccp_alpha parameter. I do notice that it is possible to tune ...
0
votes
0answers
10 views

Why one of the features is dominating all rest of the features in my trained SVM?

I have been given a task to train the SVM model on conll2003 dataset for Named Entity "Identification" (That is I have to tag all tokens in "Statue of Liberty" as named entities ...
1
vote
1answer
26 views

What is the purpose of positive parameter in sklearn.linear_model.ElasticNet?

I saw this parameter in the sklearn.linear_model.ElasticNet. What is the purpose of this? What is the possible scenario where we want to force the coefficients to ...
1
vote
0answers
33 views

how to perform clustering using dtw and some clustering method like kmeans

I have a timeseries(temperature of a sensor)and I want to apply an unsupervised clustering that. I've already done that using sklearn library and Kmeans. but the problem is that I don't know how to ...
1
vote
1answer
44 views

Which algorithm is best for predicting diseases if symptoms are given? [closed]

After Topic modelling through LDA, I get the following dataset as result. ...
0
votes
2answers
25 views

Obtain precision at a certain probability value [closed]

With scikit-learn, one is able to compute the precision values as well the predicted probability output. To compute the precision values, the sklearn precision/recall function takes the true target ...
1
vote
1answer
305 views

NameError: name 'model' is not defined Keras with f1_score

I'm having a problem with my Keras model, in the .compile() I use accuracy, loss, precision, recall and AUC, but also I need f1_score, due to Keras doesn´t include f1_score, I tried to calculate by ...
1
vote
1answer
17 views

Sklearn xgb.fit: TypeError: fit() missing 1 required positional argument: 'y'

I am new to ML, and XGB is really confusing me. I understand that for Python XGB can be imported directly from the xgb library or via SKLearn. The methods for xgb from the direct xgb library also ...
1
vote
0answers
8 views

Listing categorical variables captured using OrdinalEncoder

Long time listener, first-time caller..! I've searched and have been unable to find an existing solution to the problem outlined below. I have a large list of discrete categorical data that has now ...
1
vote
0answers
34 views

How to deal with multiple binary timeseries?

I have a time series data looks like this userID month year target user1 1 2 1 user2 12 2 0 ... ... ... ... userN 6 3 0 with about 2000 unique userID, ...
0
votes
0answers
28 views

How to suppress Python from showing status of my random forest run?

How can I stop scikit-learn Random Forest from displaying the following status output during run? I have already set verbosity to -1 in RandomForestClassifier() and GridSearchCV() ...
1
vote
1answer
40 views

Understanding hierarchical clustering features importance

I made a hierarchical clustering with scikit : selected_model = AgglomerativeClustering(n_clusters=8) hierarchical_clustering8 = selected_model.fit_predict(answers) ...
0
votes
1answer
36 views

ColumnTransformer worse performance than sklearn pipeline

I have an (unbalanced , binary data) pipeline model consisting of two pipelines (preprocessing and the actual model). Now I wanted to include SimpleImputer into my ...
1
vote
0answers
31 views

How to handle unclassifiable data in the dataset

Premise: Classification problem Input is three text fields Output classes are A, B, A&B (Note: A and B are not always exclusive though usually are, hence the 'A&B' class) Sci-Kit Learn is the ...
1
vote
0answers
12 views

Is it possible to see the output for each layer in a mlp? using SKLearn

I have a simple NN which I have made with SKLearn. I have extracted: The weights sent to each node The bias assigned to each activation function But I can't see a way to get the output of the ...
3
votes
0answers
26 views

Understanding an MLP coefficient array

I have implemented a super simple MLP using SKLearn. I have a 2 hidden layer model and 31 features on the input layer. So the lengths of the arays are 31, 20 and 10. ...
0
votes
0answers
10 views

Compare multiple confusion matrix with unbalanced data?

I have a dataset with about 240k points, where the first 30k are "normal" (first class) and all the other 210k are considered anomalies (second class). I have applied on it four different ...
1
vote
0answers
17 views

How should you preprocess the data before K-fold validation?

I often see Kaggle notebook authors preprocessing the entire training data prior to splitting it for K-fold validation, but does this have a risk of leaking information into the validation set each ...
2
votes
2answers
44 views

Deep Neural Network Model in sklearn Pipeline

Is it possible to add a deep neural network model as the estimator/model in an sklearn Pipeline? or is it only possible for ML models as the estimator. For example, ...
1
vote
0answers
19 views

Is there a "tree-based-correlation" for tree-based algorithms?

Although correlated features are not a big issue when training tree-based models, they spoil model explainability. When several features correlate, sometimes they may be picked at random. Then their ...
1
vote
0answers
25 views

How to implement kfold and cv into Hybrid feature selection and evaluate the classification model performance?

I have been working on a Hybrid feature selection combined with hyperopt package for hyperparameter tuning and I am thinking about evaluating the performance of several model classifiers. I looked ...
0
votes
1answer
38 views

How to identify/recognize that a sentence about talks about future?

Brief Introduction: I have a report/paragraph in which there are sentences with reference to future plans/outlooks/expectations for a particular entity. I want to extract all such sentences for now. ...
0
votes
0answers
20 views

Different AUC values for xgb and sklearn built in functions [duplicate]

The model is trained with early stopping on a validation set: ...
2
votes
1answer
36 views

How can I get the dataframe after scikit pipeline?

I'm making many data transformations and fitting a model using scikit pipeline, but I need to extract X_train and X_test right after transformations (imputer, encoding, etc) in order to use it for ...
1
vote
2answers
35 views

Understanding Sklearns learning_curve

I have been using sklearns learning_curve , and there are a few questions I have that are not answered by the documentation(see also here and here), as well as questions that are raised by the ...
5
votes
4answers
559 views

Best platform to work with when having millions of rows in dataframe

I have table with around 20 features and millions of observations (rows). I need to create model base on this table, however, as it is huge, training models like random forest or XGB takes forever. I'...
0
votes
0answers
16 views

Why doesn't SVC in Sklearn have n_jobs hyperparameter?

Why doesn't SVC in Sklearn have n_jobs hyperparameter unlike other algorithms such as Randomforest or Logistic Regression?
0
votes
1answer
35 views

Why scikit-learn's sequential feature selection requires how much features to be selected beforehand?

From the version 0.24, the scikit-learn has new method 'SequentialFeatureSelector', which adds (forward selection) or removes (backward selection) features to form a feature subset in a greedy fashion....
1
vote
1answer
37 views

when I only give command 'fit', my class does 'transform' too

I have created 2 classes, first of which is: ...
0
votes
0answers
11 views

Increase dimension of dataset for modelisation

I have a dataset like that : | A header | Another header | | -------- | -------------- | | a | {player_1: stat_1,stat_2,stat_3} | | b | {player_2: stat_1,stat_2,stat_3} | | ...
0
votes
1answer
35 views

How do I calculate precision, recall, specificity, sensitivity manually?

I have actual class labels and predicted class labels: ...
2
votes
0answers
7 views

Multidimensional scaling (MDS) fails on a simple example

I want to apply multi-dimensional scaling (MDS) on specific objects; using the Euclidean distance does not make sense for such objects; using another distance metric, I can compute their dissimilarity ...
1
vote
2answers
149 views

What is the difference between LabelBinarizer and MultiLabelBinarizer?

I am trying to understand the difference between the two label encoding techniques for output variable. I have read things but still can't get a clear picture as what makes them different. Also can we ...
0
votes
0answers
7 views

Random Forests notebook collections to be used as benchmark

I'm trying to evaluate my modification of Decision Tree and Random Forests methods as compared to the standard distribution in libraries such as sklearn. I've searched the Kaggle, but did not find a ...
1
vote
1answer
17 views

Difference in result in every run of Neural network?

I have written a simple neural network (MLP Regressor), to fit simple data frame columns. To have an optimum architecture, I also defined it as a function to see whether it is converging to a pattern. ...
0
votes
0answers
21 views

How to top n values from .predict_proba in multioutputclassifier?

I am following MultiOutputClassifier technique to predict roles (the data are transformed to numeric so that's not a concern) I want to use .predict_proba() and ...

1
2 3 4 5
41