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
0
votes
0answers
5 views

Do I have to wrap multiclass SVM in OneVsRestClassifier()?

I am using an SVM for mulitclass classification between 3 labels (1,0,-1). I thought this could simply be done by using SVC(decision_function_shape = 'ovr') in my ...
0
votes
0answers
6 views

upload model to S3

Hello I'm using AWS Sage Maker to build my model. I want to store the model in S3 for later use. How do you save your model in S3 with Amazon Sage Maker? I know this seem trivial but I didn't ...
0
votes
1answer
7 views

extract classifier properties from pickled file

I have *.clf file which I get from fit() of sklearn. I fit my data with ...
3
votes
2answers
56 views

scikit-learn RandomForestClassifier always hits 100% test accuracy

I have been playing with a toy problem to compare the performance and behavior of several scikit-learn classifiers. Brief, I have one continuous variable X (which contains two samples of size N, each ...
1
vote
0answers
24 views

What to do when feature engineering and parameter tuning don't add to the base model performance

I've been working on using LogisticRegression from scikit to try the Titanic Kaggle comp. I've found something interesting, and that is that no amount of feature engineering and paramater tuning is ...
1
vote
0answers
12 views

Two questions on hyper-parameter tuning

Question 1: In the example of logistic regression, I often see the regularization constant and penalty methods being tuned by a grid search. However, it seems like there are a lot more options for ...
2
votes
2answers
25 views

How to perform one hot encoding on multiple categorical columns

I am trying to perform one-hot encoding on some categorical columns. From the tutorial I am following, I am supposed to do LabelEncoding before One hot encoding. I have successfully performed the ...
0
votes
1answer
24 views

How to apply dataset balancing techniques whilst using Pipeline in Sklearn?

I am new to Machine Learning and trying to construct machine learning models that adhere to good practice and not susceptible to biases. I have decided to use Sklearn's ...
0
votes
1answer
14 views

How to compute AUC in gridsearchSV (multiclass problem)

I'm working on a multiclass classification problem, comparing results from SVM and Random Forest classificators. I would like to use gridsearchCV for hyperparameters tuning and find that AUC is the ...
0
votes
1answer
17 views

What annotators are used in Cohen Kappa for classification problems?

I am working on a classification problem using algorithms such as Logistic Regression, Support Vector Machines, Decision Trees, Random Forests and Naive Bayes. My data consists of binary class ...
0
votes
0answers
13 views

How to improve the model training time of scikitlearn [closed]

scikitlearn MultinomialNB taking time for prediction
0
votes
1answer
22 views

How to use r2-score as a loss function in LightGBM?

I am trying to implement a custom loss function in LightGBM for a regression problem. The intrinsic metrics do not help me much, because they penalise for outliers... Is there any way to use ...
0
votes
0answers
16 views

All the classifiers have the same score

I'm trying to implement a classifier for text analytics but all the classifiers get the same accuracy_score. All of these are sklearn implementations. What am I doing wrong ? ...
0
votes
1answer
18 views

Should I scale data before or after balancing dataset?

I have 3 datasets which I each split into 3 separate classes [Buy/hold/sell]. I randomly up-sample each class's frequency in each dataset to 10,000 data points each. My question is, should I scale ...
1
vote
1answer
16 views

Can you use two different datasets as train and test sets with countVectorizer and test_train_split?

So I managed to run my code on a combination of train data and validation data, but now I need to create a text file that contains the predictions for the test data and I just don't understand how. Is ...
1
vote
1answer
18 views

Formula to calculate confidence value in Adaboost

I am coding an AdaBoostClassifier with the two class variant of SAMME algorithm. Here is the code. def I(flag): return 1 if flag else 0 ...
1
vote
1answer
7 views

How can I tell whether my Random-Forest model is overfitting?

I was trying to generate predictions for Iris species using the UCI Machine Learning Iris dataset. I used a RandomForestClassifier with GridSearchCV and calculated the mean absolute error. However, ...
0
votes
1answer
16 views

Using MultiLabelBinarizer for SMOTE

This is my first NLP project. I'm trying to use SMOTE for a classifier with 14 classes. I need to convert the classes into an array before using SMOTE. I tried using MultiLinearBinarizer but it does ...
-1
votes
0answers
9 views

How to select best features SVM- numerical inputs and categorical output

I have a number of features and I want to reduce the dimensionality to ensure good model accuracy. How do I select the best features where all the inputs are numerical and the outputs are categorical. ...
-1
votes
1answer
19 views

How to select the best features for Support Vector Classification

I have a feature set that contains approximately 2 dozen features of technical analysis indicators. My own domain knowledge tells me that some of these features are better than others for predicitive ...
0
votes
0answers
13 views

Variable with extra small Pearson coefficient has bigger positive impact on ML model performance than variable with bigger Pearson

I made some machine learning models using Python sci-kit learn library and I found some strange situation for me regarding the real importance of some variables (features) to the ML model. I found ...
3
votes
1answer
36 views

Iterate over multiple dataframe rows at the same time

I have 16 different dataframes with the same number of rows/columns and another 2 separate dataframes with that same shape that i'm using to compare with the 16 dataframe values. I need to loop over ...
1
vote
0answers
8 views

PLS-DA on sklearn: correlated features

Is there a way to retrieve the groups of features that, jointly, show a high loading in each LV. I'm aware that I can retrieve this by digging into x_loadings_, but ...
0
votes
0answers
21 views

T-SNE good clustering but SVM classification poor

I am trying to classify in 4 different classes, paragraph embedding vector computed with doc2vec using an non-linear svm over them. When I visualize the embeddings using tensorboard t-sne I can see ...
0
votes
1answer
29 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 ...
0
votes
0answers
10 views

Can someone provide me the code of the MiLoF(Memory Efficient Local Outlier Factor) algorithm?

I have to code the MiLoF algorithm for detecting outliers in an unsupervised manner using non-stationary data. I am attaching the paper which explains the algorithm here. However, there are many ...
5
votes
3answers
53 views

How to normalize data without knowing the min and max values?

I have a Lending club dataset from Kaggle; it contains many different columns: there are for example dummy variables, years, amount of the loan...ect I want to normalize the data in the training and ...
0
votes
0answers
16 views

Custom Decision Function for Custom Outlier Detection Algorithm

I have built a custom algorithm for semi-supervised anomaly detection and here is my output example as following with probability threshold set to 0.05 and 1 = outlier, 0 = inlier: ...
1
vote
0answers
13 views

Which Machine Learning model to choose for n Number recommendations based of input numeric parameters

We want to develop a Machine Learning based recommendation model. Our data-set has about 25 numeric input parameters and an output parameter (Lender). Based on the input parameters we want machine ...
0
votes
0answers
22 views

How do I improve the accuracy of this classifier?

I have a dataset of 20000 x 3072 images for a homework assignment. This is just the training set, and the images are 32x32 and can depict one of four labels/classes, namely cars, trucks, boats and ...
2
votes
2answers
80 views

Is it better to have higher train accuracy with lower test accuracy or higher test accuracy with lower train accuracy?

The results from my RandomForest model with 5 max features are as follows: 84% train accuracy 76% test accuracy The results with 10 max features: ...
0
votes
2answers
23 views

Why ROC value area under curve of two models is different whereas accuracy, precision, recall, f1-score and confusion matrix is same

I am applying logistic regression and support vector machines on the extacly same dataset with 70% data for training and 30% for test. Both perform exactly the same have the same precision, recall, f1-...
0
votes
0answers
33 views

How to correctly manage predictions when the inputs are outbound the original scaling range?

I have a neural network for a regression problem that was trained using MinMaxScaler(0,1) for features and I have two questions with this. I often find that scaling the output (or target variable) ...
1
vote
1answer
14 views

Text vectorizer that capture feature offset in the text?

I'm using sklearn Tfifdfvectorizer to extract feature from text towards text classification. I believe the information I need tends to be in the beginning of the document, so I would like to somehow ...
1
vote
1answer
29 views

Sklearn Pipeline for mixed features: numerical and (skewed) categorical

I am working on a dataset from Kaggle (housing price prediction). I have done some pre-processing on the data (missing values, category aggregation, selecting ordinal vs one-hot). I am trying to ...
0
votes
0answers
16 views

How to use Predefined Split for Randomized SearchCV

I'm trying to regularize my random forest regressor with RandomizedSearchCV. With RandomizedSearchCV the train and test are not ...
4
votes
2answers
50 views

Extremely high MSE/MAE for Ridge Regression(sklearn) when the label is directly calculated from the features

Edit: Removing TransformedTargetRegressor and adding more info as requested. Edit2: There were 18K rows where the relation did not hold. I'm sorry :(. After ...
0
votes
0answers
12 views

How do I evaluate a K-Means unsupervised anomaly detection approach?

how do I evaluate K-means clustering anomaly detection method as there is no labelled data of anomaly class. To find the cluster (K), I have used the silhouette score from Scikit learn library. Scikit ...
0
votes
0answers
31 views

ValueError: “The estimator should be a classifier”

I am adapting sklearn-extension ELMClassifier to be accepted as base_estimator to both VotingClassifier and AdaboostClassifier. ...
0
votes
1answer
30 views

When should train and test data be merged?

I am very new to data science and machine learning. I am following courses on datacamp, and then trying to solve problems on kaggle/drivendata. Very often, I try to use the sklearn.model_selection ...
0
votes
1answer
32 views

Score remains same during hyper parameter tuning

My model- ...
0
votes
1answer
94 views
0
votes
1answer
17 views

Split into test and train set before or after generating document-term matrix?

I'm working on simple machine learning problems and I trying to build a classifier that can differentiate between spam and non-spam SMS. I'm confused as to whether I need to generate the document-term ...
1
vote
3answers
50 views

How to determine which features matter the most?

I have a large dataset which consists of search results of loans. Someone would input their details like income etc and the results would include a bunch of loans from different companies and ...
0
votes
1answer
7 views

Solution for TF-IDF Vectorization in Angular project?

While making an Angular project to use my text-classification model on unseen data, i struggle in finding a way how to transform text to TFIDF features. Anyone faced same issue? Maybe a solution on ...
0
votes
1answer
19 views

Can one property name be used twice in the same branch of a DecisionTreeRegressor?

I am using this dataset for the analysis (Generated using make_regression of sklearn library) I was trying to learn the DecisionTreeRegression algorithm of sklearn library. I used the following code ...
0
votes
1answer
11 views

How fit_transform, transform and TfidfVectorizer works

I'm a machine learning beginner and I tried to use the cosine similarity on fuzzy matching purpose. In the following example I want to compare 'data_dirty' with 'data_clean' : When I have to ...
1
vote
1answer
17 views

In an SVM, does a more negative/positive decision score mean that it is further from the seperating hyperplane?

For example, if I have a sample with a decision score of -6 and another with a score of -3, which sample is closer to the hyperplane? Also, does the probability of a sample belonging to a class ...
1
vote
2answers
41 views

Weights for unbalanced classification

I'm working with an unbalanced classification problem, in which the target variable contains: np.bincount(y_train) array([151953, 13273]) i.e. ...
0
votes
1answer
23 views

Different definitions of Macro F1 score, which one is used in Scikit-learn?

In this article Macro F1 and Macro F1 two different definitions of the F1 used in the literature are demonstrated. The first F1 score is computed such as: F1 scores are computed for each class ...

1
2 3 4 5
29