I’m perfoming a LinearRegression model with a pipeline and GridSearchCV, i can not manege to make it to the coefficients that are calculated for each feature of X_train. mlr_gridsearchcv = Pipeline(steps =[(‘preprocessor’, preprocessor), (‘gridsearchcv_lr’, GridSearchCV(TransformedTargetRegressor(regressor= LinearRegression(), func = np.log,inverse_func = np.exp), param_grid=parameter_lr, cv = nfolds, scoring = (‘r2′,’neg_mean_absolute_error’), return_train_score = True, refit=’neg_mean_absolute_error’, n_jobs = -1))]) ..

#### Category : scikit-learn

I am using Vaex as my dataset is huge(45 GB). I was trying to use sklearn.feature_extraction.text.TfidfVectorizer but could not on vaex dataframe. Can anyone help me to create a TF-IDF matrix using Vaex ? It will be a great help. Source: Python..

What is the better way of selecting the hyperparameters of SVR for tuning them using GridSearchCV? I learnt that the input to GridSearchCV is set of values for C, gamma and epsilon. The GridSearchCV algorithm evaluates each of these values and suggests the best among the set of values given to it as input. How ..

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 currently used ML library Model: Each text field is put through a HashingVectorizer (Note: ngram_range=(1,2)) The output is then fed to a ..

I want to calculate powerset of 1-dim array using numpy, sckit-learn of whatever is the fastest approach. By fast approach i mean, something that will take less that 9 seconds, even when the length of the input is 200000. This code below does the trick. But it is too slow. from itertools import chain, combinations ..

I am hoping somebody may be able to help me with some guidance in using scikit-learn. I am working with a system that currently uses linear regression to generate predictions based on a set of about 20 features. The current model is as follows. yi=P0+P1xi1+…+Pkxik Where xik are the k features for observation i. Pk ..

x_tr = SelectKBest(chi2, k=25).fit_transform(x_tr,y_tr) x_ts = SelectKBest(chi2, k=25).fit_transform(x_ts, y_ts) This is the code I have. I’m worried that it will select different features for the training and testing data. Should I change the code or will it give the same features? Source: Python..

I am doing a seldon deployment. I have created custom pipelines using sklearn and it is in the directory MyPipelines/CustomPipelines.py. The main code ie. my_prediction.py is the file which seldon will execute by default (based on my configuration). In this file I am importing the custom pipelines. If I execute my_prediction.py in my local (PyCharm) ..

I’ve trained a machine learning model using sklearn and want to simulate the result by sampling the predictions according to the predict_proba probabilities. So I want to do something like samples = np.random.choice(a = possible_outcomes, size = (n_data, n_samples), p = probabilities) Where probabilities would be is an (n_data, n_possible_outcomes) array But np.random.choice only allows ..

In my project I’m using OrdinalEncoder, but for some reason some of my features are not encoded properly. The data in features ‘Education’ and ‘Dependants’ are wrong because they are just a series of -1. Maybe some of you, folks, can take a look at my project and give an answer The code is the ..

## Recent Comments